/* Palette follows the validated reference data-viz palette (light + dark). */
:root {
  color-scheme: light;
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, 0.1);
  --series-1: #2a78d6;   /* blue: recorded tracks, bars */
  --series-2: #eb6834;   /* orange: selected flight */
  --series-3: #1baf7a;
  --est: #898781;        /* great-circle estimates */
  --warn: #fab219;
  --good: #006300;
  --bad: #d03b3b;        /* errors, Delete */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 4px 16px rgba(0, 0, 0, 0.05);
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, 0.1);
    --series-1: #3987e5;
    --series-2: #d95926;
    --series-3: #199e70;
    --good: #0ca30c;
    --bad: #ef6b6b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 4px 16px rgba(0, 0, 0, 0.3);
  }
}

* { box-sizing: border-box; }
/* The browser's own [hidden] rule is weaker than any id or class selector that
   sets display, so elements toggled with .hidden = true would stay on screen.
   This makes the attribute mean what it says. */
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--page);
  padding: 0 20px 32px;
}
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: 20px; }
h2 { font-size: 15px; }
p { margin: 0; }
.muted { color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
a { color: var(--series-1); }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 16px 0 12px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 26px; line-height: 1; color: var(--series-1); }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
/* Who is signed in, with Sign out and Change password beside the name. */
.account { display: inline-flex; gap: 6px; align-items: center; padding-left: 8px; border-left: 1px solid var(--border); font-size: 13px; }
#password-dlg { width: min(440px, calc(100vw - 32px)); }
/* People (owner only): accounts, invitations, and a new invitation's link. */
#people-dlg { width: min(680px, calc(100vw - 32px)); }
#people-dlg h2 { margin-right: 44px; }
#people-dlg > .muted { margin: 4px 0 8px; }
#people-dlg h3 { font-size: 13px; color: var(--ink-2); margin: 16px 0 6px; }
#people-users tbody tr { cursor: default; }
#people-users tbody tr:hover { background: none; }
.people-confirm { display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.people-invites { list-style: none; padding: 0; margin: 0 0 8px; }
.people-invites li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--grid); font-size: 13px; }
.invite-link { padding: 10px 12px; margin-bottom: 10px; border: 1px solid var(--series-1); border-radius: 8px; background: color-mix(in srgb, var(--series-1) 8%, var(--page)); }
.invite-link p { margin: 0 0 6px; font-size: 13px; }
.invite-row { display: flex; gap: 8px; margin-bottom: 6px; }
.invite-row input { flex: 1; min-width: 0; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.btn {
  font: inherit; font-weight: 550; cursor: pointer; text-decoration: none;
  padding: 7px 12px; border-radius: 8px; border: 1px solid transparent;
  background: var(--series-1); color: #fff;
}
.btn:hover { filter: brightness(1.08); }
.btn.ghost { background: var(--surface); color: var(--ink); border-color: var(--border); }
.btn[disabled] { opacity: 0.6; cursor: progress; }

.filters {
  display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: end;
  padding: 12px 16px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.filters label.check { flex-direction: row; align-items: center; gap: 8px; align-self: center; padding-top: 14px; }
.filters select, .filters input[type="search"], .list-head select {
  font: inherit; color: var(--ink); background: var(--page);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; min-width: 150px;
}
.filters input[type="search"] { min-width: 240px; }
#filter-summary { margin-left: auto; align-self: center; }

/* Total miles, the number the page leads with. */
.hero {
  display: flex; align-items: baseline; gap: 18px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 18px; margin-bottom: 10px; box-shadow: var(--shadow);
}
.hero .figure {
  font-size: 56px; font-weight: 680; letter-spacing: -0.03em; line-height: 1;
}
.hero .figure small { font-size: 20px; font-weight: 500; color: var(--ink-2); margin-left: 6px; letter-spacing: 0; }
.hero .label { font-size: 13px; color: var(--ink-2); }
.hero .notes { margin-left: auto; text-align: right; font-size: 12px; color: var(--muted); line-height: 1.6; }
@media (max-width: 700px) {
  .hero .figure { font-size: 40px; }
  .hero .notes { margin-left: 0; text-align: left; }
}

.kpis {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px;
  margin-bottom: 14px;
}
@media (max-width: 760px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* An ultrawide has room for the whole row at once. */
@media (min-width: 1700px) { .kpis { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow);
}
.kpi .label { font-size: 12px; color: var(--ink-2); }
.kpi .value { font-size: 26px; font-weight: 650; letter-spacing: -0.02em; margin-top: 2px; }
.kpi .value small { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-left: 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* The map is the point of the page, so it takes the height the window allows
   and, on a wide screen, everything the flight list does not need. */
.main {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(360px, 2fr); gap: 14px;
  margin-bottom: 14px;
  --map-h: clamp(520px, calc(100vh - 300px), 1100px);
}
@media (max-width: 1000px) { .main { grid-template-columns: 1fr; } }
@media (min-width: 1500px) { .main { grid-template-columns: minmax(0, 1fr) 460px; } }
@media (min-width: 2200px) { .main { grid-template-columns: minmax(0, 1fr) 520px; } }

.map-wrap { position: relative; min-height: var(--map-h); }
#map, #globe {
  height: 100%; min-height: var(--map-h); border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface); overflow: hidden;
}
#globe { position: absolute; inset: 0; }
#globe .cesium-viewer-bottom { right: 8px; bottom: 4px; left: auto; }
#globe .cesium-widget-credits { font-size: 10px; }

.map-controls {
  position: absolute; top: 10px; right: 10px; z-index: 500;
  display: flex; gap: 8px; align-items: center;
}
.map-controls .inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.map-controls select {
  font: inherit; font-size: 12px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px;
}
#globe-tools {
  display: flex; gap: 8px; align-items: center; padding: 5px 8px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow);
}
.btn.small { padding: 4px 9px; font-size: 12px; }
.seg {
  display: inline-flex; background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border); border-radius: 9px; overflow: hidden; box-shadow: var(--shadow);
}
.seg button {
  font: inherit; font-weight: 600; font-size: 12px; cursor: pointer;
  padding: 5px 12px; border: none; background: none; color: var(--ink-2);
}
.seg button.on { background: var(--series-1); color: #fff; }

#play-readout {
  position: absolute; top: 56px; right: 10px; z-index: 500;
  display: flex; gap: 12px; align-items: center; padding: 6px 10px; font-size: 12px;
  font-variant-numeric: tabular-nums; color: var(--ink);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow);
}
#play-clock { font-weight: 650; }
.map-legend {
  position: absolute; left: 10px; bottom: 10px; z-index: 500;
  display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 10px; font-size: 12px;
  max-width: calc(100% - 20px); /* whole items wrap onto a new line rather than squeezing into columns */
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  border: 1px solid var(--border); border-radius: 8px; color: var(--ink-2);
}
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 22px; height: 0; border-top: 2px solid var(--series-1); }
.swatch.line-est { border-top: 2px dashed var(--est); }
/* A coverage gap: the altitude colours, faded, solid (dashes mean no track at all). */
.swatch.line-gap { border-top: none; height: 3px; border-radius: 2px; opacity: 0.35; }
.swatch.line-selected { border-top: 4px solid var(--series-2); }
.swatch.arrow-key { border: none; width: auto; height: auto; color: var(--ink-2); font-size: 13px; line-height: 1; }
.alt-key { gap: 8px !important; }
.ramp {
  display: inline-block; width: 96px; height: 8px; border-radius: 4px;
  border: 1px solid var(--border);
}
/* Direction arrows drawn over the flat map. */
.dir-arrow { pointer-events: none; }
.dir-arrow svg { display: block; filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.65)); }
.leaflet-container { font: inherit; }
.leaflet-tooltip { font: inherit; font-size: 12px; }
.airport-label {
  background: none; border: none; box-shadow: none; color: var(--ink);
  font-weight: 650; font-size: 11px; text-shadow: 0 0 3px var(--page), 0 0 3px var(--page);
  padding: 0;
}
.leaflet-tooltip.airport-label::before { display: none; }
/* Hover cards on the map: an airport's and a flight's are told apart by a
   label pill and a coloured edge (the dot's blue; the line's own colour). */
