/* The hidden attribute is a low-specificity UA style, so ANY class that
   sets display overrides it - .btn and .pill both do. Without this, an
   element marked hidden in markup or via el.hidden still renders (the
   live feed's "N new" pill and the playlist editor's "Add all" / "Load
   more" buttons all showed as empty buttons). Global, so the next
   component to use [hidden] doesn't rediscover it. */
[hidden] { display: none !important; }

/* ==========================================================================
   Beacon design system (package 01)

   Loaded as a stylesheet <link>, placed BEFORE base.html's existing inline
   <style> block (which still defines the old --panel/--primary/etc. token
   set every unmigrated page's extra_css depends on). That ordering means:
   for any selector both systems define, the inline block still wins
   (later in the cascade), so nothing existing breaks. Pages adopt this
   system deliberately as they migrate in package 02.
   ========================================================================== */

/* ---- fonts ------------------------------------------------------------------
   IBM Plex Sans, self-hosted (SIL OFL, licence beside the files) so pages do
   not depend on Google Fonts. Latin subset, four weights. */
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans/ibm-plex-sans-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans/ibm-plex-sans-latin-500-normal.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans/ibm-plex-sans-latin-600-normal.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/static/fonts/ibm-plex-sans/ibm-plex-sans-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ---- tokens: colour (UI redesign, 2026-09-30) ------------------------------
   One palette, two themes: true black and warm charcoal in dark, warm
   off-white in light, one blue accent. In dark mode --accent is the deeper
   blue used for FILLS (white text on it stays readable, 4.7:1); --accent-text
   is the lighter blue for links and active marks on black.
   See docs/2026-09-30-ui-refactor-build-plan.md. */

:root {
  --surface-0: #f5f2ee;
  --surface-1: #fffdfa;
  --surface-2: #efebe5;
  --surface-3: #e7e2da;
  --border: #e2dbd2;
  --border-soft: #ece7e0;
  --border-strong: #d2cabf;
  --text-primary: #1c1917;
  --text-secondary: #57524c;
  --text-tertiary: #6b655d;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-quiet: rgba(37, 99, 235, 0.12);
  --accent-text: #1d4ed8;
  --ok: #15803d;
  --warn: #a16207;
  --danger: #b91c1c;
  --info: #1d4ed8;
  --ok-bg: #dcfce7;
  --warn-bg: #fef3c7;
  --danger-bg: #fee2e2;
  --info-bg: #dbeafe;
  --elev-1: 0 1px 2px rgba(28, 25, 23, 0.06);
  --elev-2: 0 8px 24px rgba(28, 25, 23, 0.10), 0 2px 6px rgba(28, 25, 23, 0.06);
  --c-law: #1d5fd8;
  --c-fire: #c2410c;
  --c-other: #7e3fce;
  --m-flights: #0379b0;
  --m-vessels: #0f7a6c;
  --m-sentinel: #b91c1c;
  --m-weather: #a16207;
  --m-sports: #6d3fc9;
  --panel-soft: #faf8f5;
  --logo-dark: none;
  --logo-light: block;
  /* Legacy names. Most pages' own CSS still uses these (base.html used to
     define them per theme); they now alias the palette above, so one set of
     values drives every page. */
  --bg-top: var(--surface-0);
  --bg-main: var(--surface-0);
  --panel: var(--surface-1);
  --panel-alt: var(--surface-2);
  --text: var(--text-primary);
  --muted: var(--text-secondary);
  --link: var(--accent-text);
  --primary: var(--accent);
  --primary-hover: var(--accent-hover);
  --shadow: none;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-0: #000000;
    --surface-1: #100f0e;
    --surface-2: #1c1a18;
    --surface-3: #25231f;
    --border: #2a2825;
    --border-soft: #211f1c;
    --border-strong: #3d3a35;
    --text-primary: #f5f3f0;
    --text-secondary: #aca69e;
    --text-tertiary: #918b83;
    --accent: #2f6fed;
    --accent-hover: #2563eb;
    --accent-quiet: rgba(91, 155, 255, 0.16);
    --accent-text: #8ab8ff;
    --ok: #4ade80;
    --warn: #fbbf24;
    --danger: #f87171;
    --info: #7cb4ff;
    --ok-bg: rgba(74, 222, 128, 0.13);
    --warn-bg: rgba(251, 191, 36, 0.13);
    --danger-bg: rgba(248, 113, 113, 0.13);
    --info-bg: rgba(124, 180, 255, 0.13);
    --elev-1: inset 0 1px 0 rgba(255, 248, 240, 0.04);
    --elev-2: 0 12px 32px rgba(0, 0, 0, 0.6);
    --c-law: #6ea8ff;
    --c-fire: #ff8a5c;
    --c-other: #b99cf2;
    --m-flights: #56c2f5;
    --m-vessels: #34d3bd;
    --m-sentinel: #f87171;
    --m-weather: #facc15;
    --m-sports: #b99cf2;
    --panel-soft: #151412;
    --logo-dark: block;
    --logo-light: none;
  }
}

