:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #16191d;
  --muted: #5b6470;
  --border: #dde1e6;
  --accent: #1c6fd1;
  --land: #e6e9ed;
  --neutral: #cfd5dc;
  --below: #d9480f;
  --above: #1c7ed6;
  --ok: #1f8a5b;
  --warn: #b7791f;
  --bad: #c2410c;
  --unknown: #7a8591;
  --seq-lo: #eef1f5;
  --seq-hi: #1c5fb0;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216;
    --surface: #171b21;
    --text: #e7eaee;
    --muted: #9aa4b0;
    --border: #2a313a;
    --accent: #5aa2f0;
    --land: #222831;
    --neutral: #3a424d;
    --below: #f08a4b;
    --above: #5aa2f0;
    --ok: #46c08a;
    --warn: #e0b04a;
    --bad: #f08a4b;
    --unknown: #8b96a3;
    --seq-lo: #1f2630;
    --seq-hi: #5aa2f0;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); }
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 16px; }
h1 { font-size: 1.6rem; margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; margin: 0 0 4px; }
.muted { color: var(--muted); font-size: .9rem; margin: 2px 0 10px; }
.sub { margin: 4px 0 0; color: var(--muted); }

.top { background: var(--surface); border-bottom: 1px solid var(--border); padding: 20px 0; }
.top-inner { display: flex; gap: 16px; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; }
.updated { margin: 0; color: var(--muted); font-size: .9rem; }

main { padding-top: 20px; padding-bottom: 20px; display: grid; gap: 16px; }

.banner { border: 1px solid var(--warn); background: color-mix(in srgb, var(--warn) 12%, var(--surface)); padding: 10px 14px; border-radius: var(--radius); }
.banner.err { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, var(--surface)); }

.status { display: flex; gap: 16px; align-items: center; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.status[hidden], .banner[hidden] { display: none; }
.status-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--unknown); flex: none; }
.status[data-level="ok"] .status-dot { background: var(--ok); }
.status[data-level="warn"] .status-dot { background: var(--warn); }
.status[data-level="bad"] .status-dot { background: var(--bad); }
.status-text { font-size: 1.35rem; font-weight: 650; margin: 0; }
.status p.muted { margin: 2px 0 0; }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.tile .label { color: var(--muted); font-size: .82rem; }
.tile .value { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1.25; }
.tile .hint { color: var(--muted); font-size: .8rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: center; }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }

.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; flex-wrap: wrap; }
.seg button { font: inherit; font-size: .88rem; padding: 6px 12px; background: transparent; color: var(--text); border: 0; border-right: 1px solid var(--border); cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.map-grid { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
@media (max-width: 860px) { .map-grid { grid-template-columns: 1fr; } }
.map-box { min-width: 0; }
#map { width: 100%; height: auto; display: block; background: color-mix(in srgb, var(--land) 40%, var(--surface)); border-radius: 8px; }
#map path { stroke: var(--surface); stroke-width: .4; vector-effect: non-scaling-stroke; }
#map path:hover { stroke: var(--text); stroke-width: 1; }
.legend { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: .8rem; color: var(--muted); flex-wrap: wrap; }
.legend .bar { height: 10px; width: 180px; border-radius: 5px; border: 1px solid var(--border); }
.legend .grey { width: 14px; height: 10px; background: var(--neutral); border-radius: 2px; margin-left: 10px; }

.movers h3 { font-size: .95rem; margin: 0 0 6px; }
.movers ol { list-style: none; margin: 0 0 12px; padding: 0; }
.movers li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: .9rem; }
.movers .num { font-variant-numeric: tabular-nums; font-weight: 600; }
.neg { color: var(--below); } .pos { color: var(--above); }

.chart { position: relative; }
.chart svg { width: 100%; height: auto; display: block; }
.axis text { fill: var(--muted); font-size: 11px; }
.grid line { stroke: var(--border); stroke-width: 1; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; }
.chart .cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .dot { stroke: var(--surface); stroke-width: 2; }

table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: .8rem; }
.tablewrap { overflow-x: auto; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; border: 1px solid var(--border); white-space: nowrap; }
.pill.live { border-color: var(--bad); color: var(--bad); }
.pill.ok { border-color: var(--ok); color: var(--ok); }
.more { margin-top: 8px; font: inherit; font-size: .88rem; background: transparent; color: var(--accent); border: 1px solid var(--border); border-radius: 8px; padding: 5px 12px; cursor: pointer; }
.empty { color: var(--muted); margin: 6px 0; }
.err-text { color: var(--muted); font-style: italic; }

.bgp-cols { display: grid; gap: 12px; }
.bgp-cols h3 { font-size: .95rem; margin: 0 0 4px; }
.bgp-cols ul { margin: 0; padding-left: 18px; font-size: .88rem; }

.notes { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.notes li { margin-bottom: 6px; }
.foot { padding-bottom: 32px; color: var(--muted); font-size: .85rem; }

.tip { position: fixed; z-index: 10; pointer-events: none; background: var(--text); color: var(--bg); padding: 6px 10px; border-radius: 6px; font-size: .82rem; max-width: 260px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.tip[hidden] { display: none; }
.tip b { display: block; }
