:root {
  --bg: var(--tg-theme-bg-color, #ffffff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f2f5);
  --fg: var(--tg-theme-text-color, #141413);
  --muted: var(--tg-theme-hint-color, #8a8a8e);
  --accent: var(--tg-theme-button-color, #d97757);
  --link: var(--tg-theme-link-color, #2a7ae2);
  --up: #2f9e6e; --down: #d4573c; --warn: #c99a00;
  --line: color-mix(in srgb, var(--muted) 25%, transparent);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.35 -apple-system, "Inter", "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
main { padding: 12px 12px calc(76px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.pad { padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.card { background: var(--bg2); border-radius: 14px; padding: 12px 14px; margin: 0 0 10px; }
.card h2 { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 6px; text-transform: none; letter-spacing: .01em; }
.row { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; padding: 4px 0; }
.row + .row { border-top: 1px solid var(--line); }
.row .l { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.row .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.big { font-size: 34px; font-weight: 650; line-height: 1.1; font-variant-numeric: tabular-nums; }
.mid { font-size: 20px; font-weight: 600; }
.up { color: var(--up); } .down { color: var(--down); } .warn { color: var(--warn); }
.status { display: flex; gap: 10px; align-items: center; }
.dot { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.dot.green { background: var(--up); } .dot.yellow { background: var(--warn); } .dot.red { background: var(--down); }
.bar { height: 8px; background: var(--line); border-radius: 4px; position: relative; overflow: hidden; margin: 6px 0 2px; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 4px; }
.bar > b { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--down); }
.seg { display: flex; gap: 6px; margin: 0 0 10px; }
.seg button { flex: 1; border: 0; border-radius: 10px; padding: 8px; background: var(--bg2); color: var(--fg); font: inherit; }
.seg button.on { background: var(--accent); color: var(--tg-theme-button-text-color, #fff); }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: var(--bg2);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; border: 0; background: none; color: var(--muted); font: 600 12px/1 inherit; padding: 14px 2px; }
.tabs button.on { color: var(--accent); }
.stale { position: sticky; top: 0; z-index: 2; background: #f6d860; color: #3a3000; padding: 8px 12px; font-size: 13px; text-align: center; }
.err { color: var(--down); font-size: 13px; }
svg.curve { width: 100%; height: 120px; display: block; margin-top: 6px; }
svg.curve path.l { fill: none; stroke-width: 2; }
svg.curve line.z { stroke: var(--line); stroke-width: 1; }
.tag { display: inline-block; font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--line); margin-left: 4px; }
details summary { cursor: pointer; color: var(--link); font-size: 13px; padding: 4px 0; }
