/* Cumbria Flood Update 2027 — design system
   Themes are token sets on <html data-theme="…">. Components use tokens only.
   Severity colours are fixed across every theme so warnings always look the same. */

:root,
[data-theme="fellside"] {
  --bg: #1F2244;
  --side: #23264A;
  --panel: #2B2F55;
  --panel-2: #3A3F6E;
  --line: #3A3F6E;
  --text: #EEF0FF;
  --muted: #A3A9D6;
  --link: #7FE3EA;
  --accent: #5ADBE0;
  --accent-ink: #0E0057;
  --logo: #0E0057;
  --brand: linear-gradient(135deg, #0E0057 0%, #2A2F9E 55%, #0071CF 100%);
  --hero: linear-gradient(120deg, #4A1430 0%, #2E2B5C 60%, #2B2F55 100%);
  --hero-line: #6A2440;
  --hero-muted: #EAD6E0;
  --gauge-up: #5AA2FF;
  --gauge-norm: #4A4F80;
  --gauge-ink: #0B1B3A;
  --chart-line: #3A8EEA;
  --chart-line-2: #5AA2FF;
  --chart-band: #C3C8F0;
  --chart-surf: #5ADBE0;
  --chart-water: #0071CF;
  --rain-0: #4A4F80; --rain-1: #3A4590; --rain-2: #2F5FC4; --rain-3: #3D92F0; --rain-4: #86C8FF; --rain-5: #D2FAFB; /* rain: none, then light to heavy */
  --rain-ink: #FFFFFF; --rain-ink-dark: #0B1B3A;
  --chart-grid: #3A3F6E;
  --chart-axis: #A3A9D6;
  --map-none: #555B8F;
  --map-label: #D5D8F5;
  --font: 'DM Sans', system-ui, sans-serif;
  --radius: 22px;
  --radius-sm: 14px;
}

[data-theme="tarn"] {
  --bg: #070B18;
  --side: #0B1024;
  --panel: #0F1530;
  --panel-2: #1B2550;
  --line: #222B52;
  --text: #E8ECFF;
  --muted: #A9B2D6;
  --link: #7FE3F5;
  --accent: #3563E9;
  --accent-ink: #FFFFFF;
  --logo: #3563E9;
  --brand: linear-gradient(135deg, #0E0057 0%, #1F3C99 55%, #0E6E8A 100%);
  --hero: linear-gradient(120deg, #34101A 0%, #1A1530 55%, #0F1530 100%);
  --hero-line: #5A1E2A;
  --hero-muted: #E2CDD2;
  --gauge-up: #2DD4EF;
  --gauge-norm: #3B4675;
  --gauge-ink: #06202A;
  --chart-line: #4C7DFF;
  --chart-line-2: #2DD4EF;
  --chart-band: #2DD4EF;
  --chart-surf: #2DD4EF;
  --chart-water: #1F3C99;
  --rain-0: #3B4675; --rain-1: #26357A; --rain-2: #2E52CC; --rain-3: #4C82FF; --rain-4: #5CD3F2; --rain-5: #CFF8FD;
  --rain-ink: #FFFFFF; --rain-ink-dark: #06202A;
  --chart-grid: #222B52;
  --chart-axis: #A9B2D6;
  --map-none: #46507A;
  --map-label: #C9D1F2;
  --font: 'Outfit', system-ui, sans-serif;
  --radius: 24px;
  --radius-sm: 16px;
}

[data-theme="beck"] {
  --bg: #222326;
  --side: #222326;
  --panel: #2E2F34;
  --panel-2: #3A3B41;
  --line: #3A3B41;
  --text: #F1F2F4;
  --muted: #A1A3AB;
  --link: #6EE7B7;
  --accent: #6EE7B7;
  --accent-ink: #10231B;
  --logo: #2F7A5E;
  --brand: linear-gradient(135deg, #2F6B57 0%, #1E4A3C 100%);
  --hero: linear-gradient(120deg, #3E1A1E 0%, #2E2F34 70%);
  --hero-line: #5A2A2E;
  --hero-muted: #E4D2D2;
  --gauge-up: #6EE7B7;
  --gauge-norm: #3F6B5A;
  --gauge-ink: #10231B;
  --chart-line: #6EE7B7;
  --chart-line-2: #6EE7B7;
  --chart-band: #FFFFFF;
  --chart-surf: #6EE7B7;
  --chart-water: #1E4A3C;
  --rain-0: #3F6B5A; --rain-1: #24574A; --rain-2: #2E7D62; --rain-3: #3FAE86; --rain-4: #7DEBC0; --rain-5: #DDFCEF;
  --rain-ink: #FFFFFF; --rain-ink-dark: #10231B;
  --chart-grid: #3A3B41;
  --chart-axis: #A1A3AB;
  --map-none: #55575F;
  --map-label: #D9DADF;
  --font: 'Manrope', system-ui, sans-serif;
  --radius: 22px;
  --radius-sm: 14px;
}

:root {
  /* Brand: sampled from the Cumbria Flood Update logo */
  --brand-navy: #0E0057;
  --brand-cyan: #5ADBE0;
  --brand-green: #00B76F;
  --brand-blue: #0071CF;
  --brand-water: #00A4CD;
  --cg-green: #00A652;
  /* Severity: matches the Environment Agency signs (alert orange, warning red) */
  --sev-severe: #A8000D;
  --sev-warn: #E3000F;
  --sev-alert: #F18700;
  --sev-ended: #5E6669;
  --sev-severe-ink: #FFFFFF;
  --sev-warn-ink: #FFFFFF;
  --sev-alert-ink: #1F1300;
  --sev-ended-ink: #FFFFFF;
  --sev-warn-text: #FF7A82;
  --sev-alert-text: #FFB54D;
  --sev-severe-text: #FF9AA2;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); color: var(--text); font-family: var(--font); -webkit-text-size-adjust: 100%; }
body { margin: 0; font-size: 16px; line-height: 1.5; }
a { color: var(--link); }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: clamp(26px, 3vw, 32px); font-weight: 600; }
h2 { font-size: 18px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 13px; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 50; padding: 10px 16px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.skip:focus { top: 12px; }

/* ---------- app shell ---------- */
.app { min-height: 100vh; display: flex; align-items: stretch; }
.side {
  flex: 0 0 248px; background: var(--side); border-right: 1px solid var(--line);
  padding: 26px 18px; display: flex; flex-direction: column; gap: 24px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.main { flex: 1 1 0; min-width: 0; padding: 28px clamp(16px, 2.6vw, 36px) 40px; display: flex; flex-direction: column; gap: 22px; }
.rail { flex: 0 0 340px; background: var(--side); border-left: 1px solid var(--line); padding: 26px 22px; display: flex; flex-direction: column; gap: 22px; }

.brand { display: flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; padding: 0 8px; }
.brand__mark { width: 38px; height: 38px; border-radius: 11px; background: var(--logo); color: #FFFFFF; display: grid; place-items: center; font-weight: 700; font-size: 15px; flex: 0 0 auto; }
.brand__name { font-size: 18px; font-weight: 600; line-height: 1.15; }
.brand__name small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); }

.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 14px; min-height: 46px; padding: 0 12px; border-radius: 12px; color: var(--muted); text-decoration: none; font-weight: 500; }
.nav a:hover { color: var(--text); background: color-mix(in srgb, var(--panel) 60%, transparent); }
.nav a[aria-current="page"] { background: var(--panel); color: var(--text); font-weight: 600; }
.nav svg { flex: 0 0 auto; }
.nav__count { margin-left: auto; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; background: var(--sev-warn); color: var(--sev-warn-ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; }

.side__box { background: var(--panel); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
/* Bottom padding leaves room for Google's cookie-consent button, which floats about 80 px up from the bottom-left
   corner and is about 75 px tall. If that button is switched off in AdSense, html.no-cmp-button drops the gap. */
.side__foot { margin-top: auto; display: flex; flex-direction: column; gap: 14px; padding-bottom: 170px; }
html.no-cmp-button .side__foot { padding-bottom: 0; }

.seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--panel); }
.seg button, .seg a {
  flex: 1; min-height: 38px; padding: 0 12px; border-radius: 10px; border: 0; background: transparent;
  color: var(--muted); font-size: 14px; font-weight: 500; cursor: pointer; text-decoration: none; display: grid; place-items: center; white-space: nowrap;
}
.seg [aria-pressed="true"], .seg [aria-current="true"] { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.seg--inline { display: inline-flex; background: var(--side); }

/* mobile top bar */
.topbar { display: none; }
.side .side__close { display: none; } /* .side prefix: beats .icon-btn, defined later */
@media (max-width: 1180px) {
  .app { flex-wrap: wrap; }
  .rail { flex: 1 1 100%; border-left: 0; border-top: 1px solid var(--line); }
}
/* Tablet / zoomed-in widths: the rail drops below the page but the sidebar is still pinned on the left,
   so start the rail beside it instead of underneath it. */
@media (min-width: 861px) and (max-width: 1180px) {
  .rail { flex-basis: calc(100% - 248px); margin-left: 248px; }
}
@media (max-width: 860px) {
  .app { display: block; }
  .topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: sticky; top: 0; z-index: 30; padding: 10px 16px; background: var(--side); border-bottom: 1px solid var(--line);
  }
  /* Drawer opens from the right, next to the menu button in the top bar. */
  .side { position: fixed; inset: 0 0 0 auto; width: min(300px, 86vw); height: 100vh; z-index: 40; border-right: 0; border-left: 1px solid var(--line); transform: translateX(105%); transition: transform 0.2s ease; box-shadow: 0 0 0 100vmax transparent; }
  .side.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55); }
  .side .brand { display: none; }
  /* Close button sits exactly where the menu button is in the top bar (10px down, 16px in). */
  .side .side__close { display: grid; flex: 0 0 auto; align-self: flex-end; margin: -16px -2px -8px 0; }
  .main { padding: 20px 16px 32px; }
  .rail { padding: 22px 16px; }
}
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }

.icon-btn { width: 44px; height: 44px; border-radius: 12px; border: 0; background: var(--panel); color: var(--text); display: grid; place-items: center; cursor: pointer; }

/* ---------- page header ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; }
.page-head__title { flex: 1 1 280px; display: flex; flex-direction: column; gap: 4px; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 4px; padding: 0; font-size: 14px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; opacity: 0.6; }
.crumbs a { color: var(--muted); }
.search { flex: 0 1 320px; display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 0 16px; border-radius: 14px; background: var(--panel); }
.search input { flex: 1; min-width: 0; background: transparent; border: 0; font-size: 16px; } /* 16px or more: iPhones zoom into smaller text boxes when tapped */
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; }
.search:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---------- cards & layout ---------- */
.card { background: var(--panel); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 10px 14px; }
.card__head > div:not(.seg) { display: flex; flex-direction: column; gap: 4px; }
.card--flat { background: transparent; padding: 0; }
.row { display: flex; flex-wrap: wrap; gap: 18px; }
.row > .w-2 { flex: 2 1 520px; min-width: 0; }
.row > .w-1 { flex: 1 1 300px; min-width: 0; }
/* A column of cards inside a .row, so a tall card on one side never leaves a gap under a short one on the other. */
.row > .col { display: flex; flex-direction: column; gap: 18px; align-self: flex-start; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* status banner */
.hero { border-radius: var(--radius); padding: 22px 24px; background: var(--hero); border: 1px solid var(--hero-line); display: flex; flex-wrap: wrap; align-items: center; gap: 18px 24px; }
.hero__icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; flex: 0 0 auto; background: var(--sev-warn); color: var(--sev-warn-ink); }
.hero__text { flex: 1 1 420px; display: flex; flex-direction: column; gap: 6px; }
.hero__text h2 { font-size: 23px; }
.hero__text p { color: var(--hero-muted); }
.hero--calm { background: var(--panel); border-color: var(--line); }
.hero--calm .hero__icon { background: var(--panel-2); color: var(--accent); }
.notice { border-radius: var(--radius-sm); padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); font-size: 15px; }
.notice--stale { background: #3A2E12; border-color: #7A5C1A; color: #FFE7B0; }
.notice--stale a { color: #FFE7B0; }

/* brand card (your place) */
.place-card { border-radius: var(--radius); padding: 22px; background: var(--brand); color: #FFFFFF; text-decoration: none; display: flex; flex-direction: column; gap: 12px; }
.place-card a, .place-card { color: #FFFFFF; }
.place-card__name { font-size: 32px; font-weight: 600; line-height: 1.1; }
.place-card__foot { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.3); }

/* KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.kpi { background: var(--panel); border-radius: 20px; padding: 16px; display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
a.kpi:hover { outline: 2px solid var(--line); }
.kpi__icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; flex: 0 0 auto; background: var(--panel-2); color: var(--sev-severe-text); }
.kpi__icon--warn { background: var(--sev-warn); color: var(--sev-warn-ink); }
.kpi__icon--alert { background: var(--sev-alert); color: var(--sev-alert-ink); }
.kpi__icon--gauge { background: var(--gauge-up); color: var(--gauge-ink); }
.kpi__label { font-size: 14px; color: var(--muted); }
.kpi__value { font-size: 30px; font-weight: 600; line-height: 1.15; }
.kpi__value small { font-size: 16px; font-weight: 500; color: var(--muted); }

/* badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 8px; font-size: 12px; font-weight: 700; white-space: nowrap; background: var(--panel-2); color: var(--text); }
.badge--severe { background: var(--sev-severe); color: var(--sev-severe-ink); }
.badge--warning { background: var(--sev-warn); color: var(--sev-warn-ink); }
.badge--alert { background: var(--sev-alert); color: var(--sev-alert-ink); }
.badge--ended { background: var(--sev-ended); color: var(--sev-ended-ink); }
.badge--up { background: var(--gauge-up); color: var(--gauge-ink); }
.dot { width: 12px; height: 12px; border-radius: 4px; flex: 0 0 auto; background: var(--map-none); }
.dot--warning { background: var(--sev-warn); }
.dot--alert { background: var(--sev-alert); }
.dot--severe { background: var(--sev-severe); }
.t-warning { color: var(--sev-warn-text); }
.t-alert { color: var(--sev-alert-text); }
.t-up { color: var(--link); font-weight: 600; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid transparent; background: var(--panel-2); color: var(--text); font-weight: 600; text-decoration: none; cursor: pointer; }
.btn--primary { background: var(--accent); color: var(--accent-ink); }
.btn--warn { background: var(--sev-warn); color: var(--sev-warn-ink); }
.btn--ghost { background: transparent; border-color: var(--line); }
.hero .btn--ghost { border-color: var(--hero-line); }
.btn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
.link-strong { font-size: 14px; font-weight: 600; }

/* lists */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--panel-2); color: var(--text); text-decoration: none; }
.card .item { background: color-mix(in srgb, var(--panel-2) 55%, var(--panel)); }
a.item:hover { outline: 2px solid var(--line); }
.item__main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.item__title { font-weight: 600; }
.item__sub { font-size: 13px; color: var(--muted); }
.item__end { font-size: 13px; color: var(--muted); text-align: right; white-space: nowrap; }
.item--warning { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--sev-warn) 45%, transparent); }
.avatar { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; background: var(--panel-2); color: var(--text); }
.avatar--warning { background: var(--sev-warn); color: var(--sev-warn-ink); }
.avatar--alert { background: var(--sev-alert); color: var(--sev-alert-ink); }
.round { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; background: var(--panel-2); color: var(--sev-alert-text); }
.round--warning { background: var(--sev-warn); color: var(--sev-warn-ink); }
.round--alert { background: var(--sev-alert); color: var(--sev-alert-ink); }
.round--ended { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.updates { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.updates li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; padding: 0 4px; }
.table { width: 100%; border-collapse: separate; border-spacing: 0 6px; font-size: 15px; min-width: 620px; }
.table th { text-align: left; font-size: 13px; font-weight: 500; color: var(--muted); padding: 0 14px; }
.table td { padding: 13px 14px; background: color-mix(in srgb, var(--panel-2) 45%, var(--panel)); }
.table td:first-child { border-radius: 12px 0 0 12px; }
.table td:last-child { border-radius: 0 12px 12px 0; }
.table a { color: var(--text); font-weight: 600; text-decoration: none; }
.table a:hover { text-decoration: underline; }
.num { font-variant-numeric: tabular-nums; }
.meter { width: 120px; height: 8px; border-radius: 8px; background: var(--panel-2); position: relative; overflow: hidden; }
.meter span { position: absolute; inset: 0 auto 0 0; border-radius: 8px; background: var(--gauge-norm); }
.meter span.up { background: var(--gauge-up); }
.meter::after { content: ""; position: absolute; top: -2px; bottom: -2px; left: 66.6%; border-left: 2px solid var(--text); opacity: 0.6; }

/* stats */
.stats { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 28px; }
.stat { display: flex; flex-direction: column; gap: 3px; padding-bottom: 4px; }
.stat__label { font-size: 13px; color: var(--muted); }
.stat__big { font-size: clamp(38px, 5vw, 48px); font-weight: 600; line-height: 1; letter-spacing: -0.02em; padding-bottom: 0; }
.stat__big small { font-size: 22px; color: var(--muted); }

/* EA message */
.message { border-radius: var(--radius-sm); padding: 18px; background: var(--side); border: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.placeholder { border: 1px dashed var(--line); border-radius: 12px; padding: 14px; color: var(--muted); font-size: 15px; }

/* timeline */
.timeline { list-style: none; margin: 0; padding: 0 0 0 4px; display: flex; flex-direction: column; }
.timeline li { position: relative; padding: 0 0 18px 26px; display: flex; flex-direction: column; gap: 2px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 8px; bottom: -6px; width: 2px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: var(--panel-2); border: 2px solid var(--muted); }
.timeline li.is-warning::after { background: var(--sev-warn); border-color: var(--sev-warn); }
.timeline li.is-alert::after { background: var(--sev-alert); border-color: var(--sev-alert); }

/* forms */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field legend { font-size: 14px; font-weight: 600; }
.input { min-height: 46px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--side); color: var(--text); width: 100%; }
.input:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
fieldset { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 14px; border-radius: 12px; background: var(--side); border: 1px solid var(--line); cursor: pointer; }
.choice input { width: 20px; height: 20px; accent-color: var(--accent); flex: 0 0 auto; }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); font-size: 13px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; }
.toggle input { appearance: none; width: 52px; height: 30px; border-radius: 999px; background: var(--panel-2); position: relative; cursor: pointer; flex: 0 0 auto; transition: background 0.15s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: var(--text); transition: transform 0.15s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(22px); background: var(--accent-ink); }

