/* The APP SHELL and its components -- shared by the three operations sites
   (Airport Operations, the fleet dashboard, the installation tool). Colour
   ONLY through tokens.css (tests/web/test_ui_design_system.py).

   One system, used the same way on every page:
     spacing   8 px grid: 4 / 8 / 16 / 24 / 32
     type      12 label caps · 13 table · 14 body · 16 card title ·
               20 page title · 28 KPI · 36 hero word; numbers tabular
     radius    8 controls · 12 cards · 999 pills
     icons     the sprite in icons.svg, 20 px in chrome, 28 px in tiles
   Safety colour rule (tokens.css): quiet/veto grey, ARMED cyan outline,
   EMITTING the one magenta, FAULT red, stale hatch + "?", green only for
   "link OK". Navy is the BRAND and only chrome. Every state is icon + word
   + colour, never colour alone. */

[hidden] { display: none !important; }

body.app-body { background: var(--canvas); color: var(--ink); font-size: 14px; line-height: 1.45; }
.app { display: grid; grid-template-columns: 224px minmax(0, 1fr); min-height: 100vh; }
.num, .tabnum { font-variant-numeric: tabular-nums; }

/* ---- sidebar ------------------------------------------------------------ */
.app-side {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 24px;
  padding: 20px 16px; background: var(--card); border-right: 1px solid var(--card-line);
}
.app-logo { display: flex; align-items: center; gap: 12px; padding: 0 8px; text-decoration: none; color: var(--ink); }
.app-logo-mark {
  width: 36px; height: 36px; border-radius: 10px; flex: none;
  display: grid; place-items: center; background: var(--nav-active); color: var(--brand-ink);
}
.app-logo-mark svg { width: 22px; height: 22px; }
.app-logo-text { display: grid; line-height: 1.15; }
.app-logo-text strong { font-size: 14px; letter-spacing: .01em; }
.app-logo-text span { font-size: 12px; color: var(--ink-faint); }
.app-nav { display: grid; gap: 2px; }
.app-nav a {
  display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 0 12px;
  border-radius: 999px; color: var(--ink-muted); text-decoration: none; font-size: 14px;
}
.app-nav a:hover { background: var(--brand-tint); color: var(--ink); }
.app-nav a[aria-current="page"] { background: var(--nav-active); color: var(--brand-ink); font-weight: 600; }
.app-nav svg { width: 20px; height: 20px; flex: none; }
.app-nav .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count {
  min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 12px;
  display: inline-grid; place-items: center; font-weight: 700;
  background: var(--state-fault-bg); color: var(--state-fault-fg);
}
.nav-step { width: 18px; height: 18px; flex: none; color: var(--ink-faint); }
.nav-step[data-done="done"] { color: var(--state-done-fg); }
.nav-step[data-done="part"] { color: var(--chart-det); }
.app-nav a[aria-current="page"] .nav-step { color: var(--brand-ink); }
.app-nav-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); padding: 0 12px 4px; }
.app-side-foot { margin-top: auto; font-size: 12px; color: var(--ink-faint); padding: 0 8px; }

