/* Layout: one column of summary → trend → tables, two-up where wide. */
:root {
  --bg: #f6f7f4; --panel: #ffffff; --fg: #1b1f1d; --muted: #5e6763; --line: #e1e4df;
  --accent: #1f6f55; --accent-soft: rgba(31,111,85,.10); --prior: #9aa39f;
  --good: #1a7f4b; --bad: #b3362b; --hover: #eef1ec;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a; --panel: #1c2024; --fg: #e8ebe8; --muted: #9aa39f; --line: #2c3236;
    --accent: #5cc79c; --accent-soft: rgba(92,199,156,.12); --prior: #6b7470;
    --good: #5cc79c; --bad: #f07b6e; --hover: #23292d; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--fg); font: 15px/1.5 var(--sans); -webkit-text-size-adjust: 100%; }
a { color: var(--accent); }
.wrap {
  max-width: 1180px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px;
  padding-block: max(20px, env(safe-area-inset-top)) max(40px, env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right));
}
h1 { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.15; margin: 0 0 6px; text-wrap: balance; }
h2 { font-size: 17px; font-weight: 600; margin: 0; }
.top { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.top > div { min-width: 0; flex: 1 1 320px; }
.lede { margin: 0; color: var(--muted); max-width: 70ch; }
.lede b { color: var(--fg); font-weight: 600; }
.top-actions { display: flex; gap: 8px; }
.ghost, button, .button {
  font: inherit; font-size: 14px; border-radius: 8px; padding: 8px 14px; cursor: pointer; text-decoration: none;
  display: inline-block; border: 1px solid var(--line); background: var(--panel); color: var(--fg);
}
button[type=submit], .button { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.ghost:hover { background: var(--hover); }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible, tr:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.controls { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field span { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
select, input[type=password] {
  font: inherit; font-size: 16px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--fg); max-width: 100%;
}
.window { font-size: 13px; color: var(--muted); padding-bottom: 9px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 760px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 16px; min-width: 0; }
.tile h3 { margin: 0 0 6px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.big { font-family: var(--serif); font-size: 30px; line-height: 1.1; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.chg { font-size: 13px; margin-top: 4px; min-height: 1.3em; font-variant-numeric: tabular-nums; color: var(--muted); }
.good { color: var(--good) !important; } .bad { color: var(--bad) !important; }
.block { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.note { margin: -4px 0 0; font-size: 13px; color: var(--muted); }
.legend { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.sw { display: inline-block; width: 16px; height: 0; vertical-align: middle; margin-right: 6px; border-top: 2px solid var(--accent); }
.sw.prior { border-top: 2px dashed var(--prior); }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 20px; }
figure { margin: 0; min-width: 0; }
figcaption { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.chart { position: relative; min-height: 190px; }
.chart svg { display: block; width: 100%; height: 190px; overflow: visible; }
.chart text { fill: var(--muted); font-size: 11px; font-family: var(--sans); }
.chart .grid { stroke: var(--line); }
.tip {
  position: absolute; top: -6px; pointer-events: none; background: var(--panel); border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(0,0,0,.12); border-radius: 8px; padding: 6px 9px; font-size: 12px;
  white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tip div + div { color: var(--muted); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 28px; }
.scroll { overflow-x: auto; min-width: 0; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl .n { text-align: right; white-space: nowrap; }
.tbl .txt { overflow-wrap: anywhere; min-width: 140px; }
.tbl .site { font-size: 12px; color: var(--muted); white-space: nowrap; }
.props tbody tr { cursor: pointer; }
.props tbody tr:hover td { background: var(--hover); }
.props tr.on td { background: var(--accent-soft); font-weight: 600; }
.bar { display: inline-block; height: 6px; border-radius: 3px; background: var(--accent); vertical-align: middle; margin-left: 6px; opacity: .75; }
.empty { color: var(--muted); font-size: 13px; }
.alert { background: var(--accent-soft); border-radius: 8px; padding: 10px 12px; margin: 0; font-size: 14px; }
.defs { font-size: 13px; color: var(--muted); }
.defs summary { cursor: pointer; }
.defs p { max-width: 75ch; }
.loading .big, .loading .chg { opacity: .45; }
.gate { min-height: 100vh; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-left)); }
.gate-card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px; width: min(100%, 400px); display: flex; flex-direction: column; gap: 12px; }
.gate-card h1 { font-size: 26px; }
.gate-card label { font-size: 13px; font-weight: 600; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 13px; margin: 0; }
@media (prefers-reduced-motion: no-preference) { .tile, .chart svg { transition: opacity .2s ease; } }
