:root {
  --bg: #f6f7f9; --panel: #fff; --ink: #1c2430; --muted: #66707d; --line: #e2e6eb;
  --accent: #1f5fa8; --accent-soft: #a9c4e4; --t1: #c9771b; --t2: #7b3fa0;
  --locked: #1e7b46; --track: #4c9a63; --bubble: #c9a01b; --close: #d4731c; --out: #8a929c; --below: #b0b6bd;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #14181d; --panel: #1c2128; --ink: #e6e9ee; --muted: #98a2ae; --line: #2c333c;
          --accent: #5b9be0; --accent-soft: #2f4c6e; --out: #6f7782; --below: #555c65; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
main { max-width: 1400px; margin: 0 auto; padding: 16px; }
h1 { font-size: 24px; margin: 0; }
h2 { font-size: 18px; margin: 0 0 8px; }
h2.inline { display: inline; }
h3 { font-size: 15px; margin: 16px 0 4px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 16px;
       background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.top nav { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.top form { margin: 0; }
.brand { font-weight: 700; font-size: 16px; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin: 16px 0; }
.card.narrow { max-width: 360px; margin: 48px auto; }
.card label { display: block; margin: 10px 0; }
.card input { display: block; width: 100%; padding: 8px; margin-top: 4px; border: 1px solid var(--line); border-radius: 6px;
              background: var(--bg); color: var(--ink); }
.error { color: #b3261e; }
button { font: inherit; cursor: pointer; }
button.primary { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 16px; margin-top: 8px; }
button.link { background: none; border: 0; color: var(--accent); padding: 0; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.filters { margin-bottom: 8px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.tab { background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 999px; padding: 5px 12px; }
.tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.tab .n { opacity: .7; margin-left: 4px; }
.filters .row { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select, .filters input { padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel);
                                  color: var(--ink); min-width: 200px; }
.tablewrap { overflow: auto; max-height: calc(100vh - 140px); background: var(--panel); border: 1px solid var(--line);
             border-radius: 8px; }
.card .tablewrap { border: 0; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--panel); position: sticky; top: 0;
     z-index: 1; box-shadow: inset 0 -1px 0 var(--line); }
thead th { white-space: normal; vertical-align: bottom; min-width: 64px; }
table.sortable th { cursor: pointer; user-select: none; }
table.sortable th[aria-sort="ascending"]::after { content: " ▲"; }
table.sortable th[aria-sort="descending"]::after { content: " ▼"; }
.r { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #fff; white-space: nowrap; }
.badge.locked { background: var(--locked); } .badge.track { background: var(--track); }
.badge.bubble { background: var(--bubble); color: #1c2430; } .badge.close { background: var(--close); }
.badge.out { background: var(--out); } .badge.below { background: var(--below); color: #1c2430; }
.flag { color: var(--close); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-top: 12px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.tile .k { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; }
.tile .s { font-size: 12px; color: var(--muted); white-space: normal; }
.chart { position: relative; height: 280px; }
.chart.tall { height: 340px; }
.card .tiles { margin: 12px 0; }
.callout { border-left: 3px solid var(--close); padding: 6px 10px; background: color-mix(in srgb, var(--close) 8%, transparent); }
details summary { cursor: pointer; margin: 8px 0; }
table.kv th { position: static; width: 280px; }
@media (max-width: 640px) { .filters select, .filters input { min-width: 0; width: 100%; } }