:root[data-theme="dark"] {
  --surface-0: #000000;
  --surface-1: #100f0e;
  --surface-2: #1c1a18;
  --surface-3: #25231f;
  --border: #2a2825;
  --border-soft: #211f1c;
  --border-strong: #3d3a35;
  --text-primary: #f5f3f0;
  --text-secondary: #aca69e;
  --text-tertiary: #918b83;
  --accent: #2f6fed;
  --accent-hover: #2563eb;
  --accent-quiet: rgba(91, 155, 255, 0.16);
  --accent-text: #8ab8ff;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --info: #7cb4ff;
  --ok-bg: rgba(74, 222, 128, 0.13);
  --warn-bg: rgba(251, 191, 36, 0.13);
  --danger-bg: rgba(248, 113, 113, 0.13);
  --info-bg: rgba(124, 180, 255, 0.13);
  --elev-1: inset 0 1px 0 rgba(255, 248, 240, 0.04);
  --elev-2: 0 12px 32px rgba(0, 0, 0, 0.6);
  --c-law: #6ea8ff;
  --c-fire: #ff8a5c;
  --c-other: #b99cf2;
  --m-flights: #56c2f5;
  --m-vessels: #34d3bd;
  --m-sentinel: #f87171;
  --m-weather: #facc15;
  --m-sports: #b99cf2;
  --panel-soft: #151412;
  --logo-dark: block;
  --logo-light: none;
}

/* ---- tokens: altitude ramp ----------------------------------------------
   Ground through FL400+, warm to cool. Breakpoints published in JS too —
   see app/static/js/beacon-tokens.js. Keep the two in sync by hand; there
   are only six stops. */

:root {
  --alt-0: #ffb347; /* ground - 2,000 ft */
  --alt-1: #ff7a6b; /* 2,000 - 10,000 */
  --alt-2: #e0568f; /* 10,000 - 20,000 */
  --alt-3: #a558d4; /* 20,000 - 30,000 */
  --alt-4: #6d7ce8; /* 30,000 - 38,000 */
  --alt-5: #7fd8e8; /* 38,000+ */

  --alt-0-glow: rgba(255, 179, 71, 0.35);
  --alt-1-glow: rgba(255, 122, 107, 0.35);
  --alt-2-glow: rgba(224, 86, 143, 0.35);
  --alt-3-glow: rgba(165, 88, 212, 0.35);
  --alt-4-glow: rgba(109, 124, 232, 0.35);
  --alt-5-glow: rgba(127, 216, 232, 0.35);
}

/* ---- tokens: space / radius / type --------------------------------------- */

:root {
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --r-surface: 14px;
  --r-control: 8px;
  --r-pill: 999px;

  --fs-1: 30px;
  --fs-2: 24px;
  --fs-3: 19px;
  --fs-4: 16px;
  --fs-5: 14px;
  --fs-6: 12.5px;
}

/* ---- base ----------------------------------------------------------------
   Scoped to .bcn-root so this system is opt-in per page during migration —
   it never touches un-migrated pages' bare body/html. */

.bcn-root {
  color-scheme: light dark;
  color: var(--text-primary);
}

.bcn-root :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .bcn-root *,
  .bcn-root *::before,
  .bcn-root *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

/* ---- layout ---------------------------------------------------------------- */

.shell {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--sp-4);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}

.cluster {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--sp-3);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(var(--grid-min, 260px), 1fr));
  gap: var(--sp-4);
}

/* ---- card ------------------------------------------------------------------ */

