:root {
  --bg: #f5f7f8; --panel: #ffffff; --ink: #0f172a; --muted: #5b6676; --line: #e2e8f0;
  --accent: #0f766e; --accent-ink: #ffffff; --down: #0f766e; --up: #b45309; --ok: #15803d; --bad: #b91c1c;
  --warn: #a16207; --radius: 12px; --shadow: 0 1px 2px rgb(15 23 42 / 6%), 0 4px 16px rgb(15 23 42 / 4%);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1114; --panel: #121a1f; --ink: #e6edf0; --muted: #8b99a6; --line: #22303a;
    --accent: #2dd4bf; --accent-ink: #042f2e; --down: #2dd4bf; --up: #fbbf24; --ok: #4ade80; --bad: #f87171;
    --warn: #facc15; --shadow: none;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 ui-sans-serif, -apple-system, "Segoe UI", sans-serif; }
.bar { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: .01em; }
nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
nav button { background: none; color: var(--muted); border: 0; padding: 6px 12px; border-radius: 8px; font-weight: 550; }
nav button.active { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--ink); }
.who { display: flex; align-items: center; gap: 12px; color: var(--muted); }
main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; display: grid; gap: 16px; }
section { display: grid; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; overflow-x: auto; }
.card.narrow { max-width: 420px; width: 100%; margin: 48px auto 0; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
h1 { font-size: 22px; margin: 0 0 16px; } h2 { font-size: 16px; margin: 0 0 12px; }
.muted { color: var(--muted); margin-top: 0; }
.mono, td.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; word-break: break-all; }
.grid.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { display: grid; gap: 2px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 26px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 13px; min-height: 1.5em; }
.good { color: var(--ok); } .bad { color: var(--bad); } .warn { color: var(--warn); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 12px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button { font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent; border-radius: 8px; padding: 8px 14px; background: var(--accent); color: var(--accent-ink); }
button.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
button.danger { color: var(--bad); }
button.small { padding: 4px 10px; font-size: 13px; }
button:disabled { opacity: .5; cursor: progress; }
form.inline { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; align-items: end; }
form.inline label { margin: 0; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 550; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
td select { width: auto; padding: 4px 8px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { color: var(--muted); text-align: center; padding: 20px; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); }
#chart { width: 100%; height: 160px; display: block; }
#chart .grid-line { stroke: var(--line); stroke-width: 1; }
#chart .down { fill: none; stroke: var(--down); stroke-width: 2; vector-effect: non-scaling-stroke; }
#chart .up { fill: none; stroke: var(--up); stroke-width: 2; vector-effect: non-scaling-stroke; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.legend { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 3px; border-radius: 2px; margin-left: 8px; }
.legend i.down { background: var(--down); } .legend i.up { background: var(--up); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.switch { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-size: 14px; margin: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch span { width: 40px; height: 22px; border-radius: 999px; background: var(--line); position: relative; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--panel); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
#flash { padding: 10px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
#flash.error { border-color: var(--bad); color: var(--bad); }
.qr { display: block; margin: 8px auto 12px; background: #fff; border-radius: 8px; image-rendering: pixelated; }
details { margin-bottom: 12px; color: var(--muted); font-size: 13px; }
summary { cursor: pointer; }
button.wide { width: 100%; }
.divider { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; margin: 16px 0; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); max-width: 400px; width: calc(100% - 32px); }
dialog::backdrop { background: rgb(0 0 0 / 45%); }
@media (max-width: 640px) { .bar { padding: 10px 16px; gap: 10px; } main { padding: 16px 16px 48px; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
