:root {
  color-scheme: light;
  --bg: #f4f4f2;
  --surface: #fcfcfb;
  --surface-2: #f0efec;
  --line: #e2e1dc;
  --line-strong: #c9c8c1;
  --text: #0b0b0b;
  --text-2: #52514e;
  --muted: #7a7973;
  --accent: #2a78d6;
  --accent-ink: #1c5cab;
  --accent-soft: #cde2fb;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --good: #0a7d32;
  --warn: #a86a00;
  --bad: #c62f2f;
  --bad-soft: #fbe3e3;
  --warn-soft: #fbefd6;
  --good-soft: #dcf2e3;
  --radius: 10px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121211;
    --surface: #1a1a19;
    --surface-2: #232321;
    --line: #2f2f2c;
    --line-strong: #44443f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --muted: #8f8e86;
    --accent: #3987e5;
    --accent-ink: #86b6ef;
    --accent-soft: #184f95;
    --series-1: #3987e5;
    --series-2: #d95926;
    --good: #3fbf6a;
    --warn: #e0a43a;
    --bad: #e66767;
    --bad-soft: #3a1f1f;
    --warn-soft: #3a2e17;
    --good-soft: #17301f;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 4px; font-weight: 650; }
h2 { font-size: 16px; margin: 0 0 12px; font-weight: 620; }
h3 { font-size: 14px; margin: 0 0 8px; font-weight: 600; color: var(--text-2); }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--surface-2); padding: 10px 12px; border-radius: 8px; overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-all; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
[hidden] { display: none !important; }

.top { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 52px;
  background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; color: var(--text); font-size: 15px; }
.brand:hover { text-decoration: none; }
#nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; }
#nav a { padding: 6px 10px; border-radius: 7px; color: var(--text-2); white-space: nowrap; }
#nav a.on, #nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.who { display: flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; white-space: nowrap; }

main { max-width: 1320px; margin: 0 auto; padding: 22px 20px 60px; }
.center { min-height: 60vh; display: grid; place-items: center; text-align: center; }
.signin { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 36px 40px; max-width: 420px; }
.signin p { color: var(--text-2); }

.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head .sub { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card + .card, .grid + .card, .card + .grid, .grid + .grid { margin-top: 14px; }
.grid > .card { margin-top: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > h2 { padding: 14px 16px 0; }

.tile .label { color: var(--text-2); font-size: 13px; }
.tile .value { font-size: 30px; font-weight: 620; margin: 2px 0 2px; letter-spacing: -0.01em; }
.tile .note { color: var(--muted); font-size: 12px; }
.hero .value { font-size: 48px; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }

.meter { margin: 10px 0 2px; }
.meter .top-line { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.meter .top-line span:last-child { color: var(--text-2); font-variant-numeric: tabular-nums; }
.meter .track { height: 8px; border-radius: 4px; background: var(--accent-soft); overflow: hidden; }
.meter .fill { height: 100%; border-radius: 4px; background: var(--accent); }
.meter.warn .track { background: var(--warn-soft); } .meter.warn .fill { background: var(--warn); }
.meter.bad .track { background: var(--bad-soft); } .meter.bad .fill { background: var(--bad); }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--text-2); font-weight: 560; background: var(--surface-2); position: sticky; top: 0; white-space: nowrap; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.click { cursor: pointer; }
.scroll { overflow: auto; max-height: 70vh; }
.cell { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.null { color: var(--muted); font-style: italic; }
.inbar { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.inbar i { display: block; height: 6px; border-radius: 3px; background: var(--accent); min-width: 2px; }

.chip { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--text-2); white-space: nowrap; margin: 1px 2px 1px 0; }
.chip.good { background: var(--good-soft); color: var(--good); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); border-color: transparent; }

button, .btn { font: inherit; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); padding: 7px 12px; border-radius: 8px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
button:hover { background: var(--surface-2); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.primary:hover { filter: brightness(1.07); background: var(--accent); }
button.danger { color: var(--bad); border-color: var(--bad); }
button.danger:hover { background: var(--bad-soft); }
button.ghost { border-color: transparent; background: transparent; color: var(--text-2); }
button.small { padding: 4px 9px; font-size: 12.5px; }
button:disabled { opacity: .55; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 7px 10px; min-width: 0; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea { font-family: var(--mono); font-size: 12.5px; width: 100%; min-height: 120px; resize: vertical; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--text-2); }
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; margin-right: 12px; }
.form { display: grid; gap: 12px; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs a:hover { text-decoration: none; color: var(--text); }

.split { display: grid; grid-template-columns: 240px 1fr; gap: 14px; align-items: start; }
@media (max-width: 820px) { .split { grid-template-columns: 1fr; } .g2 { grid-template-columns: 1fr; } }
.side { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.side a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 10px; border-radius: 7px; color: var(--text); }
.side a span { color: var(--muted); font-size: 12px; }
.side a.on, .side a:hover { background: var(--surface-2); text-decoration: none; }
.side .title { padding: 6px 10px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

dialog { border: 1px solid var(--line); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); width: min(720px, 94vw); max-height: 90vh; }
dialog::backdrop { background: rgb(0 0 0 / .4); }
dialog form { padding: 20px; display: grid; gap: 14px; }
dialog .actions { display: flex; justify-content: flex-end; gap: 8px; }
.secret { padding: 12px; border: 1px dashed var(--warn); background: var(--warn-soft); border-radius: 8px; word-break: break-all; font-family: var(--mono); font-size: 13px; }

#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--surface); padding: 9px 16px; border-radius: 9px;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; z-index: 50; }
#toast.show { opacity: 1; }
#toast.err { background: var(--bad); color: #fff; }

.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:hover { fill: var(--surface-2); }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-2); margin-bottom: 8px; flex-wrap: wrap; }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; background: var(--c); }
.tip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px;
  font-size: 12.5px; box-shadow: 0 4px 16px rgb(0 0 0 / .14); min-width: 150px; }
.tip b { display: block; margin-bottom: 4px; }
.tip div { display: flex; justify-content: space-between; gap: 14px; font-variant-numeric: tabular-nums; }
.tip i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; background: var(--c); }
details summary { cursor: pointer; color: var(--text-2); font-size: 13px; margin-top: 10px; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 8px; align-items: center; padding: 10px 12px; border-top: 1px solid var(--line); }
.doc-item { display: block; padding: 10px 14px; border-bottom: 1px solid var(--line); color: var(--text); }
.doc-item:hover { background: var(--surface-2); text-decoration: none; }
.doc-item .preview { color: var(--muted); font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.err-box { color: var(--bad); background: var(--bad-soft); padding: 10px 12px; border-radius: 8px; white-space: pre-wrap; font-size: 13px; }