/* data viz containers (drawn by app.js) */
.viz svg { display: block; width: 100%; height: auto; }
.viz--map { max-width: 380px; }
.ch-grid { stroke: var(--chart-grid); stroke-width: 1; }
.ch-vgrid { stroke: var(--chart-grid); stroke-width: 1; stroke-opacity: .45; }
.ch-axis { fill: var(--chart-axis); font-size: 12px; font-family: var(--font); }
.lchart .ch-axis { font-size: 13px; font-variant-numeric: tabular-nums; }
.ch-note { fill: var(--muted); font-size: 13px; font-family: var(--font); }
.ch-band { fill: var(--chart-band); fill-opacity: 0.07; }
.ch-bandline { stroke: var(--chart-band); stroke-opacity: 0.7; stroke-width: 1.5; stroke-dasharray: 6 5; }
.ch-record { stroke: var(--text); stroke-opacity: 0.8; stroke-width: 1.5; stroke-dasharray: 10 6; }
.ch-mine { stroke: var(--accent); stroke-width: 2; stroke-dasharray: 1 5; stroke-linecap: round; }
.ch-line { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.ch-glow { fill: none; stroke: var(--chart-surf); stroke-width: 8; stroke-opacity: .12; stroke-linejoin: round; stroke-linecap: round; }
.ch-stop-1 { stop-color: var(--chart-line); }
.ch-stop-2 { stop-color: var(--chart-line-2); }
.ch-water-1 { stop-color: var(--chart-surf); stop-opacity: .38; }
.ch-water-2 { stop-color: var(--chart-water); stop-opacity: .06; }
.ch-shine-0, .ch-shine-2 { stop-color: var(--text); stop-opacity: 0; }
.ch-shine-1 { stop-color: var(--text); stop-opacity: .13; }
.ch-spark { stroke: var(--chart-line-2); }
.ch-dot { fill: var(--chart-line-2); stroke: var(--panel); stroke-width: 2; }
.ch-dot-halo { fill: var(--chart-line-2); fill-opacity: 0.22; }
.ch-ripple { fill: none; stroke: var(--chart-surf); stroke-width: 2; opacity: 0; transform-box: fill-box; transform-origin: center; }
.ch-cross { stroke: var(--text); stroke-opacity: .4; stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.ch-hover { fill: var(--text); stroke: var(--chart-line-2); stroke-width: 3; pointer-events: none; }
.ch-hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }

/* river level chart (app.js lineChart): water rises in, the line draws, light runs across the water, the newest reading ripples */
.lchart { display: block; overflow: visible; border-radius: 8px; }
.lchart:focus { outline: none; }
.lchart:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
.lchart .ch-water { transform-box: view-box; transition: transform 1.1s cubic-bezier(.2, .8, .2, 1); }
.lchart.is-wait .ch-water { transform: scaleY(0); }
.lchart .ch-line { stroke-dasharray: var(--len); stroke-dashoffset: 0; transition: stroke-dashoffset 1.4s cubic-bezier(.45, 0, .2, 1); }
.lchart.is-wait .ch-line { stroke-dashoffset: var(--len); }
.lchart .ch-glow, .lchart .ch-now { transition: opacity .5s ease 1.1s; }
.lchart.is-wait .ch-glow, .lchart.is-wait .ch-now { opacity: 0; }
.lchart.is-in:not(.no-anim) .ch-ripple { animation: ch-ripple 3.2s ease-out 1.4s infinite; }
.lchart.is-in:not(.no-anim) .ch-shimmer { animation: ch-shimmer 8s ease-in-out 1.6s infinite; }
@keyframes ch-ripple { 0% { opacity: .9; transform: scale(1); } 70%, 100% { opacity: 0; transform: scale(3.4); } }
@keyframes ch-shimmer { 0% { transform: translateX(0); } 45%, 100% { transform: translateX(var(--sweep)); } }
.ch-tags { position: absolute; inset: 0; pointer-events: none; transition: opacity .5s ease .9s; }
.lchart.is-wait ~ .ch-tags { opacity: 0; }
.ch-tag { position: absolute; transform: translateY(-50%); display: inline-flex; align-items: center; gap: 7px; max-width: calc(100% - 90px); padding: 3px 10px 3px 8px; border-radius: 8px; border: 1px solid var(--line); background: color-mix(in srgb, var(--panel) 90%, transparent); color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-tag i { flex: 0 0 auto; width: 16px; border-top: 2px dashed var(--chart-band); }
.ch-tag--mine i { border-top: 3px dotted var(--accent); }
.ch-tag--record i { border-top: 2px dashed var(--text); }
.chart-tip--river { background: var(--brand); border-color: color-mix(in srgb, var(--chart-surf) 35%, transparent); color: var(--text); padding: 8px 12px; text-align: left; line-height: 1.35; }
.chart-tip--river strong { font-size: 16px; font-variant-numeric: tabular-nums; }
.chart-tip__when { color: var(--text); opacity: .85; margin-left: 4px; }
.chart-tip__sub { display: block; font-size: 12px; color: var(--text); opacity: .85; }
.chart-tip.is-below { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) {
  .lchart .ch-water, .lchart .ch-line, .lchart .ch-glow, .lchart .ch-now, .ch-tags { transition: none; }
  .lchart .ch-ripple, .lchart .ch-shimmer { animation: none !important; }
}
.ch-bar { fill: var(--gauge-norm); }
.ch-bar-hi { fill: var(--sev-warn); }
.ch-value { fill: var(--text); font-size: 13px; font-weight: 700; font-family: var(--font); }
.map-grid { stroke: var(--chart-grid); stroke-width: 0.6; stroke-opacity: 0.7; }
.map-town { fill: var(--map-none); }
.map-town--alert { fill: var(--sev-alert); }
.map-town--warning { fill: var(--sev-warn); }
.map-halo--alert { fill: var(--sev-alert); fill-opacity: 0.18; }
.map-halo--warning { fill: var(--sev-warn); fill-opacity: 0.18; }
.map-focus { fill: none; stroke: var(--text); stroke-width: 2; }
.map-gauge { fill: none; stroke: var(--gauge-norm); stroke-width: 1.6; }
.map-gauge--up { fill: var(--gauge-up); stroke: var(--gauge-up); }
.map-label { fill: var(--map-label); stroke: var(--panel); stroke-width: 3; paint-order: stroke; font-size: 13px; font-weight: 600; font-family: var(--font); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }

.bars { display: flex; flex-direction: column; gap: 10px; padding-top: 30px; }
.bars__plot { position: relative; display: flex; gap: clamp(6px, 1.4vw, 16px); height: 200px; align-items: flex-end; }
.bars__norm { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--muted); opacity: 0.7; pointer-events: none; }
.bars__norm span { position: absolute; right: 0; bottom: 4px; font-size: 12px; color: var(--muted); }
.bar { flex: 1; height: 100%; border-radius: 12px; background: var(--panel-2); display: flex; align-items: flex-end; position: relative; text-decoration: none; }
.bar__fill { width: 100%; border-radius: 12px; background: var(--gauge-norm); }
.bar--up .bar__fill { background: var(--gauge-up); }
.bar__tip { position: absolute; top: -32px; left: 50%; transform: translateX(-50%); padding: 4px 8px; border-radius: 8px; background: var(--text); color: var(--bg); font-size: 13px; font-weight: 700; white-space: nowrap; }
.bars__labels { display: flex; gap: clamp(6px, 1.4vw, 16px); font-size: 12px; color: var(--muted); text-align: center; line-height: 1.3; }
.bars__labels span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.bars__labels .is-top { color: var(--text); font-weight: 600; }

/* footer */
.foot { display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 16px; margin-top: auto; }
.demo-flag { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.meter--plain::after { display: none; }
.table td.num { white-space: nowrap; }

/* ---------- brand ---------- */
.brand__logo { display: block; width: 200px; height: auto; }
.topbar .brand__logo { width: auto; height: 42px; }
.hero__sign { width: 76px; height: auto; flex: 0 0 auto; }
.kpi__sign { width: 54px; height: auto; flex: 0 0 auto; }
.sign { width: 36px; height: auto; flex: 0 0 auto; }
.foot__by { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); text-decoration: none; }
.foot__by img { width: 20px; height: 20px; border-radius: 4px; }

/* severe status on maps and avatars */
.map-town--severe { fill: var(--sev-severe); }
.map-halo--severe { fill: var(--sev-severe); fill-opacity: 0.22; }
.avatar--severe, .round--severe { background: var(--sev-severe); color: var(--sev-severe-ink); }
.t-severe { color: var(--sev-severe-text); }

/* rain: hourly bars (river data colours, never severity colours) */
.rainbars { display: flex; flex-direction: column; gap: 6px; }
.rainbars__plot { position: relative; height: 150px; display: flex; align-items: flex-end; gap: 3px; border-bottom: 1px solid var(--line); touch-action: pan-y; cursor: crosshair; }
.rainbars__bar { flex: 1 1 0; min-width: 0; background: linear-gradient(to top, var(--chart-water), var(--chart-line-2)); opacity: .8; border-radius: 4px 4px 0 0; transform-origin: 50% 100%; transition: transform .7s cubic-bezier(.2, .8, .2, 1) calc(var(--i, 0) * 14ms), opacity .15s; }
.rainbars__bar--heavy { opacity: 1; background: linear-gradient(to top, var(--chart-line-2), var(--chart-surf)); }
.rainbars.is-wait .rainbars__bar { transform: scaleY(0); }
.rainbars__plot.is-reading .rainbars__bar { opacity: .4; }
.rainbars__plot.is-reading .rainbars__bar.is-on { opacity: 1; box-shadow: 0 0 0 2px var(--text); }
.rainbars__plot .chart-tip { white-space: nowrap; }
@media (prefers-reduced-motion: reduce) { .rainbars__bar { transition: opacity .15s; } }
.rainbars__heavy { position: absolute; left: 0; right: 0; border-top: 1px dashed var(--muted); pointer-events: none; }
.rainbars__heavy span { position: absolute; right: 0; bottom: 2px; font-size: 12px; color: var(--muted); background: var(--panel); padding: 0 4px; }
.rainbars__axis { display: flex; gap: 3px; }
.rainbars__axis span { flex: 1 1 0; min-width: 0; overflow: visible; white-space: nowrap; font-size: 12px; color: var(--muted); }

/* five-day flood risk: words plus a 4-step blue meter (orange and red are kept for EA warnings) */
.fcdays { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.fcdays li { display: grid; grid-template-columns: 7em 1fr 5.5em; align-items: center; gap: 12px; }
.fcmeter { display: flex; gap: 3px; }
.fcmeter i { flex: 1 1 0; height: 8px; border-radius: 4px; background: var(--panel-2); }
.fcmeter i.on { background: var(--gauge-up); }
.side [data-install] { margin: 0 12px; }
.rainstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px 20px; align-items: start; }
.rainstats .stat { padding-bottom: 0; }
@media (max-width: 560px) { .rainstats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* live map (MapLibre GL + OpenFreeMap). Replaces the schematic once loaded. */
.viz--map.is-live { position: relative; max-width: none !important; width: 100%; height: 440px; align-self: stretch !important; }
.viz--map.is-live > svg { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .35; }
.livemap, .livemap.maplibregl-map { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: var(--radius-sm); overflow: hidden; }
/* In a side card (place page "Where"), fill the whole card below its heading, however tall the row is. */
.card.w-1 > .viz--map.is-live { flex: 1 1 auto; height: auto; min-height: 320px; }
@media (max-width: 560px) { .viz--map.is-live { height: 360px; } }
.livemap-pop .maplibregl-popup-content { background: var(--panel-2); color: var(--text); border-radius: 12px; padding: 12px 30px 12px 14px; font: 14px/1.45 var(--font); box-shadow: 0 6px 24px rgba(0, 0, 0, .4); }
.livemap-pop .maplibregl-popup-content a { color: var(--link); font-weight: 600; }
.livemap-pop .maplibregl-popup-close-button { color: var(--muted); font-size: 20px; width: 28px; height: 28px; }
.livemap-pop.maplibregl-popup-anchor-bottom .maplibregl-popup-tip { border-top-color: var(--panel-2); }
.livemap-pop.maplibregl-popup-anchor-top .maplibregl-popup-tip { border-bottom-color: var(--panel-2); }
.livemap-pop.maplibregl-popup-anchor-left .maplibregl-popup-tip { border-right-color: var(--panel-2); }
.livemap-pop.maplibregl-popup-anchor-right .maplibregl-popup-tip { border-left-color: var(--panel-2); }
.livemap .maplibregl-ctrl-group { background: var(--panel-2); }
.livemap .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.place-card__foot strong { white-space: nowrap; }

/* advert: one labelled card in the page (see src/Web/Ads.php); app.js hides it when no advert comes back */
.spot { gap: 10px; }
.spot__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 14px; }
.spot__label { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.spot__why { font-size: 13px; color: var(--muted); }
.spot__slot { min-height: 100px; border-radius: var(--radius-sm); background: var(--side); overflow: hidden; }
.spot__slot ins { max-width: 100%; }

/* Cumbria Guru town guide on place pages (templates/partials/guide.php) */
.cg-tag { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.cg-tag img, .cgquiet img { width: 20px; height: 20px; border-radius: 4px; }
.ext { width: 14px; height: 14px; flex: 0 0 auto; }
.cgpill { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 6px 14px 6px 8px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 600; }
.cgpill:hover { border-color: var(--accent); }
.cgpill img { width: 28px; height: 28px; border-radius: 50%; }
.cgpill small { display: block; font-weight: 400; font-size: 12px; color: var(--muted); line-height: 1.2; }
.page-head .cgpill { margin-left: auto; }
.cgvisit { padding: 0; overflow: hidden; flex-direction: row; flex-wrap: wrap; gap: 0; }
.cgvisit__img { flex: 1 1 340px; min-height: 230px; margin: 0; position: relative; background: var(--panel-2); }
.cgvisit__img img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cgvisit__body { flex: 1 1 340px; padding: 24px; display: flex; flex-direction: column; gap: 12px; justify-content: center; }
.cgvisit__body h2 { font-size: 24px; }
.cgvisit__body p { color: var(--muted); }
.cgvisit__stats { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.cgvisit__stats a { display: inline-flex; gap: 6px; align-items: baseline; min-height: 36px; padding: 6px 12px; border-radius: 999px; background: var(--panel-2); color: var(--text); text-decoration: none; font-size: 14px; }
.cgvisit__stats a:hover { background: color-mix(in srgb, var(--accent) 25%, var(--panel-2)); }
.cgvisit__stats strong { font-size: 15px; }
.cgvisit .btn { align-self: flex-start; }
.cgquiet { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--panel); color: var(--muted); font-size: 14px; text-decoration: none; }
.cgquiet b { color: var(--link); font-weight: 600; }
@media (max-width: 560px) { .page-head .cgpill { margin-left: 0; } }

/* monthly chart (app.js months()): stacked EA colours, grow-in animation, hover/focus/select */
.mchart { display: block; max-width: 100%; height: auto; overflow: visible; }
.ch-sev { fill: var(--sev-severe); }
.ch-warn { fill: var(--sev-warn); }
.ch-alert { fill: var(--sev-alert); }
.ch-baseline { stroke: var(--line); stroke-width: 1; }
.ch-year { font-weight: 700; fill: var(--muted); }
.mbar { cursor: default; outline: none; }
.mbar[role="button"] { cursor: pointer; }
.mbar__hit { fill: transparent; }
.mbar:hover .mbar__hit, .mbar:focus-visible .mbar__hit { fill: var(--text); fill-opacity: .06; }
.mbar:focus-visible .mbar__hit { stroke: var(--accent); stroke-width: 2; }
.mbar__stack { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); transition: transform .7s cubic-bezier(.2, .8, .2, 1), opacity .2s; }
.mchart.is-in .mbar__stack { transform: scaleY(1); }
.mchart .ch-value { opacity: 0; transition: opacity .4s ease .45s; }
.mchart.is-in .ch-value { opacity: 1; }
.mbar.is-dim .mbar__stack { opacity: .3; }
.mbar.is-selected .mbar__hit { fill: var(--accent); fill-opacity: .12; }
.chart-tip { position: absolute; z-index: 5; transform: translate(-50%, -100%); pointer-events: none; white-space: nowrap; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 13px; box-shadow: 0 6px 20px rgba(0, 0, 0, .35); }
@media (prefers-reduced-motion: reduce) {
  .mbar__stack { transition: none; transform: none; }
  .mchart .ch-value { transition: none; opacity: 1; }
}
/* episode table pages */
.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; }
.pager__btns { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.pager__btn { min-width: 40px; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.pager__btn[aria-current="page"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.pager__btn:disabled { opacity: .4; cursor: default; }
.pager__gap { color: var(--muted); padding: 0 2px; }
.linklike { background: none; border: 0; padding: 0; color: var(--link); text-decoration: underline; cursor: pointer; font: inherit; }

/* ---------- admin stats: column bars, flood strip, share meters ---------- */
.colbars { display: flex; flex-direction: column; gap: 6px; }
.colbars__plot { height: 180px; display: flex; align-items: flex-end; gap: 2px; border-bottom: 1px solid var(--line); }
.colbars--short .colbars__plot { height: 120px; }
.colbars__bar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; cursor: default; } /* full height: an easy hover target */
.colbars__fill { width: 100%; background: var(--gauge-up); border-radius: 4px 4px 0 0; }
.colbars__bar:hover .colbars__fill { opacity: .75; }
.colbars__flood { display: flex; gap: 2px; height: 6px; }
.colbars__flood span { flex: 1 1 0; min-width: 0; border-radius: 2px; }
.colbars__flood .is-alert { background: var(--sev-alert); }
.colbars__flood .is-warning { background: var(--sev-warn); }
.colbars__flood .is-severe { background: var(--sev-severe); }
.colbars__axis { display: flex; gap: 2px; }
.colbars__axis span { flex: 1 1 0; min-width: 0; overflow: visible; white-space: nowrap; font-size: 12px; color: var(--muted); }
.colbars__axis span:last-child { display: flex; justify-content: flex-end; } /* today's label overflows leftwards, inside the card */
.table--compact { min-width: 0; }
.table--compact td { padding: 10px 12px; }
.statlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.statlist li { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.statlist__name { overflow-wrap: anywhere; }
.statlist .share { grid-column: 1 / -1; }
.share { display: block; height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.share > span { display: block; height: 100%; border-radius: 3px; background: var(--gauge-up); }
details > summary { cursor: pointer; color: var(--link); margin: 4px 0; }

/* ---------- live map: rain radar control (top left) ---------- */
.radar-ctrl { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; max-width: 230px; padding: 4px; border-radius: 12px; background: var(--panel-2); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .35); font: 13px/1.3 var(--font); }
.radar-ctrl button { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; min-height: 34px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; font-weight: 600; cursor: pointer; }
.maplibregl-ctrl.radar-ctrl button:not(:disabled):hover { background: color-mix(in srgb, var(--text) 10%, transparent); } /* beats MapLibre's own button hover */
.maplibregl-ctrl.radar-ctrl .radar-ctrl__toggle[aria-pressed="true"], .maplibregl-ctrl.radar-ctrl .radar-ctrl__toggle[aria-pressed="true"]:not(:disabled):hover { background: var(--accent); color: var(--accent-ink); }
.radar-ctrl .radar-ctrl__play { min-width: 34px; padding: 0; justify-content: center; }
.radar-ctrl__when { padding: 0 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.radar-ctrl__key { flex-basis: 100%; display: flex; align-items: center; gap: 6px; padding: 0 6px 4px; font-size: 12px; color: var(--muted); }
.radar-ctrl__key i { flex: 1; height: 6px; border-radius: 3px; background: linear-gradient(90deg, #DED097, #88DDEE, #009AD5, #004768, #FFEE00, #FF9500, #D91B00); }
.radar-ctrl [hidden] { display: none !important; }
.radar-ctrl--compact { max-width: 180px; }
.radar-ctrl--compact .radar-ctrl__key { display: none !important; }

/* ---------- overview: every gauge strip ---------- */
[data-viz="strip"]:empty { display: none; }
.strip__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-top: 8px; }
.strip__head h3 { margin: 0; font-size: 15px; font-weight: 600; }
.strip { position: relative; display: flex; align-items: flex-end; gap: 1px; height: 64px; margin-top: 8px; border-bottom: 1px solid var(--line); }
.strip__norm { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--muted); opacity: .6; pointer-events: none; }
.strip__bar { flex: 1 1 0; min-width: 0; height: 100%; display: flex; align-items: flex-end; }
.strip__bar span { display: block; width: 100%; border-radius: 2px 2px 0 0; background: var(--gauge-norm); }
.strip__bar.is-up span { background: var(--gauge-up); }
.strip__bar:hover span { opacity: .75; }

/* ---------- history: flood calendar ---------- */
.cal { width: 100%; border-collapse: separate; border-spacing: 4px; table-layout: fixed; min-width: 300px; }
.cal th { font-size: 12px; font-weight: 500; color: var(--muted); text-align: center; padding: 0 0 2px; }
.cal th[scope="row"] { width: 44px; text-align: left; font-variant-numeric: tabular-nums; }
.cal td { padding: 0; height: 40px; }
.cal__wide { display: none; }
@media (min-width: 700px) { .cal__wide { display: inline; } }
.cal__cell { display: grid; place-items: center; width: 100%; height: 100%; min-height: 36px; border: 0; border-radius: 8px; padding: 0; font: inherit; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); background: color-mix(in srgb, var(--panel-2) 55%, var(--panel)); }
button.cal__cell { cursor: pointer; }
button.cal__cell:hover { outline: 2px solid var(--muted); outline-offset: -2px; }
.cal__cell--1 { background: color-mix(in srgb, var(--gauge-up) 28%, var(--panel)); }
.cal__cell--2 { background: color-mix(in srgb, var(--gauge-up) 50%, var(--panel)); }
.cal__cell--3 { background: color-mix(in srgb, var(--gauge-up) 75%, var(--panel)); color: var(--gauge-ink); }
.cal__cell--4 { background: var(--gauge-up); color: var(--gauge-ink); }
.cal__cell.has-storm { box-shadow: inset 0 0 0 2px var(--text); }
.cal__cell.is-selected { outline: 3px solid var(--accent); outline-offset: 1px; }
.cal__cell.is-dim { opacity: .45; }
.cal__none { background: transparent; }
.cal__key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--muted); }
.cal__key i { display: inline-block; width: 18px; height: 12px; border-radius: 3px; }
.cal__storm-key { display: inline-flex; align-items: center; gap: 6px; margin-left: 12px; }
.cal__storm-key i { background: transparent; box-shadow: inset 0 0 0 2px var(--text); }
.cal__storms { margin: 8px 0 0; }

/* ---------- places: list and map side by side (store-finder layout) ---------- */
.card.locator { padding: 0; gap: 0; display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); height: calc(100vh - 170px); height: calc(100dvh - 170px); min-height: 560px; overflow: hidden; }
.locator__list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.locator__tools { display: flex; flex-direction: column; gap: 12px; padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.locator__tools .search { flex: 0 0 auto; }
.locator__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.locator__summary { margin: 0; display: flex; align-items: center; gap: 8px; }
.locator__summary img { flex: 0 0 auto; }
.prows { position: relative; /* keeps the rows' hidden screen-reader text (position: absolute) inside the scroll box, or it stretches the page */ flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; padding: 8px; }
.prows__head { flex: 0 0 auto; margin: 10px 12px 4px; font-size: 13px; font-weight: 600; color: var(--muted); }
.prow { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 12px; border-radius: 12px; color: var(--text); text-decoration: none; }
.prow:hover, .prow.is-picked { background: var(--panel-2); }
.prow--alert { box-shadow: inset 4px 0 0 var(--sev-alert); }
.prow--warning { box-shadow: inset 4px 0 0 var(--sev-warn); }
.prow--severe { box-shadow: inset 4px 0 0 var(--sev-severe); }
.prow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.prow__name { font-size: 16px; font-weight: 600; line-height: 1.25; }
.prow__sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prow__status { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 13px; font-weight: 600; }
.prow__status .sign { width: 24px; }
.prow__end { flex: 0 0 auto; width: 92px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.prow__level { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prow .meter { width: 92px; background: color-mix(in srgb, var(--text) 14%, transparent); } /* rows turn --panel-2 on hover, so the track needs its own shade */
.locator__map { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; padding: 12px; }
.locator__map > .viz--map { flex: 1 1 auto; align-self: stretch; max-width: none; min-height: 0; }
.locator__map > .viz--map.is-live { height: auto; }
@media (max-width: 1000px) {
  .card.locator { display: flex; flex-direction: column; height: auto; min-height: 0; }
  .locator__list { display: contents; } /* phones: search and filters, then the map, then the list */
  .locator__tools { order: 1; border-bottom: 0; }
  .locator__map { order: 2; padding-top: 0; }
  .prows { order: 3; border-top: 1px solid var(--line); }
  .locator__map > .viz--map, .locator__map > .viz--map.is-live { flex: none; height: 340px; }
  .prows { overflow: visible; }
}

/* iPhones zoom the page when a text box under 16px is tapped. Keep every form field at 16px or more on phones
   (pinch-zoom still works: we never block zooming in the viewport tag). */
@media (max-width: 860px) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea { font-size: max(16px, 1em); }
}

/* ---------- gauge alerts: one-tap heights ---------- */
.picks { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pick { min-height: 44px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--line); background: transparent; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.pick:hover { background: var(--panel-2); }
.pick strong { font-variant-numeric: tabular-nums; }

/* ---------- live map: "show my location" ---------- */
/* Map buttons are inverted for the dark theme; the location button's active blue must not invert to orange-red,
   which belongs to EA warnings. */
.livemap .maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-active .maplibregl-ctrl-icon,
.livemap .maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-background .maplibregl-ctrl-icon,
.livemap .maplibregl-ctrl-geolocate.maplibregl-ctrl-geolocate-waiting .maplibregl-ctrl-icon { filter: none; }
.livemap-note { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 2; padding: 10px 12px; border-radius: 10px; background: var(--panel-2); color: var(--text); font-size: 14px; box-shadow: 0 4px 16px rgba(0, 0, 0, .35); }
.prow__dist { font-weight: 500; font-size: 13px; color: var(--muted); }
.locator__near { min-height: 44px; padding: 0 12px; font-size: 14px; }
.locator__near[hidden] { display: none; }

/* ---------- what to do + local help ---------- */
.help__head { display: flex; align-items: flex-start; gap: 12px; }
.help__head h2 { margin: 0; }
.help--alert { box-shadow: inset 0 0 0 2px var(--sev-alert); }
.help--warning { box-shadow: inset 0 0 0 2px var(--sev-warn); }
.help--severe { box-shadow: inset 0 0 0 2px var(--sev-severe); }
.help__steps { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.help__steps li { padding-left: 4px; line-height: 1.45; }
.help__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.help__list li { display: flex; flex-direction: column; gap: 1px; }
.help__list a { font-weight: 600; }
.help__list--wide { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px 18px; }
.help__council { margin: 6px 0 -4px; font-size: 14px; font-weight: 600; color: var(--muted); }

/* ---------- water heading your way (river colours, never EA severity colours) ---------- */
.watch { box-shadow: inset 0 0 0 2px var(--gauge-up); gap: 10px; }
.watch__head { display: flex; align-items: center; gap: 10px; color: var(--gauge-up); }
.watch__head h2 { margin: 0; color: var(--text); }

/* ---------- live map: flood risk control (under the rain radar) ---------- */
.risk-ctrl { }
.risk-ctrl__key { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 0 6px 4px; font-size: 12px; color: var(--muted); }
.risk-ctrl__key span { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.risk-ctrl__key i { width: 12px; height: 12px; border-radius: 3px; }
.risk-ctrl__key a { color: var(--link); font-weight: 600; }

/* ---------- Met Office weather warnings: words, never the EA's orange or red ---------- */
/* One line per warning, so the card stays small below the flood warnings and alerts. */
.wx { box-shadow: inset 0 0 0 2px var(--line); gap: 6px; padding: 14px 18px; }
.wx__head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; color: var(--accent); }
.wx__head h2 { margin: 0; color: var(--text); font-size: 16px; }
.wx__note { flex: 1 1 auto; text-align: right; }
.wx__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.wx__list li + li { border-top: 1px solid var(--line); }
.wx__list a { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; padding: 6px 0; color: var(--text); text-decoration: none; }
.wx__what { font-weight: 600; }
.wx__more { margin-left: auto; color: var(--link); text-decoration: underline; }
.wx__list a:hover .wx__what, .wx__list a:focus-visible .wx__what { text-decoration: underline; }
.wx__level { flex: 0 0 auto; min-width: 58px; text-align: center; padding: 1px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
@media (max-width: 600px) { .wx__note { flex-basis: 100%; text-align: left; } }
/* The rain radar and flood risk controls sit side by side; on small maps (< 420 px) they are icon buttons only. */
.livemap .maplibregl-ctrl-top-left { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding: 10px 0 0 10px; }
.livemap .maplibregl-ctrl-top-left .maplibregl-ctrl { margin: 0; }
.radar-ctrl--compact { max-width: 150px; }
.radar-ctrl--compact .radar-ctrl__toggle span,
.radar-ctrl--compact .risk-ctrl__key { display: none !important; }
.radar-ctrl--compact .radar-ctrl__toggle { padding: 0; width: 36px; justify-content: center; }

/* river level chart sizes: --sc (1 on phones, up to 1.5 on wide screens) is set by lineChart so the chart stays chunky */
.lchart .ch-axis { font-size: calc(13px * var(--sc, 1)); }
.lchart .ch-note { font-size: calc(13px * var(--sc, 1)); }
.lchart .ch-line { stroke-width: calc(2.5px * var(--sc, 1)); }
.lchart .ch-glow { stroke-width: calc(8px * var(--sc, 1)); }
.lchart .ch-mine { stroke-width: calc(2px * var(--sc, 1)); }
.lchart .ch-record, .lchart .ch-bandline { stroke-width: calc(1.5px * var(--sc, 1)); }
.lchart .ch-dot { stroke-width: calc(2px * var(--sc, 1)); }
.lchart .ch-hover { stroke-width: calc(3px * var(--sc, 1)); }
.lchart ~ .ch-tags .ch-tag { font-size: calc(13px * var(--sc, 1)); padding: calc(3px * var(--sc, 1)) calc(10px * var(--sc, 1)) calc(3px * var(--sc, 1)) calc(8px * var(--sc, 1)); border-radius: calc(8px * var(--sc, 1)); }
.lchart ~ .ch-tags .ch-tag i { width: calc(16px * var(--sc, 1)); }
.lchart ~ .chart-tip--river { font-size: calc(13px * var(--sc, 1)); padding: calc(8px * var(--sc, 1)) calc(12px * var(--sc, 1)); border-radius: calc(10px * var(--sc, 1)); }
.lchart ~ .chart-tip--river strong { font-size: calc(16px * var(--sc, 1)); }
.lchart ~ .chart-tip--river .chart-tip__sub { font-size: calc(12px * var(--sc, 1)); }

/* rain falling into the rain bars (app.js rainBars): drops in on arrival, gentle rain while the latest hour is wet */
.rainbars.is-in .rainbars__bar, .rainbars.is-wait .rainbars__bar { transition-delay: calc(var(--i, 0) * 14ms + .3s), 0s; }
.rainbars__drops { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.rainbars__drops i { position: absolute; top: -16px; width: 3px; height: 16px; margin-left: -1.5px; }
.rainbars__drops i::before { content: ""; position: absolute; inset: 0; border-radius: 3px; background: linear-gradient(to bottom, transparent, var(--chart-surf)); opacity: 0; }
.rainbars__drops i::after { content: ""; position: absolute; left: 50%; bottom: -2px; width: 12px; height: 4px; margin-left: -6px; border-radius: 50%; border: 1.5px solid var(--chart-surf); opacity: 0; }
.rainbars.is-in .rainbars__drops i { animation: rb-fall var(--dur, .5s) cubic-bezier(.55, 0, 1, .45) var(--delay, 0s) var(--n, 1) both; }
.rainbars.is-in .rainbars__drops i::before { animation: rb-streak var(--dur, .5s) linear var(--delay, 0s) var(--n, 1) both; }
.rainbars.is-in .rainbars__drops i::after { animation: rb-splash var(--dur, .5s) ease-out var(--delay, 0s) var(--n, 1) both; }
@keyframes rb-fall { 0% { transform: translateY(0); } 70%, 100% { transform: translateY(var(--fall)); } }
@keyframes rb-streak { 0% { opacity: 0; } 12%, 66% { opacity: .9; } 72%, 100% { opacity: 0; } }
@keyframes rb-splash { 0%, 68% { opacity: 0; transform: scale(.3); } 74% { opacity: .9; } 100% { opacity: 0; transform: scale(1.6); } }
@media (prefers-reduced-motion: reduce) { .rainbars__drops { display: none; } }

/* ---------- Rain page and rain gauge pages ----------
   One hue per theme, darker for less and brighter for more (--rain-1..5); --rain-0 is a gauge that recorded none.
   Rain is never shown in the EA's orange or red. */
.hero__facts { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 4px 0 0; padding: 0; list-style: none; font-size: 14px; color: var(--hero-muted); }
.hero__facts li { display: flex; align-items: center; gap: 8px; }
.hero__facts .sign { width: 22px; height: auto; }
.hero__facts a { color: inherit; }
.rlocator .locator__tools { gap: 10px; }
.rlocator .seg button { min-height: 44px; padding: 0 12px; }
.rrow { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 12px; border-radius: 12px; color: var(--text); text-decoration: none; }
.rrow:hover, .rrow:focus-visible, .rrow.is-picked { background: var(--panel-2); }
.rrow__rank { flex: 0 0 22px; font-size: 13px; color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rrow__main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rrow__name { font-size: 16px; font-weight: 600; line-height: 1.25; }
.rrow__sub { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rrow__tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 3px; }
.rrow__end { flex: 0 0 auto; width: 96px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.rrow__mm { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rrow__mm small { font-weight: 500; color: var(--muted); font-size: 13px; }
.rbar { width: 96px; height: 8px; border-radius: 8px; background: color-mix(in srgb, var(--text) 14%, transparent); overflow: hidden; }
.rbar span { display: block; height: 100%; border-radius: 8px; }
.badge--doubt { background: transparent; color: var(--muted); border: 1px dashed var(--muted); }
.rmap { position: relative; flex: 1 1 auto; min-height: 0; border-radius: var(--radius-sm); overflow: hidden; background: var(--side); }
.rmap--small { flex: none; height: 300px; }
.rmap .livemap { position: absolute; inset: 0; }
.rmap__fallback { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 20px; text-align: center; color: var(--muted); }
.rlegend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.rlegend li { display: flex; align-items: center; gap: 6px; }
.rlegend i { display: inline-block; border-radius: 50%; border: 1.5px solid #0E0057; }
.rlegend .is-dry i { background: transparent; border-color: var(--rain-0); }
.rlegend .is-doubt i { background: var(--rain-0); box-shadow: 0 0 0 2px var(--panel), 0 0 0 3.5px #FFFFFF; }
@media (max-width: 1000px) { .rlocator .rmap { flex: none; height: 360px; } }
.rivwatch { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rivwatch--grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.rivwatch .item__end strong { color: var(--text); font-size: 15px; }
.updown { font-weight: 600; }
.heat { width: 100%; border-collapse: separate; border-spacing: 2px; font-variant-numeric: tabular-nums; }
.heat th { font-size: 13px; font-weight: 600; color: var(--muted); text-align: center; padding: 4px 2px; white-space: nowrap; }
.heat th[scope="row"] { text-align: left; color: var(--text); font-size: 14px; padding-right: 10px; min-width: 150px; white-space: normal; }
.heat th[scope="row"] a { color: var(--text); text-decoration: none; }
.heat th[scope="row"] a:hover { text-decoration: underline; }
.heat th[scope="row"] span { display: block; font-weight: 400; font-size: 12px; color: var(--muted); }
.heat td { height: 40px; min-width: 52px; border-radius: 6px; text-align: center; font-size: 13px; font-weight: 600; }
.heat td.is-none { color: var(--muted); font-weight: 400; border: 1px dashed var(--line); }
.heat td.wk { background: var(--panel-2); color: var(--text); }
.heat--0 { background: var(--rain-0); color: var(--text); }
.heat--1 { background: var(--rain-1); color: var(--rain-ink); }
.heat--2 { background: var(--rain-2); color: var(--rain-ink); }
.heat--3 { background: var(--rain-3); color: var(--rain-ink-dark); }
.heat--4 { background: var(--rain-4); color: var(--rain-ink-dark); }
.heat--5 { background: var(--rain-5); color: var(--rain-ink-dark); }
.heat__key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 0; font-size: 13px; color: var(--muted); }
.heat__key i { width: 26px; height: 14px; border-radius: 4px; display: inline-block; }
.dbars { display: flex; flex-direction: column; gap: 6px; padding-top: 22px; }
.dbars__plot { position: relative; height: 150px; display: flex; align-items: flex-end; gap: 10px; border-bottom: 1px solid var(--line); }
.dbars__bar { flex: 1 1 0; min-width: 0; border-radius: 4px 4px 0 0; position: relative; }
.dbars__bar b { position: absolute; left: 0; right: 0; bottom: 100%; padding-bottom: 4px; font-size: 13px; font-weight: 600; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }
.dbars__axis { display: flex; gap: 10px; }
.dbars__axis span { flex: 1 1 0; min-width: 0; text-align: center; font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .dbars__plot, .dbars__axis { gap: 4px; } .dbars__bar b { font-size: 11px; } }
.records { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.records li { display: grid; grid-template-columns: minmax(120px, 200px) minmax(0, 1fr) 76px; align-items: center; gap: 12px; font-size: 14px; }
.records li.is-now { font-weight: 600; }
.records .rbar { width: 100%; height: 10px; }
.records__mm { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.records__when span { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }

/* ---------- Met Office warnings with the advert beside them (wide screens; app.js moves the advert in) ---------- */
.wx-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.wx-row:has(> .spot:not([hidden])) { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.wx-row > .spot { align-self: stretch; }
