:root {
  --bg: #f5f5f7; --surface: #ffffff; --surface-2: #fafafa; --text: #1d1d1f; --text-2: #6e6e73; --text-3: #8e8e93;
  --line: rgba(0,0,0,.1); --line-strong: rgba(0,0,0,.18); --accent: #0a7d5a; --accent-soft: rgba(10,125,90,.1);
  --danger: #c0392b; --warn: #a86400; --radius: 12px; --radius-s: 8px;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 64px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --series-1: #0a7d5a; --series-2: #8e8e93;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --surface: #1c1c1e; --surface-2: #2c2c2e; --text: #f5f5f7; --text-2: #a1a1a6; --text-3: #8e8e93;
    --line: rgba(255,255,255,.12); --line-strong: rgba(255,255,255,.22); --accent: #30c48d; --accent-soft: rgba(48,196,141,.14);
    --danger: #ff6b5e; --warn: #f0a440; --series-1: #30c48d; --series-2: #8e8e93; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
.t-hero { font-size: clamp(36px, 6vw, 64px); line-height: 1.05; font-weight: 700; letter-spacing: -0.03em; }
.t-1 { font-size: 28px; line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
.t-2 { font-size: 20px; line-height: 1.25; font-weight: 600; }
.t-3 { font-size: 17px; font-weight: 600; }
.t-num { font-variant-numeric: tabular-nums; }
.muted { color: var(--text-2); } .faint { color: var(--text-3); }
.small { font-size: 13px; } .tiny { font-size: 11px; letter-spacing: .02em; }
.label { font-size: 12px; font-weight: 500; color: var(--text-2); text-transform: uppercase; letter-spacing: .06em; }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: var(--s3); } .between { justify-content: space-between; } .wrap { flex-wrap: wrap; }
.stack > * + * { margin-top: var(--s4); } .stack-s > * + * { margin-top: var(--s2); }
.grow { flex: 1; min-width: 0; }
.hidden { display: none !important; }

.card { background: var(--surface); border-radius: var(--radius); border: 1px solid var(--line); }
.pad { padding: var(--s5); } .pad-s { padding: var(--s4); }
.hair { border: 0; border-top: 1px solid var(--line); margin: 0; }

.btn { appearance: none; font: inherit; font-weight: 500; min-height: 44px; padding: 0 var(--s5); border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn-primary { background: var(--text); color: var(--bg); border-color: var(--text); }
.btn-primary:hover { background: var(--text); opacity: .86; }
.btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent); opacity: .9; }
.btn-quiet { border-color: transparent; background: transparent; color: var(--text-2); padding: 0 var(--s3); }
.btn-quiet:hover { color: var(--text); background: var(--surface-2); }
.btn-block { width: 100%; } .btn-s { min-height: 32px; padding: 0 var(--s3); font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.field { display: block; } .field > span { display: block; font-size: 13px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
input, select, textarea { font: inherit; color: var(--text); width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--surface); }
textarea { min-height: 88px; resize: vertical; }
input[type=color] { padding: 4px; width: 64px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s4); }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 2px; }
.seg button { appearance: none; border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 500; color: var(--text-2); padding: 0 var(--s3); min-height: 32px; border-radius: 8px; cursor: pointer; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.badge { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 500; background: var(--surface-2); color: var(--text-2); border: 1px solid var(--line); }
.badge.ok { color: var(--accent); background: var(--accent-soft); border-color: transparent; }
.badge.warn { color: var(--warn); } .badge.bad { color: var(--danger); }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; font-size: 12px; color: var(--text-2); padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-wrap { overflow-x: auto; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 12px; font-size: 14px; z-index: 100; max-width: calc(100% - 32px); }
.toast.err { background: var(--danger); color: #fff; }
.empty { padding: var(--s7) var(--s5); text-align: center; color: var(--text-2); }

/* charts */
.chart { width: 100%; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 11px; fill: var(--text-3); font-variant-numeric: tabular-nums; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: var(--line-strong); }
.legend { display: flex; gap: var(--s4); font-size: 12px; color: var(--text-2); }
.legend i { display: inline-block; width: 10px; height: 2px; vertical-align: middle; margin-right: 6px; border-radius: 1px; }
.tip { position: fixed; pointer-events: none; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; font-size: 12px; z-index: 50; box-shadow: 0 4px 12px rgba(0,0,0,.08); }
.hbar { display: grid; grid-template-columns: minmax(80px, 140px) 1fr auto; gap: var(--s3); align-items: center; font-size: 13px; }
.hbar + .hbar { margin-top: var(--s3); }
.hbar .track { height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--series-1); border-radius: 4px; }
