/* Transit Fabric network dashboard. System fonts only; no external loads. */
:root {
  --bg: #f6f6f3; --surface: #efefec; --raised: #ffffff; --line: #dcdcd7; --line-strong: #c4c4be;
  --text: #161719; --muted: #5c6166; --subtle: #6f747a;
  --accent: #2d5a88; --good: #296942; --warn: #8a5a10; --bad: #a83833;
  --globe-bg: #dfe6ee; --globe-text: #1b2633; --globe-muted: #4c5b6c; --globe-chip: rgba(255, 255, 255, 0.7); --globe-chip-line: rgba(20, 40, 70, 0.18);
  --tip-bg: rgba(255, 255, 255, 0.97);
  --g-ocean: #c9d6e3; --g-rim: #6f8fb0; --g-land: #6d8297; --g-land-flat: #f3f4f1; --g-region: #c98a1a; --g-point: #7a4b00; --g-focus: #b8321f;
  --g-op: #d6336c; --g-dim: #9aa6b2; --g-vant: #0f7f8c; --g-anchor: #3f4f63;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12161c; --surface: #181d24; --raised: #1d232b; --line: #2a323d; --line-strong: #3a4452;
    --text: #e6eaef; --muted: #a2acb8; --subtle: #8b96a3;
    --accent: #7fa8d6; --good: #6fbf8e; --warn: #d9a55a; --bad: #e07a73;
    --globe-bg: #0a1018; --globe-text: #d9e2ec; --globe-muted: #8796a8; --globe-chip: rgba(255, 255, 255, 0.06); --globe-chip-line: rgba(255, 255, 255, 0.16);
    --tip-bg: rgba(14, 22, 33, 0.96);
    --g-ocean: #132131; --g-rim: #3c6e9e; --g-land: #4f6f8f; --g-land-flat: #2a3d53; --g-region: #e8b04b; --g-point: #fff1c9; --g-focus: #ff8a65;
    --g-op: #ff5c8a; --g-dim: #3d4a5a; --g-vant: #6fd3e0; --g-anchor: #b9c4d2;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #12161c; --surface: #181d24; --raised: #1d232b; --line: #2a323d; --line-strong: #3a4452;
  --text: #e6eaef; --muted: #a2acb8; --subtle: #8b96a3;
  --accent: #7fa8d6; --good: #6fbf8e; --warn: #d9a55a; --bad: #e07a73;
  --globe-bg: #0a1018; --globe-text: #d9e2ec; --globe-muted: #8796a8; --globe-chip: rgba(255, 255, 255, 0.06); --globe-chip-line: rgba(255, 255, 255, 0.16);
  --tip-bg: rgba(14, 22, 33, 0.96);
  --g-ocean: #132131; --g-rim: #3c6e9e; --g-land: #4f6f8f; --g-land-flat: #2a3d53; --g-region: #e8b04b; --g-point: #fff1c9; --g-focus: #ff8a65;
  --g-op: #ff5c8a; --g-dim: #3d4a5a; --g-vant: #6fd3e0; --g-anchor: #b9c4d2;
  color-scheme: dark;
}

* { box-sizing: border-box }
[hidden] { display: none !important }
html { -webkit-text-size-adjust: 100% }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 14px; line-height: 1.5;
  padding: 20px max(16px, env(safe-area-inset-right, 0px)) 40px max(16px, env(safe-area-inset-left, 0px));
  overflow-x: hidden;
}
a { color: var(--accent) }
.wrap { max-width: 1320px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; min-width: 0 }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums }
h1, h2 { margin: 0; text-wrap: balance; font-weight: 600 }
h1 { font-size: 1.5rem; letter-spacing: -0.01em }
h2 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted) }
button, select { font: inherit; color: inherit }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }

header { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px 24px }
.meta-line { display: flex; flex-wrap: wrap; gap: 4px 16px; color: var(--muted); font-size: 0.8125rem }
.head-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 0.8125rem; color: var(--muted) }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); display: inline-block; flex: none }
.dot.good { background: var(--good) } .dot.warn { background: var(--warn) } .dot.bad { background: var(--bad) }
.btn { background: var(--raised); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 10px; cursor: pointer; font-size: 0.8125rem; color: var(--text) }
.btn:hover { background: var(--surface) }
.btn[disabled] { opacity: 0.45; cursor: default }

