:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --line: #e2e0d9;
  --text: #0b0b0b;
  --text-2: #52514e;
  --brand: #f2b632;
  --brand-ink: #1a1a19;
  --s-s: #2a78d6;
  --s-m: #eb6834;
  --s-l: #1baf7a;
  --s-xl: #eda100;
  --seq-lo: #dbe9fb;
  --seq-hi: #104281;
  --critical: #d03b3b;
  --warning-bg: #fdecc4;
  --ok-bg: #dcf1dc;
  --error-bg: #f9dede;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #111110;
    --surface: #1a1a19;
    --line: #33322f;
    --text: #f0efec;
    --text-2: #c3c2b7;
    --s-s: #3987e5;
    --s-m: #d95926;
    --s-l: #199e70;
    --s-xl: #c98500;
    --seq-lo: #1b2a40;
    --seq-hi: #86b6ef;
    --critical: #e66767;
    --warning-bg: #4a3a10;
    --ok-bg: #173a17;
    --error-bg: #4a1f1f;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; margin: 0 0 .25rem; }
h3 { font-size: .95rem; margin: 1.25rem 0 .5rem; }
p { margin: 0 0 .5rem; }
.muted { color: var(--text-2); }
.small { font-size: .85rem; }

.top {
  display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap;
  padding: .75rem 1.25rem;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 700; text-decoration: none; }
.hex {
  width: 1.1rem; height: 1.25rem; background: var(--brand);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.top nav { display: flex; gap: 1rem; flex: 1; }
.top nav a { text-decoration: none; color: var(--text-2); }
.top nav a:hover { color: var(--text); }
.who { display: flex; align-items: center; gap: .75rem; color: var(--text-2); }

main { max-width: 1180px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 1.1rem 1.25rem; margin-bottom: 1rem;
}
.card.empty { text-align: center; padding: 2.5rem 1rem; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; margin-top: 1rem; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.5fr); gap: 1rem; }
@media (max-width: 800px) { .cols { grid-template-columns: minmax(0, 1fr); } }

.station { display: block; text-decoration: none; margin: 0; transition: border-color .15s; }
.station:hover { border-color: var(--text-2); }
.card-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; flex: 1; }
.hero { margin: .75rem 0 .5rem; color: var(--text-2); }
.hero strong { font-size: 2.2rem; line-height: 1; color: var(--text); margin-right: .25rem; }

.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: .4rem 0 .25rem; }
.meter span { display: block; height: 100%; border-radius: 4px; background: var(--s-s); }

.sizes { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin: .75rem 0; }
.sizes div { border: 1px solid var(--line); border-radius: 8px; padding: .35rem .5rem; text-align: center; }
.sizes dt { font-size: .75rem; color: var(--text-2); }
.sizes dd { margin: 0; font-size: 1.15rem; font-weight: 600; }

.badge {
  font-size: .75rem; font-weight: 500; padding: .1rem .5rem; border-radius: 999px;
  border: 1px solid var(--line); color: var(--text-2); vertical-align: middle;
}
.badge.warn { background: var(--warning-bg); border-color: transparent; color: var(--text); }

.page-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.segmented { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.segmented a { padding: .4rem .9rem; text-decoration: none; color: var(--text-2); }
.segmented a + a { border-left: 1px solid var(--line); }
.segmented a[aria-current] { background: var(--text); color: var(--surface); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: .8rem 1rem;
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .5rem;
}
.card .tile { background: none; }
.tile .label { flex-basis: 100%; font-size: .8rem; color: var(--text-2); }
.tile strong { font-size: 1.8rem; line-height: 1.2; }
.tile .meter { flex-basis: 100%; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .4rem; }
.dot.s-s { background: var(--s-s); }
.dot.s-m { background: var(--s-m); }
.dot.s-l { background: var(--s-l); }
.dot.s-xl { background: var(--s-xl); }
.delta { font-size: .8rem; color: var(--text-2); white-space: nowrap; }

.chart { position: relative; height: 340px; margin-top: .75rem; }
.chart.low { height: 200px; }

.facts { margin: .5rem 0 0; }
.facts div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-bottom: 1px solid var(--line); }
.facts div:last-child { border: 0; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; font-weight: 500; text-align: right; }

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; font-weight: 500; color: var(--text-2); }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.actions { text-align: right; white-space: nowrap; }
.actions form { display: inline; }

.heat { border-collapse: separate; border-spacing: 2px; margin-top: .5rem; }
.heat th, .heat td { padding: 0; border: 0; }
.heat thead th { font-size: .7rem; text-align: left; height: 1.2rem; }
.heat tbody th { font-size: .75rem; padding-right: .4rem; width: 1.8rem; }
.heat td {
  height: 22px; min-width: 14px; border-radius: 3px;
  background: color-mix(in oklab, var(--seq-hi) calc(var(--v) * 1%), var(--seq-lo));
}
.heat td.none { background: none; outline: 1px dashed var(--line); outline-offset: -1px; }
.heat td:hover { outline: 2px solid var(--text); }
.heat-legend { display: flex; align-items: center; gap: .5rem; margin: .5rem 0 0; }
.heat-legend i { width: 120px; height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--seq-lo), var(--seq-hi)); }

label { display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; color: var(--text-2); }
input, select, button {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 7px; padding: .45rem .6rem;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--s-s); outline-offset: 1px; }
button { cursor: pointer; background: var(--brand); border-color: transparent; color: var(--brand-ink); font-weight: 600; }
button.ghost { background: none; border-color: var(--line); color: var(--text); font-weight: 400; padding: .3rem .6rem; }
button.ghost:hover { border-color: var(--text-2); }
button.danger { color: var(--critical); }
form.inline { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem; margin-top: 1rem; }
form.inline p { flex-basis: 100%; margin: 0; }
form.row { display: flex; flex-wrap: wrap; gap: .5rem; }
.login { max-width: 340px; margin: 12vh auto 0; display: flex; flex-direction: column; gap: .9rem; }

.flash { padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; }
.flash.ok { background: var(--ok-bg); }
.flash.error { background: var(--error-bg); }