.card {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-surface);
  box-shadow: var(--elev-1);
  padding: var(--sp-5);
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-3);
  flex-wrap: wrap;
  margin-bottom: var(--sp-3);
}

.card-head h3 {
  margin: 0;
  font-size: var(--fs-3);
  color: var(--text-primary);
}

.card-body {
  color: var(--text-secondary);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex-wrap: wrap;
  margin-top: var(--sp-4);
}

/* ---- button ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: 40px;
  padding: 0 var(--sp-4);
  border-radius: var(--r-control);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: var(--fs-5);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}

.btn:hover {
  background: var(--surface-1);
  border-color: var(--accent);
  text-decoration: none;
}

.btn--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.btn--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}

.btn--quiet {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn--quiet:hover {
  background: var(--surface-2);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn--danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}

.btn--danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn--sm {
  min-height: 32px;
  padding: 0 var(--sp-3);
  font-size: var(--fs-6);
  border-radius: calc(var(--r-control) - 2px);
}

.btn--lg {
  min-height: 48px;
  padding: 0 var(--sp-5);
  font-size: var(--fs-4);
}

@media (pointer: coarse) {
  .btn,
  .btn--sm {
    min-height: 44px;
  }
}

/* ---- form ------------------------------------------------------------------- */

.bcn-field {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.bcn-field-label {
  font-size: var(--fs-5);
  font-weight: 600;
  color: var(--text-primary);
}

.bcn-field-hint {
  font-size: var(--fs-6);
  color: var(--text-tertiary);
}

.bcn-field-error {
  font-size: var(--fs-6);
  color: var(--danger);
}

.bcn-input,
.bcn-select,
.bcn-textarea {
  width: 100%;
  font: inherit;
  font-size: var(--fs-5);
  min-height: 40px;
  padding: 0 var(--sp-3);
  border: 1px solid var(--border);
  border-radius: var(--r-control);
  background: var(--surface-0);
  color: var(--text-primary);
  color-scheme: inherit;
}

.bcn-textarea {
  min-height: 96px;
  padding: var(--sp-2) var(--sp-3);
}

.bcn-input:focus,
.bcn-select:focus,
.bcn-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-quiet);
}

@media (pointer: coarse) {
  .bcn-input,
  .bcn-select,
  .bcn-textarea {
    min-height: 44px;
  }
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 24px;
  flex: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  transition: background-color 0.15s ease;
}

.switch-track::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--surface-1);
  box-shadow: var(--elev-1);
  transition: transform 0.15s ease;
}

.switch input:checked ~ .switch-track {
  background: var(--accent);
  border-color: var(--accent);
}

.switch input:checked ~ .switch-track::before {
  transform: translateX(16px);
  background: #fff;
}

.switch input:focus-visible ~ .switch-track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- table / responsive collapse -------------------------------------------- */

.dtable-wrap {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--r-surface);
  overflow: hidden;
}

.dtable {
  width: 100%;
  border-collapse: collapse;
}

.dtable th,
.dtable td {
  padding: var(--sp-3);
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  font-size: var(--fs-5);
}

.dtable th {
  color: var(--text-secondary);
  font-size: var(--fs-6);
  font-weight: 600;
  background: var(--surface-2);
  white-space: nowrap;
}

.dtable tbody tr:last-child td {
  border-bottom: none;
}

@media (min-width: 768px) {
  .dtable-wrap {
    overflow-x: auto;
  }
}

/* < 768px: each row becomes a stacked card. Cells render label/value using
   data-label; data-priority="primary" renders large up top; data-priority
   ="hidden" is omitted (lives only in the tier-2 detail, package 02). */
@media (max-width: 767.98px) {
  .dtable-wrap {
    border: none;
    background: transparent;
  }

  .dtable thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .dtable,
  .dtable tbody,
  .dtable tr,
  .dtable td {
    display: block;
    width: 100%;
  }

  .dtable tr {
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: var(--r-surface);
    box-shadow: var(--elev-1);
    padding: var(--sp-3) var(--sp-4);
    margin-bottom: var(--sp-3);
  }

  .dtable td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--sp-3);
    padding: var(--sp-1) 0;
    border-bottom: none;
    text-align: right;
  }

  .dtable td::before {
    content: attr(data-label);
    color: var(--text-tertiary);
    font-size: var(--fs-6);
    text-align: left;
  }

  .dtable td[data-priority="primary"] {
    font-size: var(--fs-3);
    font-weight: 700;
    padding-bottom: var(--sp-2);
    margin-bottom: var(--sp-2);
    border-bottom: 1px solid var(--border-soft);
  }

  .dtable td[data-priority="primary"]::before {
    display: none;
  }

  .dtable td[data-priority="hidden"] {
    display: none;
  }
}