/* ---- main + top bar ---------------------------------------------------- */
.app-main { min-width: 0; display: flex; flex-direction: column; gap: 16px; padding: 16px 24px 32px; }
.app-top {
  display: flex; align-items: center; gap: 16px; min-height: 64px; padding: 8px 12px 8px 20px;
  border-radius: 12px; background: var(--brand); color: var(--brand-ink);
  /* pinned: STOP ALL is on screen however far down a page is scrolled */
  position: sticky; top: 8px; z-index: 15;
}
.tb-clock { display: grid; line-height: 1.1; }
.tb-clock strong { font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.tb-clock span { font-size: 12px; color: var(--brand-ink-muted); }
.tb-sep { width: 1px; align-self: stretch; margin: 6px 0; background: var(--brand-line); }
.tb-user { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.tb-user svg { width: 26px; height: 26px; color: var(--brand-ink-muted); }
.tb-user small { display: block; font-size: 12px; color: var(--brand-ink-muted); }
.tb-spacer { flex: 1; }
/* screen-reader-only live region: announces a CHANGE of field/link state, not
   the pills themselves (rebuilt every poll, they would be read out each time) */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tb-pills { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tb-pill {
  display: inline-flex; align-items: center; gap: 8px; height: 30px; padding: 0 12px;
  border-radius: 999px; font-size: 13px; background: var(--brand-hover); color: var(--brand-ink);
  border: 1px solid var(--brand-line); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.tb-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--chart-veto); }
.tb-pill[data-link="ok"] .dot { background: var(--state-link-ok); }
.tb-pill[data-link="stale"] .dot { background: transparent; border: 2px dotted var(--brand-ink-muted); }
.tb-pill[data-link="stale"]::after { content: "?"; font-weight: 800; }
.tb-pill .pill-state { font-weight: 700; letter-spacing: .03em; }
.tb-pill[data-state="emitting"] { background: var(--state-emit-bg); border-color: var(--state-emit-line); color: var(--state-emit-fg); }
.tb-pill[data-state="fault"] { background: var(--state-fault-bg); border-color: var(--state-fault-line); color: var(--state-fault-fg); }
.sim-pill {
  display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 800; letter-spacing: .08em;
  color: var(--state-warn-fg); background: var(--state-warn-bg); border: 1.5px dashed var(--state-warn-line);
  text-decoration: none;
}
.tb-veto { display: flex; gap: 8px; }
.tb-veto .btn-veto { min-height: 48px; font-size: 15px; padding: 0 20px; border-radius: 10px; }
.tb-menu { position: relative; }
.tb-menu > summary {
  list-style: none; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  display: grid; place-items: center; color: var(--brand-ink);
}
.tb-menu > summary::-webkit-details-marker { display: none; }
.tb-menu > summary:hover { background: var(--brand-hover); }
.tb-menu > summary svg { width: 22px; height: 22px; }
.tb-menu-panel {
  position: absolute; right: 0; top: 46px; z-index: 20; min-width: 220px; padding: 8px;
  background: var(--card); color: var(--ink); border: 1px solid var(--card-line);
  border-radius: 12px; box-shadow: var(--shadow); display: grid; gap: 2px;
}
.tb-menu-panel a, .tb-menu-panel button {
  display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 12px;
  border: 0; border-radius: 8px; background: none; color: var(--ink); text-decoration: none;
  font: inherit; font-size: 14px; cursor: pointer; width: 100%; text-align: left;
}
.tb-menu-panel a:hover, .tb-menu-panel button:hover { background: var(--brand-tint); }
.tb-menu-panel svg { width: 18px; height: 18px; color: var(--ink-muted); }
.tb-menu-panel form { margin: 0; }

/* ---- page head ------------------------------------------------------------ */
.page-head { display: flex; align-items: center; gap: 12px; min-height: 40px; }
.page-head h1 { margin: 0; font-size: 20px; font-weight: 700; letter-spacing: -.005em; }
.page-head .page-sub { color: var(--ink-faint); font-size: 13px; }
.page-head .page-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }

/* ---- grid + card ----------------------------------------------------------- */
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: start; }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; } .span-9 { grid-column: span 9; } .span-12 { grid-column: span 12; }
.stretch { align-self: stretch; }
@media (max-width: 1100px) { .grid > * { grid-column: span 12; } }