.notices { display: flex; flex-direction: column; gap: 8px }
.notices:empty { display: none }
.notice { border: 1px solid var(--warn); color: var(--text); background: color-mix(in srgb, var(--warn) 10%, var(--raised)); border-radius: 8px; padding: 8px 12px; font-size: 0.875rem }

.row3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.35fr); gap: 20px; align-items: stretch }
@media (max-width: 960px) { .row3 { grid-template-columns: minmax(0, 1fr) } }
.atlas-wrap { position: relative; min-width: 0 }
.over { position: absolute; right: 52px; top: 10px; width: min(340px, 40%); max-height: calc(100% - 20px); overflow-y: auto; display: flex; flex-direction: column; gap: 10px; z-index: 4 }
.over .card { box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25) }
@media (max-width: 760px) { .over { position: static; width: auto; max-height: none; margin-top: 12px } }

.globe-panel { position: relative; background: var(--globe-bg); border-radius: 10px; overflow: hidden; height: clamp(360px, 62vh, 700px); width: 100%; touch-action: none; cursor: grab; color: var(--globe-text) }
.globe-panel:active { cursor: grabbing }
.globe-panel canvas { display: block; position: absolute; inset: 0; width: 100%; height: 100% }
.globe-panel.off { cursor: default; height: auto }
.topbar { position: absolute; top: 10px; left: 10px; right: 56px; display: flex; flex-wrap: wrap; gap: 6px 10px; z-index: 2; align-items: center }
.layers { display: flex; flex-wrap: wrap; gap: 6px }
.chip-select { display: inline-flex; align-items: center; gap: 6px; font: 500 0.75rem var(--font-sans); color: var(--globe-text); background: var(--globe-chip); border: 1px solid var(--globe-chip-line); border-radius: 999px; padding: 2px 4px 2px 10px }
.chip-select select { font: inherit; color: var(--globe-text); background: transparent; border: 0; padding: 2px 4px; max-width: 7rem }
.chip-select select option { color: initial; background: initial }
.views { display: inline-flex; border: 1px solid var(--globe-chip-line); border-radius: 999px; overflow: hidden; background: var(--globe-chip) }
.views button { font: 600 0.75rem var(--font-sans); color: var(--globe-text); background: none; border: 0; padding: 4px 12px; cursor: pointer }
.views button[aria-pressed="true"] { background: var(--globe-text); color: var(--globe-bg) }
.views button[disabled] { opacity: 0.4; cursor: not-allowed }
.layers button, .zoom button { font: 500 0.75rem var(--font-sans); color: var(--globe-text); background: var(--globe-chip); border: 1px solid var(--globe-chip-line); border-radius: 999px; padding: 4px 10px; cursor: pointer; display: inline-flex; gap: 6px; align-items: center }
.layers button[aria-pressed="false"] { opacity: 0.45 }
.zoom { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2 }
.zoom button[aria-pressed="true"] { background: var(--globe-text); color: var(--globe-bg) }
.zoom button { width: 32px; height: 32px; padding: 0; justify-content: center; border-radius: 8px; font-size: 1rem }
.sw { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none }
.sw.nodes { background: var(--g-region); box-shadow: 0 0 0 2px color-mix(in srgb, var(--g-region) 35%, transparent) }
.sw.regions { background: color-mix(in srgb, var(--g-region) 35%, transparent); border: 1.5px solid var(--g-region) }
.sw.vant { background: var(--g-vant); border-radius: 2px; transform: rotate(45deg) }
.sw.anch { border: 1.5px solid var(--g-anchor) }
.sw.op { background: var(--g-op) }
.legend { position: absolute; left: 12px; bottom: 10px; max-width: min(560px, 55%); color: var(--globe-muted); font-size: 0.75rem; display: flex; flex-wrap: wrap; gap: 2px 14px; pointer-events: none; z-index: 1 }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden }
.vlabel, .count { position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: none; will-change: transform }
.vlabel { margin: -22px 0 0 0; translate: -50% 0; color: var(--globe-text); font: 500 0.6875rem var(--font-sans); letter-spacing: 0.02em; text-shadow: 0 0 3px var(--globe-bg), 0 0 3px var(--globe-bg) }
.count { translate: -50% -50%; color: var(--globe-bg); font: 700 0.625rem var(--font-mono); line-height: 1 }
.tip { position: absolute; left: 0; top: 0; z-index: 3; pointer-events: none; background: var(--tip-bg); color: var(--globe-text); border: 1px solid var(--globe-chip-line); border-radius: 8px; padding: 8px 10px; font-size: 0.75rem; min-width: 180px; max-width: min(280px, calc(100% - 16px)) }
.tip b { font-weight: 600 }
.tip .k { color: var(--globe-muted) }
.tip .hl { color: var(--g-op); font-weight: 600 }
.noglobe { margin: 0; padding: 56px 20px 64px; text-align: center; color: var(--globe-muted) }