/* ---- expandable row ---------------------------------------------------------- */

.row-detail {
  overflow: hidden;
}

.row-detail[hidden] {
  display: none;
}

.expand-toggle {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: var(--fs-6);
  font-weight: 600;
  cursor: pointer;
}

@media (prefers-reduced-motion: no-preference) {
  .row-detail {
    transition: grid-template-rows 0.2s ease;
  }
}

/* ---- pill / chip / badge ------------------------------------------------------ */

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  min-height: 24px;
  padding: 0 var(--sp-3);
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: var(--fs-6);
  font-weight: 600;
  white-space: nowrap;
}

.pill--ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--ok); border-color: transparent; }
.pill--warn { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); border-color: transparent; }
.pill--danger { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); border-color: transparent; }
.pill--info { background: color-mix(in srgb, var(--info) 16%, transparent); color: var(--info); border-color: transparent; }
/* Air quality: the six EPA categories, each its own colour. The text is the
   colour pulled toward the theme's text colour, so yellow stays readable on
   light backgrounds. */
.pill--aqi { background: color-mix(in srgb, var(--aqi) 18%, transparent); color: color-mix(in srgb, var(--aqi) 78%, var(--text-primary)); border-color: transparent; }
.pill--aqi-good { --aqi: #22c55e; }
.pill--aqi-moderate { --aqi: #eab308; }
.pill--aqi-usg { --aqi: #f97316; }
.pill--aqi-unhealthy { --aqi: #ef4444; }
.pill--aqi-very { --aqi: #a855f7; }
.pill--aqi-hazardous { --aqi: #be123c; }

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 var(--sp-2);
  border-radius: var(--r-control);
  background: var(--surface-2);
  color: var(--text-secondary);
  font-size: var(--fs-6);
}

/* ---- empty state ---------------------------------------------------------------- */

.empty {
  border: 1px dashed var(--border);
  border-radius: var(--r-surface);
  padding: var(--sp-6) var(--sp-5);
  text-align: center;
  color: var(--text-secondary);
}

.empty h3 {
  margin: 0 0 var(--sp-1) 0;
  color: var(--text-primary);
  font-size: var(--fs-3);
}

.empty p {
  margin: 0 0 var(--sp-4) 0;
  font-size: var(--fs-5);
}

/* ---- notice ----------------------------------------------------------------------- */

.notice {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-control);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
  font-size: var(--fs-5);
}

.notice--ok { border-color: color-mix(in srgb, var(--ok) 40%, var(--border)); background: color-mix(in srgb, var(--ok) 10%, var(--surface-2)); }
.notice--warn { border-color: color-mix(in srgb, var(--warn) 40%, var(--border)); background: color-mix(in srgb, var(--warn) 10%, var(--surface-2)); }
.notice--danger { border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); background: color-mix(in srgb, var(--danger) 10%, var(--surface-2)); }
.notice--info { border-color: color-mix(in srgb, var(--info) 40%, var(--border)); background: color-mix(in srgb, var(--info) 10%, var(--surface-2)); }

/* ---- skeleton ----------------------------------------------------------------------- */

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-1) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  border-radius: var(--r-control);
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}

@keyframes skeleton-sweep {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton {
    animation: none;
    background: var(--surface-2);
  }
}

/* ---- topbar / theme toggle --------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-2);
  flex-wrap: wrap;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  padding: 2px;
  gap: 2px;
}

.theme-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

.theme-toggle button[aria-pressed="true"] {
  background: var(--surface-1);
  color: var(--accent);
  box-shadow: var(--elev-1);
}

@media (pointer: coarse) {
  .theme-toggle button {
    width: 36px;
    height: 36px;
  }
}

/* ==========================================================================
   Shell (UI redesign phase 1, 2026-09-30)
   Sidebar on desktop; below 900px the same sidebar becomes a drawer opened
   from a top bar (hamburger at top left). See base.html.
   ========================================================================== */

.app { display: flex; min-height: 100vh; }

.app-side {
  position: sticky;
  top: 0;
  height: 100vh;
  width: 240px;
  flex: none;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 16px 12px;
  border-right: 1px solid var(--border);
  background: var(--surface-0);
  overflow-y: auto;
  z-index: 40;
}

.side-head { display: flex; align-items: center; justify-content: space-between; }

.side-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.side-brand:hover { text-decoration: none; }
.brand-dark { display: var(--logo-dark); }
.brand-light { display: var(--logo-light); }

.side-close {
  display: none;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: var(--text-primary);
}

.side-nav { display: flex; flex-direction: column; gap: 2px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 40px;
  padding: 0 11px;
  border-radius: 9px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14.5px;
  font-weight: 500;
}
.side-link:hover { background: var(--surface-2); color: var(--text-primary); text-decoration: none; }
.side-link.is-on { background: var(--surface-2); color: var(--text-primary); }
.side-link.is-on .bcn-ico { color: var(--accent-text); }

.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.side-foot .theme-toggle { align-self: flex-start; margin-left: 6px; }

.side-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 6px 0;
  border-top: 1px solid var(--border);
}
.side-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--accent-quiet);
  color: var(--accent-text);
  font-size: 12.5px;
  font-weight: 700;
}
.side-user-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; flex: 1; }
.side-user-text b { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text small { font-size: 12px; color: var(--text-tertiary); }
.side-signout {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  color: var(--text-tertiary);
}
.side-signout:hover { background: var(--surface-2); color: var(--text-primary); }

.side-scrim { display: none; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-bar { display: none; }

.page-top-zone { padding: 24px 0 8px; }
.page-main-zone { padding: 4px 0 40px; flex: 1; }
.page-shell { max-width: var(--max-width, 1280px); margin: 0 auto; padding: 0 32px; }

@media (max-width: 900px) {
  .app { display: block; }
  .app-side {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    height: auto;
    width: 300px;
    max-width: 86vw;
    background: var(--surface-1);
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.35);
    transform: translateX(-104%);
    transition: transform 0.2s ease;
  }
  body.nav-open .app-side { transform: none; }
  body.nav-open { overflow: hidden; }
  .side-close { display: grid; }
  .side-link { min-height: 46px; }
  .side-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0, 0, 0, 0.45); }
  body.nav-open .side-scrim { display: block; }
  .app-bar {
    display: flex;
    align-items: center;
    gap: 2px;
    position: sticky;
    top: 0;
    z-index: 20;
    height: 56px;
    padding: 0 12px 0 4px;
    background: var(--surface-0);
    border-bottom: 1px solid var(--border);
  }
  .app-bar .side-brand { font-size: 16px; padding: 0; margin-right: auto; }
  .app-bar-menu {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--text-primary);
  }
  .page-shell { padding: 0 16px; }
  .page-top-zone { padding-top: 16px; }
}
@media (prefers-reduced-motion: reduce) { .app-side { transition: none; } }

