:root {
  --bg: #f2f2ef; --card: #fff; --ink: #1d1f1c; --muted: #6c706a; --line: #e3e4df;
  --accent: #2f5d40; --accent-soft: #a9c4b0; --accent-strong: #1d3a28; --target: #d99a2b; --tab: #e6e7e2;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121412; --card: #1c1f1c; --ink: #eceeea; --muted: #9aa097; --line: #2c302c;
    --accent: #6fae84; --accent-soft: #3f6149; --accent-strong: #b5dcc0; --target: #e0ac4a; --tab: #252925;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0 auto; max-width: 640px; padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  background: var(--bg); color: var(--ink);
  font: 15px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
header { display: flex; align-items: center; justify-content: space-between; margin: 8px 0 14px; }
h1 { font-size: 28px; margin: 0; }
h2 { font-size: 15px; margin: 0; font-weight: 600; }
.pill { display: inline-flex; gap: 6px; align-items: center; background: var(--card); border-radius: 999px; padding: 4px 10px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.pill.stale i { background: var(--target); }
.tabs { display: flex; background: var(--tab); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.tabs button { flex: 1; border: 0; background: none; padding: 8px; border-radius: 9px; font: inherit; color: var(--muted); cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px #0001; }
.card { background: var(--card); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
.row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.big { font-size: 34px; font-weight: 600; margin: 10px 0 2px; font-variant-numeric: tabular-nums; }
.big small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 8px; }
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { display: flex; flex-direction: column; gap: 2px; margin: 0; }
.tile b { font-size: 22px; font-variant-numeric: tabular-nums; }
.tile span { font-size: 12px; color: var(--muted); }
.line { margin: 8px 2px 14px; font-size: 13px; }
.chart { margin-top: 10px; }
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--muted); font-size: 10px; }
.grid { stroke: var(--line); }
.bar { fill: var(--accent); }
.bar.partial { fill: var(--accent-soft); }
.series { fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linejoin: round; }
.target { fill: none; stroke: var(--target); stroke-width: 1.4; stroke-dasharray: 4 3; }
.stack { display: flex; height: 14px; border-radius: 4px; overflow: hidden; margin: 12px 0 10px; background: var(--line); gap: 2px; }
.stack div { height: 100%; }
.legend { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; }
table { width: 100%; border-collapse: collapse; margin-top: 8px; font-variant-numeric: tabular-nums; font-size: 14px; }
th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; }
th, td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.alarm { color: #b3261e; font-weight: 600; }
.error { color: #b3261e; text-align: center; }
footer { text-align: center; margin-top: 16px; }
a { color: var(--accent); }
a.pill { text-decoration: none; }
code, pre { font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; }
.url code { font-size: 15px; word-break: break-all; }
pre { background: var(--tab); border-radius: 8px; padding: 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
