/* ============================================================================
   DEAD Planning — "Glass Cockpit / EFB" theme
   Dark slate base, cyan instrument accents, monospace data readouts, and a
   green/amber/red status language used consistently across the whole UI.
   ============================================================================ */

:root {
  --bg: #0a0e14;
  --bg-grad-1: #0b1018;
  --bg-grad-2: #070a0f;
  --panel: #121821;
  --panel-2: #0e131b;
  --panel-raised: #161e29;
  --border: #1f2a37;
  --border-bright: #2b3a4d;

  --text: #e6edf3;
  --text-dim: #97a3b4;
  --text-faint: #5b6878;

  --accent: #37b6c3;
  --accent-dim: #1d6b74;

  --go: #3fb950;
  --caution: #d29922;
  --nogo: #f85149;
  --nodata: #6e7b8c;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --radius: 12px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  font-family: var(--sans);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(55, 182, 195, 0.08), transparent 60%),
    linear-gradient(160deg, var(--bg-grad-1), var(--bg-grad-2));
  background-attachment: fixed;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
}

.app { max-width: 1180px; margin: 0 auto; padding: 18px clamp(12px, 3vw, 28px) 60px; }

/* Header */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 6px 2px 18px; border-bottom: 1px solid var(--border); margin-bottom: 20px;
}
.topbar .logo { width: 40px; height: 40px; flex: none; filter: drop-shadow(0 0 10px rgba(55,182,195,0.35)); }
.topbar h1 { font-size: 18px; letter-spacing: 0.5px; margin: 0; font-weight: 650; }
.topbar .subtitle { color: var(--text-dim); font-size: 12.5px; margin-top: 2px; }
.topbar .spacer { flex: 1; }

.pill {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.4px;
  padding: 4px 9px; border-radius: 999px; border: 1px solid var(--border-bright);
  color: var(--text-dim); background: var(--panel-2); white-space: nowrap;
}
.pill.live { color: var(--go); border-color: rgba(63,185,80,0.4); }
.pill.fixture { color: var(--caution); border-color: rgba(210,153,34,0.4); }
.pill.unavail { color: var(--nogo); border-color: rgba(179,35,27,0.45); }

/* Data-source status strip */
.status-strip { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.status-strip:empty { display: none; }
.sbadge { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.5px; padding: 4px 11px; border-radius: 999px; border: 1px solid; }
.sbadge.live { color: var(--go); border-color: rgba(63, 185, 80, 0.45); background: rgba(63, 185, 80, 0.1); }
.sbadge.demo { color: var(--caution); border-color: rgba(210, 153, 34, 0.45); background: rgba(210, 153, 34, 0.1); }
.sbadge.unavail { color: var(--nogo); border-color: rgba(179, 35, 27, 0.5); background: rgba(179, 35, 27, 0.1); }
/* Pills/badges with an explanation are tap-to-reveal (and hover-title) */
.sbadge[data-tip], .pill[data-tip] { cursor: help; }
.sbadge[data-tip]::after, .pill[data-tip]::after { content: 'ⓘ'; font-size: 9px; opacity: 0.7; margin-left: 5px; vertical-align: top; }
.pill-tip {
  position: absolute; z-index: 9998; max-width: min(330px, 92vw);
  background: var(--panel-raised); color: var(--text);
  border: 1px solid var(--border-bright); border-radius: 8px;
  padding: 9px 11px; font-size: 12px; line-height: 1.5; white-space: pre-line;
  box-shadow: var(--shadow);
}

/* Card detail tabs — pills */
.card-tabs { display: flex; flex-wrap: wrap; gap: 5px; border-top: 1px solid var(--border); padding-top: 10px; margin-top: 2px; }
.tab { display: inline-flex; align-items: center; gap: 5px; font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 0.3px; padding: 5px 11px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border-bright); color: var(--text-dim); cursor: pointer; transition: background 0.12s, color 0.12s; }
.tab-ico { width: 13px; height: 13px; flex: none; }
.tab:hover { color: var(--text); border-color: var(--accent-dim); }
.tab.active { color: #04141a; background: var(--accent); border-color: var(--accent); }
.tab .count { font-family: var(--mono); background: var(--panel); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px; font-size: 9.5px; color: var(--text-dim); }
.tab.active .count { background: rgba(0, 0, 0, 0.18); color: #04141a; border-color: transparent; }
.tabpanels { border: 1px solid var(--border); border-radius: 8px; padding: 10px; margin-top: 8px; }
.tabpanel { display: none; }
.tabpanel.active { display: block; }
.sub-hd { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-faint); margin-bottom: 6px; }
.taf-hd { display: flex; justify-content: flex-end; }

/* NOTAM category filter chips */
.nfilters { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.nfilter { font-family: var(--mono); font-size: 10px; letter-spacing: 0.3px; padding: 3px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--border); color: var(--text-dim); cursor: pointer; }
.nfilter:hover { border-color: var(--accent-dim); color: var(--text); }
.nfilter.active { color: var(--accent); border-color: var(--accent); background: rgba(55, 182, 195, 0.12); }
.nfilter b { color: var(--text); }
/* Print-only note for NOTAMs omitted by the essential-print toggle */
.n-hidden-note { display: none; font-size: 11px; font-style: italic; color: var(--text-dim); padding: 6px 0 2px; border-top: 1px dashed var(--border); }

/* Controls */
.controls {
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow); margin-bottom: 22px;
}
.controls .row { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-dim); }
.field input {
  font-family: var(--mono); font-size: 14px; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--border-bright);
  border-radius: 8px; padding: 9px 11px; outline: none;
}
.field input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(55,182,195,0.18); }
.field select { font-family: var(--mono); font-size: 13px; color: var(--text); background: var(--panel-2); border: 1px solid var(--border-bright); border-radius: 8px; padding: 9px 11px; outline: none; min-width: 180px; }
.field select:focus { border-color: var(--accent); }
.field.grow { flex: 1; min-width: 240px; }
.field.num input { width: 90px; text-align: center; }

button.go {
  font-family: var(--sans); font-weight: 650; font-size: 14px; letter-spacing: 0.3px;
  color: #04141a; background: linear-gradient(180deg, #46c6d4, var(--accent));
  border: none; border-radius: 8px; padding: 10px 20px; cursor: pointer;
  box-shadow: 0 4px 14px rgba(55,182,195,0.3);
}
button.go:hover { filter: brightness(1.06); }
button.go:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
button.go.secondary {
  color: var(--accent); background: transparent;
  border: 1px solid var(--accent-dim); box-shadow: none;
}
button.go.secondary:hover { background: rgba(55, 182, 195, 0.1); filter: none; }