.leaflet-tooltip.tip { padding: 0; color: var(--ink); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); }
.tip .tip-body { padding: 6px 10px 6px 9px; line-height: 1.5; border-left: 4px solid var(--series-1); border-radius: 7px 0 0 7px; }
.tip .tip-kind {
  display: inline-block; margin-right: 6px; padding: 0 7px; border-radius: 999px; vertical-align: 1px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
}
.tip-airport .tip-kind { background: var(--series-1); color: #fff; }
.tip-flight .tip-kind { background: color-mix(in srgb, var(--ink) 8%, var(--surface)); color: var(--ink-2); border: 1px solid var(--border); }
.leaflet-tooltip-top.tip::before { border-top-color: var(--surface); }
.leaflet-tooltip-bottom.tip::before { border-bottom-color: var(--surface); }
.leaflet-tooltip-left.tip::before { border-left-color: var(--surface); }
.leaflet-tooltip-right.tip::before { border-right-color: var(--surface); }

.list-wrap {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column; height: var(--map-h); box-shadow: var(--shadow);
}
.list-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px 8px; }
.list-head select { min-width: 0; padding: 4px 6px; font-size: 12px; }
.table-scroll { overflow: auto; flex: 1; }
.table-scroll.small { max-height: 260px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 0; background: var(--surface); text-align: left; font-weight: 600;
  font-size: 12px; color: var(--ink-2); padding: 6px 10px; border-bottom: 1px solid var(--grid);
}
tbody td { padding: 7px 8px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
#flights td:first-child, #flights th:first-child { padding-left: 14px; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: color-mix(in srgb, var(--series-1) 8%, transparent); }
tbody tr.selected { background: color-mix(in srgb, var(--series-2) 14%, transparent); }
tbody tr.untracked td.route::after { content: " ·"; color: var(--muted); }
.tag {
  display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 999px;
  background: color-mix(in srgb, var(--series-1) 12%, transparent); color: var(--ink-2); margin-left: 6px;
}
.tag.est { background: color-mix(in srgb, var(--est) 18%, transparent); }
.tag.warn { background: color-mix(in srgb, var(--warn) 25%, transparent); }
#airports-table tbody tr { cursor: default; }

/* Time scrubber. Drives every number on the page, not just the map. */
.timeline {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 10px 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.timeline .inline { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.timeline select {
  font: inherit; font-size: 12px; color: var(--ink); background: var(--page);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 6px;
}
.timeline .btn { min-width: 88px; }
.tl-track { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 2px; }
.tl-ends { display: flex; justify-content: space-between; font-size: 11px; }
.tl-date {
  font-size: 15px; font-weight: 650; min-width: 200px; text-align: center;
  font-variant-numeric: tabular-nums;
}
#tl-slider { width: 100%; margin: 0; accent-color: var(--series-1); cursor: pointer; }
.timeline.playing .tl-date { color: var(--series-2); }
#play-readout label { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; }

.charts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px;
}
@media (min-width: 1000px) {
  .charts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .charts .card.wide { grid-column: 1 / -1; }
  .charts .card.wide .chart-box { height: 200px; }
}
.card {
  margin: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px 8px; box-shadow: var(--shadow);
}
.card figcaption { font-weight: 600; font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.chart-box { position: relative; height: 240px; }

dialog {
  border: 1px solid var(--border); border-radius: 14px; background: var(--surface); color: var(--ink);
  padding: 20px 22px; width: min(720px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
dialog::backdrop { background: rgba(0, 0, 0, 0.35); }
.detail-close { position: absolute; top: 10px; right: 10px; margin: 0; }
.detail h2 { font-size: 20px; margin-bottom: 2px; }
.detail .sub { color: var(--ink-2); margin-bottom: 14px; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px 16px; margin: 10px 0 14px; }
.fact .label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.fact .value { font-size: 15px; font-weight: 600; }
.fact .value small { font-weight: 400; color: var(--ink-2); font-size: 12px; }
.detail .links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.profile { position: relative; height: 160px; margin-top: 8px; }
#warnings-list { padding-left: 18px; color: var(--ink-2); }
#warnings-list li { margin: 6px 0; }
#warnings-list li.error { color: #d03b3b; }
#unlinked-box h3 { font-size: 14px; margin: 16px 0 4px; }
#unlinked-list { padding-left: 18px; }
#unlinked-list li { margin: 4px 0; }

/* A flight with a receipt: its panel widens, details on the left, the receipt
   beside them, each scrolling on its own. Stacked on a narrow window. */
#detail.with-receipt { width: min(1400px, calc(100vw - 32px)); height: 85vh; }
#detail.with-receipt[open] { display: flex; flex-direction: column; }
#detail.with-receipt #detail-body { flex: 1; min-height: 0; }
.detail-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; height: 100%; }
.detail-main { min-height: 0; overflow: auto; padding-right: 4px; }
.receipt-viewer { display: flex; flex-direction: column; min-height: 0; }
.receipt-bar { display: flex; align-items: center; gap: 10px; min-height: 32px; margin: 0 44px 8px 0; font-size: 13px; }
.receipt-bar a { margin-left: auto; white-space: nowrap; }
.receipt-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.receipt-tabs { display: flex; gap: 4px; min-width: 0; overflow-x: auto; }
.receipt-tabs button {
  font: inherit; font-size: 12px; cursor: pointer; padding: 4px 10px; max-width: 16em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink-2);
}
.receipt-tabs button.on { background: var(--series-1); border-color: var(--series-1); color: #fff; }
.receipt-frame { flex: 1; min-height: 0; display: flex; overflow: auto; border: 1px solid var(--border); border-radius: 8px; background: var(--page); }
.receipt-frame iframe { flex: 1; width: 100%; border: 0; }
.file-drag .receipt-frame iframe { pointer-events: none; }
.receipt-frame img { max-width: 100%; height: auto; margin: 0 auto; align-self: flex-start; }
.receipt-frame p { margin: auto; padding: 16px; text-align: center; }
@media (max-width: 1000px) {
  #detail.with-receipt { height: auto; }
  .detail-split { display: block; }
  .detail-main { overflow: visible; padding-right: 0; }
  .receipt-viewer { height: 70vh; margin-top: 16px; }
  .receipt-bar { margin-right: 0; }
}

/* The airport panel: stats on the left, its flights (the flights table,
   narrowed to it) on the right, each scrolling on its own. */
#airport { width: min(1200px, calc(100vw - 32px)); height: 85vh; }
#airport[open] { display: flex; flex-direction: column; }
.airport-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr); position: relative; }
#airport-body { min-height: 0; }
.airport { display: flex; flex-direction: column; height: 100%; }
.airport h2 { font-size: 20px; margin: 0 44px 2px 0; }
.airport .sub { color: var(--ink-2); }
.airport h3 { font-size: 13px; color: var(--ink-2); margin: 14px 0 6px; }
.airport-scope { font-size: 12px; margin: 4px 0 10px; }
.airport-cols { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; }
.airport-stats, .airport-list { min-height: 0; overflow: auto; }
.airport-stats .facts { margin-top: 6px; }
.airport-empty { color: var(--ink-2); margin: 8px 0; }
#airport-table tr.empty { cursor: default; }
#airport-table tr.empty:hover { background: none; }
.airport-chart { height: 150px; }
.airport-lists { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 18px; }
.airport-tally { list-style: none; padding: 0; margin: 0; }
.airport-tally li { display: flex; justify-content: space-between; gap: 8px; padding: 3px 0; border-bottom: 1px solid var(--grid); font-size: 13px; }
.airport-list h3 { margin-top: 0; }

/* A flight opened from the airport panel shows in a pane of the same dialog:
   beside the panel on a wide window (the panel's table first, then its stats,
   in one column), over it on a narrower one, above it on a phone. */
#airport-flight { min-height: 0; display: flex; flex-direction: column; }
#airport-flight-body { flex: 1; min-height: 0; overflow: auto; }
.pane-back { align-self: flex-start; margin-bottom: 8px; }
@media (min-width: 1400px) {
  #airport.with-flight { width: calc(100vw - 32px); max-width: none; height: 90vh; }
  #airport.with-flight .airport-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 20px; }
  #airport-flight { border-left: 1px solid var(--grid); padding-left: 20px; }
  .pane-back { display: none; }
  #airport.with-flight .airport-cols { display: flex; flex-direction: column; gap: 16px; overflow: auto; }
  #airport.with-flight .airport-stats, #airport.with-flight .airport-list { min-height: auto; overflow: visible; }
  #airport.with-flight .airport-list { order: -1; }
}
@media (max-width: 1399px) {
  #airport-flight { position: absolute; inset: 0; z-index: 3; background: var(--surface); }
}
@media (max-width: 900px) {
  #airport { height: auto; }
  .airport-cols { display: block; }
  .airport-stats { overflow: visible; }
  .airport-list { overflow: visible; overflow-x: auto; margin-top: 16px; }
  /* Natural heights, so the dialog itself scrolls rather than squeezing its parts. */
  .airport-layout { display: flex; flex-direction: column; flex: none; }
  #airport-body, #airport-flight { min-height: auto; }
  #airport-flight { position: static; order: -1; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--grid); }
  #airport-flight-body { overflow: visible; }
}
@media (max-width: 560px) { .airport-lists { grid-template-columns: 1fr; } }

/* Forms: the add-flight dialog, the edit form and the lookup results. */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; margin: 12px 0; }
.form-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid h3 { font-size: 14px; color: var(--ink); }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } }
dialog input:not([type="checkbox"]):not([type="radio"]):not([type="file"]), dialog select, dialog textarea {
  font: inherit; color: var(--ink); background: var(--page);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px;
}
dialog textarea { resize: vertical; }
dialog input[type="file"] { font: inherit; font-size: 13px; color: var(--ink-2); }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.form-msg { font-size: 13px; margin: 8px 0; color: var(--ink-2); }
.form-msg.error { color: var(--bad); }
label.check { display: flex; flex-direction: row; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); margin: 8px 0; cursor: pointer; }
.lookup { margin-top: 12px; }
.lookup:empty { display: none; }
.lookup > p { margin: 8px 0; }
.preview {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--page);
  padding: 10px 14px; margin: 8px 0;
}
.preview-route { font-size: 18px; font-weight: 650; }
.preview .facts { margin: 6px 0 2px; }
.choices { list-style: none; padding: 0; margin: 8px 0; display: flex; flex-direction: column; gap: 6px; }
.choices li, .choice {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--page);
}
.choice { justify-content: flex-start; cursor: pointer; }
.choice:has(input:checked) { border-color: var(--series-1); background: color-mix(in srgb, var(--series-1) 8%, var(--page)); }
/* Inside a form (the rows of Add flights), a choice still reads as one line. */
.form-grid label.choice { flex-direction: row; font-size: inherit; color: inherit; }
fieldset.legs { border: 1px solid var(--border); border-radius: 8px; padding: 4px 12px; margin: 4px 0; }
fieldset.legs legend { font-size: 12px; color: var(--ink-2); padding: 0 4px; }
fieldset.legs label.check { margin: 4px 0; }
/* Add flights: one compact line per flight, wrapping on a narrow screen, with its lookup underneath. */
.add-head { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 2px; }
.add-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; padding: 6px 0; border-bottom: 1px solid var(--grid); }
.add-row [data-row="flight"] { flex: 0 1 8em; min-width: 6em; }
.add-row .add-extra { width: 4.5em; }
.add-row [data-row="cabin"] { width: 6.5em; }
.add-route { font-size: 13px; }
.add-hint { flex: 1 1 8em; font-size: 12px; color: var(--muted); }
.add-row.saved .add-hint { color: var(--good); }
.add-row .lookup { flex-basis: 100%; margin-top: 0; }
#a-more { margin-top: 8px; }
/* Dropping a receipt onto a dialog: its drop zone lights up while a file is over it. */
.drop-cue { display: none; font-weight: 600; color: var(--series-1); }
.dragging .drop-cue { display: block; }
.dragging .drop-zone { outline: 2px dashed var(--series-1); outline-offset: 4px; border-radius: 8px; background: color-mix(in srgb, var(--series-1) 8%, transparent); }

