:root {
  --bg: #0b0d12;
  --surface-1: #12151c;
  --surface-2: #191d26;
  --line: #262b36;
  --text-primary: #eef0f4;
  --text-secondary: #b4bac6;
  --text-muted: #7c8392;
  --accent: #3987e5;
  --select: #ff4fd8;
  --good: #0ca30c;
  --warn: #fab219;
  --crit: #e5484d;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text-primary);
  font: 14px/1.4 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; }
body { display: flex; flex-direction: column; overflow: hidden; }
button, select, input { font: inherit; color: inherit; }
.muted { color: var(--text-muted); }
.small { font-size: 12px; }
h2, h3 { margin: 0 0 8px; font-weight: 600; }
h3 { font-size: 14px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .06em; }

header { display: flex; align-items: center; gap: 24px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--surface-1); }
.brand { font-weight: 700; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; font-size: 16px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
#tabs { display: flex; gap: 4px; }
#tabs button { background: none; border: 0; padding: 6px 12px; border-radius: 6px; color: var(--text-secondary); cursor: pointer; }
#tabs button:hover { background: var(--surface-2); }
#tabs button.on { background: var(--surface-2); color: var(--text-primary); box-shadow: inset 0 -2px 0 var(--accent); }
#coverage { margin-left: auto; font-size: 12px; }

#filters { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--surface-1); }
.f { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.f.grow { flex: 1; min-width: 180px; }
select, input[type=search] { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; text-transform: none; letter-spacing: 0; font-size: 14px; }
select { max-width: 240px; }
input[type=search] { width: 100%; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { background: var(--surface-2); border: 0; border-right: 1px solid var(--line); padding: 6px 10px; cursor: pointer; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text-secondary); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:disabled { color: #454b57; cursor: not-allowed; }
.toggle { display: flex; align-items: center; gap: 6px; padding-bottom: 7px; cursor: pointer; color: var(--text-secondary); }
.ghost { background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; }
#catPanel { position: absolute; right: 18px; top: 100%; z-index: 30; width: 520px; max-height: 60vh; overflow: auto; background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 8px; padding: 12px; box-shadow: 0 12px 40px #000a; }
#catPanel .chips { display: flex; flex-wrap: wrap; gap: 6px; }
#catPanel .row { display: flex; justify-content: space-between; margin-bottom: 10px; font-size: 12px; }
#catPanel .row a { color: var(--accent); cursor: pointer; }
.chip { display: inline-flex; gap: 6px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; background: var(--surface-1); color: var(--text-secondary); }
.chip .n { color: var(--text-muted); }
.chip.on { border-color: var(--accent); color: var(--text-primary); background: #3987e522; }
.chip.off { text-decoration: line-through; opacity: .55; }
.cat { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-secondary); white-space: nowrap; }

main { flex: 1; min-height: 0; }
.tab { height: 100%; }
#tab-globe { display: flex; }
#tab-globe[hidden] { display: none; }
#globeWrap { position: relative; flex: 1; min-width: 0; overflow: hidden; }
#globe { position: absolute; inset: 0; }
#mapCtl { position: absolute; left: 14px; bottom: 14px; background: #12151ccc; backdrop-filter: blur(6px); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; max-width: 360px; }
#legend .bar { display: flex; height: 10px; border-radius: 3px; overflow: hidden; gap: 2px; }
#legend .bar span { flex: 1; }
#legend .ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: 3px; }
#legend .title { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
#legend .nodata { display: inline-block; width: 10px; height: 10px; background: #262a33; border-radius: 2px; vertical-align: -1px; margin-right: 4px; }
#storyBanner { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); background: #12151cee; border: 1px solid var(--select); border-radius: 8px; padding: 8px 14px; display: flex; gap: 12px; align-items: center; box-shadow: 0 0 20px #ff4fd833; }
#storyBanner[hidden] { display: none; }
#storyBanner button { background: none; border: 1px solid var(--line); border-radius: 6px; padding: 3px 9px; cursor: pointer; }

.tip { background: #0b0d12f2; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 200px; max-width: 300px; font: 13px/1.35 Inter, system-ui, sans-serif; color: var(--text-primary); }
.tip b { font-size: 14px; }
.tip .v { color: var(--text-secondary); font-size: 12px; margin: 2px 0 6px; }
.tip ol { margin: 0; padding-left: 18px; }
.tip li { color: var(--text-secondary); }

#side { width: 420px; border-left: 1px solid var(--line); background: var(--surface-1); display: flex; flex-direction: column; min-height: 0; }
#sideHead { padding: 12px 14px 8px; border-bottom: 1px solid var(--line); }
#sideHead .t { font-size: 17px; font-weight: 600; }
#sideHead .back { background: none; border: 0; color: var(--accent); cursor: pointer; padding: 0; margin-bottom: 4px; font-size: 12px; }
#sideBody { overflow-y: auto; flex: 1; }
.story { display: grid; grid-template-columns: 26px 1fr auto; gap: 2px 8px; padding: 9px 14px; border-bottom: 1px solid #1d212a; cursor: pointer; }
.story:hover { background: var(--surface-2); }
.story .rk { color: var(--text-muted); font-variant-numeric: tabular-nums; text-align: right; grid-row: span 2; }
.story .lb { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.story .sc { font-variant-numeric: tabular-nums; color: var(--text-secondary); font-size: 12px; text-align: right; }
.story .meta { grid-column: 2 / 4; display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--text-muted); }
.live { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); box-shadow: 0 0 6px var(--good); }
.sbar { height: 4px; background: #1d212a; border-radius: 2px; overflow: hidden; width: 70px; }
.sbar span { display: block; height: 100%; background: var(--accent); border-radius: 0 2px 2px 0; }
.more { display: block; width: calc(100% - 28px); margin: 10px 14px 16px; }

.detail { padding: 12px 14px; }
.detail section { margin-bottom: 18px; }
.kw { display: flex; flex-wrap: wrap; gap: 5px; }
.kw span { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 2px 7px; font-size: 12px; color: var(--text-secondary); }
.news a { display: grid; grid-template-columns: 64px 1fr; gap: 10px; color: var(--text-primary); text-decoration: none; padding: 6px 0; border-bottom: 1px solid #1d212a; }
.news a:hover .nt { color: var(--accent); }
.news img { width: 64px; height: 48px; object-fit: cover; border-radius: 4px; background: var(--surface-2); }
.news .ns { font-size: 11px; color: var(--text-muted); }
.geoRow { display: grid; grid-template-columns: 1fr 70px 80px; gap: 8px; font-size: 13px; padding: 3px 0; align-items: center; }
.geoRow .gv { text-align: right; color: var(--text-muted); font-variant-numeric: tabular-nums; font-size: 12px; }

#tab-board, #tab-compare, #tab-status, #tab-rising { overflow: auto; padding: 16px 18px; }
.boardHead { display: flex; gap: 12px; align-items: baseline; margin-bottom: 10px; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { text-align: left; font-weight: 500; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); }
td { padding: 6px 8px; border-bottom: 1px solid #1a1e27; vertical-align: middle; }
tbody tr:hover { background: var(--surface-1); }
#boardTable tbody tr { cursor: pointer; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.num { color: var(--text-secondary); }
td.muted { color: var(--text-muted); }
table.runs { width: auto; min-width: 100%; }
table.runs td, table.runs th { white-space: nowrap; padding: 7px 12px; }
table.runs td.note { white-space: normal; color: var(--text-muted); font-size: 12px; width: 100%; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid; }
.pill.done { color: #8be08b; border-color: #1f5a1f; background: #0ca30c1a; }
.pill.running { color: #9ec5f4; border-color: #1e3658; background: #3987e51f; }
.pill.partial { color: #fbd77c; border-color: #53410f; background: #fab2191a; }
.pill.interrupted { color: var(--text-secondary); border-color: var(--line); background: var(--surface-2); }
.geos { color: var(--text-muted); font-size: 12px; }

.cmpCtl { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.vs { color: var(--text-muted); padding-bottom: 7px; }
.cmpCols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.cmpRow { display: grid; grid-template-columns: 1fr 120px 54px; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #1a1e27; cursor: pointer; }
.cmpRow:hover { background: var(--surface-1); }
.cmpRow .lb { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dbar { display: flex; flex-direction: column; gap: 2px; }
.dbar span { height: 5px; border-radius: 0 2px 2px 0; display: block; }
.dbar .a { background: var(--accent); }
.dbar .b { background: #6c7383; }
.cmpRow .d { text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; color: var(--text-secondary); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface-1); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; }
.tile .k { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.tile .v { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; margin-top: 2px; }
.statusCols { display: grid; grid-template-columns: 2fr 1fr; gap: 24px; }
.statusCols table { margin-bottom: 18px; }
.ok { color: var(--good); } .bad { color: var(--crit); }

#toast { position: fixed; bottom: 18px; right: 18px; background: var(--surface-2); border: 1px solid var(--line); padding: 8px 12px; border-radius: 6px; z-index: 50; }
.loading { padding: 20px 14px; color: var(--text-muted); }
/* Rising: time/sort in the shared filter bar don't apply; the tab has its own window picker */
body[data-tab=rising] .notRising { display: none; }
body[data-tab=status] #filters { display: none; }  /* none of the filters apply to collector health */
.risingHead { display: flex; align-items: flex-end; gap: 20px; margin-bottom: 14px; flex-wrap: wrap; }
.risingHead h2 { margin: 0 0 2px; }
#risingList { max-width: 1100px; }
.rcard { display: grid; grid-template-columns: 26px minmax(0, 1fr) 132px; gap: 4px 12px; padding: 10px 12px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-1); cursor: pointer; }
.rcard:hover { border-color: #3a4252; background: var(--surface-2); }
.rcard .rk { color: var(--text-muted); font-weight: 700; font-size: 15px; text-align: right; font-variant-numeric: tabular-nums; }
.rcard .mid { min-width: 0; }
.rcard .ttl { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rcard .ttl b { font-size: 15px; font-weight: 600; }
.newb { font-size: 10px; font-weight: 700; color: #111; background: var(--warn); border-radius: 4px; padding: 0 5px; letter-spacing: .04em; }
.rchips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; }
.rchip { font-size: 12px; border-radius: 4px; padding: 1px 7px; background: #14233a; color: #9ec5f4; border: 1px solid #1e3658; }
.rchip.hot { background: #3a1416; color: #ffb3b5; border-color: #5b1f22; }
.rchip.big, .rchip.surge { background: #33280b; color: #fbd77c; border-color: #53410f; }
.rcard .geos { margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rcard .rt { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.rcard .hl { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.heat { width: 120px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.heat i { display: block; height: 100%; background: linear-gradient(90deg, var(--warn), var(--crit)); border-radius: 3px; }
.spark { display: block; }
.spark rect { fill: #2a3445; }
.spark rect.in { fill: var(--accent); }
@media (max-width: 600px) { .rcard { grid-template-columns: 22px minmax(0, 1fr); } .rcard .rt { grid-column: 2; align-items: flex-start; } }
@media (max-width: 900px) { #side { width: 100%; } #tab-globe { flex-direction: column; } #globeWrap { min-height: 50vh; } .cmpCols, .statusCols { grid-template-columns: 1fr; } }