.card {
  background: var(--card); border: 1px solid var(--card-line); border-radius: 12px;
  padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0;
}
.card--flush { padding: 0; gap: 0; }
.card--flush > .card-head { padding: 16px 16px 12px; }
.card-head { display: flex; align-items: center; gap: 8px; min-height: 28px; }
.card-head h2 { margin: 0; font-size: 16px; font-weight: 650; }
.card-head .card-sub { color: var(--ink-faint); font-size: 13px; font-variant-numeric: tabular-nums; }
.card-head .card-tools { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card-foot { color: var(--ink-faint); font-size: 12px; }
.card-head a.card-tools, .app-content a.link { color: var(--link); text-decoration: none; font-weight: 600; }
.card-head a.card-tools:hover, .app-content a.link:hover { text-decoration: underline; }
.kpis.kpis--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.muted { color: var(--ink-faint); }
.small { font-size: 12px; }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.stack { display: grid; gap: 8px; }
.stack-lg { display: grid; gap: 16px; }

/* ---- KPI ------------------------------------------------------------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 16px; }
.kpi { display: grid; gap: 4px; align-content: start; }
.kpi-label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); display: flex; gap: 6px; align-items: center; }
.kpi-label svg { width: 16px; height: 16px; }
.kpi-value { font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi-value small { font-size: 14px; font-weight: 500; color: var(--ink-faint); margin-left: 4px; }
.kpi-sub { font-size: 12px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.kpi--emit .kpi-value { color: var(--state-emit-bg); }
.kpi--fault .kpi-value { color: var(--state-fault-bg); }
.card.kpi { padding: 16px; }

/* ---- meter (budget bar) -------------------------------------------------- */
.meter { height: 8px; border-radius: 999px; background: var(--chart-grid); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--state-emit-bg); border-radius: 999px; }
.meter[data-level="warn"] > i { background: var(--state-warn-line); }

/* ---- status icon tiles (Video / Auto / Sound) ----------------------------- */
.stiles { display: grid; gap: 6px; align-content: start; }
.stile { display: grid; justify-items: center; gap: 4px; width: 76px; }
.stile-box {
  width: 60px; height: 60px; border-radius: 12px; display: grid; place-items: center;
  border: 1.5px solid var(--state-quiet-line); background: var(--state-quiet-bg); color: var(--state-quiet-fg);
}
.stile-box svg { width: 28px; height: 28px; }
.stile-label { font-size: 12px; font-weight: 600; color: var(--ink-muted); }
.stile-word { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em; }
.stile[data-state="ok"] .stile-box { background: var(--state-link-bg); color: var(--state-link-ok); border-color: var(--state-link-ok); }
.stile[data-state="armed"] .stile-box { background: var(--state-armed-bg); color: var(--state-armed-fg); border: 1.5px dashed var(--state-armed-line); }
.stile[data-state="emit"] .stile-box { background: var(--state-emit-bg); color: var(--state-emit-fg); border-color: var(--state-emit-line); }
.stile[data-state="fault"] .stile-box { background: var(--state-fault-bg); color: var(--state-fault-fg); border-color: var(--state-fault-line); }
.stile[data-state="warn"] .stile-box { background: var(--state-warn-bg); color: var(--state-warn-fg); border-color: var(--state-warn-line); }
.stile[data-state="stale"] .stile-box {
  color: var(--state-stale-fg); border: 1.5px dotted var(--state-stale-line);
  background: repeating-linear-gradient(45deg, var(--state-stale-bg), var(--state-stale-bg) 6px, var(--card) 6px, var(--card) 10px);
}

/* ---- the field word (Airport Home) ----------------------------------------- */
.field { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 12px;
  border: 1.5px solid var(--state-quiet-line); background: var(--state-quiet-bg); color: var(--state-quiet-fg); }