/* ---- page header ----------------------------------------------------------- */
.ph { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.ph-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ph-eyebrow {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.ph h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 4px 0 0; }
.ph-sub { color: var(--text-secondary); font-size: 13.5px; margin: 0; max-width: 90ch; }
.ph-gear { width: 42px; min-height: 42px; padding: 0; }
.ph-tabs {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
  scrollbar-width: none;
}
.ph-tabs::-webkit-scrollbar { display: none; }
.ph-tabs a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.ph-tabs a:hover { color: var(--text-primary); text-decoration: none; }
.ph-tabs a.is-on { color: var(--text-primary); border-bottom-color: var(--accent-text); }
@media (max-width: 900px) { .ph h1 { font-size: 24px; } }

/* ---- settings sub-tabs (phase 4) -------------------------------------------------- */
.ph-subtabs {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}
.ph-subtabs::-webkit-scrollbar { display: none; }
.ph-subtabs a {
  flex: none;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border);
  background: var(--surface-1);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}
.ph-subtabs a:hover { color: var(--text-primary); text-decoration: none; border-color: var(--border-strong); }
.ph-subtabs a.is-on { color: var(--accent-text); border-color: var(--accent); background: var(--accent-quiet); }

/* ---- settings landing (phase 4) --------------------------------------------------- */
.set-group { margin-top: 22px; }
.set-group h2 { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em;
                color: var(--text-tertiary); margin: 0 0 10px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.set-tile { display: block; padding: 14px 16px; background: var(--surface-1); border: 1px solid var(--border);
            border-radius: 12px; color: var(--text-primary); text-decoration: none; }
.set-tile:hover { border-color: var(--accent); text-decoration: none; }
.set-tile b { display: block; font-weight: 600; font-size: 14.5px; }
.set-tile small { display: block; color: var(--text-secondary); font-size: 12.5px; margin-top: 3px; line-height: 1.4; }

/* ---- aircraft map (phase 5, static/js/beacon-aircraft-map.js) --------------------- */
.bam-marker { position: relative; cursor: pointer; transition: opacity .6s ease; line-height: 0; }
.bam-rot { will-change: transform; transform-origin: 50% 50%; }
.bam-svg { display: block; filter: drop-shadow(0 1px 1.5px rgba(0,0,0,.35)); }
.bam-marker.is-dimmed { opacity: .45; }
.bam-marker.is-selected .bam-svg { filter: drop-shadow(0 0 6px var(--accent)) drop-shadow(0 1px 1.5px rgba(0,0,0,.35)); }
.bam-label {
  position: absolute; left: 50%; bottom: calc(100% + 2px); transform: translateX(-50%);
  padding: 2px 7px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  font: 600 10.5px/1.2 var(--font); letter-spacing: .01em;
  background: color-mix(in srgb, var(--surface-1) 82%, transparent); color: var(--text-primary);
  border: 1px solid var(--border); box-shadow: 0 2px 8px rgba(0,0,0,.18);
  display: none;
}
.bam-marker[data-label="all"] .bam-label,
.bam-marker[data-label="hover"]:hover .bam-label { display: block; }
.bam-popup .maplibregl-popup-content {
  background: var(--surface-1); color: var(--text-primary); border: 1px solid var(--border);
  border-radius: 10px; padding: 9px 26px 9px 11px; box-shadow: 0 8px 24px rgba(0,0,0,.25); font-family: var(--font);
}
.bam-popup .maplibregl-popup-tip { border-top-color: var(--surface-1) !important; border-bottom-color: var(--surface-1) !important; }
.bam-popup .maplibregl-popup-close-button { color: var(--text-secondary); font-size: 16px; padding: 2px 7px; }
.bam-pop-call { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.bam-pop-line { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
/* Aircraft photo (static/js/beacon-aircraft-photo.js): the credit line and
   the link to the photo's page are conditions of using it. */
.acp { margin: 0; }
.acp-img { display: block; border-radius: 10px; overflow: hidden; background: var(--surface-2); aspect-ratio: 3 / 2; }
.acp-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.acp-credit { font-size: 12px; color: var(--text-secondary); margin-top: 5px; overflow-wrap: anywhere; }
.acp-credit a { color: var(--accent-text); }
.bam-pop-photo .acp { width: 200px; margin-bottom: 8px; }
.bam-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; font-size: 12px; color: var(--text-secondary); }
.bam-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* ---- phase 5 glance components (from the approved renders) ------------------------ */
.mtile { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
         color: var(--mc); background: color-mix(in srgb, var(--mc) 17%, transparent); }
.mtile.m-flights { --mc: var(--m-flights); } .mtile.m-vessels { --mc: var(--m-vessels); }
.mtile.m-sentinel { --mc: var(--m-sentinel); } .mtile.m-weather { --mc: var(--m-weather); }
.mtile.m-sports { --mc: var(--m-sports); }
.gcard { background: var(--surface-1); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; min-width: 0; }
.gcard-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px;
           border-bottom: 1px solid var(--border); }
.gcard-h h2 { font-size: 15px; font-weight: 600; margin: 0; line-height: 1.3; }
.gcard-b { padding: 16px; }
.gcard-f { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 16px 16px; }
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
         font-size: 12px; font-weight: 500; line-height: 1; background: var(--surface-2); color: var(--text-secondary); white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.danger { background: var(--danger-bg); color: var(--danger); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.accent { background: var(--accent-quiet); color: var(--accent-text); }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-tertiary); }
