/* SDC Ops Portal - one stylesheet, no frameworks. Dark by design (it lives on NOC screens). */
:root {
  --bg: #111214;
  --surface: #191919;
  --surface-2: #202226;
  --line: #2b2e34;
  --line-2: #363a41;
  --text: #efefef;
  --text-2: #9c9c9c;
  --text-3: #6f737a;
  --accent: #4ba6e6;          /* brand spiral blue, lightened for text on dark */
  --accent-2: #0068b4;        /* brand spiral blue - white text passes AA */
  --brand-navy: #1d1751;       /* SPACE lettering */
  --brand-blue: #0070b8;
  --brand-ice: #a0d8f0;        /* spiral centre */
  --ok: #0aac23;
  --warn: #fbb315;
  --serious: #f18a59;
  --down: #dc3c3d;
  --na: #3a3d44;
  --radius: 10px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "JetBrains Mono", "SF Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: 12.5px; background: var(--surface-2); padding: 1px 5px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
.muted { color: var(--text-2); }
.small { font-size: 12.5px; }
.num { font-variant-numeric: tabular-nums; }
.mt { margin-top: 18px; }
.txt-ok { color: var(--ok); } .txt-warn { color: var(--warn); } .txt-down { color: #ff6b6b; }

/* ---------- shell ---------- */
body.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; background: linear-gradient(to right, #0b0c0e 236px, var(--bg) 236px); }
.side { background: #0b0c0e; border-right: 1px solid var(--line); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 22px 20px 14px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-logo { width: 186px; height: auto; display: block; }
.brand-sub { font-size: 10.5px; font-weight: 600; letter-spacing: .28em; text-transform: uppercase; color: var(--accent); padding-left: 2px; }
.side nav { flex: 1; overflow-y: auto; padding: 4px 10px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); padding: 16px 10px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; color: var(--text-2); padding: 7px 10px; border-radius: 7px; margin: 1px 0; }
.nav-item:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-item.is-active { background: var(--surface-2); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-mcp { background: var(--accent) !important; }
.nav-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--line-2); flex: none; }
.nav-home { background: #9c9c9c; } .nav-mcp { background: var(--accent); } .nav-network { background: #f47230; }
.nav-datacentre { background: #00a888; } .nav-tickets { background: #e24d8b; } .nav-ipam { background: #9887ef; } .nav-dns { background: #d28e05; }
.soon { margin-left: auto; font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); border: 1px solid var(--line-2); border-radius: 4px; padding: 0 5px; }
.side-foot { border-top: 1px solid var(--line); padding: 12px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.me { display: flex; align-items: center; gap: 9px; color: var(--text); min-width: 0; }
.me:hover { text-decoration: none; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: linear-gradient(135deg, var(--brand-navy), var(--accent-2)); display: grid; place-items: center; font-weight: 600; flex: none; }
.me-txt { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.me-txt b { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-txt small { color: var(--text-3); }
.link-btn { background: none; border: 0; color: var(--text-2); cursor: pointer; font: inherit; padding: 4px; }
.link-btn:hover { color: var(--text); text-decoration: underline; }

.main { padding: 26px 32px 60px; min-width: 0; max-width: 1500px; }
.top { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.top h1 { font-size: 24px; display: flex; align-items: center; gap: 12px; }
.crumbs { color: var(--text-3); font-size: 12.5px; margin-bottom: 4px; }
.crumbs a { color: var(--text-2); }
.top-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.top-actions form { margin: 0; }
.autorefresh { font-size: 12px; color: var(--text-3); }
.autorefresh::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 6px; animation: pulse 2s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
@media (prefers-reduced-motion: reduce) { .autorefresh::before { animation: none; } }

/* ---------- flash ---------- */
.flash { border-radius: 8px; padding: 10px 14px; margin: 0 0 16px; border: 1px solid; font-size: 13.5px; }
.flash-ok { border-color: #1d5a29; background: #0f2414; }
.flash-warn { border-color: #6b5110; background: #241c08; }
.flash-err { border-color: #6b2222; background: #2a1010; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: 7px; padding: 8px 14px; font: 500 13.5px var(--font); cursor: pointer; border: 1px solid transparent; color: var(--text); text-decoration: none; }
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--accent-2); }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { background: var(--surface-2); border-color: var(--line-2); }
.btn-ghost:hover { border-color: #4a4f57; }
.btn-danger { background: #5a1a1a; border-color: #7a2424; }
.btn-wide { width: 100%; margin-top: 8px; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); }
.form-row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
.form-row label { flex: 1 1 180px; }
.form-inline { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.form-inline label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--text-2); }
input, select, textarea { background: #0d0e10; border: 1px solid var(--line-2); color: var(--text); border-radius: 7px; padding: 9px 11px; font: 14px var(--font); width: 100%; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
.form-inline input { width: auto; min-width: 220px; }
.code-input { font: 600 20px var(--mono); letter-spacing: .25em; text-align: center; }
.check-line { flex-direction: row !important; align-items: center; gap: 8px !important; color: var(--text) !important; }
.check-line input { width: auto; }
.row-btns { display: flex; gap: 10px; }
.inline-actions { display: inline-flex; gap: 6px; margin: 0; }
.inline-actions select { width: auto; padding: 5px 8px; font-size: 12.5px; }

/* ---------- cards, tiles ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }
.card-flush { padding: 0; overflow: hidden; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.card-head h3 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 16px; }
.grid-inner { gap: 28px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.tile-label { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 6px; }
.tile-value { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.tile-of { font-size: 14px; color: var(--text-3); font-weight: 400; margin-left: 5px; }
.tile-sub { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.empty { color: var(--text-3); padding: 14px 4px; font-size: 13px; }

.hero { display: flex; justify-content: space-between; align-items: center; gap: 20px; border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; border: 1px solid var(--line); background: var(--surface); }
.hero h2 { font-size: 19px; margin: 10px 0 4px; }
.hero p { margin: 0; font-size: 13px; }
.hero-ok { box-shadow: inset 3px 0 0 var(--ok); }
.hero-warn { box-shadow: inset 3px 0 0 var(--warn); }
.hero-down { box-shadow: inset 3px 0 0 var(--down); background: #1d1212; }

/* ---------- status ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 2px 9px 2px 3px; border-radius: 999px; border: 1px solid; white-space: nowrap; vertical-align: middle; }
.badge-ico { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; font-size: 10.5px; color: #0b0c0e; font-weight: 800; }
.badge-ok { color: #5fd46f; border-color: #1d5a29; background: #0f2414; } .badge-ok .badge-ico { background: var(--ok); }
.badge-warn { color: var(--warn); border-color: #6b5110; background: #241c08; } .badge-warn .badge-ico { background: var(--warn); }
.badge-down { color: #ff7a7a; border-color: #6b2222; background: #2a1010; } .badge-down .badge-ico { background: var(--down); color: #fff; }
.badge-unknown, .badge-gone { color: var(--text-2); border-color: var(--line-2); background: var(--surface-2); } .badge-unknown .badge-ico, .badge-gone .badge-ico { background: #6f737a; }
.pill { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line-2); color: var(--text-2); white-space: nowrap; }
.pill-ok { color: #5fd46f; border-color: #1d5a29; } .pill-warn { color: var(--warn); border-color: #6b5110; } .pill-down { color: #ff7a7a; border-color: #6b2222; }
.chk { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; font-size: 11px; font-weight: 800; }
.chk-ok { background: #0f2414; color: #5fd46f; border: 1px solid #1d5a29; }
.chk-bad { background: #2a1010; color: #ff7a7a; border: 1px solid #6b2222; }
.chk-na { background: var(--surface-2); color: var(--text-3); border: 1px solid var(--line-2); }

.strip { display: flex; gap: 2px; height: 22px; align-items: stretch; min-width: 140px; }
.strip-cell { flex: 1; border-radius: 2px; background: var(--na); }
.s-ok { background: var(--ok); } .s-warn, .s-unknown { background: var(--warn); } .s-down { background: var(--down); } .s-none { background: var(--na); }
.legend { font-size: 12px; color: var(--text-2); display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-left: 8px; }

/* ---------- connector list (home) ---------- */
.con-list { list-style: none; margin: 0; padding: 0; }
.con-row { display: grid; grid-template-columns: minmax(160px, 1.2fr) 2fr 64px 104px; align-items: center; gap: 14px; padding: 9px 6px; border-top: 1px solid var(--line); color: var(--text); }
.con-list li:first-child .con-row { border-top: 0; }
.con-row:hover { background: var(--surface-2); text-decoration: none; border-radius: 6px; }
.con-name { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.con-name small, .cell-name small { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.con-up { font-size: 12.5px; color: var(--text-2); text-align: right; font-variant-numeric: tabular-nums; }
.cell-name { display: flex; flex-direction: column; line-height: 1.3; color: var(--text); }
.cell-name:hover { text-decoration: none; }
.cell-name:hover b { color: var(--accent); }

/* ---------- events ---------- */
.events { list-style: none; margin: 0; padding: 0; }
.ev { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: baseline; padding: 7px 0; border-top: 1px solid var(--line); font-size: 13px; }
.ev:first-child { border-top: 0; }
.ev-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); align-self: center; }
.ev-ok .ev-dot { background: var(--ok); } .ev-warn .ev-dot { background: var(--warn); } .ev-down .ev-dot { background: var(--down); } .ev-info .ev-dot { background: var(--accent); }
.ev-txt a { color: var(--text); }
.ev-time { color: var(--text-3); font-size: 12px; white-space: nowrap; }

/* ---------- modules ---------- */
.section-title { font-size: 15px; margin: 26px 0 12px; color: var(--text-2); font-weight: 500; }
.modules { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.module { background: var(--surface); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 14px 16px; color: var(--text); display: flex; flex-direction: column; gap: 8px; }
.module:hover { border-color: #4a4f57; text-decoration: none; }
.module-head { display: flex; align-items: center; gap: 9px; }
.module p { margin: 0; color: var(--text-2); font-size: 13px; }
.module-src { display: flex; gap: 5px; flex-wrap: wrap; margin-top: auto; }
.soon-card { max-width: 720px; }
.soon-card h2 { margin: 12px 0 6px; font-size: 18px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 500; color: var(--text-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; padding: 11px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #16171a; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #1d1f23; }
.table .r { text-align: right; } .table .c { text-align: center; }
.table-tight td, .table-tight th { padding: 7px 10px; }
.card .table-tight th { background: none; }
.row-dim { opacity: .55; }
.trunc { max-width: 260px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- detail ---------- */
.reason { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.reason-ok { box-shadow: inset 3px 0 0 var(--ok); } .reason-warn, .reason-unknown { box-shadow: inset 3px 0 0 var(--warn); } .reason-down { box-shadow: inset 3px 0 0 var(--down); }
.checks { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; margin-bottom: 16px; }
.check-card { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 13px 14px; }
.check-card div { display: flex; flex-direction: column; min-width: 0; }
.check-card small { color: var(--text-2); font-size: 12px; overflow-wrap: anywhere; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; }
.seg a { padding: 6px 12px; color: var(--text-2); font-size: 13px; }
.seg a.is-on { background: var(--surface-2); color: var(--text); }
.seg a:hover { text-decoration: none; color: var(--text); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 7px 14px; margin: 0; font-size: 13px; align-content: start; }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.kv-row { display: flex; justify-content: space-between; gap: 10px; padding: 4px 0; font-size: 13px; border-bottom: 1px solid var(--line); }
.usage { display: grid; grid-template-columns: 1.5fr 1fr; gap: 24px; }
.hbar { display: grid; grid-template-columns: minmax(150px, 1.3fr) 1fr 36px; gap: 8px; align-items: center; padding: 3px 0; font-size: 12.5px; }
.hbar-l { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; width: 0; }
.hbar-n { text-align: right; color: var(--text-2); }
.errlist { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.errlist li { display: flex; flex-direction: column; gap: 3px; }
.errlist code { white-space: pre-wrap; overflow-wrap: anywhere; color: #ffb3b3; }
.agent + .agent { border-top: 1px solid var(--line); margin-top: 14px; padding-top: 14px; }
.agent-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }

/* ---------- charts ---------- */
.chart-wrap { position: relative; }
.chart { width: 100%; height: 130px; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--text-3); font: 10.5px var(--font); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .area { fill: var(--accent); opacity: .12; }
.chart .cross { stroke: var(--text-3); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .bar { fill: var(--accent); }
.chart .bar-hit { fill: transparent; }
.chart .bar-g:hover .bar { fill: var(--brand-ice); }
.chart-stats { display: flex; gap: 18px; font-size: 12px; color: var(--text-2); margin-bottom: 6px; }
.chart-stats b { color: var(--text); font-weight: 600; }
.chart-empty { color: var(--text-3); font-size: 13px; padding: 34px 0; text-align: center; border: 1px dashed var(--line-2); border-radius: 8px; }
.tip { position: absolute; pointer-events: none; background: #0b0c0e; border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 9px; font-size: 12px; white-space: nowrap; transform: translate(-50%, -110%); box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.tip b { display: block; font-size: 13px; }

/* ---------- auth ---------- */
body.auth { min-height: 100vh; background: radial-gradient(1100px 560px at 50% -180px, #14274a 0%, var(--bg) 62%); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 30px 16px; }
.auth-card { width: 100%; max-width: 430px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px 30px; box-shadow: 0 20px 60px rgba(0,0,0,.45); }
.auth-card h1 { font-size: 21px; margin: 6px 0 8px; }
.auth-card > p { margin: 0 0 14px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 4px 0 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.auth-brand img { width: 100%; max-width: 300px; height: auto; }
.auth-tag { font-size: 11px; font-weight: 600; letter-spacing: .36em; text-transform: uppercase; color: var(--text-3); }
.auth-alt { margin: 16px 0 0; font-size: 13px; color: var(--text-2); text-align: center; }
details.auth-alt { text-align: left; }
details.auth-alt summary { cursor: pointer; color: var(--accent); text-align: center; }
.auth-foot { color: var(--text-3); font-size: 12px; margin-top: 18px; }
.qr { background: #fff; border-radius: 10px; padding: 10px; width: max-content; margin: 8px auto 10px; }
.qr svg { display: block; width: 190px; height: 190px; }
.secret { text-align: center; } .secret code { font-size: 13px; letter-spacing: .06em; }
.codes { columns: 2; padding-left: 22px; margin: 12px 0 16px; font-size: 14px; }
.codes li { margin: 4px 0; }
.codes code { font-size: 14px; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  body.app { grid-template-columns: 1fr; }
  .side { position: static; height: auto; }
  .side nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav-label { display: none; }
  .main { padding: 18px 14px 40px; }
  .grid-2 { grid-template-columns: 1fr; }
  .con-row { grid-template-columns: 1fr auto; }
  .con-row .strip, .con-row .con-up { display: none; }
  .usage { grid-template-columns: 1fr; }
}
@media (forced-colors: active) {
  .strip-cell, .badge-ico, .ev-dot { forced-color-adjust: none; }
}

.nowrap { white-space: nowrap; }
.table .strip { min-width: 96px; height: 18px; }
.table td, .table th { padding-left: 10px; padding-right: 10px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