/* The detail panel's own controls. */
.detail h3 { font-size: 13px; color: var(--ink-2); margin: 0 0 6px; }
.detail .links .spacer { flex: 1; }
.detail .links > .muted { align-self: center; }
.btn.danger { color: var(--bad); }
.btn.danger:not(.ghost) { background: var(--bad); border-color: var(--bad); color: #fff; }
/* "Delete this flight?" inside the edit form. */
.confirm { padding: 8px 12px; border: 1px solid color-mix(in srgb, var(--bad) 45%, var(--border)); border-radius: 8px; background: var(--page); }
.confirm p { margin: 0 0 6px; }
.banner {
  padding: 8px 12px; border-radius: 8px; margin: 0 0 10px; font-size: 13px;
  background: color-mix(in srgb, var(--series-1) 10%, transparent);
}
.banner.warn { background: color-mix(in srgb, var(--warn) 22%, transparent); }
/* A flight's data notes, at the top of its panel: one line each, the table's ⚠ in front. */
.flight-warnings { list-style: none; border-left: 3px solid var(--warn); }
.flight-warnings li { display: flex; gap: 8px; }
.flight-warnings li + li { margin-top: 4px; }
.flight-notes { color: var(--ink-2); white-space: pre-wrap; margin: 0 0 10px; }
.receipts, #d-edit { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--grid); }
.receipt-list { list-style: none; padding: 0; margin: 0 0 8px; }
.receipt-list li { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.x {
  font: inherit; font-size: 16px; line-height: 1; cursor: pointer;
  border: none; background: none; color: var(--muted); padding: 2px 6px; border-radius: 6px;
}
.x:hover { color: var(--bad); background: color-mix(in srgb, var(--bad) 12%, transparent); }
.attach { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13px; }
.attach select { font-size: 12px; padding: 4px 6px; }
#d-attach { margin-top: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--page); }
#d-attach p { margin: 0 0 4px; }
.tag.booked { background: color-mix(in srgb, var(--series-3) 20%, transparent); }
.tag.set-here { margin-left: 4px; font-size: 10px; background: color-mix(in srgb, var(--series-2) 15%, transparent); }

/* One message at a time along the bottom; inverted colours so it reads in either theme. */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 2000;
  display: flex; align-items: center; gap: 12px; max-width: calc(100vw - 32px);
  padding: 10px 10px 10px 16px; border-radius: 10px; font-size: 13px;
  background: var(--ink); color: var(--page); box-shadow: var(--shadow);
}
.toast.error { border-left: 5px solid var(--bad); }
.toast-action {
  font: inherit; font-weight: 650; cursor: pointer; color: inherit; background: none;
  border: 1px solid color-mix(in srgb, var(--page) 45%, transparent); border-radius: 6px; padding: 3px 10px;
}
.toast-close { font: inherit; cursor: pointer; color: inherit; background: none; border: none; opacity: 0.7; padding: 2px 6px; }
.toast-close:hover, .toast-action:hover { opacity: 1; filter: brightness(1.2); }