.idf { font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.list-row:last-child { border-bottom: 0; }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 13.5px; padding: 7px 0; }
.kv > span:first-child { color: var(--text-secondary); }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); }
.seg button, .seg a { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-secondary);
                      font: 500 13px/28px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.seg .on { background: var(--surface-1); color: var(--text-primary); box-shadow: 0 1px 2px rgba(0,0,0,.3), 0 0 0 1px var(--border-strong); }
.meter-bar { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; flex: 1; }
.meter-bar i { display: block; height: 100%; border-radius: 3px; background: var(--c, var(--text-tertiary)); }
.tag { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600;
       color: var(--c); background: color-mix(in srgb, var(--c) 15%, transparent); white-space: nowrap; }
.tag.law { --c: var(--c-law); } .tag.fire { --c: var(--c-fire); } .tag.other { --c: var(--c-other); }
.alogo { width: 30px; height: 30px; border-radius: 8px; background: #fff; display: grid; place-items: center; flex: none;
         overflow: hidden; border: 1px solid var(--border); }
.alogo img { width: 22px; height: 22px; object-fit: contain; }
/* Airline logos: a thin dark edge traced around the artwork, then a soft
   light halo outside it. On light surfaces (the white tile, light-theme
   panels) the dark edge makes a white or pale logo readable - Reliant Air,
   Silver Air; on dark surfaces the halo does the same for a dark one -
   Republic's navy, Porter's grey. Each disappears where it is not needed. */
