:root {
  --bg: #f7f7f5;
  --panel: #ffffff;
  --text: #1d1d1b;
  --muted: #66665f;
  --line: #deded8;
  --accent: #2f5fd0;
  --x: #8a8a82;
  --y: #2f5fd0;
  --warn-bg: #fff6e0;
  --warn-line: #e6c36a;
  --error: #b42318;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --panel: #1f1f1d;
    --text: #ecece6;
    --muted: #a3a39b;
    --line: #34342f;
    --accent: #7ea2ff;
    --x: #9a9a92;
    --y: #7ea2ff;
    --warn-bg: #2d2613;
    --warn-line: #7a6326;
    --error: #ff8a7a;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.top { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { font-weight: 600; color: inherit; text-decoration: none; }
.who { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 0; color: var(--muted); overflow-wrap: anywhere; }
main { max-width: 1040px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 0.95rem; margin: 0 0 4px; font-weight: 600; }
.head { display: flex; gap: 12px; align-items: center; margin: 8px 0 16px; flex-wrap: wrap; }
.badge { font-size: 0.8rem; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--warn-line); background: var(--warn-bg); }
.range { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
input, select, button { font: inherit; padding: 6px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); }
button { cursor: pointer; background: var(--accent); border-color: var(--accent); color: #fff; }
.who button { background: transparent; color: var(--text); border-color: var(--line); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile, .trend, .method, .login, .notice { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; }
.tile p { margin: 0; color: var(--muted); }
.tile .big { font-size: 1.6rem; color: var(--text); font-variant-numeric: tabular-nums; }
.trend, .method { margin-bottom: 16px; }
/* Below about 560px the chart keeps a readable size and scrolls inside its
   box; the page itself never scrolls sideways. */
.chart-wrap { overflow-x: auto; }
.chart { width: 100%; min-width: 560px; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line-x { fill: none; stroke: var(--x); stroke-width: 2; stroke-dasharray: 5 4; }
.chart .line-y { fill: none; stroke: var(--y); stroke-width: 2; }
.chart .dot-x { fill: var(--x); }
.chart .dot-y { fill: var(--y); }
.legend { color: var(--muted); font-size: 0.85rem; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.key { display: inline-block; width: 18px; height: 0; border-top: 2px solid var(--y); }
.key-x { border-top: 2px dashed var(--x); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 4px 8px; border-bottom: 1px solid var(--line); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 560px) { dl { grid-template-columns: 1fr; } dd { margin-bottom: 6px; } }
.notice { background: var(--warn-bg); border-color: var(--warn-line); margin-bottom: 16px; }
.notice p, .notice ul { margin: 0; }
.muted { color: var(--muted); }
.error { color: var(--error); }
.login { max-width: 360px; margin: 48px auto; display: flex; flex-direction: column; gap: 12px; }
.badge-demo { border-color: var(--accent); }
.ok { color: var(--text); background: var(--warn-bg); border: 1px solid var(--warn-line); border-radius: 6px; padding: 8px 12px; }
form.inline { display: inline; margin: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
button.danger { background: transparent; color: var(--error); border-color: var(--error); }
.menu { display: flex; gap: 4px; margin-right: auto; margin-left: 16px; }
.menu a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.menu a:hover { color: var(--text); background: var(--bg); }
.menu a[aria-current="page"] { color: var(--text); background: var(--bg); box-shadow: inset 0 -2px 0 var(--accent); }
.badge-live { border-color: var(--line); background: transparent; color: var(--muted); }