.side { display: flex; flex-direction: column; gap: 16px; min-width: 0 }
.card { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0 }
.card-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px }
.kpi { background: var(--raised); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; min-width: 0 }
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) } }
.kpi .v { font: 500 1.5rem var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; overflow-wrap: anywhere }
.kpi .v small { white-space: nowrap; font-size: 0.8125rem; color: var(--muted); font-family: var(--font-sans); margin-left: 4px }
.kpi .l { color: var(--muted); font-size: 0.75rem }
.agree { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; font-size: 0.8125rem }
.pill { font: 500 0.6875rem var(--font-mono); padding: 1px 7px; border-radius: 999px; border: 1px solid currentColor; justify-self: end; white-space: nowrap }
.pill.good { color: var(--good) } .pill.warn { color: var(--warn) } .pill.bad { color: var(--bad) } .pill.na { color: var(--subtle) }
.spark { width: 100%; height: 56px; display: block }
.note { color: var(--muted); font-size: 0.8125rem; margin: 0 }
.field { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; color: var(--muted) }
.field select, .field input { background: var(--raised); border: 1px solid var(--line-strong); border-radius: 6px; padding: 3px 6px; color: var(--text); max-width: 11rem; font: inherit }
.field input { width: 15rem; max-width: 100%; font-family: var(--font-mono); font-size: 0.75rem }
@media (max-width: 640px) { .field:has(#f-q) { flex: 1 1 100% } .field input { width: auto; flex: 1; min-width: 0 } }
.oplist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 220px; overflow-y: auto }
.oplist button { width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 4px 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; font-size: 0.8125rem }
.oplist button:hover { background: var(--surface) }
.oplist .here { color: var(--g-op); font-family: var(--font-mono); white-space: nowrap }
dl.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px; margin: 0; font-size: 0.8125rem }
dl.kv dt { color: var(--muted) }
dl.kv dd { margin: 0; overflow-wrap: anywhere }
.keyrow { display: flex; gap: 8px; align-items: flex-start }
.keyrow code { flex: 1; min-width: 0; overflow-wrap: anywhere; word-break: break-all }

.filters { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch }
table { width: 100%; border-collapse: collapse; font-size: 0.8125rem }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 0.6875rem; text-transform: uppercase; letter-spacing: 0.06em; padding: 0; border-bottom: 1px solid var(--line-strong); white-space: nowrap }
th button { all: unset; cursor: pointer; padding: 6px 8px; display: block; width: 100%; box-sizing: border-box }
th button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px }
th[aria-sort="ascending"] button::after { content: " ▲"; font-size: 0.6rem }
th[aria-sort="descending"] button::after { content: " ▼"; font-size: 0.6rem }
th.plain { padding: 6px 8px }
th.num, td.num { text-align: right }
th.num button { text-align: right }
td { padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; font-variant-numeric: tabular-nums }
tr.row { cursor: pointer }
tr.row:hover td { background: var(--surface) }
tr.row.sel td { background: color-mix(in srgb, var(--accent) 14%, transparent) }
td.empty { color: var(--subtle); text-align: center; padding: 20px 8px; white-space: normal }
.bar { vertical-align: middle; margin-right: 6px }
.bar rect { fill: var(--accent); opacity: 0.8 }
.muted { color: var(--subtle) }
.pager { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; font-size: 0.8125rem; color: var(--muted) }
.pager .btns { display: flex; flex-wrap: wrap; gap: 6px }
@media (max-width: 640px) { .opt { display: none } .legend { display: none } .layers button { padding: 3px 8px } .kpi .v { font-size: 1.25rem } .topbar { right: 50px } }

details.method summary { cursor: pointer; color: var(--accent); font-size: 0.8125rem }
details.method p { color: var(--muted); font-size: 0.8125rem; margin: 8px 0 0; max-width: 72ch }
code { font-family: var(--font-mono); font-size: 0.75rem; background: var(--surface); padding: 1px 4px; border-radius: 4px }
footer { color: var(--subtle); font-size: 0.75rem; display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 14px }
footer nav { display: flex; flex-wrap: wrap; gap: 4px 14px }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap }
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important } }
