:root {
    --bg: #070a12;
    --panel: rgba(12, 17, 30, 0.92);
    --panel-border: rgba(120, 160, 220, 0.18);
    --text: #dfe6f3;
    --muted: #8b98b3;
    --accent: #78dcff;
    --accent-2: #ffbe50;
    --danger: #ff5a5a;
    --warn: #ffbe50;
    --watch: #78dcff;
    --ok: #5ad48a;
    --font: "Segoe UI", system-ui, -apple-system, sans-serif;
    --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; }
h1:focus { outline: none; }
a { color: var(--accent); text-decoration: none; }

.shell { display: flex; flex-direction: column; height: 100vh; }
.topbar {
    display: flex; align-items: center; gap: 24px; height: 48px; padding: 0 16px;
    background: linear-gradient(180deg, #0d1322, #090d18); border-bottom: 1px solid var(--panel-border);
}
/* ---------- brand (assets/brand/BRAND.md) ---------- */
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); }
.brand-mark { width: 28px; height: 28px; flex: none; filter: drop-shadow(0 0 6px rgba(120,220,255,0.25)); }
.brand-name { font-weight: 700; letter-spacing: 0.2em; font-size: 15px; line-height: 1; }
.brand-aegis { font-weight: 300; color: var(--accent-2); margin-left: 0.45em; }
.brand-sub { color: var(--muted); font-size: 11px; letter-spacing: 0.04em; padding-left: 10px; border-left: 1px solid var(--panel-border); }
@media (max-width: 1280px) { .brand-sub { display: none; } }
.nav { display: flex; gap: 4px; }
.nav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); }
.nav a:hover { color: var(--text); background: rgba(255,255,255,0.04); }
.nav a.active { color: var(--text); background: rgba(120,220,255,0.12); }
.status { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot-ok { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot-bad { background: var(--danger); box-shadow: 0 0 6px var(--danger); }

.content { flex: 1; min-height: 0; position: relative; }

/* ---------- globe page ---------- */
.globe-page { position: absolute; inset: 0; display: flex; }
.globe-host { flex: 1; min-width: 0; position: relative; }
.globe-host .cesium-viewer { position: absolute; inset: 0; }
.side-panel {
    width: 340px; flex: none; display: flex; flex-direction: column; gap: 10px; padding: 12px;
    background: var(--panel); border-right: 1px solid var(--panel-border); overflow: hidden;
}
.side-panel h2 { margin: 0; font-size: 12px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.search { width: 100%; padding: 8px 10px; border-radius: 6px; border: 1px solid var(--panel-border); background: #0b1020; color: var(--text); font: inherit; }
.results { flex: 1; min-height: 0; overflow: auto; border: 1px solid var(--panel-border); border-radius: 6px; }
.row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.03); }
.row:hover { background: rgba(255,255,255,0.04); }
.row.selected { background: rgba(120,220,255,0.12); }
.row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .id { color: var(--muted); font-family: var(--mono); font-size: 12px; }
.tag { font-size: 10px; padding: 1px 6px; border-radius: 10px; border: 1px solid currentColor; }
.tag-Payload { color: var(--accent); }
.tag-RocketBody { color: var(--accent-2); }
.tag-Debris { color: var(--danger); }
.tag-Tba { color: #c88cff; }
.tag-Unknown { color: var(--muted); }
.selected-list { max-height: 160px; overflow: auto; }
.toolbar { display: flex; flex-wrap: wrap; gap: 6px; }
.toolbar button.active { color: var(--text); background: rgba(120,220,255,0.18); border-color: rgba(120,220,255,0.5); }
.pivot-slider { width: 100%; margin: 4px 0 8px; accent-color: #7fd6ff; }
button, .btn {
    padding: 6px 10px; border-radius: 6px; border: 1px solid var(--panel-border); background: #101830; color: var(--text);
    font: inherit; font-size: 13px; cursor: pointer;
}
button:hover { background: #172346; }
button.primary { background: #1a4a66; border-color: #2d7ca6; }
button.primary:hover { background: #22608a; }
button:disabled { opacity: 0.5; cursor: default; }
.detail { font-size: 12px; color: var(--muted); display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; }
.detail b { color: var(--text); font-weight: 500; font-family: var(--mono); }
.hint { color: var(--muted); font-size: 12px; }

/* ---------- globe: stations, tracks, links (domain colours: assets/brand/BRAND.md "Domains and links") ---------- */
:root {
    --dom-station: #dfe6f3;
    --dom-space: #78dcff;
    --dom-air: #c88cff;
    --dom-sea: #4fd1c5;
    --dom-ground: #ff9a5a;
    --dom-unknown: #8b98b3;
    --link-closes: #5ad48a;
    --link-marginal: #ffbe50;
    --link-fails: #ff5a5a;
}
.side-panel .tabs { flex-wrap: nowrap; }
.side-panel .tabs button { flex: 1; padding: 6px 4px; }
.side-panel .tabs button.active { color: var(--text); background: rgba(120,220,255,0.16); border-color: rgba(120,220,255,0.5); }
.tabs .count { font-family: var(--mono); font-size: 11px; color: var(--muted); margin-left: 3px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.switch { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--muted); cursor: pointer; }
.switch input { accent-color: #78dcff; margin: 0; }
.station-list { flex: none; max-height: 150px; }
.track-list { flex: none; max-height: 270px; }
.dom-station { color: var(--dom-station); }
.dom-space { color: var(--dom-space); }
.dom-air { color: var(--dom-air); }
.dom-sea { color: var(--dom-sea); }
.dom-ground { color: var(--dom-ground); }
.dom-unknown { color: var(--dom-unknown); }
.tag.dom-station { background: rgba(45,124,166,0.35); border-color: #2d7ca6; }
.badge-sample { font-size: 9.5px; letter-spacing: 0.08em; padding: 1px 6px; border-radius: 3px; color: var(--accent-2); border: 1px solid rgba(255,190,80,0.55); background: rgba(255,190,80,0.08); }
.row .kind { font-size: 11px; color: var(--muted); font-family: var(--mono); }
.trk-status { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--muted); }
.trk-status.st-active { background: var(--ok); box-shadow: 0 0 5px var(--ok); }
.trk-status.st-coasted { background: transparent; border: 1px solid var(--muted); }
.trk-status.st-resolved { background: var(--accent); }
table.grid.passes { font-size: 12px; }
table.grid.passes th { background: transparent; position: static; }
table.grid.passes tbody tr { cursor: pointer; }
table.grid.passes tr.active td { background: rgba(90,212,138,0.10); }
.margin { padding: 1px 6px; border-radius: 8px; font-size: 11px; white-space: nowrap; }
.margin.m-closes { background: rgba(90,212,138,0.16); color: var(--link-closes); }
.margin.m-marginal { background: rgba(255,190,80,0.16); color: var(--link-marginal); }
.margin.m-fails { background: rgba(255,90,90,0.16); color: var(--link-fails); }
.margin.m-none { color: var(--muted); }
.toolbar button.active.notional { background: rgba(200,140,255,0.16); border-color: rgba(200,140,255,0.55); }
/* notional (simulated or planned) entries beside live ones: marked in violet, never by recolouring the domain (BRAND.md) */
.tag.world-notional { color: #c88cff; background: rgba(200,140,255,0.12); letter-spacing: 0.06em; margin-left: 4px; }
tr.notional-row td:first-child, .row.notional-row { box-shadow: inset 2px 0 0 rgba(200,140,255,0.7); }
.field .world-switch { margin: 0; padding: 2px 0; }

.globe-legend {
    position: absolute; top: 10px; left: 10px; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
    max-width: calc(100% - 140px); padding: 6px 10px; border-radius: 6px; font-size: 11.5px; color: var(--text);
    background: rgba(7,10,18,0.72); border: 1px solid var(--panel-border); backdrop-filter: blur(3px); pointer-events: none;
}
.globe-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.globe-legend .sep { width: 1px; height: 12px; background: var(--panel-border); }
.globe-legend .sw { width: 9px; height: 9px; border-radius: 50%; background: currentColor; display: inline-block; }
.globe-legend .sw-station { background: var(--dom-station); box-shadow: 0 0 0 2px #2d7ca6; width: 7px; height: 7px; }
.globe-legend .ln { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
.globe-legend .ln.m-closes { background: var(--link-closes); box-shadow: 0 0 5px var(--link-closes); }
.globe-legend .ln.m-marginal { background: var(--link-marginal); }
.globe-legend .ln.m-fails { background: var(--link-fails); }
.world-banner {
    position: absolute; top: 46px; left: 50%; transform: translateX(-50%); z-index: 2; padding: 5px 14px; border-radius: 4px;
    font-size: 11.5px; letter-spacing: 0.08em; color: #ead7ff; background: rgba(60,30,90,0.82); border: 1px solid rgba(200,140,255,0.6);
    pointer-events: none; white-space: nowrap;
}
.link-hud { position: absolute; bottom: 44px; right: 10px; z-index: 2; width: 300px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.link-hud[hidden] { display: none; }
.link-hud-card {
    padding: 9px 12px 8px; border-radius: 6px; font-size: 11.5px; color: var(--text);
    background: rgba(7,10,18,0.80); border: 1px solid rgba(90,212,138,0.45); border-left: 3px solid var(--link-closes); backdrop-filter: blur(3px);
}
.link-hud-card p { margin: 0 0 6px; font-size: 12px; }
.link-hud-card p::before { content: "LINK · "; color: var(--link-closes); font-size: 10.5px; letter-spacing: 0.12em; }
.link-hud-card:has(.link-marginal) { border-color: rgba(255,190,80,0.45); border-left-color: var(--link-marginal); }
.link-hud-card:has(.link-fails) { border-color: rgba(255,90,90,0.45); border-left-color: var(--link-fails); }
.link-hud-card:has(.link-none) { border-color: rgba(120,220,255,0.40); border-left-color: var(--accent); }
.link-hud-card p.link-marginal::before { color: var(--link-marginal); }
.link-hud-card p.link-fails::before { color: var(--link-fails); }
.link-hud-card p.link-none::before { color: var(--accent); }
.link-hud-card table { border-collapse: collapse; width: 100%; }
.link-hud-card th { text-align: left; font-weight: 400; color: var(--muted); padding: 1.5px 10px 1.5px 0; white-space: nowrap; vertical-align: top; width: 1%; }
.link-hud-card td { font-variant-numeric: tabular-nums; padding: 1.5px 0; white-space: nowrap; }
.link-hud-card ul { display: none; }

/* operator views: every layer starts off and the operator opts in (docs/ARCHITECTURE.md "Operator views") */
.side-panel { overflow-y: auto; }
.side-panel > .results { min-height: 90px; }
.layers { flex: none; display: flex; flex-direction: column; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--panel-border); }
.layers-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: var(--muted); }
.layers-toggle:hover { background: none; color: var(--text); }
.layers-toggle .caret { width: 10px; font-size: 11px; }
.layers-title { font-size: 12px; letter-spacing: 0.12em; text-transform: uppercase; }
.layers-toggle .count { font-family: var(--mono); font-size: 11px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); font-size: 12px; }
.link-btn:hover { background: none; text-decoration: underline; }
.layers-note { margin: 0; padding: 5px 8px; font-size: 11.5px; line-height: 1.45; color: var(--text); border-left: 2px solid var(--accent-2); border-radius: 3px; background: rgba(255,190,80,0.07); }
.layer-list { display: flex; flex-direction: column; gap: 7px; }
.layer-group { display: flex; flex-direction: column; gap: 4px; }
.layer-group .switch { color: var(--text); font-size: 13px; }
.layer-group.world-row { flex-direction: row; align-items: center; gap: 8px; }
.world-row .toolbar button { padding: 3px 9px; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; padding-left: 20px; }
.chips.dim { opacity: 0.45; }
.chip { padding: 2px 9px; border-radius: 10px; font-size: 11.5px; background: transparent; border: 1px solid currentColor; }
.layer-list .chip:not(.on) { color: var(--muted); border-color: var(--panel-border); }
.chip.on { background: rgba(120,220,255,0.08); }
.row.off-layer { opacity: 0.55; }
.globe-hint {
    position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 2; width: max-content; max-width: min(520px, calc(100% - 180px));
    padding: 8px 14px; border-radius: 6px; font-size: 12.5px; line-height: 1.45; color: var(--text); text-align: center;
    background: rgba(7,10,18,0.78); border: 1px solid rgba(120,220,255,0.35); backdrop-filter: blur(3px);
}
.globe-hint b { font-weight: 600; color: var(--accent); }
.globe-hint .link-btn { font-size: 12.5px; font-weight: 600; }
.pick-prompt { display: inline-block; margin-bottom: 16px; padding: 12px 16px; border: 1px dashed var(--panel-border); border-radius: 8px; background: rgba(12,17,30,0.5); }
.pick-prompt p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.pick-prompt .chips { padding-left: 0; gap: 8px; }
.pick-prompt .chip { padding: 5px 16px; font-size: 13px; }
.form-row .link-btn { align-self: center; }
/* stations and tracks pages */
.pill { padding: 1px 8px; border-radius: 10px; font-size: 11px; font-family: var(--font); white-space: nowrap; }
.pill.st-active { background: rgba(90,212,138,0.16); color: var(--ok); }
.pill.st-coasted { background: rgba(140,150,180,0.15); color: var(--muted); }
.pill.st-resolved { background: rgba(120,220,255,0.15); color: var(--accent); }
.notional-note { margin: -6px 0 12px; padding: 6px 12px; border-radius: 4px; font-size: 12px; letter-spacing: 0.04em; color: #ead7ff;
    background: rgba(60,30,90,0.55); border: 1px solid rgba(200,140,255,0.5); display: inline-block; }
.field.switch-field .switch { padding: 7px 0; color: var(--text); font-size: 13px; }
.field input[type=checkbox] { min-width: 0; padding: 0; width: 15px; height: 15px; }
.badge-sample { margin-left: 6px; vertical-align: 1px; }
.two-col.top { align-items: start; }
table.grid tr.picked td { background: rgba(120,220,255,0.08); }
.detail.wide { grid-template-columns: 130px 1fr; gap: 4px 12px; font-size: 12.5px; }
ul.caveats { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 12px; line-height: 1.5; }
a.btn.primary-link { background: #1a4a66; border-color: #2d7ca6; color: var(--text); }
a.btn.primary-link:hover { background: #22608a; }

/* ---------- table pages ---------- */
.page { padding: 20px 24px; height: 100%; overflow: auto; }
.page h1 { font-size: 20px; font-weight: 600; margin: 0 0 12px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; margin-bottom: 16px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field input, .field select { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--panel-border); background: #0b1020; color: var(--text); font: inherit; min-width: 120px; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
table.grid th { text-align: left; padding: 8px; border-bottom: 1px solid var(--panel-border); color: var(--muted); font-weight: 500; font-size: 12px; position: sticky; top: 0; background: var(--bg); }
table.grid td { padding: 6px 8px; border-bottom: 1px solid rgba(255,255,255,0.04); font-family: var(--mono); }
table.grid td.text { font-family: var(--font); }
table.grid tr:hover td { background: rgba(255,255,255,0.03); }
.sev { padding: 2px 8px; border-radius: 10px; font-size: 11px; font-family: var(--font); }
.sev-Critical { background: rgba(255,90,90,0.2); color: var(--danger); }
.sev-Warning { background: rgba(255,190,80,0.2); color: var(--warn); }
.sev-Watch { background: rgba(120,220,255,0.15); color: var(--watch); }
.sev-Info { background: rgba(140,150,180,0.15); color: var(--muted); }
.cov { padding: 1px 7px; border-radius: 10px; font-size: 11px; white-space: nowrap; }
.cov-real { background: rgba(120,255,170,0.15); color: #8ff0b4; }
.cov-mixed { background: rgba(255,190,80,0.15); color: var(--warn); }
.cov-model { background: rgba(140,150,180,0.15); color: var(--muted); }
tr.emergency td { background: rgba(255,90,90,0.08); }
.summary { color: var(--muted); font-size: 12px; margin-bottom: 8px; }

#blazor-error-ui { color-scheme: light only; background: lightyellow; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2); box-sizing: border-box; display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000; color: #111; }
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* Cesium chrome tweaks: no ion logo (no ion assets are used), compact credits */
.cesium-credit-logoContainer { display: none !important; }
.cesium-widget-credits { font-size: 10px; opacity: 0.7; }

/* ---------- launch / analysis pages ---------- */
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.card { min-width: 0; }
@media (max-width: 1100px) { .two-col { grid-template-columns: 1fr; } }
.card { border: 1px solid var(--panel-border); border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; background: rgba(12,17,30,0.6); }
.card h2 { margin: 0 0 10px; font-size: 12px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; }
.table-wrap { overflow-x: auto; }
table.grid.compact td, table.grid.compact th { padding: 3px 6px; font-size: 12px; }
table.grid.compact input { padding: 3px 5px; font-size: 12px; border-radius: 4px; border: 1px solid var(--panel-border); background: #0b1020; color: var(--text); font-family: var(--mono); }
table.grid tr.cut td { background: rgba(255,90,90,0.12); }
code { font-family: var(--mono); font-size: 12px; color: var(--accent); }
details summary { cursor: pointer; margin: 6px 0; }

/* ---- account / auth ---- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth-card { width: min(420px, 100%); border: 1px solid var(--panel-border); border-radius: 10px; padding: 24px 26px; background: rgba(12,17,30,0.85); }
.auth-card .brand { display: flex; flex-direction: column; gap: 2px; margin-bottom: 18px; text-decoration: none; }
.auth-card h1 { font-size: 18px; margin: 0 0 14px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .field input { width: 100%; box-sizing: border-box; }
.auth-form button { align-self: flex-start; margin-top: 4px; }
.auth-error { color: var(--danger); font-size: 12px; margin: 0; }
.auth-error ul { margin: 0; padding-left: 18px; }
.status .user { color: var(--text); margin-left: 10px; padding: 4px 8px; border-radius: 6px; border: 1px solid var(--panel-border); }
.status .logout { display: inline; margin-left: 6px; }
.status .logout button { padding: 4px 8px; font-size: 12px; }
.key-reveal { margin: 8px 0 12px; padding: 10px 12px; border: 1px dashed rgba(120,220,255,0.5); border-radius: 6px; background: rgba(120,220,255,0.06); }
.key-reveal code { display: block; margin-top: 6px; word-break: break-all; font-size: 13px; color: #cff3ff; }

/* ---------- audit (docs/AUDIT-LOGGING.md "Reading the logs (web)"): outcome and status chips from the brand palette ---------- */
.audit-tabs { margin-bottom: 14px; }
.audit-tabs button, .audit-range .toolbar button { padding: 5px 12px; }
.audit-tabs button.active, .audit-range .toolbar button.active { color: var(--text); background: rgba(120,220,255,0.16); border-color: rgba(120,220,255,0.5); }
.audit-filters { padding: 10px 12px; border: 1px solid var(--panel-border); border-radius: 8px; background: rgba(12,17,30,0.5); }
.audit-filters .field input, .audit-filters .field select { min-width: 110px; }
.audit-filters .field.check { flex-direction: row; align-items: center; gap: 5px; padding-bottom: 8px; }
.audit-filters .field.check input { min-width: 0; width: 15px; height: 15px; }
.field input.invalid { border-color: var(--danger); }
.audit-actions { align-items: center; margin-bottom: 10px; }
.pill.oc-success, .pill.code-2xx { background: rgba(90,212,138,0.16); color: var(--ok); }
.pill.code-3xx { background: rgba(120,220,255,0.15); color: var(--accent); }
.pill.oc-failure, .pill.code-4xx { background: rgba(255,190,80,0.16); color: var(--warn); }
.pill.oc-denied, .pill.code-5xx { background: rgba(255,90,90,0.18); color: var(--danger); }
.pill.oc-other, .pill.code-1xx, .pill.code-other { background: rgba(140,150,180,0.15); color: var(--muted); }
table.audit-grid td { white-space: nowrap; }
table.audit-grid td.wrap { white-space: normal; word-break: break-all; min-width: 160px; }
table.audit-grid td.ua { max-width: 280px; overflow: hidden; text-overflow: ellipsis; }
table.audit-grid .link-btn { font-family: var(--mono); }
.verify-result { display: inline-block; margin: 0 0 12px; padding: 6px 12px; border-radius: 4px; font-size: 12.5px; }
.verify-result.ok { color: var(--ok); background: rgba(90,212,138,0.10); border: 1px solid rgba(90,212,138,0.5); }
.verify-result.broken { color: var(--danger); background: rgba(255,90,90,0.10); border: 1px solid rgba(255,90,90,0.55); }
.audit-drawer {
    position: fixed; top: 48px; right: 0; bottom: 0; z-index: 20; width: min(540px, 100%); overflow-y: auto; padding: 14px 18px;
    background: var(--panel); border-left: 1px solid var(--panel-border); box-shadow: -8px 0 24px rgba(0,0,0,0.45);
}
.audit-drawer h2 { margin: 0; font-size: 14px; letter-spacing: 0.06em; }
.audit-drawer h3 { margin: 16px 0 6px; font-size: 11.5px; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; font-weight: 500; }
.audit-drawer .detail { margin-top: 10px; }
.audit-drawer .detail b { word-break: break-word; }
.audit-drawer .hash { word-break: break-all; font-size: 11.5px; }
.audit-drawer pre.json {
    margin: 0; padding: 10px; border-radius: 6px; background: #0b1020; border: 1px solid var(--panel-border);
    font-family: var(--mono); font-size: 12px; color: var(--text); white-space: pre-wrap; word-break: break-word;
}
.role-pick { display: inline-flex; align-items: center; gap: 10px; }