.field-icon { width: 56px; height: 56px; flex: none; }
.field-word { font-size: 36px; font-weight: 800; letter-spacing: .04em; line-height: 1; }
.field-why { font-size: 14px; margin-top: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.field-txt { min-width: 0; }
.field[data-state="restricted"] { background: var(--state-armed-bg); color: var(--state-armed-fg); border: 1.5px dashed var(--state-armed-line); }
.field[data-state="emitting"] { background: var(--state-emit-bg); color: var(--state-emit-fg); border-color: var(--state-emit-line); }
.field[data-state="stale"], .field[data-state="nodata"] {
  color: var(--state-stale-fg); border: 1.5px dotted var(--state-stale-line);
  background: repeating-linear-gradient(45deg, var(--state-stale-bg), var(--state-stale-bg) 10px, var(--card) 10px, var(--card) 18px);
}

/* ---- tower grid -------------------------------------------------------------- */
.towers { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.tower {
  display: grid; justify-items: center; gap: 4px; padding: 10px 6px 8px; border-radius: 10px;
  border: 1px solid var(--card-line); background: var(--card); position: relative;
}
.tower-id { font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }
.tower-mode { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-faint); display: flex; gap: 4px; align-items: center; }
.tower-mode svg { width: 13px; height: 13px; }
.tower[data-state="emit"] { border: 2px solid var(--state-emit-bg); box-shadow: 0 0 0 3px var(--chart-emit-soft); }
.tower[data-state="emit"] .tower-mode { color: var(--state-emit-bg); font-weight: 700; }
.tower[data-state="fault"] { border: 2px solid var(--state-fault-bg); }
.tower[data-state="fault"] .tower-mode { color: var(--state-fault-bg); font-weight: 700; }
.tower[data-state="armed"] .tower-mode { color: var(--state-armed-fg); }
.tower[data-state="stale"] { border-style: dotted; }
.tower-role { position: absolute; top: 6px; right: 8px; color: var(--ink-faint); }
.tower-role svg { width: 14px; height: 14px; }

/* aim dial: N up, needle = where the horn points */
.dial { width: 44px; height: 44px; }
.dial-ring { fill: none; stroke: var(--card-line); stroke-width: 1.5; }
.dial-tick { stroke: var(--ink-faint); stroke-width: 1.5; }
.dial-needle { stroke: var(--ink-muted); stroke-width: 2.5; stroke-linecap: round; }
.dial-hub { fill: var(--ink-muted); }
.tower[data-state="emit"] .dial-needle, .tower[data-state="emit"] .dial-hub { stroke: var(--state-emit-bg); fill: var(--state-emit-bg); }
.tower[data-state="fault"] .dial-needle { stroke: var(--state-fault-bg); }
.tower[data-state="armed"] .dial-needle { stroke: var(--state-armed-line); }
.dial-n { font-size: 7px; fill: var(--ink-faint); font-weight: 700; }

/* ---- data table ---------------------------------------------------------------- */
.table-wrap { overflow: auto; max-height: 560px; border-top: 1px solid var(--card-line); }
.card--flush .table-wrap { border-radius: 0 0 12px 12px; }
table.dtable { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.dtable th, .dtable td { padding: 0 12px; height: 40px; text-align: left; border-bottom: 1px solid var(--card-line); white-space: nowrap; }
.dtable thead th {
  position: sticky; top: 0; z-index: 1; background: var(--card); height: 36px;
  font-size: 12px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .04em;
}
.dtable thead th.nocaps { text-transform: none; }
.dtable th.num, .dtable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.dtable tbody tr:nth-child(even) td { background: var(--row-alt); }
.dtable tbody tr:hover td { background: var(--brand-tint); }
.dtable td.wrap { white-space: normal; min-width: 240px; }
.dtable .sort { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.dtable .sort:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.dtable th[aria-sort="ascending"] .sort::after { content: "\25B2"; font-size: 9px; }
.dtable th[aria-sort="descending"] .sort::after { content: "\25BC"; font-size: 9px; }
.dash { color: var(--ink-faint); cursor: help; }
.clip { display: inline-block; max-width: 560px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: var(--ink-muted); }

/* ---- filter bar, inputs, buttons --------------------------------------------- */
.filterbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.fld { display: grid; gap: 4px; font-size: 12px; color: var(--ink-faint); }
.fld > span { text-transform: uppercase; letter-spacing: .05em; }
.input, .select, .fld input, .fld select {
  font: inherit; font-size: 14px; height: 40px; padding: 0 12px; min-width: 120px;
  border: 1px solid var(--line-strong); border-radius: 8px; background: var(--card); color: var(--ink);
}
.input:focus, .fld input:focus, .fld select:focus { outline: 2px solid var(--focus-ring); outline-offset: 0; border-color: transparent; }
.fld--wide input { min-width: 260px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 8px; font: inherit; font-size: 14px; font-weight: 600;
  border: 1px solid var(--line-strong); background: var(--card); color: var(--ink); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--brand-tint); }
.btn svg { width: 18px; height: 18px; }
.btn--primary { background: var(--nav-active); color: var(--brand-ink); border-color: var(--nav-active); }
.btn--primary:hover { background: var(--brand-hover); }
.btn--sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-veto:disabled { opacity: .45; cursor: not-allowed; }
.btn-hold { position: relative; overflow: hidden; }
.btn-hold > span { position: relative; }
.btn-hold .hold-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0%;
  background: var(--state-armed-bg); border-right: 2px solid var(--state-armed-line); }

/* ---- tabs ------------------------------------------------------------------------ */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--card-line); }
.tab {
  all: unset; cursor: pointer; padding: 10px 14px; font-size: 14px; color: var(--ink-muted);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab[aria-selected="true"] { color: var(--ink); font-weight: 650; border-bottom-color: var(--brand); }
.tab:focus-visible { outline: 2px solid var(--focus-ring); }

/* ---- help "?" popover ------------------------------------------------------------ */
.help { position: relative; display: inline-flex; }
.help-btn {
  all: unset; cursor: pointer; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; color: var(--ink-faint);
}
.help-btn:hover, .help-btn[aria-expanded="true"] { color: var(--brand); background: var(--brand-tint); }
.help-btn:focus-visible { outline: 2px solid var(--focus-ring); }
.help-btn svg { width: 18px; height: 18px; }
.help-pop {
  position: absolute; top: 30px; left: -8px; z-index: 30; width: 360px; max-width: 80vw;
  padding: 12px 14px; background: var(--card); color: var(--ink); font-size: 13px; line-height: 1.5;
  border: 1px solid var(--card-line); border-radius: 12px; box-shadow: var(--shadow); font-weight: 400;
  text-transform: none; letter-spacing: 0; white-space: normal;
  /* Text only, never a control: a click on it goes THROUGH to what lies
     under it (and the outside-click handler closes it). An open help once
     sat over STOP ALL and swallowed the click. */
  pointer-events: none;
}
.help-pop p { margin: 0 0 8px; } .help-pop p:last-child { margin: 0; }
.help-pop ul { margin: 0; padding-left: 18px; }
.help--right .help-pop { left: auto; right: -8px; }

/* ---- empty state ----------------------------------------------------------------- */
.empty { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 24px 12px; color: var(--ink-faint); font-size: 14px; text-align: center; }
.empty svg { width: 22px; height: 22px; flex: none; }

/* ---- pills / badges (state word + icon + colour) ----------------------------------- */
.st { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .03em; border: 1px solid var(--state-quiet-line);
  background: var(--state-quiet-bg); color: var(--state-quiet-fg); white-space: nowrap; }
.st svg { width: 14px; height: 14px; }
.st[data-state="ok"] { background: var(--state-link-bg); color: var(--state-link-ok); border-color: var(--state-link-ok); }
/* "done" is NOT a link state: audit chain intact, commissioning step done (operator 2026-10-08) */
.st[data-state="done"] { background: var(--state-done-bg); color: var(--state-done-fg); border-color: var(--state-done-line); }
.st[data-state="armed"] { background: var(--state-armed-bg); color: var(--state-armed-fg); border: 1px dashed var(--state-armed-line); }
.st[data-state="emit"] { background: var(--state-emit-bg); color: var(--state-emit-fg); border-color: var(--state-emit-line); }
.st[data-state="fault"] { background: var(--state-fault-bg); color: var(--state-fault-fg); border-color: var(--state-fault-line); }
.st[data-state="warn"] { background: var(--state-warn-bg); color: var(--state-warn-fg); border-color: var(--state-warn-line); }
.st[data-state="stale"] { color: var(--state-stale-fg); border: 1px dotted var(--state-stale-line);
  background: repeating-linear-gradient(45deg, var(--state-stale-bg), var(--state-stale-bg) 5px, var(--card) 5px, var(--card) 9px); }
.lvl { display: inline-grid; place-items: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: 6px;
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; }
.lvl[data-level="P1"] { background: var(--state-fault-bg); color: var(--state-fault-fg); }
.lvl[data-level="P2"] { background: var(--state-warn-bg); color: var(--state-warn-fg); border: 1px solid var(--state-warn-line); }
.lvl[data-level="P3"] { background: var(--state-quiet-bg); color: var(--state-quiet-fg); border: 1px solid var(--state-quiet-line); }

/* ---- compact lists ----------------------------------------------------------------- */
.rows { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); }
.rows > li { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 0; border-bottom: 1px solid var(--card-line); font-size: 14px; }
.rows > li:last-child { border-bottom: 0; }
.rows .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rows .cd { font-variant-numeric: tabular-nums; font-weight: 700; }
svg.ri { width: 18px; height: 18px; color: var(--ink-muted); flex: none; }
.dtable .row { flex-wrap: nowrap; gap: 6px; }
.dtable svg.ri { width: 16px; height: 16px; }

