:root {
  --bg: #fafafa; --card: #ffffff; --text: #18181b; --muted: #71717a; --line: #e4e4e7;
  --accent: #2563eb; --accent2: #0d9488; --warn: #dc2626; --soft: #f4f4f5;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #09090b; --card: #18181b; --text: #fafafa; --muted: #a1a1aa; --line: #27272a;
    --accent: #60a5fa; --accent2: #2dd4bf; --warn: #f87171; --soft: #27272a;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", sans-serif;
}
[hidden] { display: none !important; }
.bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 12px 24px; border-bottom: 1px solid var(--line); background: var(--card);
}
.brand { font-weight: 600; font-size: 16px; letter-spacing: -0.01em; }
.controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.controls label { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.who { color: var(--muted); }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 16px; }
.narrow { max-width: 420px; margin: 48px auto; }
h1 { font-size: 18px; margin: 0 0 4px; }
h2 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.muted { color: var(--muted); }
.note { margin: 0 0 12px; font-size: 13px; }
.error { color: var(--warn); margin: 8px 0; min-height: 0; }
.error:empty { display: none; }
form label { display: block; margin: 12px 0; color: var(--muted); }
form label span { display: block; margin-bottom: 4px; }
input, select, button {
  font: inherit; color: var(--text); background: var(--card);
  border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; height: 36px;
}
form input { width: 100%; }
button { cursor: pointer; background: var(--text); color: var(--bg); border-color: var(--text); font-weight: 500; }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 12px 16px; }
.tile .label { color: var(--muted); font-size: 13px; }
.tile .value { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.tile .unit { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.grid .card { margin-bottom: 0; }
.grid { margin-bottom: 16px; }
.chart { height: 200px; position: relative; }
.chart svg { width: 100%; height: 100%; display: block; }
.chart .empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 12px; color: var(--muted); margin-top: 6px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 6px; }
.row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.row h2 { margin: 0; }
.switch { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.switch input { height: auto; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.sql { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; word-break: break-word; max-width: 560px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: var(--soft); font-size: 12px; }
.badge.warn { color: var(--warn); }