.alogo img, .tracker-logo, .logo-pill, .review-logo {
  filter: drop-shadow(0 0 0.5px rgba(0, 0, 0, .85)) drop-shadow(0 0 0.5px rgba(0, 0, 0, .85))
          drop-shadow(0 0 0.6px rgba(255, 255, 255, .55));
}
.alogo.ga { background: var(--surface-2); color: var(--text-secondary); font-size: 10.5px; font-weight: 700; letter-spacing: .04em; }
.altchip { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.altchip i { display: block; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.maplibregl-ctrl-attrib, .maplibregl-ctrl-attrib.maplibregl-compact { background: color-mix(in srgb, var(--surface-1) 85%, transparent) !important; color: var(--text-secondary); }
.maplibregl-ctrl-attrib a { color: var(--text-secondary) !important; }
.maplibregl-ctrl-group { background: var(--surface-1) !important; border: 1px solid var(--border); box-shadow: none !important; }
.maplibregl-ctrl-group button + button { border-top: 1px solid var(--border) !important; }
:root[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon,
:root[data-theme="dark"] .maplibregl-ctrl-attrib-button { filter: invert(1); }

/* ---- persistent player (phase 7, static/js/beacon-shell.js) ------------------------ */
html.embedded .app-side, html.embedded .app-bar, html.embedded .side-scrim { display: none !important; }
html.embedded .app { display: block; }
body.shell-framed .page-top-zone, body.shell-framed .page-main-zone { display: none; }
body.shell-framed { overflow: hidden; }
.shell-overlay[hidden], .mini-player[hidden] { display: none !important; }
.shell-overlay { flex: 1 1 auto; display: flex; min-height: 0; }
.shell-frame { width: 100%; height: calc(100dvh - 56px); border: 0; display: block; background: var(--surface-0); }
.mini-player { position: sticky; bottom: 0; z-index: 25; display: flex; align-items: center; gap: 10px;
               height: 56px; padding: 0 14px; background: var(--surface-1); border-top: 1px solid var(--border);
               box-shadow: 0 -6px 18px rgba(0,0,0,.18); }
.mini-text { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.2; }
.mini-text b { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-state { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ok); }
.mini-player.is-paused .mini-state { color: var(--text-tertiary); }
.mini-eq { display: inline-flex; align-items: flex-end; gap: 2px; width: 18px; height: 16px; flex: none; }
.mini-eq i { display: block; width: 4px; background: var(--accent); border-radius: 1px; animation: mini-eq 1s ease-in-out infinite; }
.mini-eq i:nth-child(1) { height: 60%; } .mini-eq i:nth-child(2) { height: 100%; animation-delay: -.3s; } .mini-eq i:nth-child(3) { height: 40%; animation-delay: -.6s; }
.mini-player.is-paused .mini-eq i { animation: none; background: var(--text-tertiary); }
.mini-toggle { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent, #fff); cursor: pointer; }
.mini-toggle:hover { filter: brightness(1.08); }
.mini-toggle .mini-ico-play, .mini-player.is-paused .mini-toggle .mini-ico-pause { display: none; }
.mini-player.is-paused .mini-toggle .mini-ico-play { display: grid; }
.mini-toggle .mini-ico-pause { display: grid; }
.mini-player.is-paused .mini-toggle .mini-ico-play svg { margin-left: 2px; }
.mini-toggle svg { fill: currentColor; stroke: none; }
@keyframes mini-eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
.mini-eq i { transform-origin: bottom; }
/* Phones: the framed page is pinned between the top bar and the player bar, so
   the page underneath has nothing to scroll and only the frame moves (2026-10-18:
   with the old flow layout a swipe could slide the host instead, tucking the
   page's title under the top bar and leaving a gap at the bottom). */
@media (max-width: 900px) {
  body.shell-framed .shell-overlay { position: fixed; top: 56px; left: 0; right: 0; bottom: 0; z-index: 10; }
  body.shell-framed.mini-on .shell-overlay { bottom: 56px; }
  body.shell-framed .shell-frame { height: 100%; }
  body.shell-framed .mini-player { position: fixed; left: 0; right: 0; bottom: 0; }
  body.shell-framed { overscroll-behavior: none; }
}
@media (prefers-reduced-motion: reduce) { .mini-eq i { animation: none; } }

/* ---- status light (modules/status.py, js/beacon-status.js) ------------------
   One light for everything this person can see. Green: all normal; amber: a
   warning (a hot or full node); red: something is down. Grey while checking. */
.status-light {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.status-light:hover { background: var(--surface-2); color: var(--text-primary); }
.status-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-dot {
  width: 9px;
  height: 9px;
  flex: none;
  margin: 0 4.5px;
  border-radius: 50%;
  background: var(--text-tertiary);
}
.status-light[data-level="ok"] .status-dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.status-light[data-level="warn"] .status-dot { background: var(--warn); box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 22%, transparent); }
.status-light[data-level="bad"] .status-dot { background: var(--danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 22%, transparent); }
.status-light[data-level="warn"] .status-text { color: var(--warn); }
.status-light[data-level="bad"] .status-text { color: var(--danger); }
.status-light--bar { width: 44px; height: 44px; padding: 0; justify-content: center; margin-right: 4px; }
.status-light--bar .status-dot { width: 10px; height: 10px; margin: 0; }

.status-panel {
  position: fixed;
  left: 252px;
  bottom: 16px;
  z-index: 60;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-1);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28);
}
.status-panel[hidden] { display: none; }
.status-panel-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 16px; }
.status-panel-close { width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 8px; background: transparent; color: var(--text-secondary); }
.status-panel-close:hover { background: var(--surface-2); color: var(--text-primary); }
.status-panel-body { overflow-y: auto; padding: 0 8px 4px; }
.status-panel-foot { padding: 8px 16px 12px; border-top: 1px solid var(--border); }
.status-group + .status-group { margin-top: 6px; }
.status-group h4 {
  margin: 8px 8px 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}
.status-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 8px;
  border-radius: 8px;
  color: var(--text-primary);
  text-decoration: none;
}
a.status-row:hover { background: var(--surface-2); text-decoration: none; }
.status-row .status-dot { margin: 5px 0 0; }
.status-row[data-level="ok"] .status-dot { background: var(--ok); }
.status-row[data-level="warn"] .status-dot { background: var(--warn); }
.status-row[data-level="bad"] .status-dot { background: var(--danger); }
.status-row[data-level="off"] .status-dot { background: transparent; box-shadow: inset 0 0 0 1.5px var(--text-tertiary); }
.status-row-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.status-row-text b { font-size: 13.5px; font-weight: 600; }
.status-row-text small { font-size: 12.5px; color: var(--text-secondary); }
.status-row[data-level="warn"] small { color: var(--warn); }
.status-row[data-level="bad"] small { color: var(--danger); }

@media (max-width: 900px) {
  .status-panel { left: auto; right: 12px; top: 64px; bottom: auto; max-height: calc(100dvh - 80px); }
  .status-light { min-height: 44px; }
  .status-light--bar { min-height: 0; }
}
