:root {
  --bg: #f6f7f9; --surface: #ffffff; --ink: #14181f; --muted: #5b6573; --line: #dde1e7;
  --accent: #1f6feb; --accent-ink: #ffffff; --good: #1a7f4b; --warn: #b7791f; --bad: #c0392b;
  --bar: #9db8e8; --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1318; --surface: #171c23; --ink: #e6eaf0; --muted: #98a2b0; --line: #2a313b;
    --accent: #5b9bff; --accent-ink: #0b1220; --good: #4cc38a; --warn: #e0b04a; --bad: #ff7b6b; --bar: #2f4a7a;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1318; --surface: #171c23; --ink: #e6eaf0; --muted: #98a2b0; --line: #2a313b;
  --accent: #5b9bff; --accent-ink: #0b1220; --good: #4cc38a; --warn: #e0b04a; --bad: #ff7b6b; --bar: #2f4a7a;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.45 system-ui, "Segoe UI", sans-serif; }
.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; padding: 12px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
h1 { font-size: 16px; margin: 0; letter-spacing: .02em; }
h2 { font-size: 15px; margin: 0 0 8px; }
nav { display: flex; flex-wrap: wrap; gap: 4px; }
nav button { background: none; border: 0; color: var(--muted); padding: 6px 10px; border-radius: 6px; cursor: pointer; font: inherit; }
nav button[aria-current="page"] { background: var(--accent); color: var(--accent-ink); }
.controls { display: flex; flex-wrap: wrap; gap: 12px; margin-left: auto; align-items: center; }
label { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); }
select, input, button { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 8px; }
button { cursor: pointer; }
button[type="submit"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.quiet { color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
main { padding: 16px; max-width: 1280px; margin: 0 auto; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 48px auto; display: grid; gap: 12px; }
.muted { color: var(--muted); margin: 0; }
.error { color: var(--bad); margin: 0; min-height: 1.4em; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.card .value { font-size: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.card .label { color: var(--muted); font-size: 12px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
.scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; background: var(--surface); }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 500; font-size: 12px; position: sticky; top: 0; background: var(--surface); }
td.text, th.text { text-align: left; }
.meter { display: inline-block; height: 8px; border-radius: 4px; background: var(--bar); vertical-align: middle; margin-right: 6px; }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }
.map-wrap { position: relative; }
canvas { width: 100%; height: auto; max-height: 70vh; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); padding: 6px 8px;
  border-radius: 6px; font-size: 12px; white-space: pre; transform: translate(10px, 10px); z-index: 2; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; color: var(--muted); font-size: 12px; margin-top: 8px; align-items: center; }
.swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; }
.empty { color: var(--muted); padding: 24px; text-align: center; }
.mono { font-family: var(--mono); font-size: 12px; }
@media (max-width: 640px) { .controls { margin-left: 0; } }