/* ---- charts (web/ui/charts.js) --------------------------------------------------------- */
.chart { position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart-grid { stroke: var(--chart-grid); stroke-width: 1; }
.chart-axis { fill: var(--ink-faint); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-bar { fill: var(--chart-det); }
.chart-bar--det { fill: var(--chart-det); }
.chart-bar--emit { fill: var(--state-emit-bg); }
.chart-bar--emit-soft { fill: var(--chart-emit-soft); }
.chart-bar--veto { fill: var(--chart-veto); }
.chart-bar--ok { fill: var(--state-link-ok); }
.chart-bar--nodata { fill: none; stroke: var(--chart-grid); stroke-dasharray: 2 2; }
.chart-col:hover .chart-bar, .chart-col:focus .chart-bar { opacity: .8; }
.chart-col:focus-visible { outline: 2px solid var(--focus-ring); }
.chart-hit { fill: transparent; }
.chart-line { fill: none; stroke: var(--chart-det); stroke-width: 1.8; }
.chart-line--emit { stroke: var(--state-emit-bg); }
.chart-area { fill: var(--brand-tint); }
.chart-tip {
  position: absolute; z-index: 5; pointer-events: none; padding: 6px 10px; border-radius: 8px; font-size: 12px;
  background: var(--brand); color: var(--brand-ink); white-space: nowrap; font-variant-numeric: tabular-nums;
  transform: translate(-50%, -100%); margin-top: -8px;
}
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--ink-muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .l-det { background: var(--chart-det); }
.legend .l-emit { background: var(--state-emit-bg); }
.legend .l-emit-soft { background: var(--chart-emit-soft); }
.legend .l-veto { background: var(--chart-veto); }
.legend .l-ok { background: var(--state-link-ok); }
.legend .l-works { background: var(--state-warn-line); }
.legend .l-nogo { border: 1.5px dotted var(--ink-muted); background: var(--state-quiet-bg); }

/* ---- timeline (movements) ------------------------------------------------------------ */
.tl { position: relative; height: auto; display: grid; gap: 6px; }
.tl-axis { position: relative; height: 18px; font-size: 11px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.tl-axis span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tl-axis span:first-child { transform: none; }
.tl-axis span:last-child { transform: translateX(-100%); }
.tl-eta { position: absolute; top: -2px; bottom: -2px; width: 3px; margin-left: -1px; border-radius: 2px; background: var(--brand); z-index: 2; }
.tl-row { position: relative; height: 28px; background: var(--row-alt); border-radius: 6px; }
.tl-bar { position: absolute; top: 3px; bottom: 3px; border-radius: 5px; padding: 0 8px; font-size: 12px;
  display: flex; align-items: center; overflow: hidden; white-space: nowrap;
  background: var(--state-quiet-bg); color: var(--state-quiet-fg); border: 1px solid var(--state-quiet-line); }
.tl-bar--works { background: var(--state-warn-bg); color: var(--state-warn-fg); border-color: var(--state-warn-line); }
.tl-bar--eta { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--ink); z-index: 2; }
.tl-label { font-size: 12px; color: var(--ink-muted); }

/* ---- live tiles ----------------------------------------------------------------------- */
.live-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.live { border-radius: 12px; overflow: hidden; border: 1px solid var(--card-line); background: var(--card); }
.live-view { aspect-ratio: 16 / 9; display: grid; place-items: center; background: var(--brand); color: var(--brand-ink-muted); position: relative; }
.live-view .dial { width: 88px; height: 88px; }
.live-view .dial-ring { stroke: var(--brand-line); }
.live-view .dial-needle, .live-view .dial-hub { stroke: var(--brand-ink); fill: var(--brand-ink); }
.live-view .dial-n { fill: var(--brand-ink-muted); }
.live-view .dial-tick { stroke: var(--brand-ink-muted); }
.live-nostream { position: absolute; left: 12px; bottom: 10px; font-size: 11px; letter-spacing: .04em; color: var(--brand-ink-muted); }
.live-az { position: absolute; right: 12px; bottom: 10px; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--brand-ink); }
.live[data-state="emit"] .live-view { box-shadow: inset 0 0 0 3px var(--state-emit-bg); }
.live[data-state="emit"] .dial-needle { stroke: var(--state-emit-bg); }
.live-foot { display: flex; align-items: center; gap: 8px; padding: 10px 12px; }
.live-foot strong { font-size: 14px; }

/* ---- map -------------------------------------------------------------------------------- */
.map-card { align-self: stretch; justify-content: center; }
.map-card .runway-map { width: 100%; height: auto; display: block; border-radius: 8px; background: var(--row-alt); }
.runway-map .map-building { fill: var(--card-line); stroke: none; }
.runway-map .map-apron { fill: var(--canvas); stroke: var(--line-strong); stroke-width: 3; }
.runway-map .map-terminal { fill: var(--line-strong); stroke: none; }
.runway-map .map-taxiway { fill: none; stroke: var(--ink-faint); stroke-width: 12; stroke-linecap: round; opacity: .45; }
.runway-map .map-runway { fill: var(--ink-muted); stroke: var(--ink); stroke-width: 4; }
.runway-map .map-centreline { fill: none; stroke: var(--card); stroke-width: 3; stroke-dasharray: 30 30; }
.runway-map .map-zone { fill: none; stroke: none; }
.runway-map .map-zone.active { fill: url(#hatch); stroke: var(--state-warn-line); stroke-width: 8; }
.runway-map .map-hatch-bg { fill: var(--state-warn-bg); opacity: .6; }
.runway-map .map-hatch-line { stroke: var(--state-warn-line); stroke-width: 14; }
.runway-map .map-label { fill: var(--ink); font: 700 110px var(--font-sans); }
.runway-map .map-nogo { fill: var(--state-quiet-bg); fill-opacity: .55; stroke: var(--ink-muted); stroke-width: 5; stroke-dasharray: 14 12; }
.runway-map .map-nogo--low { fill-opacity: .25; }
.runway-map .map-beam { fill: var(--chart-det); fill-opacity: .10; stroke: var(--chart-det); stroke-width: 4; stroke-opacity: .5; }
.runway-map .map-tower-dot { fill: var(--card); stroke: var(--ink); stroke-width: 12; }
.runway-map .map-tower-ring { fill: none; stroke: var(--ink); stroke-width: 6; }
.runway-map .map-tower-label { fill: var(--ink); font: 700 90px var(--font-sans); }
.runway-map .map-tower[data-state="emit"] .map-beam { fill: var(--state-emit-bg); fill-opacity: .45; stroke: var(--state-emit-bg); stroke-opacity: 1; }
.runway-map .map-tower[data-state="emit"] .map-tower-dot { fill: var(--state-emit-bg); stroke: var(--state-emit-line); }
.runway-map .map-tower[data-state="fault"] .map-tower-dot { fill: var(--state-fault-bg); }
.runway-map .map-tower[data-state="stale"] .map-beam { display: none; }

/* ---- dialog + toast ---------------------------------------------------------------------- */
.dlg { border: 1px solid var(--card-line); border-radius: 12px; background: var(--card); color: var(--ink);
  width: min(520px, 92vw); padding: 0; box-shadow: var(--shadow); }
.dlg::backdrop { background: var(--brand); opacity: .35; }
.dlg-body { padding: 24px; display: grid; gap: 12px; }
.dlg-body h2 { margin: 0; font-size: 18px; }
.dlg-body ul { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: 420px; padding: 12px 16px;
  border-radius: 10px; background: var(--brand); color: var(--brand-ink); font-weight: 600; box-shadow: var(--shadow); }
.toast[data-kind="warn"] { background: var(--state-warn-bg); color: var(--state-warn-fg); border: 1px solid var(--state-warn-line); }
.toast[data-kind="error"] { background: var(--state-fault-bg); color: var(--state-fault-fg); }

/* ---- forms in cards ----------------------------------------------------------------------- */
.form { display: grid; gap: 12px; }
.form-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; min-height: 44px; }
.check input { width: 20px; height: 20px; }

.rule { font-size: 13px; color: var(--ink-muted); }
.rule strong { color: var(--ink); }
.big-veto { min-height: 72px !important; font-size: 18px !important; width: 100%; justify-content: center; }

/* ---- launcher cards (the ops index, the export step) ---------------------------------------- */
.launch { width: min(980px, 100%); display: grid; gap: 24px; }
.launch-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.launch-card { display: grid; gap: 8px; align-content: start; padding: 24px; border-radius: 16px;
  text-decoration: none; color: var(--ink); background: var(--card); border: 1px solid var(--card-line); }
.launch-card:hover { border-color: var(--brand); }
.launch-card svg { width: 28px; height: 28px; color: var(--brand); }
.launch-card strong { font-size: 16px; }
.launch-card span { font-size: 13px; color: var(--ink-faint); }

/* ---- the one-line footer that stays on every airport page --------------------------------- */
.app-foot { font-size: 12px; color: var(--ink-faint); text-align: center; padding-top: 8px; }

/* Phone / small tablet: the sidebar becomes one scrollable strip of pills,
   the top bar wraps with the stop controls FIRST and full width, and stays
   pinned (as it does on desktop). minmax(0, 1fr), never 1fr: a bare 1fr
   column grows to its widest child and the whole page scrolls sideways.
   LAST in the file on purpose: it overrides the base rules above. */
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .app-side {
    position: static; height: auto; min-width: 0; flex-direction: row; align-items: center;
    gap: 8px; padding: 8px 12px; border-right: 0; border-bottom: 1px solid var(--card-line);
    overflow: visible;
  }
  .app-logo { padding: 0; }
  .app-logo-text, .app-nav-title, .app-side-foot { display: none; }
  /* the nav WRAPS under the logo: a strip that scrolls sideways hides items off-screen */
  .app-side { flex-wrap: wrap; }
  .app-nav { display: flex; flex-wrap: wrap; gap: 4px; flex: 1 1 100%; min-width: 0; }
  .app-nav a { min-height: 36px; padding: 0 10px; gap: 6px; white-space: nowrap; font-size: 13px; }
  .app-nav .nav-label { overflow: visible; }
  .app-main { padding: 8px 12px 24px; }
  .app-top { flex-wrap: wrap; gap: 8px; padding: 8px; }
  .tb-veto { order: -1; width: 100%; }
  .tb-veto .btn-veto { flex: 1; min-height: 52px; padding: 0 8px; font-size: 14px; }
  .tb-sep, .tb-user small { display: none; }
  .tb-pill { height: 26px; font-size: 12px; padding: 0 8px; }
  .kpis.kpis--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi-label { overflow-wrap: anywhere; }
  .field { gap: 12px; }
  .field-icon { width: 40px; height: 40px; }
  .field-word { font-size: 22px; overflow-wrap: anywhere; }
  .page-head { flex-wrap: wrap; }
  .card-head { flex-wrap: wrap; }
  .rows .grow { white-space: normal; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
  .app-side, .app-top, .page-tools, .tb-menu { display: none !important; }
  .app { display: block; }
  .card { border-color: var(--print-line); }
}