/* Print header — hidden on screen, shown on the kneeboard printout */
.print-head { display: none; }

.toggle { display: flex; align-items: center; gap: 7px; color: var(--text-dim); font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text-dim); cursor: pointer;
}
.chip:hover { border-color: var(--accent-dim); color: var(--text); }

/* Grid */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 18px; }

.card {
  background: linear-gradient(180deg, var(--panel-raised), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; display: flex; flex-direction: column;
}
.card .head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border); }
.card .head .icao { font-family: var(--mono); font-size: 19px; font-weight: 700; letter-spacing: 1px; }
.card .head .name { color: var(--text-dim); font-size: 12px; line-height: 1.25; }
.card .head .spacer { flex: 1; }
.card .head { cursor: pointer; user-select: none; }
.ahas-chip { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.4px; padding: 3px 8px; border-radius: 999px; border: 1px solid; white-space: nowrap; }
.card-chev { color: var(--text-faint); font-size: 11px; transition: transform 0.15s ease; }
.card.collapsed .card-chev { transform: rotate(-90deg); }
.card.collapsed .body { display: none; }

/* Quick-links toolbar (external references for the current departure field) */
.quicklinks { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.ql-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-faint); margin-right: 2px; }
.ql { font-family: var(--mono); font-size: 12px; color: var(--accent); text-decoration: none; background: var(--panel-2); border: 1px solid var(--border-bright); border-radius: 999px; padding: 5px 12px; white-space: nowrap; transition: border-color 0.15s ease, background 0.15s ease; }
.ql:hover { border-color: var(--accent); background: rgba(55, 182, 195, 0.12); }
.ql::after { content: " ↗"; color: var(--text-faint); }
.ql-build { color: #04141a; background: linear-gradient(180deg, #46c6d4, var(--accent)); border-color: var(--accent); font-weight: 700; }
.ql-build::after { content: ""; }
.ql-build:hover { filter: brightness(1.06); background: linear-gradient(180deg, #46c6d4, var(--accent)); }

/* Collapsible tool panels (Route Winds, Route Lookup) */
.tool-head { display: flex; align-items: center; justify-content: space-between; cursor: pointer; user-select: none; }
.tool-title { font-size: 13px; font-weight: 650; letter-spacing: 0.3px; color: var(--text); }
.tool-head .chev { color: var(--text-faint); transition: transform 0.15s ease; }
.tool.collapsed .tool-head .chev { transform: rotate(-90deg); }
.tool-body { margin-top: 14px; }
.tool.collapsed .tool-body { display: none; }
.tool.collapsed { padding-bottom: 16px; }

.status-led { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.6px; padding: 5px 10px; border-radius: 7px; white-space: nowrap; }
.status-led[data-tip], .ahas-chip[data-tip] { cursor: help; }
.status-GO { color: var(--go); background: rgba(63,185,80,0.12); border: 1px solid rgba(63,185,80,0.4); }
.status-CAUTION { color: var(--caution); background: rgba(210,153,34,0.12); border: 1px solid rgba(210,153,34,0.4); }
.status-NOGO { color: var(--nogo); background: rgba(248,81,73,0.13); border: 1px solid rgba(248,81,73,0.45); }
.status-NODATA { color: var(--nodata); background: rgba(110,123,140,0.12); border: 1px solid var(--border-bright); }

.card .body { padding: 14px 15px; display: flex; flex-direction: column; gap: 14px; }

.readout { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); }
.readout .raw { color: var(--text); background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; word-break: break-word; line-height: 1.5; }
.metrics { display: flex; flex-wrap: wrap; gap: 8px; }
.metric { flex: 1; min-width: 88px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.metric .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-faint); }
.metric .v { font-family: var(--mono); font-size: 16px; margin-top: 2px; }
.metric .v small { font-size: 11px; color: var(--text-dim); }
.metric.warn .v { color: var(--caution); }
.metric[data-tip] { cursor: help; }
.ahas-when { display: block; font-size: 9px; color: var(--text-faint); margin-top: 2px; letter-spacing: 0.2px; }

.wind-block { display: flex; gap: 14px; align-items: center; }
.wind-block .compass { flex: none; }
.wind-readout { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.active-rwy { font-family: var(--mono); font-size: 13px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.active-rwy b { font-size: 22px; color: var(--accent); letter-spacing: 1px; }
.comp { display: flex; gap: 8px; }
.comp .box { flex: 1; text-align: center; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 7px 4px; }
.comp .box .lbl { font-size: 10px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.6px; }
.comp .box .val { font-family: var(--mono); font-size: 18px; margin-top: 2px; }
.comp .box.xw .val { color: var(--accent); }
.comp .box.xw.high .val { color: var(--nogo); }
.comp .box.xw.mod .val { color: var(--caution); }
.comp .box.tw .val { color: var(--caution); }
.gust-note { font-family: var(--mono); font-size: 11px; color: var(--text-dim); }
.pw-block { margin-top: 6px; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; }
.pw-hdr { font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-faint); background: var(--panel-2); padding: 4px 8px; }
.pw-row { display: grid; grid-template-columns: 1.5fr 0.8fr 1.4fr; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; padding: 4px 8px; }
.pw-row:nth-child(even) { background: var(--panel-2); }
.pw-alt { color: var(--text-dim); }
.pw-alt small { color: var(--text-faint); }
.pw-wind { text-align: center; color: var(--text); }
.pw-comp { text-align: right; color: var(--accent); }

.rwys-cap { font-size: 10.5px; color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.6px; margin: 2px 0 4px; }
.rwys-cap b { color: var(--accent); font-weight: 600; }
.rwys { display: flex; flex-direction: column; gap: 3px; }
.rwy-row { display: grid; grid-template-columns: minmax(120px, 1.6fr) 0.9fr 1fr 16px; align-items: center; gap: 6px; font-family: var(--mono); font-size: 12px; padding: 4px 8px; border-radius: 6px; }
.rwy-row.active { background: rgba(55,182,195,0.1); }
.rwy-row.selectable { cursor: pointer; }
.rwy-row.selectable:hover { background: rgba(55,182,195,0.08); }
.rwy-row.selected { background: rgba(55,182,195,0.16); box-shadow: inset 2px 0 0 var(--accent); }
.rwy-row.closed { opacity: 0.45; text-decoration: line-through; cursor: default; }
.rec-tag, .cmp-tag { font-family: var(--sans); font-size: 9px; letter-spacing: 0.4px; text-transform: uppercase; padding: 2px 6px; border-radius: 4px; vertical-align: middle; }
.rec-tag { color: var(--go); background: rgba(63,185,80,0.12); border: 1px solid rgba(63,185,80,0.4); }
.cmp-tag { color: var(--accent); background: rgba(55,182,195,0.12); border: 1px solid var(--accent-dim); }
.rwy-len { font-family: var(--mono); font-size: 10px; color: var(--text-faint); margin-left: 4px; }
.rwy-row .id { font-weight: 700; }
.rwy-row .rwy-dim { font-weight: 400; font-size: 9.5px; color: var(--text-faint); }
.rwy-row .tw { color: var(--caution); }
.rwy-row .star { color: var(--accent); }

.warnings { display: flex; flex-direction: column; gap: 6px; }
.warn-item { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.4; background: rgba(210,153,34,0.08); border: 1px solid rgba(210,153,34,0.3); border-radius: 8px; padding: 8px 10px; color: #f0d59a; }
.warn-item.crit { background: rgba(248,81,73,0.09); border-color: rgba(248,81,73,0.35); color: #f7b1ad; }
.warn-item .ico { flex: none; }
/* Forecast-at-ETA block (TAF-driven, time-aware) */
.forecast-block { margin-top: 10px; padding: 9px 11px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; }
.forecast-block.is-source { border-color: var(--accent-dim); box-shadow: inset 0 0 0 1px rgba(55,182,195,0.12); }
.forecast-block .fc-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 4px; }
.forecast-block .fc-when { font-family: var(--mono); text-transform: none; letter-spacing: 0; color: var(--text-faint); }
.forecast-block .fc-src { font-family: var(--mono); font-size: 10px; color: var(--accent); border: 1px solid var(--accent-dim); border-radius: 5px; padding: 1px 5px; }
.forecast-block .fc-line { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.forecast-block .fc-caveat { font-size: 11.5px; color: var(--text-dim); margin-top: 5px; }
.forecast-block .fc-caveat.crit { color: #f7b1ad; }
.forecast-block .warnings { margin-top: 6px; }
.cat-chip { font-family: var(--mono); font-size: 10px; font-weight: 700; border: 1px solid; border-radius: 5px; padding: 1px 5px; }

/* Local-time conversion shown next to a Zulu time — brighter/bold so it reads
   clearly instead of blending into the Zulu string. */
.t-loc { font-weight: 700; color: var(--accent); white-space: nowrap; }

/* Freezing level + icing band line (winds-aloft section). */
.thermal-line { font-size: 12px; color: var(--text-dim); margin-bottom: 7px; line-height: 1.5; }
.thermal-line .thm-h { font-family: var(--mono); font-size: 10px; font-weight: 700; color: var(--accent); border: 1px solid var(--accent-dim); border-radius: 5px; padding: 1px 5px; }
.thermal-line b { color: var(--text); }
.thm-band { font-family: var(--mono); font-size: 11px; border-radius: 5px; padding: 1px 5px; }
.thm-mod { color: #f7b1ad; border: 1px solid rgba(248,81,73,0.5); }
.thm-lt { color: #f0c552; border: 1px solid rgba(210,153,34,0.5); }
.thm-tr { color: var(--text-dim); border: 1px solid var(--border); }
.thm-ok { color: var(--go, #3fb950); }
.thm-note { color: var(--text-faint); font-size: 10.5px; }

/* NVG illumination trend sparkline (in the ribbon section). */
.nvg-trend { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 8px; }
.nvg-trend .nt-h { font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 4px; }
.nvg-trend .nt-h small { text-transform: none; letter-spacing: 0; color: var(--text-faint); font-size: 10.5px; }
.nt-svg { width: 100%; height: 64px; display: block; background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; }
.nt-line { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.nt-thr { stroke: #f0c552; stroke-width: 1; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; }
.nt-mark { stroke: var(--text-faint); stroke-width: 1; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.nt-mtext { fill: var(--text-dim); font: 700 9px var(--mono); text-anchor: middle; }
.nt-svg rect, .nt-thr, .nt-line { cursor: help; }
/* Illumination-trend legend under the sparkline. */
.nt-legend { display: flex; flex-wrap: wrap; gap: 10px 14px; margin-top: 6px; font-size: 11px; color: var(--text-dim); }
.nt-li { display: inline-flex; align-items: center; gap: 5px; }
.nt-sw { display: inline-block; width: 13px; height: 13px; border-radius: 3px; border: 1px solid var(--border); }
.nt-sw.nt-day { background: rgba(210,153,34,0.45); }
.nt-sw.nt-twi { background: rgba(120,130,170,0.55); }
.nt-sw.nt-night { background: rgba(20,28,52,0.9); }
.nt-swline { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--accent); }
.nt-swdash { display: inline-block; width: 16px; height: 0; border-top: 2px dashed #f0c552; }
.nt-swmark { font: 700 10px var(--mono); color: var(--text-dim); }

/* Sun-glare / lunar-geometry awareness line in the NVG block. */
.glare-line { margin-top: 7px; font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); line-height: 1.5; border-top: 1px dashed var(--border); padding-top: 6px; }

/* NVG illumination card block (computed sun/moon + AFI 11-214 LOW/HIGH call).
   LOW illumination is a planning caution (not a GO/NO-GO driver). */
.illum-block { margin-top: 10px; padding: 9px 11px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; }
.illum-block.b-illlow { border-color: rgba(210,153,34,0.5); box-shadow: inset 0 0 0 1px rgba(210,153,34,0.12); }
.illum-block.b-illhigh { border-color: rgba(90,130,220,0.5); box-shadow: inset 0 0 0 1px rgba(90,130,220,0.12); }
.illum-block.daylight { border-style: dashed; }
.illum-block .il-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 6px; }
.illum-block .cat-chip.b-illlow { color: #f0c552; }
.illum-block .cat-chip.b-illhigh { color: #8fb0f0; }
.illum-block .fc-src { font-family: var(--mono); font-size: 10px; color: var(--text-faint); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
.illum-block .il-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 7px; }
.illum-block .il-cell { background: var(--panel); border: 1px solid var(--border); border-radius: 7px; padding: 6px 8px; }
.illum-block .il-cell .k { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-faint); margin-bottom: 2px; }
.illum-block .il-cell .v { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.illum-block .il-cell .v small { color: var(--text-faint); }
.illum-block .fc-line { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
.illum-block .fc-caveat { font-size: 11.5px; color: var(--text-dim); margin-top: 6px; }
.illum-block .fc-caveat.crit { color: #f7b1ad; }
.nvg-toggle { white-space: nowrap; }

.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-faint); display: flex; align-items: center; gap: 8px; }

/* Collapsible card sections */
.sec { border-top: 1px solid var(--border); padding-top: 10px; }
.sec > summary { list-style: none; cursor: pointer; user-select: none; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::before { content: '▸'; color: var(--text-faint); font-size: 9px; transition: transform 0.15s ease; }
.sec[open] > summary::before { transform: rotate(90deg); }
.sec > summary:hover { color: var(--text-dim); }
.sec-body { padding-top: 8px; }
.section-title .count { font-family: var(--mono); background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; color: var(--text-dim); }
.notams { display: flex; flex-direction: column; gap: 5px; }
.notam { display: grid; grid-template-columns: 78px 1fr; gap: 9px; align-items: start; font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; }
.notam .cat { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.4px; text-align: center; padding: 3px 4px; border-radius: 5px; align-self: start; border: 1px solid var(--border-bright); color: var(--text-dim); }
.cat-RUNWAY { color: var(--nogo); border-color: rgba(248,81,73,0.45); background: rgba(248,81,73,0.08); }
.cat-APPROACH, .cat-GPS_RAIM, .cat-NAVAID { color: var(--caution); border-color: rgba(210,153,34,0.4); }
.cat-LIGHTING, .cat-OBSTACLE, .cat-AIRSPACE, .cat-BIRD { color: var(--accent); border-color: var(--accent-dim); }
.notam .txt { font-family: var(--mono); line-height: 1.45; color: var(--text); }
.notam .when { color: var(--text-faint); font-size: 10.5px; margin-top: 3px; }

/* NOTAMs grouped into collapsible per-category sections. */
.ngroups { display: flex; flex-direction: column; gap: 6px; }
.ngroup { border: 1px solid var(--border); border-radius: 7px; background: rgba(255, 255, 255, 0.015); overflow: hidden; }
.ngroup[hidden] { display: none; }
.ngroup-sum { display: flex; align-items: center; gap: 8px; padding: 6px 9px; cursor: pointer; list-style: none; user-select: none; }
.ngroup-sum::-webkit-details-marker { display: none; }
.ngroup-sum:hover { background: var(--panel-2); }
.ngroup-sum .cat { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.4px; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border-bright); color: var(--text-dim); }
.ngroup-n { font-family: var(--mono); font-size: 10px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; color: var(--text-dim); }
.ngroup-chev { margin-left: auto; color: var(--text-faint); font-size: 11px; transition: transform 0.15s ease; }
.ngroup[open] .ngroup-chev { transform: rotate(180deg); }
.ngroup > .notams { padding: 0 8px 8px; }

.taf { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px; padding: 8px 10px; line-height: 1.5; word-break: break-word; }
.taf-toggle { margin-left: auto; font-family: var(--sans); font-size: 10px; letter-spacing: 0.4px; color: var(--accent); cursor: pointer; text-transform: none; }
.taf-toggle:hover { text-decoration: underline; }
.taf-decoded { display: flex; flex-direction: column; gap: 8px; }
.taf-period { background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid var(--accent-dim); border-radius: 7px; padding: 7px 10px; }
.taf-when { font-family: var(--mono); font-size: 11px; color: var(--accent); margin-bottom: 4px; }
.taf-items { margin: 0; padding-left: 16px; font-size: 12.5px; line-height: 1.5; }
.taf-items .extra { color: var(--text-faint); list-style: none; margin-left: -16px; font-family: var(--mono); font-size: 11px; }

.empty, .loading, .errbox { text-align: center; color: var(--text-dim); padding: 60px 20px; font-size: 14px; }
.errbox { color: var(--nogo); }
.spinner { width: 26px; height: 26px; margin: 0 auto 14px; border-radius: 50%; border: 3px solid var(--border-bright); border-top-color: var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.footer { text-align: center; color: var(--text-faint); font-size: 11px; margin-top: 30px; }

.missing-card { border: 1px dashed var(--border-bright); border-radius: var(--radius); padding: 18px; color: var(--text-dim); font-size: 13px; }
.missing-card .icao { font-family: var(--mono); font-weight: 700; color: var(--text); }

/* Airspace rows (reuse NOTAM look) */
.as-row { display: grid; grid-template-columns: 50px 1fr; gap: 9px; align-items: start; font-size: 12px; background: var(--panel-2); border: 1px solid var(--border); border-radius: 7px; padding: 7px 9px; }
.as-row .cat { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.4px; text-align: center; padding: 3px 4px; border-radius: 5px; align-self: start; border: 1px solid var(--border-bright); color: var(--text-dim); }
.as-row .txt { font-family: var(--mono); line-height: 1.45; color: var(--text); }
.as-row .when { color: var(--text-faint); font-size: 10.5px; margin-top: 3px; }
.section-title .cat { font-family: var(--mono); font-size: 9.5px; padding: 3px 6px; border-radius: 5px; border: 1px solid var(--border-bright); }

/* ---- Route / climb winds tool -------------------------------------------- */
.winds-tool #winds-results:empty { display: none; }
.winds-tool #winds-results { margin-top: 14px; }
.wind-profile { display: flex; flex-direction: column; gap: 2px; }
.wind-row { display: grid; grid-template-columns: 1fr 1fr 1fr; align-items: center; font-family: var(--mono); font-size: 12.5px; padding: 4px 8px; border-radius: 5px; }
.wind-row .wa { color: var(--text-dim); }
.wind-row .wd { text-align: center; color: var(--text); }
.wind-row .ws { text-align: right; color: var(--accent); }
.wind-row.mod .ws { color: var(--caution); }
.wind-row.strong .ws { color: var(--nogo); }
.wind-row:nth-child(even) { background: var(--panel-2); }
.wind-row.hdr { color: var(--text-faint); font-size: 10px; letter-spacing: 0.6px; background: transparent; border-bottom: 1px solid var(--border); border-radius: 0; }
.wind-row.hdr .wd { text-align: center; }
.wind-row.hdr .ws { text-align: right; color: var(--text-faint); }

/* Route lookup result fills the available width (single card, not a grid). */
.route-detail { margin-top: 12px; }
.route-detail .card { width: 100%; }

/* Removable chips for the routes currently overlaid on the map. */
.route-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 12px; }
.rc-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-faint); }
.route-chip { display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--text); background: var(--panel-2); border: 1px solid var(--border-bright); border-radius: 999px; padding: 3px 5px 3px 9px; }
.route-chip .rc-dot { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.rc-ir .rc-dot { background: #3fb950; } /* low-level green */
.rc-vr .rc-dot { background: #3fb950; }
.rc-ar .rc-dot { background: #4aa3df; } /* A/R blue */
.route-chip-x { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; border-radius: 50%; border: none; background: transparent; color: var(--text-dim); font-size: 15px; line-height: 1; cursor: pointer; padding: 0; }
.route-chip-x:hover { background: var(--nogo); color: #fff; }
.route-chip-clear { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.3px; color: var(--text-dim); background: transparent; border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; cursor: pointer; }
.route-chip-clear:hover { border-color: var(--accent-dim); color: var(--text); }

/* ---- Sortie plan (phase-by-phase) --------------------------------------- */
.sortie-hint { font-size: 12px; line-height: 1.5; color: var(--text-dim); margin: 0 0 12px; }
.rof-row { align-items: flex-end; }
.rof-hint { font-weight: 400; color: var(--text-faint); font-size: 11px; }
.rof-hint code { font-family: var(--mono); background: var(--panel-2); padding: 0 4px; border-radius: 4px; }
.rof-status { font-size: 12px; margin-top: 6px; min-height: 0; }
.rof-status .rof-ok { color: var(--go); font-family: var(--mono); }
.rof-status .rof-warn { color: var(--warn, #d29922); }
.rof-status .rof-load { color: var(--text-dim); }
.mtr-points { font-size: 12px; color: var(--text-dim); margin: 6px 0; }
.mtr-points .mtr-pts { font-family: var(--mono); color: var(--text); letter-spacing: 1px; }
.mtr-points code { font-family: var(--mono); background: var(--panel-2); padding: 1px 5px; border-radius: 4px; color: var(--accent); }
.mtr-portion { font-family: var(--mono); font-size: 11px; color: var(--accent); border: 1px solid var(--border-bright); border-radius: 5px; padding: 1px 6px; margin-left: 6px; }
.sortie-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.sphase { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; background: var(--panel-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; }
.sphase-tag { font-family: var(--mono); font-size: 11px; font-weight: 700; letter-spacing: 0.4px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; border: 1px solid; }
.sphase-tag.dep { color: var(--go); border-color: rgba(63,185,80,0.5); background: rgba(63,185,80,0.1); }
.sphase-tag.ll { color: #c77dff; border-color: rgba(199,125,255,0.5); background: rgba(199,125,255,0.1); }
.sphase-tag.ar { color: #46c6a0; border-color: rgba(70,198,160,0.5); background: rgba(70,198,160,0.1); }
.sphase-tag.rec { color: var(--accent); border-color: var(--accent-dim); background: rgba(55,182,195,0.1); }
.sphase-tag.alt { color: var(--caution); border-color: rgba(210,153,34,0.5); background: rgba(210,153,34,0.1); }
.sp-field { flex: 1; min-width: 130px; font-family: var(--mono); font-size: 13px; color: var(--text); background: var(--panel); border: 1px solid var(--border-bright); border-radius: 8px; padding: 8px 10px; outline: none; }
.sp-field:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(55,182,195,0.18); }
.sphase input[type="date"], .sp-hhmm { font-family: var(--mono); font-size: 12px; color: var(--text); background: var(--panel); border: 1px solid var(--border-bright); border-radius: 8px; padding: 7px 9px; outline: none; color-scheme: dark; }
.sphase input[type="date"]:focus, .sp-hhmm:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(55,182,195,0.18); }
.sp-hhmm { width: 4.2em; text-align: center; letter-spacing: 1.5px; }
.sp-hhmm::placeholder { letter-spacing: 1px; color: var(--text-faint); }
.sp-note { font-size: 11px; color: var(--text-faint); }
.sp-z { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.5px; color: var(--accent); border: 1px solid var(--accent-dim); border-radius: 5px; padding: 2px 5px; align-self: center; }
@media (max-width: 640px) { .sortie-grid { grid-template-columns: 1fr; } }

/* Relocated low-level route detail (chips + per-leg cards), shown under the map */
.route-results:not(:empty) { margin: 4px 0 18px; }

/* Phase grouping in the brief output */
.phase-group { margin-bottom: 18px; }
.phase-group-h { font-family: var(--mono); font-size: 12px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase; color: var(--text-dim); padding: 0 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.ll-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid #c77dff; border-radius: 9px; padding: 10px 12px; }
.ll-hint { font-size: 11.5px; color: var(--text-dim); }

/* Per-card phase banner + role tag */
.role-tag { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.5px; padding: 3px 7px; border-radius: 6px; border: 1px solid; white-space: nowrap; }
.role-tag.role-departure { color: var(--go); border-color: rgba(63,185,80,0.5); background: rgba(63,185,80,0.1); }
.role-tag.role-recovery { color: var(--accent); border-color: var(--accent-dim); background: rgba(55,182,195,0.1); }
.role-tag.role-alternate { color: var(--caution); border-color: rgba(210,153,34,0.5); background: rgba(210,153,34,0.1); }
.phase-when { font-family: var(--mono); font-size: 12px; color: var(--accent); background: rgba(55,182,195,0.08); border: 1px solid var(--border); border-radius: 7px; padding: 6px 10px; }
.phase-when.future { color: var(--caution); background: rgba(210,153,34,0.08); border-color: rgba(210,153,34,0.35); }
.phase-caveat { font-size: 11.5px; line-height: 1.45; color: var(--text-dim); margin-top: 6px; }

/* ---- MTR detail ---------------------------------------------------------- */
.bird-badge { font-family: var(--mono); font-size: 9px; letter-spacing: 0.4px; padding: 2px 6px; border-radius: 4px; border: 1px solid var(--border-bright); white-space: nowrap; }
.mtr-bird { font-size: 12.5px; margin-bottom: 4px; }
/* Route weather-hazards block (convective/SIGMET along route + icing). */
.mtr-wxblock { margin: 4px 0 8px; display: flex; flex-direction: column; gap: 3px; }
.mtr-wx { font-size: 12px; color: var(--text-dim); }
.mtr-wx a { color: inherit; text-decoration: none; }
.mtr-wx a:hover { text-decoration: underline; filter: brightness(1.2); }
.mtr-wx.crit { color: #f7b1ad; }
.mtr-wx.ok { color: var(--go, #3fb950); }
.mtr-wx small { color: var(--text-faint); }
.mtr-wx.ice-moderate { color: #f7b1ad; }
.mtr-wx.ice-light { color: #f0c552; }
.mtr-wx.ice-trace { color: var(--text-dim); }
.mtr-ice { font-family: var(--mono); font-size: 10px; font-weight: 700; border: 1px solid; border-radius: 5px; padding: 1px 5px; }
.mtr-ice.ice-moderate { color: #f7b1ad; border-color: rgba(248,81,73,0.5); }
.mtr-ice.ice-light { color: #f0c552; border-color: rgba(210,153,34,0.5); }
.mtr-ice.ice-trace { color: var(--text-dim); border-color: var(--border); }
.mtr-when { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-bottom: 10px; }
.mtr-when b { color: var(--accent); }
.mtr-segs { display: flex; flex-direction: column; gap: 8px; }
.mtr-seg { background: var(--panel-2); border: 1px solid var(--border); border-left: 3px solid #4aa3df; border-radius: 7px; padding: 8px 10px; }
.mtr-seg-h { font-family: var(--mono); font-size: 13px; color: var(--text); }
.mtr-seg-w { font-family: var(--mono); font-size: 12px; color: var(--accent); margin-top: 4px; }
.mtr-seg-w.hi { color: var(--nogo); }

/* ---- Map ----------------------------------------------------------------- */
/* ---- TAF degradation banner + forecast-ranked alternates ---- */
.degrade-banner { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.alt-rank-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 10px; }
.alt-rank-lbl { font-size: 11.5px; color: var(--text-dim); }
.alt-rank { font-family: var(--mono); font-size: 11.5px; font-weight: 700; border: 1px solid var(--border-bright); border-radius: 7px; padding: 3px 9px; color: var(--text); }
.alt-rank small { font-weight: 400; color: var(--text-dim); }
.alt-rank.go { border-color: rgba(63,185,80,0.5); }
.alt-rank.caution { border-color: rgba(210,153,34,0.55); }
.alt-rank.nogo { border-color: rgba(248,81,73,0.6); }
.alt-rank-badge { font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: 0.4px; color: var(--text-dim); border: 1px solid var(--border-bright); border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.alt-rank-badge.best { color: var(--go); border-color: rgba(63,185,80,0.55); background: rgba(63,185,80,0.1); }

/* ---- Mission hazard ribbon (sortie as flown) ---- */
.rb-section { margin-bottom: 22px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.rb-section .tool-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; cursor: default; }
.rb-note { font-size: 11px; color: var(--text-faint); margin-left: auto; }
.rb-sum { font-family: var(--mono); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 6px; border: 1px solid; }
.rb-sum.go { color: var(--go); border-color: rgba(63,185,80,0.5); background: rgba(63,185,80,0.1); }
.rb-sum.caution { color: var(--caution); border-color: rgba(210,153,34,0.5); background: rgba(210,153,34,0.1); }
.rb-sum.nogo { color: var(--nogo); border-color: rgba(248,81,73,0.5); background: rgba(248,81,73,0.1); }
.rb-track { display: flex; align-items: stretch; gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.rb-arrow { display: flex; align-items: center; color: var(--text-faint); font-size: 16px; flex: none; }
.rb-phase { flex: 1 1 0; min-width: 124px; border: 1px solid var(--border); border-left: 4px solid var(--border-bright); border-radius: 9px; padding: 8px 10px; background: var(--panel-2); }
.rb-phase.rb-go { border-left-color: var(--go); }
.rb-phase.rb-caution { border-left-color: var(--caution); background: rgba(210,153,34,0.06); }
.rb-phase.rb-nogo { border-left-color: var(--nogo); background: rgba(248,81,73,0.07); }
.rb-phase.rb-na { border-left-color: var(--border-bright); }
.rb-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.rb-role { font-family: var(--mono); font-size: 10px; font-weight: 800; letter-spacing: 0.5px; color: var(--text-dim); }
.rb-clear { font-size: 10px; color: var(--go); }
.rb-id { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--text); margin-top: 2px; }
.rb-time { font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.rb-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.rb-chip { font-family: var(--mono); font-size: 10px; font-weight: 700; border: 1px solid; border-radius: 5px; padding: 1px 5px; }
.rb-chip.sev-go { color: var(--go); border-color: rgba(63,185,80,0.45); }
.rb-chip.sev-caution { color: var(--caution); border-color: rgba(210,153,34,0.5); }
.rb-chip.sev-nogo { color: var(--nogo); border-color: rgba(248,81,73,0.55); }
.rb-chip.sev-info { color: var(--text-faint); border-color: var(--border); }
.rb-chip-link { text-decoration: none; cursor: pointer; }
.rb-chip-link:hover { text-decoration: underline; filter: brightness(1.2); }
.rb-foot { font-size: 11px; color: var(--text-faint); margin-top: 9px; line-height: 1.45; }

/* ---- Sortie timeline (hour-by-hour status per field) ---- */
.tl-section { margin-bottom: 22px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.tl-section .tool-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; cursor: default; }
.tl-demo { font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: #f0b429; border: 1px solid rgba(240,180,41,0.55); background: rgba(240,180,41,0.1); border-radius: 5px; padding: 2px 7px; }
.tl-range { font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-left: auto; }
.tl-grid { display: grid; gap: 3px; overflow-x: auto; }
.tl-row { display: grid; grid-template-columns: 92px repeat(var(--tlcols), minmax(24px, 1fr)); gap: 3px; align-items: stretch; }
.tl-lbl { font-family: var(--mono); font-size: 11.5px; font-weight: 700; color: var(--text); display: flex; align-items: center; gap: 5px; white-space: nowrap; overflow: hidden; }
.tl-lbl small { color: var(--text-faint); font-weight: 400; }
.tl-hours .tl-h { font-family: var(--mono); font-size: 10px; color: var(--text-dim); text-align: center; padding: 2px 0; }
.tl-hours .tl-h.tl-now { color: var(--accent); font-weight: 700; }
.tl-c { position: relative; height: 26px; border-radius: 5px; border: 1px solid var(--border); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.tl-c.tl-now { outline: 2px solid var(--accent); outline-offset: -1px; }
.tl-go { background: rgba(63,185,80,0.4); border-color: rgba(63,185,80,0.55); }
.tl-caution { background: rgba(210,153,34,0.45); border-color: rgba(210,153,34,0.6); }
.tl-nogo { background: rgba(248,81,73,0.5); border-color: rgba(248,81,73,0.65); }
.tl-na { background: repeating-linear-gradient(135deg, var(--panel-2) 0 5px, var(--panel) 5px 10px); }
.tl-mark { font-family: var(--mono); font-size: 10px; font-weight: 800; color: #0a0e14; background: var(--text); border-radius: 4px; padding: 0 4px; line-height: 15px; }
.tl-legend { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; font-size: 11px; color: var(--text-dim); }
.tl-legend .tl-sw { display: inline-block; width: 13px; height: 13px; border-radius: 4px; vertical-align: -2px; margin-right: 5px; border: 1px solid var(--border); }
.tl-legend .tl-note { color: var(--text-faint); }
.tl-legend .tl-leg-h { font-weight: 700; color: var(--text-dim); }
.tl-legend .tl-mark { margin-right: 4px; }
.tl-sw.tl-nowleg { background: transparent; outline: 2px solid var(--accent); outline-offset: -2px; }
.tl-bird { font-family: var(--mono); font-size: 10px; font-weight: 800; color: #0a0e14; opacity: 0.75; }
.tl-detail { font-family: var(--mono); font-size: 12px; color: var(--text); margin-top: 8px; min-height: 0; }

/* NVG ILLUM timeline row: day / twilight / night-HIGH / night-LOW bands. The
   night cells are dark; the glyph (☀ t H L) reads regardless of color. */
.tl-illum-lbl { color: var(--text-dim); }
.tl-c.tl-day, .tl-sw.tl-day { background: rgba(210,153,34,0.30); border-color: rgba(210,153,34,0.45); }
.tl-c.tl-twi, .tl-sw.tl-twi { background: rgba(120,130,170,0.40); border-color: rgba(120,130,170,0.55); }
.tl-c.tl-nh, .tl-sw.tl-nh { background: rgba(70,110,200,0.45); border-color: rgba(90,130,220,0.6); }
.tl-c.tl-nl, .tl-sw.tl-nl { background: rgba(20,28,52,0.85); border-color: rgba(60,72,120,0.6); }
.tl-c.tl-day, .tl-c.tl-twi, .tl-c.tl-nh, .tl-c.tl-nl { font-family: var(--mono); font-size: 11px; font-weight: 800; color: var(--text); }

.map-section { margin-bottom: 22px; }
.map-panel { position: relative; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.map-viewport { position: relative; width: 100%; height: clamp(260px, 42vh, 460px); overflow: hidden; background: #0c121a; cursor: grab; touch-action: none; resize: vertical; min-height: 200px; max-height: 88vh; }
/* Visible drag-grip over the native resizer (pointer-events:none so the drag
   still reaches the browser's resize handle underneath). */
.map-viewport::after { content: ""; position: absolute; right: 3px; bottom: 3px; width: 13px; height: 13px; z-index: 7; pointer-events: none; opacity: 0.65; background: repeating-linear-gradient(135deg, var(--text-faint) 0 1px, transparent 1px 3px); }
.map-viewport::-webkit-resizer { background: transparent; }
.map-viewport.dragging { cursor: grabbing; }
.map-tiles { position: absolute; inset: 0; }
.map-tiles.radar { pointer-events: none; mix-blend-mode: screen; }
.map-tile { position: absolute; width: 256px; height: 256px; user-select: none; pointer-events: none; }
.map-overlay { position: absolute; inset: 0; pointer-events: none; }
.map-controls { position: absolute; top: 10px; right: 10px; z-index: 5; display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 8px; max-width: calc(100% - 20px); padding: 6px 9px; background: rgba(14, 19, 27, 0.85); border: 1px solid var(--border-bright); border-radius: 8px; font-size: 12px; color: var(--text-dim); backdrop-filter: blur(4px); }
.map-controls button { width: 26px; height: 26px; font-size: 16px; line-height: 1; color: var(--text); background: var(--panel-2); border: 1px solid var(--border-bright); border-radius: 6px; cursor: pointer; }
.map-controls button:hover { border-color: var(--accent); color: var(--accent); }
.map-toggle { display: flex; align-items: center; gap: 4px; cursor: pointer; }
.map-controls input[type="range"] { width: 70px; accent-color: var(--accent); }
.map-attrib { position: absolute; bottom: 4px; left: 6px; z-index: 5; font-size: 9px; color: var(--text-faint); background: rgba(10, 14, 20, 0.6); padding: 1px 5px; border-radius: 4px; }

/* Radar animation bar — play/scrub the RainViewer radar loop. */
.map-radarbar { position: absolute; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 24px); padding: 5px 9px; background: rgba(14, 19, 27, 0.9); border: 1px solid var(--border-bright); border-radius: 9px; font-size: 11px; color: var(--text-dim); backdrop-filter: blur(4px); }
.map-radarbar button[data-act="rplay"] { width: 26px; height: 24px; font-size: 12px; line-height: 1; color: var(--text); background: var(--panel-2); border: 1px solid var(--border-bright); border-radius: 6px; cursor: pointer; }
.map-radarbar input[type="range"] { width: clamp(90px, 30vw, 220px); accent-color: var(--accent); }
.map-radarbar .rb-time { font-family: var(--mono); font-size: 11px; color: var(--text); white-space: nowrap; }
.map-radarbar .rb-hint { font-size: 9.5px; color: var(--text-faint); white-space: nowrap; }
@media (max-width: 560px) { .map-radarbar .rb-hint { display: none; } }

/* Zoom + recenter cluster */
.map-nav { position: absolute; right: 10px; bottom: 22px; z-index: 5; display: flex; flex-direction: column; gap: 4px; }
.map-nav button { width: 30px; height: 30px; font-size: 17px; line-height: 1; color: var(--text); background: rgba(14, 19, 27, 0.9); border: 1px solid var(--border-bright); border-radius: 7px; cursor: pointer; }
.map-nav button:hover { border-color: var(--accent); color: var(--accent); }

/* Map weather valid-times caption (top-left) */
.map-times { position: absolute; left: 10px; top: 10px; z-index: 6; max-width: 75%; padding: 7px 10px; background: rgba(10, 14, 20, 0.92); border: 1px solid var(--border-bright); border-radius: 8px; font-size: 11px; color: var(--text-dim); backdrop-filter: blur(4px); }
.map-times .lg-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-faint); margin-bottom: 4px; }
.mt-row { display: flex; align-items: baseline; gap: 8px; margin: 2px 0; white-space: nowrap; }
.mt-k { font-family: var(--mono); font-size: 9.5px; color: var(--text-faint); min-width: 74px; }
.mt-v { font-family: var(--mono); font-size: 10.5px; color: var(--text); }
.mt-note { color: var(--text-faint); font-size: 9px; margin-top: 4px; }

/* Map legend */
.map-legend { position: absolute; left: 10px; bottom: 22px; z-index: 6; max-width: 70%; padding: 8px 10px; background: rgba(10, 14, 20, 0.92); border: 1px solid var(--border-bright); border-radius: 8px; font-size: 11px; color: var(--text-dim); backdrop-filter: blur(4px); }
.lg-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-faint); margin-bottom: 5px; }
.lg-row { display: flex; align-items: center; gap: 5px; margin: 3px 0; }
.lg-row.lg-note { color: var(--text-faint); font-size: 10px; margin-top: 5px; }
.lg-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.lg-dia { width: 9px; height: 9px; display: inline-block; transform: rotate(45deg); }
.lg-ring { width: 11px; height: 11px; border-radius: 50%; border: 1.5px dashed var(--accent); display: inline-block; }
.lg-poly { width: 12px; height: 9px; border: 1.5px dashed; display: inline-block; }
.lg-line { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }

/* ---- Responsive (tablet / phone) ----------------------------------------- */
@media (max-width: 1040px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
  .app { padding: 14px 12px 50px; }
  .topbar { gap: 10px; padding-bottom: 14px; margin-bottom: 16px; }
  .topbar h1 { font-size: 15px; }
  .topbar .subtitle { font-size: 11px; }
  .controls .row { gap: 10px; }
  .field.grow { min-width: 100%; }
  /* Xwind / Tailwind / High DA: equal-width and wrap as a clean group instead
     of shrinking below their content (which overlapped on narrow screens). */
  .field.num { flex: 1 1 88px; min-width: 88px; }
  .field.num label { font-size: 10px; letter-spacing: 0.3px; white-space: nowrap; }
  .field.num input { width: 100%; }
  button.go { flex: 1 1 auto; }
  .sortie-row .field.grow { min-width: 100%; }
  .field select { min-width: 0; width: 100%; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .map-viewport { height: clamp(220px, 50vh, 360px); }
  .map-controls { font-size: 11px; gap: 6px; padding: 5px 7px; }
  .map-controls button { width: 24px; height: 24px; }
  .map-controls input[type="range"] { width: 56px; }
  .wind-block { flex-direction: column; align-items: flex-start; gap: 10px; }
  .wind-readout { width: 100%; }
}

/* ============================================================================
   Kneeboard print / PDF — flip the whole themed UI to an ink-friendly layout by
   redefining the CSS variables, hide on-screen chrome, and avoid card breaks.
   ============================================================================ */
@media print {
  :root {
    --bg: #fff; --bg-grad-1: #fff; --bg-grad-2: #fff;
    --panel: #fff; --panel-2: #fff; --panel-raised: #fff;
    --border: #b9c0c8; --border-bright: #8c95a0;
    --text: #000; --text-dim: #333; --text-faint: #555;
    --accent: #075b6b; --accent-dim: #0a6678;
    --go: #1a7f2e; --caution: #8a5d00; --nogo: #b3231b;
    --shadow: none;
  }
  @page { margin: 12mm; }
  body { background: #fff; }
  .app { max-width: none; padding: 0; }
  .topbar, .controls, .footer, .map-section { display: none !important; }
  .as-row { background: #fff !important; }
  /* Expand all tab panels for the kneeboard printout. */
  .card-tabs { display: none !important; }
  .tabpanels { border: none; padding: 0; }
  .tabpanel { display: block !important; border-top: 1px solid #ccc; padding-top: 8px; margin-top: 8px; }
  .raw-taf { display: none !important; }

  /* Essential-NOTAMs print mode: hide procedural/routine NOTAMs, show the
     per-category "N omitted" note instead (nothing disappears silently). */
  body.print-essential .notam.n-routine { display: none !important; }
  body.print-essential .n-hidden-note { display: block !important; }

  /* Print polish: screen-only affordances add nothing on paper. */
  [data-tip]::after { content: none !important; }     /* tap-to-reveal ⓘ icons */
  .chev, .card-chev, .ngroup-chev { display: none !important; } /* collapse arrows */
  .rwys-cap, .tl-detail, .route-chip-x, .route-chip-clear { display: none !important; } /* tap hints/buttons */
  .tl-legend .tl-note { display: none; }              /* "tap a cell" explainer */

  .print-head { display: block; margin-bottom: 12px; border-bottom: 2px solid #000; padding-bottom: 8px; }
  .print-head .ph-title { font-size: 18px; font-weight: 800; letter-spacing: 1px; }
  .print-head .ph-meta { font-family: var(--mono); font-size: 11px; color: #222; margin-top: 2px; }
  .print-head .ph-warn { color: #b3231b; font-weight: 700; margin-top: 4px; }

  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { break-inside: avoid; box-shadow: none; border: 1px solid #999; }
  .card .body { gap: 10px; }
  .raw, .metric, .comp .box, .rwy-row, .notam, .taf, .warn-item { background: #fff !important; }
  .status-led { border-width: 1.5px; }

  /* NVG illumination block: keep it whole on the kneeboard and let its cells
     print on white. The LOW/HIGH chip keeps its color (it carries the call). */
  .illum-block { break-inside: avoid; border: 1px solid #999; }
  .illum-block .il-cell { background: #fff !important; border-color: #bbb; }
  .illum-block .cat-chip { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  /* Timeline ILLUM band cells must print their fill — the band IS the data. */
  .tl-c.tl-day, .tl-c.tl-twi, .tl-c.tl-nh, .tl-c.tl-nl,
  .tl-sw.tl-day, .tl-sw.tl-twi, .tl-sw.tl-nh, .tl-sw.tl-nl {
    -webkit-print-color-adjust: exact; print-color-adjust: exact;
  }
}
