:root {
  color-scheme: dark;
  --bg: #07101d;
  --bg-deep: #050b14;
  --sidebar: #0a1422;
  --surface: #0f1b2b;
  --surface-raised: #132236;
  --surface-hover: #182a41;
  --border: #22344a;
  --border-soft: #1a2a3e;
  --text: #edf3fb;
  --muted: #91a3b9;
  --faint: #61758f;
  --accent: #f78a42;
  --accent-light: #ffb166;
  --accent-dark: #d85b24;
  --blue: #67a2ff;
  --green: #39d7a4;
  --red: #ff6f82;
  --amber: #ffc766;
  --shadow: 0 18px 45px rgb(0 0 0 / 22%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.55; }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; background: radial-gradient(circle at 78% -10%, rgb(44 91 144 / 16%), transparent 36%), radial-gradient(circle at 20% 80%, rgb(247 138 66 / 5%), transparent 30%); z-index: -1; }
a { color: var(--blue); text-decoration: none; }
a:hover { color: #a9ccff; }
button, input, select, textarea { font: inherit; }
button, .button { border: 1px solid var(--accent); border-radius: 8px; background: var(--accent); color: #17100a; padding: 0.65rem 1rem; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem; transition: background 150ms, border-color 150ms, transform 150ms; }
button:hover, .button:hover { background: var(--accent-light); border-color: var(--accent-light); color: #17100a; transform: translateY(-1px); }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent-light); outline-offset: 2px; }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
button.secondary, .button.secondary { color: var(--text); background: var(--surface-raised); border-color: var(--border); }
button.danger { color: var(--red); background: rgb(255 111 130 / 8%); border-color: rgb(255 111 130 / 30%); }
.button-small { padding: 0.45rem 0.85rem; font-size: 0.9rem; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 1.5rem; font-size: clamp(1.65rem, 3vw, 2.2rem); line-height: 1.2; letter-spacing: -0.035em; }
h2 { margin-bottom: 1rem; font-size: 1.05rem; letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; }
code { color: #bcd8f8; font-family: "SFMono-Regular", Consolas, monospace; overflow-wrap: anywhere; }
pre { margin: 0 0 1.25rem; padding: 1.2rem; overflow: auto; color: #c9d9ec; background: var(--bg-deep); border: 1px solid var(--border); border-radius: 10px; line-height: 1.55; }
small { color: var(--muted); }

.brand { display: flex; align-items: center; gap: 0.8rem; color: var(--text); }
.brand:hover { color: var(--text); }
.brand img { flex: 0 0 auto; filter: drop-shadow(0 5px 14px rgb(247 138 66 / 18%)); }
.brand-copy { display: flex; flex-direction: column; line-height: 1.2; }
.brand-copy strong { font-size: 1.06rem; font-weight: 750; letter-spacing: -0.025em; }
.brand-copy small { margin-top: 0.28rem; color: var(--faint); font-size: 0.63rem; font-weight: 650; letter-spacing: 0.12em; }
.sidebar { position: fixed; inset: 0 auto 0 0; z-index: 10; width: 256px; display: flex; flex-direction: column; padding: 1.6rem 1rem 1rem; background: rgb(10 20 34 / 96%); border-right: 1px solid var(--border-soft); }
.sidebar .brand { padding: 0 0.65rem 1.6rem; }
.primary-nav { display: flex; flex: 1; flex-direction: column; gap: 0.25rem; overflow-y: auto; }
.nav-caption { margin: 1.1rem 0.75rem 0.35rem; color: var(--faint); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.nav-link { display: flex; align-items: center; min-height: 42px; padding: 0.65rem 0.8rem; color: var(--muted); border: 1px solid transparent; border-radius: 8px; font-size: 0.9rem; font-weight: 600; }
.nav-link::before { content: ""; width: 5px; height: 5px; margin-right: 0.75rem; background: var(--faint); border-radius: 50%; }
.nav-link:hover { color: var(--text); background: var(--surface); }
.nav-link.active { color: var(--accent-light); background: rgb(247 138 66 / 9%); border-color: rgb(247 138 66 / 15%); }
.nav-link.active::before { background: var(--accent); box-shadow: 0 0 12px rgb(247 138 66 / 55%); }
.nav-spacer { flex: 1; }
.sidebar-bottom { padding-top: 1rem; border-top: 1px solid var(--border-soft); }
.locale-switch { display: inline-flex; gap: 0.15rem; padding: 0.2rem; background: var(--bg-deep); border: 1px solid var(--border); border-radius: 8px; }
.locale-switch button { padding: 0.28rem 0.5rem; color: var(--faint); background: transparent; border: 0; border-radius: 5px; font-size: 0.7rem; text-transform: uppercase; }
.locale-switch button:hover { color: var(--text); background: var(--surface-raised); transform: none; }
.locale-switch button.active { color: var(--accent-light); background: rgb(247 138 66 / 12%); }
.logout-button { width: 100%; margin-top: 0.65rem; justify-content: flex-start; color: var(--muted); background: transparent; border-color: transparent; font-size: 0.85rem; }
.logout-button:hover { color: var(--text); background: var(--surface); border-color: var(--border); }
.app-frame { min-height: 100vh; margin-left: 256px; display: flex; flex-direction: column; }
.topbar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0 2.2rem; background: rgb(7 16 29 / 72%); border-bottom: 1px solid var(--border-soft); backdrop-filter: blur(14px); }
.topbar-brand { color: var(--faint); font-size: 0.72rem; font-weight: 750; letter-spacing: 0.1em; text-transform: uppercase; }
.account-chip { display: flex; align-items: center; gap: 0.6rem; color: var(--muted); font-size: 0.82rem; }
.account-chip b { padding: 0.2rem 0.5rem; color: var(--accent-light); background: rgb(247 138 66 / 9%); border: 1px solid rgb(247 138 66 / 18%); border-radius: 5px; font-size: 0.65rem; text-transform: uppercase; }
.presence-dot { width: 7px; height: 7px; background: var(--green); border-radius: 50%; box-shadow: 0 0 12px rgb(57 215 164 / 50%); }
.page-content { width: 100%; max-width: 1600px; flex: 1; padding: 2rem 2.2rem; }
footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.2rem 2.2rem; color: var(--faint); border-top: 1px solid var(--border-soft); font-size: 0.75rem; }
footer span:last-child { display: flex; gap: 1.2rem; }
footer a { color: var(--faint); }
footer a:hover { color: var(--muted); }

.public-header { width: min(1180px, calc(100% - 3rem)); min-height: 88px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; }
.public-nav { display: flex; align-items: center; gap: 1.2rem; }
.public-nav > a:not(.button) { color: var(--muted); font-size: 0.9rem; font-weight: 650; }
.public-content { width: min(1180px, calc(100% - 3rem)); min-height: calc(100vh - 170px); margin: 0 auto; }
.public-footer { width: min(1180px, calc(100% - 3rem)); margin: 0 auto; padding: 1.4rem 0; }
.hero { display: grid; grid-template-columns: 1.15fr 0.85fr; align-items: center; gap: 4rem; min-height: 520px; padding: 4rem 0 3rem; }
.eyebrow { display: flex; align-items: center; gap: 0.55rem; margin-bottom: 1.1rem; color: var(--accent-light); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: var(--accent); }
.hero h1 { max-width: 680px; margin-bottom: 1rem; font-size: clamp(2.8rem, 6vw, 5.2rem); font-weight: 760; letter-spacing: -0.06em; }
.hero .tagline { max-width: 590px; color: var(--muted); font-size: clamp(1rem, 2vw, 1.25rem); }
.hero .slogan { max-width: 640px; margin: 1.25rem 0 0; padding-left: 1rem; color: var(--text); border-left: 2px solid var(--accent); line-height: 1.7; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-top: 2rem; }
.hero-visual { position: relative; min-height: 360px; display: grid; place-items: center; background: radial-gradient(circle, rgb(40 76 119 / 22%), transparent 64%); }
.network-ring { position: absolute; width: 240px; height: 240px; border: 1px solid var(--border); border-radius: 50%; }
.network-ring::after { content: ""; position: absolute; inset: 35px; border: 1px dashed #2b425c; border-radius: 50%; }
.network-logo { position: relative; z-index: 2; width: 110px; height: 110px; padding: 1rem; background: var(--surface); border: 1px solid var(--border); border-radius: 28px; box-shadow: var(--shadow); }
.network-node { position: absolute; z-index: 3; min-width: 70px; padding: 0.5rem 0.75rem; color: var(--blue); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); font-family: monospace; font-size: 0.75rem; text-align: center; }
.node-dns { top: 15%; left: 4%; }
.node-rtt { top: 8%; right: 3%; }
.node-http { bottom: 12%; left: 2%; }
.node-tls { right: 0; bottom: 18%; color: var(--green); }

.auth-card { width: min(100%, 470px); margin: 4rem auto; padding: 2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.auth-card h1 { margin-bottom: 0.75rem; }
.auth-card .auth-intro { margin-bottom: 1.6rem; color: var(--muted); }
.auth-card form > button { width: 100%; margin-top: 0.45rem; }
.code-input { font-family: "SFMono-Regular", Consolas, monospace; font-size: 1.5rem; font-weight: 700; letter-spacing: 0.45em; text-align: center; text-transform: uppercase; }
.auth-links { margin: 1.4rem 0 0; padding-top: 1.2rem; border-top: 1px solid var(--border-soft); font-size: 0.88rem; }
.auth-links a + a { margin-left: 0.8rem; }

section.panel, .panel { margin-bottom: 1.25rem; padding: 1.4rem; background: rgb(15 27 43 / 88%); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 24px rgb(0 0 0 / 10%); }
.panel-header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.panel-header h2 { margin: 0; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-heading h1 { margin: 0; }
.page-heading p { margin: 0.45rem 0 0; color: var(--muted); }
.back-link { display: inline-block; margin-bottom: 1.1rem; color: var(--muted); font-size: 0.82rem; }
.summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.summary-card { padding: 1.25rem 1.4rem; background: linear-gradient(145deg, var(--surface-raised), var(--surface)); border: 1px solid var(--border); border-radius: 12px; }
.summary-label { display: block; margin-bottom: 0.55rem; color: var(--muted); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.summary-value { color: var(--text); font-size: 1.65rem; font-weight: 730; letter-spacing: -0.035em; }
.summary-meta { margin: 0.35rem 0 0; color: var(--faint); font-size: 0.78rem; }
.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.9rem; margin-bottom: 1.25rem; }
.status-card { min-width: 0; padding: 1.2rem; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.status-card .status-title { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.85rem; color: var(--muted); font-size: 0.74rem; font-weight: 700; text-transform: uppercase; }
.status-value { display: block; overflow: hidden; color: var(--text); font-size: 1.45rem; font-weight: 720; letter-spacing: -0.03em; text-overflow: ellipsis; white-space: nowrap; }
.status-detail { display: block; margin-top: 0.45rem; overflow-wrap: anywhere; color: var(--faint); font-size: 0.75rem; }
.charts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.chart-panel { min-width: 0; margin: 0; }
.chart-panel h2 { margin-bottom: 1.2rem; }
.chart-panel canvas { width: 100% !important; min-height: 250px; }

form { margin-bottom: 0; }
label { display: block; margin-bottom: 0.9rem; color: var(--muted); font-size: 0.8rem; font-weight: 650; }
input, select, textarea { width: 100%; margin-top: 0.35rem; padding: 0.68rem 0.75rem; color: var(--text); background: var(--bg-deep); border: 1px solid var(--border); border-radius: 8px; transition: border-color 150ms, background 150ms; }
input:hover, select:hover, textarea:hover { border-color: #36506d; }
input:focus, select:focus, textarea:focus { background: #081423; border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input[type="checkbox"] { width: 16px; height: 16px; margin: 0 0.55rem 0 0; vertical-align: middle; accent-color: var(--accent); }
label:has(input[type="checkbox"]) { color: var(--muted); font-weight: 500; }
input[type="file"] { padding: 0.55rem; }
input[type="file"]::file-selector-button { margin-right: 0.75rem; padding: 0.35rem 0.6rem; color: var(--text); background: var(--surface-raised); border: 1px solid var(--border); border-radius: 5px; }
fieldset { margin: 0 0 1rem; padding: 0.9rem; border: 1px solid var(--border); border-radius: 8px; }
legend { padding: 0 0.4rem; color: var(--muted); font-size: 0.78rem; }
fieldset label { display: inline-flex; align-items: center; margin: 0.25rem 1rem 0.25rem 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1rem; }
.form-grid .full-width { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.65rem; margin-top: 0.8rem; }
.inline-form { display: inline-flex; align-items: center; gap: 0.45rem; margin: 0.15rem; vertical-align: middle; }
.inline-form input, .inline-form select { width: auto; min-width: 90px; margin: 0; padding: 0.48rem 0.6rem; }
.inline-form button { padding: 0.48rem 0.7rem; font-size: 0.78rem; }
.checks-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.25rem 1rem; }

.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
th { padding: 0.75rem 0.8rem; color: var(--faint); background: rgb(5 11 20 / 42%); border-bottom: 1px solid var(--border); font-size: 0.65rem; font-weight: 800; letter-spacing: 0.07em; text-align: left; text-transform: uppercase; white-space: nowrap; }
td { padding: 0.9rem 0.8rem; color: var(--muted); border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgb(103 162 255 / 3%); }
td a { font-weight: 650; }
td form { margin: 0.15rem 0; }
td input, td select { min-width: 110px; margin: 0; padding: 0.48rem 0.55rem; }
td button { padding: 0.45rem 0.65rem; font-size: 0.74rem; }
.metric-value { color: var(--text); font-family: "SFMono-Regular", Consolas, monospace; font-weight: 650; white-space: nowrap; }
.dot { display: inline-block; flex: 0 0 auto; width: 8px; height: 8px; margin-right: 0.45rem; border-radius: 50%; }
.dot.ok { background: var(--green); box-shadow: 0 0 10px rgb(57 215 164 / 40%); }
.dot.bad { background: var(--red); box-shadow: 0 0 10px rgb(255 111 130 / 35%); }
.status-pill { display: inline-flex; align-items: center; padding: 0.25rem 0.55rem; border: 1px solid var(--border); border-radius: 999px; color: var(--muted); background: var(--surface-raised); font-size: 0.68rem; font-weight: 750; text-transform: uppercase; white-space: nowrap; }
.status-pill.ok { color: var(--green); background: rgb(57 215 164 / 7%); border-color: rgb(57 215 164 / 20%); }
.status-pill.bad { color: var(--red); background: rgb(255 111 130 / 7%); border-color: rgb(255 111 130 / 20%); }
.status-pill.warn { color: var(--amber); background: rgb(255 199 102 / 7%); border-color: rgb(255 199 102 / 20%); }
p.error, p.ok, p.notice { padding: 0.75rem 0.9rem; border: 1px solid; border-radius: 8px; font-size: 0.83rem; }
p.error { color: #ffb0ba; background: rgb(255 111 130 / 7%); border-color: rgb(255 111 130 / 22%); }
p.ok { color: #8aeccd; background: rgb(57 215 164 / 7%); border-color: rgb(57 215 164 / 22%); }
p.notice { color: #b8d4fa; background: rgb(103 162 255 / 7%); border-color: rgb(103 162 255 / 22%); }
.message { margin-bottom: 0.8rem; padding: 1.25rem 1.4rem; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.message.unread { border-left: 3px solid var(--accent); }
.message h3 { display: flex; justify-content: space-between; gap: 1rem; margin-bottom: 0.8rem; }
.message h3 small { font-weight: 500; }
.message p { color: var(--muted); white-space: pre-wrap; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.dashboard-card { position: relative; min-height: 150px; padding: 1.4rem; color: var(--text); background: linear-gradient(145deg, var(--surface-raised), var(--surface)); border: 1px solid var(--border); border-radius: 12px; }
.dashboard-card:hover { color: var(--text); border-color: #3a536f; transform: translateY(-2px); }
.dashboard-card .card-label { display: block; margin-bottom: 1.5rem; color: var(--muted); font-size: 0.78rem; font-weight: 700; }
.dashboard-card .card-value { font-size: 2rem; font-weight: 740; letter-spacing: -0.04em; }
.dashboard-card .card-meta { display: block; margin-top: 0.4rem; color: var(--faint); font-size: 0.75rem; }
.search-form { display: flex; gap: 0.65rem; margin-bottom: 1rem; }
.search-form input { max-width: 360px; margin: 0; }
.action-bar { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.muted { color: var(--muted); }
.mono { font-family: "SFMono-Regular", Consolas, monospace; }

@media (max-width: 1100px) {
  .hero { gap: 1.5rem; }
  .charts-grid { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: repeat(3, 1fr); }
  .page-content { padding: 1.5rem; }
  .topbar { padding: 0 1.5rem; }
}

@media (max-width: 760px) {
  .sidebar { position: static; width: 100%; padding: 1rem; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { padding: 0 0 1rem; }
  .primary-nav { display: flex; flex: 0 0 auto; flex-direction: row; gap: 0.35rem; padding-bottom: 0.4rem; overflow-x: auto; }
  .nav-caption { display: none; }
  .nav-link { flex: 0 0 auto; min-height: 36px; padding: 0.45rem 0.6rem; font-size: 0.78rem; white-space: nowrap; }
  .sidebar-bottom { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: 0.8rem; }
  .sidebar-bottom form:last-child { margin-left: auto; }
  .logout-button { width: auto; margin: 0; }
  .app-frame { margin-left: 0; }
  .topbar { min-height: 58px; padding: 0 1rem; }
  .topbar-brand { display: none; }
  .account-chip { width: 100%; justify-content: flex-end; overflow: hidden; }
  .account-chip span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-content { padding: 1.25rem 1rem; }
  footer { flex-direction: column; padding: 1rem; }
  footer span:last-child { flex-wrap: wrap; }
  .public-header { width: calc(100% - 2rem); min-height: 78px; }
  .public-header .brand-copy small { display: none; }
  .public-nav { gap: 0.6rem; }
  .public-nav > a:not(.button) { display: none; }
  .public-nav .locale-switch { display: none; }
  .public-content, .public-footer { width: calc(100% - 2rem); }
  .hero { grid-template-columns: 1fr; min-height: 0; padding: 3rem 0 2rem; }
  .hero h1 { font-size: clamp(2.7rem, 13vw, 4.3rem); }
  .hero-visual { min-height: 300px; }
  .auth-card { margin: 2rem auto; padding: 1.35rem; }
  .summary-grid { grid-template-columns: 1fr; }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid, .checks-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .message h3 { flex-direction: column; }
}

@media (max-width: 420px) {
  .status-grid { grid-template-columns: 1fr; }
  .hero-visual { transform: scale(0.9); }
}
