/* flightroute.me — paper/card palette, one sans (Inter), map left / board right.
   Inter is self-hosted (SIL Open Font License 1.1): https://github.com/rsms/inter */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/inter-latin.woff2) format("woff2"); }

:root {
  --paper: var(--bs-body-bg);
  --card: var(--bs-body-bg);
  --ink: var(--bs-body-color);
  --navy: var(--bs-primary);
  --rust: var(--bs-danger);
  --line: var(--bs-border-color);
  --mute: var(--bs-secondary-color);
  --radius: var(--bs-border-radius);
  --display: var(--bs-body-font-family);
  --sans: var(--bs-body-font-family);
  --fill: var(--bs-primary);
  --on-fill: #fff;
  --delay: var(--bs-danger);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
button:not(:disabled) { cursor: pointer; }
b { font-weight: 700; }
.ico { width: 16px; height: 16px; flex: none; }
.ico.sm { width: 14px; height: 14px; }

/* ---------- page frame */
.app { display: flex; flex-direction: column; min-height: 100dvh; }

/* ---------- masthead */
.masthead { display: flex; flex-direction: column; gap: 16px; padding: 16px 16px 12px; }
@media (min-width: 640px) { .masthead { flex-direction: row; align-items: flex-end; justify-content: space-between; padding: 16px 24px 12px; } }
.eyebrow { margin: 0; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); }
.headline { margin: 0; font-family: var(--display); font-size: 32px; line-height: 36px; font-weight: 600; letter-spacing: -.02em; color: var(--ink); }
.headline .arrow { color: var(--rust); padding: 0 .12em; }
.blurb { margin: 4px 0 0; display: flex; align-items: center; gap: 8px; font-size: 14px; line-height: 20px; color: var(--mute); }
.pulse-dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 999px; background: var(--navy);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--navy) 45%, transparent); animation: pulse 1.6s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } }
.stats { display: flex; flex-wrap: wrap; gap: 8px; }
.stat { min-width: 96px; border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); padding: 8px 12px; }
.stat b { display: block; font-family: var(--display); font-size: 20px; line-height: 1; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; line-height: 16px; letter-spacing: .025em; text-transform: uppercase; color: var(--mute); }
.stat.clock b { color: var(--navy); }

/* ---------- notices (Bootstrap alerts, with the page margin) */
.notice { margin: 0 12px 12px; }
.notice b { text-transform: uppercase; letter-spacing: .06em; }
.notice code { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 0 5px; color: var(--ink); font-size: 13px; }
.notice.error, #errorBanner { white-space: pre-wrap; }

/* ---------- two panes (Bootstrap row; the board stays wider until a very wide window) */
.panes { flex: 1; min-width: 0; padding: 0 12px 12px; }
.panes > .row { --bs-gutter-x: 0; --bs-gutter-y: 0; gap: 12px; margin: 0; }
.card { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius); overflow: hidden; }
.map-col .map-card, .board-col .board-card { width: 100%; }
.map-card { position: relative; height: 320px; }
/* The board grows with its flights. overflow stays visible so the page scrolls
   and the selected-flight bar can stick to the viewport. */
.board-card { display: flex; flex-direction: column; min-height: 0; height: auto; }
.board-card.card { overflow: visible; }
@media (min-width: 1024px) {
  .panes { min-height: 0; overflow: visible; }
  .panes > .row { height: auto; min-height: 0; align-items: flex-start; }
  .panes .map-col, .panes .board-col { display: flex; min-width: 0; min-height: 0; width: auto; max-width: none; }
  .panes .map-col { flex: 2 1 0; }
  .panes .board-col { flex: 3 1 0; }
  .map-card { height: min(720px, calc(100dvh - 200px)); }
  .board-card { height: auto; }
}
@media (min-width: 1800px) {
  .panes .map-col, .panes .board-col { flex: 1 1 0; }
}

/* ---------- toolbar */
.toolbar { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-bottom: 1px solid var(--line); }
.pickers, .filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
/* FROM and TO share the first row. Date sits on the next row so the city
   names stay readable, and the date control cannot grow into a tall oval. */
.pickers {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  grid-template-areas: "from swap to" "start start go";
  align-items: center;
}
#pickFrom { grid-area: from; }
#swapBtn { grid-area: swap; }
#pickTo { grid-area: to; }
#searchForm > #goBtn { grid-area: go; justify-self: end; width: auto; }
.picker { position: relative; flex: 1 1 160px; min-width: 0; display: flex; align-items: center; min-height: 44px; border: 1px solid var(--line); background: var(--paper); border-radius: 999px; padding: 0 6px 0 16px; }
.picker:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 14%, transparent); }
.picker label { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--navy); margin-right: 8px; flex: none; }
.picker input { flex: 1 1 0; width: 0; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px; font-weight: 600; color: var(--ink); padding: 10px 6px 10px 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.picker input::placeholder { color: var(--mute); font-weight: 400; }
.start-slot { grid-area: start; position: relative; width: max-content; max-width: 100%; justify-self: start; min-width: 0; }
.picker.start-pick {
  width: max-content; max-width: 100%; flex: none; gap: 8px;
  height: auto; min-height: 0; max-height: none; overflow: visible;
  padding: 0; border: 0; background: transparent; border-radius: 0;
}
.picker.start-pick:focus-within { border-color: transparent; box-shadow: none; }
.leave-face, .leave-x, .leave-sheet { display: none; }
.leave-chips { flex: none; }
#startInput.form-control {
  flex: 0 0 auto; width: 9.75rem; max-width: 9.75rem; align-self: center;
  height: calc(1.5em + 0.5rem + var(--bs-border-width) * 2);
  min-height: 0; max-height: none; margin: 0;
  padding: 0.25rem 0.5rem;
  border: var(--bs-border-width) solid var(--bs-border-color);
  border-radius: var(--bs-border-radius-sm);
  background-color: var(--bs-body-bg);
  font-size: 0.875rem; font-weight: 400; line-height: 1.5;
  color: var(--bs-body-color); color-scheme: light;
}
html[data-theme="dark"] #startInput.form-control { color-scheme: dark; }
.suggest { position: absolute; z-index: 2000; top: calc(100% + 6px); left: 0; right: 0; min-width: 300px; margin: 0; padding: 6px; list-style: none; background: var(--card); border: 1px solid var(--line); border-radius: 14px; max-height: 360px; overflow: auto; display: none; box-shadow: 0 12px 32px rgba(20, 32, 43, .14); }
.suggest.open { display: block; }
.suggest li { padding: 7px 10px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; border-radius: 10px; font-size: 14px; }
.suggest li.active, .suggest li:hover { background: var(--paper); }
.suggest .code { color: var(--navy); font-weight: 700; min-width: 34px; }
.suggest .lbl { color: var(--ink); }
.suggest .sub { color: var(--mute); font-size: 12px; margin-left: auto; text-align: right; white-space: nowrap; }
.suggest li.city .code { color: var(--rust); }
.swap { position: relative; z-index: 3; flex: none; width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--navy); background: var(--paper); color: var(--navy); font-size: 18px; font-weight: 700; }
.swap:hover { background: color-mix(in srgb, var(--navy) 8%, transparent); }
.btn { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.btn[hidden] { display: none !important; }
.btn.busy .ico { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.tabs { flex-wrap: wrap; gap: 4px; }
.tab { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.tab span { opacity: .75; }
.tab.active span { opacity: 1; }
.pill-input, .pill-select { min-height: 44px; }
.pill-input { flex: 1 1 140px; min-width: 120px; width: auto; }
.pill-select { max-width: 220px; width: auto; }
#goBtn { min-height: 44px; }

/* ---------- board table */
.board-body { flex: 1; min-height: 0; overflow: visible; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; line-height: 20px; }
.tbl th { position: sticky; top: var(--pin-h, 0px); z-index: 2; background: var(--card); text-align: left; padding: 8px 12px; font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .025em; text-transform: uppercase; color: var(--mute); box-shadow: inset 0 -1px 0 var(--line); vertical-align: bottom; }
.tbl td { padding: 8px 12px; vertical-align: top; border-top: 1px solid var(--line); }
.tbl .nw { white-space: nowrap; }
.tbl .sub { display: block; font-size: 12px; line-height: 16px; color: var(--mute); }
/* Type + approx seats. In the table the line has a fixed measure so it wraps under the flight number instead of widening the row. */
.ac-line { display: block; margin-top: 1px; font-size: 11px; line-height: 14px; font-weight: 600; color: var(--mute); white-space: normal; overflow-wrap: anywhere; }
.tbl td.c-flight .ac-line { width: 9.5rem; max-width: 100%; }
.tbl .sub.then { margin-top: 4px; }
.tbl .sub b { color: var(--ink); font-weight: 600; }
.tbl .city { color: var(--ink); }
.tbl .day { font-size: 11px; font-weight: 700; color: var(--rust); margin-left: 4px; letter-spacing: .03em; }
.tbl .approx { color: var(--mute); font-style: italic; }
/* Bootstrap .row is a flex grid. A flight row stays a table row until the phone layout. */
.tbl tr.row { display: table-row; margin: 0; cursor: pointer; animation: rowIn .35s ease both; }
.tbl tr.row > td { width: auto; max-width: none; margin-top: 0; }
tr.row:hover td { background: color-mix(in srgb, var(--paper) 55%, var(--card)); }
tr.row.sel td { background: var(--paper); }
tr.row.sel td:first-child { box-shadow: inset 3px 0 0 var(--rust); }
@keyframes rowIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
tr.section td { position: static; background: var(--fill); color: var(--on-fill); border-top: 0; padding: 7px 12px; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
tr.section td .info { margin-left: 10px; font-weight: 500; letter-spacing: .02em; text-transform: none; opacity: .75; font-size: 12px; }
tr.section.con td { background: color-mix(in srgb, var(--bs-primary) 78%, #000); }
tr.empty td, .empty { padding: 32px 12px; color: var(--mute); font-size: 14px; }
.loading { padding: 32px 12px; color: var(--mute); font-size: 14px; display: flex; align-items: center; gap: 10px; }

/* status pills (as on the reference board) */
.pill { display: inline-flex; border-radius: 999px; padding: 2px 8px; font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; background: var(--line); color: var(--ink); }
.pill.navy { background: color-mix(in srgb, var(--navy) 10%, transparent); color: var(--navy); }
.pill.rust { background: color-mix(in srgb, var(--rust) 10%, transparent); color: var(--rust); }
.pill.solid { background: var(--fill); color: var(--on-fill); }
.pill.solid::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: var(--bs-success); margin: 5px 6px 0 0; animation: blink 1.6s steps(1) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- map */
#map { position: absolute; inset: 0; }
.leaflet-container { background: #d4dadc; font-family: var(--sans); }
.legend { position: absolute; z-index: 500; top: 12px; left: 12px; display: flex; flex-wrap: wrap; gap: 10px; padding: 6px 12px; background: color-mix(in srgb, var(--card) 92%, transparent); border: 1px solid var(--line); border-radius: 999px; font-size: 12px; color: var(--mute); box-shadow: 0 2px 8px rgba(20, 32, 43, .06); }
.legend span { display: inline-flex; align-items: center; }
.legend .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 5px; }
.dot.o { background: var(--rust); } .dot.d { background: var(--navy); } .dot.h { background: var(--card); border: 2px solid var(--navy); width: 9px; height: 9px; }
.legend .ln { display: inline-block; width: 18px; height: 0; border-top: 3px solid var(--rust); margin-right: 5px; }
.legend .ln.con { border-top: 2px dashed var(--navy); }
.detail { position: absolute; z-index: 600; left: 12px; right: 64px; bottom: 12px; max-height: 45%; overflow: auto; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; line-height: 18px; color: var(--ink); box-shadow: 0 10px 30px rgba(20, 32, 43, .16); }
.detail .eyebrow { font-size: 11px; }
.detail h3 { margin: 2px 0 6px; font-family: var(--display); font-weight: 600; font-size: 18px; line-height: 22px; letter-spacing: -.02em; }
.detail h3 .arrow { color: var(--rust); }
.detail .leg { display: grid; grid-template-columns: 52px 1fr; gap: 2px 10px; padding: 6px 0; border-top: 1px solid var(--line); }
.detail .k { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); padding-top: 1px; }
.detail .m { color: var(--mute); }
.detail .lay { display: inline-block; margin: 0 0 6px; padding: 2px 10px; border-radius: 999px; background: color-mix(in srgb, var(--navy) 10%, transparent); color: var(--navy); font-weight: 600; font-size: 12px; }
.ap-label { background: var(--card); border: 1px solid var(--line); color: var(--ink); font-family: var(--sans); font-weight: 700; font-size: 11px; line-height: 14px; padding: 1px 6px; border-radius: 999px; box-shadow: 0 1px 3px rgba(20, 32, 43, .12); }
.ap-label.o { background: var(--rust); border-color: var(--rust); color: #fff; font-size: 12px; }
.ap-label.d { background: var(--fill); border-color: var(--fill); color: var(--on-fill); font-size: 12px; }
.ap-label.h { color: var(--navy); }
.leaflet-tooltip.ap-label::before { display: none; }
.leaflet-control-zoom.leaflet-bar { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; box-shadow: none; }
.leaflet-control-zoom a { color: var(--ink); }

/* ---------- footer */
.footer { display: flex; align-items: center; gap: 4px 10px; flex-wrap: wrap; padding: 2px 16px 3px; font-size: 11px; line-height: 14px; color: var(--mute); }
.footer > * { min-width: 0; white-space: nowrap; }
.footer .spacer { flex: 1 1 12px; }
#metaInfo, #attribution { overflow: hidden; text-overflow: ellipsis; }
#attribution { flex: 1 1 12ch; max-width: 42ch; }
.osm-foot, .footer .prov { flex: none; }
.crew-line { flex: 1 0 100%; white-space: normal; font-weight: 500; font-variant-emoji: text; }
.footer a { color: var(--navy); }
.footer .live { color: var(--navy); font-weight: 700; }
.footer .demo { color: var(--rust); font-weight: 700; }

@media (prefers-reduced-motion: reduce) {
  .pulse-dot, tr.row, .pill.solid::before, .btn.busy .ico { animation: none; }
}

/* ===================== compact rows + step-by-step trip builder ===================== */
.tbl { font-size: 14px; line-height: 18px; }
.tbl th { font-size: 11px; color: var(--mute); padding: 6px 10px; letter-spacing: .06em; }
.tbl td { padding: 6px 10px; vertical-align: middle; }
.tbl b { font-weight: 700; }
.tbl .t { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.tbl .sub { font-size: 12px; line-height: 15px; color: var(--mute); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 28ch; }
.tbl .sub.now { color: var(--rust); }
.tbl .sub.now b { color: var(--rust); }
.tbl .now-inline { font-size: 12px; font-weight: 600; color: var(--rust); margin-left: 6px; white-space: nowrap; }
.tbl .now-inline b { color: var(--rust); font-weight: 700; }
.tbl td.total { text-align: right; color: var(--mute); font-size: 12px; line-height: 15px; padding-left: 6px; padding-right: 10px; white-space: nowrap; min-width: 5.5rem; }
.tbl td.total .total-lab { font-weight: 500; letter-spacing: .01em; display: block; }
.tbl td.total b { color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; font-size: 13px; }
.tbl th:last-child { text-align: right; min-width: 5.5rem; }
.tbl .m, .m { color: var(--mute); }
tr.section td { font-size: 11px; padding: 6px 10px; line-height: 16px; }
tr.section td .info { font-size: 12px; opacity: .85; }
.pill { font-size: 12px; padding: 2px 8px; line-height: 15px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 2px 8px; font-size: 12px; line-height: 15px; font-weight: 700; white-space: nowrap; }
.badge.nonstop { background: var(--rust); color: #fff; }
.badge.go { background: color-mix(in srgb, var(--navy) 12%, transparent); color: var(--navy); }
.badge.none { background: transparent; color: var(--mute); border: 1px dashed var(--line); font-weight: 600; }
.badge.cargo { background: var(--bs-success); color: #fff; letter-spacing: 0.04em; gap: 5px; }
.badge.cargo .cargo-ico { width: 13px; height: 13px; flex: none; opacity: 0.95; display: block; }
tr.row.cargo { cursor: pointer; opacity: 0.96; }
tr.row.cargo:hover td { background: var(--bs-success-bg-subtle); }
tr.row.cargo.sel td { background: var(--bs-success-bg-subtle); }
tr.row.cargo td.nw .badge.cargo { margin-top: 2px; }
tr.section.cargo td { background: var(--bs-success-bg-subtle); color: var(--bs-success-text-emphasis); }
.flight-cargo-tag { display: inline-flex; margin-left: 6px; vertical-align: middle; }
td.nw .badge.cargo { display: inline-flex; margin-left: 6px; vertical-align: middle; }
td.nw b + .badge.cargo { margin-left: 8px; }

tr.row.direct td { background: color-mix(in srgb, var(--rust) 5%, var(--card)); }
tr.row.direct:hover td { background: color-mix(in srgb, var(--rust) 9%, var(--card)); }
tr.row.sel td, tr.row.direct.sel td { background: var(--bs-primary-bg-subtle); }

.stepbar { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.stepbar b { display: block; font-size: 16px; line-height: 22px; }
.stepbar span:not(.step-n) { display: block; font-size: 14px; line-height: 20px; color: var(--mute); }
.step-n { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 999px; background: var(--rust); color: #fff; font-weight: 700; font-size: 15px; }

.pinned { margin: 12px; border: 1px solid var(--rust); border-radius: var(--radius); background: var(--card); padding: 10px 14px 12px; }
.pinned.done { border-color: var(--navy); }
.pin-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.pin-head .eyebrow { color: var(--rust); }
.pinned.done .pin-head .eyebrow { color: var(--navy); }
.pin-head .spacer { flex: 1; }
.pin-leg { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.pin-leg .k { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); padding-top: 3px; }
.pin-main { font-size: 15px; line-height: 22px; }
.pin-main .ac-line, .pc-l2 .ac-line { display: inline; max-width: none; margin: 0 0 0 4px; white-space: nowrap; font-size: 12px; line-height: inherit; vertical-align: baseline; }
.pin-route { font-size: 17px; line-height: 24px; font-variant-numeric: tabular-nums; }
.pin-route .arrow, .detail .arrow, .headline .arrow { color: var(--rust); }
.pin-route .m { font-size: 14px; }
.pin-lay { border-top: 1px dashed var(--line); padding: 8px 0 2px; font-size: 15px; color: var(--ink); }
.pin-total { margin-top: 8px; padding: 8px 12px; border-radius: 10px; background: var(--fill); color: var(--on-fill); font-size: 15px; }
.pin-total b { font-family: var(--display); font-size: 18px; font-weight: 600; letter-spacing: -.02em; margin: 0 2px; }
.note { margin: 10px 14px 16px; font-size: 14px; color: var(--mute); }
.note.error { color: var(--bs-danger-text-emphasis); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--navy); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.loading { font-size: 15px; padding: 24px 14px; }
.detail { right: auto; max-width: 340px; padding: 10px 14px; }
.detail .m { font-size: 14px; }
.legend { font-size: 13px; color: var(--mute); }

.toolbar .filters { flex-wrap: nowrap; }
.tab { gap: 6px; }
.pill-input { min-width: 90px; }
.pill-select { flex: 0 1 auto; max-width: 180px; min-width: 0; }
@media (max-width: 760px) { .toolbar .filters { flex-wrap: wrap; } }
.pin-route .day { font-size: 12px; font-weight: 700; color: var(--rust); }
.tab { white-space: nowrap; }
.pill-input { flex: 1 1 160px; }
.pill-select { max-width: 180px; }
.footer .prov { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink); }
.footer .prov select { border: 1px solid var(--line); background: var(--card); border-radius: 6px; padding: 0 6px; height: 22px; font-size: 11px; color: var(--ink); }
.note.warn { margin-bottom: 0; padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--rust) 8%, var(--card)); color: var(--bs-danger-text-emphasis); }
.footer .fb { color: var(--rust); }
@media (max-width: 1399px) { .tbl td, .tbl th { padding-left: 10px; padding-right: 10px; } }
.to-cell .to-line { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22ch; }

/* Map collapse control (shown on small screens) */
.map-toggle {
  display: none;
  position: absolute; z-index: 700; top: 8px; right: 8px;
  min-height: 36px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line); background: color-mix(in srgb, var(--card) 94%, transparent);
  color: var(--navy); font-size: 13px; font-weight: 600;
  box-shadow: 0 2px 8px rgba(20, 32, 43, .08);
}
.map-card.collapsed { height: 48px !important; min-height: 48px; }
.map-card.collapsed #map,
.map-card.collapsed .legend,
.map-card.collapsed .detail { display: none; }
.map-card.collapsed .map-toggle { top: 6px; }

@media (max-width: 700px) {
  .map-toggle { display: inline-flex; align-items: center; }
  .masthead { padding: 12px 12px 8px; gap: 12px; }
  .headline { font-size: 24px; line-height: 28px; }
  .blurb { font-size: 13px; line-height: 18px; flex-wrap: wrap; }
  .stats { width: 100%; gap: 6px; }
  .stat { min-width: 0; flex: 1 1 calc(50% - 6px); padding: 8px 10px; }
  .stat b { font-size: 18px; }
  .notice { margin: 0 8px 8px; font-size: 13px; }
  .panes { padding: 0 8px 8px; }
  .panes > .row { gap: 8px; }
  .map-card { height: 220px; }
  .board-card { height: auto; min-height: 420px; max-height: none; }
  @media (max-height: 900px) {
    .app { height: auto; overflow: visible; }
    .panes { overflow: visible; }
  }
  .toolbar { padding: 10px; gap: 10px; }
  .pickers {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "from" "swap" "to" "start" "go";
    align-items: stretch;
    gap: 8px;
  }
  #searchForm > #goBtn { justify-self: stretch; width: 100%; height: 44px; max-height: 44px; }
  .picker { flex: 1 1 auto; min-height: 44px; width: 100%; }
  .swap { width: 44px; height: 44px; align-self: center; }
  .btn { min-height: 44px; width: 100%; justify-content: center; }
  .toolbar .filters { flex-wrap: wrap; gap: 8px; }
  .tabs { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { min-height: 40px; padding: 0 12px; font-size: 13px; flex: 1 0 auto; justify-content: center; }
  .pill-input, .pill-select { min-height: 44px; flex: 1 1 100%; max-width: none; width: 100%; }
  .board-body { overflow: visible; }
  .tbl { font-size: 13px; line-height: 17px; }
  .tbl .t { font-size: 14px; }
  .tbl th { padding: 6px 8px; font-size: 10px; position: sticky; top: 0; z-index: 2; }
  .tbl td { padding: 6px 8px; }
  tr.section td { position: static; padding: 6px 8px; white-space: normal; line-height: 15px; }
  .pill, .badge { font-size: 11px; padding: 2px 7px; }
  .stepbar { flex-wrap: wrap; padding: 10px; gap: 8px; }
  .stepbar b { font-size: 15px; line-height: 20px; }
  .stepbar span:not(.step-n) { font-size: 13px; line-height: 18px; }
  .pinned { margin: 8px; padding: 8px 10px 10px; }
  .pin-route { font-size: 15px; line-height: 20px; }
  .footer { padding: 2px 10px 3px; gap: 2px 8px; font-size: 10px; line-height: 13px; }
  .footer .prov select { height: 20px; font-size: 10px; }
  #attribution { display: none; }
  .legend { top: 48px; left: 8px; right: 8px; max-width: none; font-size: 11px; gap: 6px; padding: 4px 8px; }
  .detail { left: 8px; right: 8px; max-width: none; bottom: 8px; max-height: 40%; font-size: 12px; }
  .to-cell .to-line { max-width: 16ch; }
}

/* Phone-narrow (~390px) polish */
@media (max-width: 430px) {
  .headline { font-size: 22px; line-height: 26px; }
  .eyebrow { font-size: 11px; letter-spacing: .04em; }
  .map-card { height: 180px; }
  .tbl .t { font-size: 13px; }
  .tbl td.total b { font-size: 12px; }
  .stat { flex: 1 1 calc(50% - 6px); }
  .tab span { display: none; } /* hide counts on very narrow to free space */
}

/* Use-my-location control inside the FROM picker + nearest-airport note */
.locate { flex: none; display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 8px; margin-left: 4px; border: 0; border-radius: 999px; background: transparent; color: var(--navy); font-size: 12px; font-weight: 600; white-space: nowrap; }
.locate:hover { background: color-mix(in srgb, var(--navy) 8%, transparent); }
.locate.busy .ico { animation: spin 1s linear infinite; }
.geo-note { margin: -2px 4px 0; font-size: 12px; line-height: 16px; color: var(--mute); }
@media (max-width: 1699px) { .locate-lbl { display: none; } }
@media (max-width: 640px) { .locate { min-height: 40px; min-width: 40px; justify-content: center; } }
/* Mid-width desktops: keep Status + Total inside the board pane */
@media (min-width: 1024px) and (max-width: 1399px) {
  .tbl td, .tbl th { padding-left: 7px; padding-right: 7px; }
  .tbl .sub { max-width: 19ch; }
  .to-cell .to-line { max-width: 14ch; }
  .tbl td.total, .tbl th:last-child { min-width: 4.5rem; }
}

/* ---------- clock card: click / tap / Enter / Space cycles Local -> Origin -> Dest -> Zulu (UTC) */
.mlabel { display: none; }
.stat.clock { position: relative; min-width: 172px; padding-right: 30px; cursor: pointer; user-select: none; -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent; transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease; }
@media (hover: hover) { .stat.clock:hover { border-color: color-mix(in srgb, var(--navy) 45%, var(--line)); background: color-mix(in srgb, var(--navy) 4%, var(--card)); } }
.stat.clock:focus-visible { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 24%, transparent); }
.stat.clock:active { background: color-mix(in srgb, var(--navy) 8%, var(--card)); }
.stat.clock b { display: block; color: var(--navy); }
.stat.clock[data-mode="zulu"] b { color: var(--ink); }
.stat.clock .clock-cap { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 3px; font-weight: 700; letter-spacing: .04em; color: var(--navy); }
.stat.clock[data-mode="local"] .clock-cap { color: var(--ink); }
.stat.clock[data-mode="dest"] .clock-cap { color: var(--rust); }
.stat.clock[data-mode="zulu"] .clock-cap { color: var(--bs-success); }
.stat.clock .clock-hint { display: block; font-size: 10px; line-height: 13px; letter-spacing: .04em; text-transform: none; color: var(--mute); opacity: .85; white-space: nowrap; }
.stat.clock .clock-hint span { font-size: inherit; line-height: inherit; letter-spacing: inherit; text-transform: none; color: inherit; }
.stat.clock .h-click { display: none; }
@media (hover: hover) and (pointer: fine) { .stat.clock .h-click { display: inline; } .stat.clock .h-tap { display: none; } }
.clock-cycle { position: absolute; top: 9px; right: 9px; width: 15px; height: 15px; color: var(--mute); transition: color .15s ease, transform .3s ease; }
@media (hover: hover) { .stat.clock:hover .clock-cycle { color: var(--navy); transform: rotate(60deg); } }
.stat.clock:focus-visible .clock-cycle { color: var(--navy); transform: rotate(60deg); }
@media (max-width: 700px) {
  .stat.clock { min-width: 0; padding-right: 28px; }
  .stat.clock .clock-cap { font-size: 11px; letter-spacing: .03em; }
}
@media (prefers-reduced-motion: reduce) { .clock-cycle { transition: none; } .stat.clock:hover .clock-cycle { transform: none; } }

/* ---------- phones: every board table becomes stacked cards, no horizontal scroll */
@media (max-width: 700px) {
  html, body { max-width: 100%; }
  .app, .panes, .card, .board-card, .board-body { min-width: 0; max-width: 100%; }
  .board-card, .board-body { overflow: visible; }

  .tbl, .tbl tbody { display: block; width: 100%; }
  .tbl thead { display: none; }
  .tbl tr.section, .tbl tr.empty { display: block; }
  .tbl tr.section td, .tbl tr.empty td { display: block; white-space: normal; overflow-wrap: anywhere; }
  tr.section td .info { display: inline; margin-left: 6px; white-space: normal; }

  .tbl tr.row {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "time status total" "flight flight flight" "to to to" "onward onward onward";
    column-gap: 8px; row-gap: 3px; align-items: center;
    padding: 9px 12px; border-top: 1px solid var(--line); background: var(--card);
  }
  .tbl tr.row td { display: block; padding: 0; border: 0; min-width: 0; background: transparent !important; box-shadow: none !important; white-space: normal; }
  .tbl tr.row:hover { background: color-mix(in srgb, var(--paper) 55%, var(--card)); }
  .tbl tr.row.direct { background: color-mix(in srgb, var(--rust) 5%, var(--card)); }
  .tbl tr.row.sel, .tbl tr.row.direct.sel { background: var(--bs-primary-bg-subtle); box-shadow: inset 3px 0 0 var(--rust); }
  .tbl tr.row.cargo.sel { background: var(--bs-success-bg-subtle); }

  .tbl td.c-time { grid-area: time; }
  .tbl td.c-status { grid-area: status; justify-self: end; }
  .tbl td.c-total { grid-area: total; justify-self: end; text-align: right; min-width: 0 !important; padding: 0; }
  .tbl td.c-flight { grid-area: flight; }
  .tbl td.c-to { grid-area: to; }
  .tbl td.c-onward { grid-area: onward; }
  .tbl td.c-total .total-lab { display: inline; }
  .tbl td.c-total b { font-size: 13px; }

  .tbl .t { font-size: 16px; }
  .tbl .sub { display: inline; max-width: none; white-space: normal; overflow: visible; margin: 0 0 0 6px; }
  .tbl td.c-time .sub { display: block; margin: 1px 0 0; }
  .to-cell .to-line { display: inline; max-width: none; white-space: normal; }
  .tbl td.c-flight .badge.cargo { margin-left: 6px; }
  .tbl td.c-onward .sub { margin-left: 6px; }
  .mlabel { display: inline; margin-right: 6px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
  .tbl td.c-to .t { font-size: 14px; }
  .lay-txt { font-size: 12px; color: var(--mute); }

  .pin-leg { grid-template-columns: 44px minmax(0, 1fr); }
  .pin-leg .pin-st { grid-column: 2; }
  .pin-main, .pin-route, .pin-lay, .pin-total { min-width: 0; overflow-wrap: anywhere; }
  .pin-head { flex-wrap: wrap; }
  .stepbar > div { min-width: 0; }
  .note, .notice { overflow-wrap: anywhere; }
  .footer { min-width: 0; overflow-wrap: anywhere; }
  .suggest { min-width: 0; }
}

/* ---------- sticky selected-flight bar (first leg / itinerary)
   .pin-bar is position:sticky with zero layout height (JS sets margin-bottom = -height); it fades in once the
   full .pinned card has scrolled off, so the page/pane never changes height while scrolling. */
.board-body, html { overflow-anchor: none; }
/* Larger, easier-to-read bar (~1.6x the old 58px on desktop, ~1.8x the old 64px on phones, still < 25% of a 390x844 screen). */
.pin-compact { display: flex; align-items: center; gap: 14px; cursor: pointer; min-height: 60px; }
.pin-bar {
  position: sticky; top: 0; z-index: 6;
  background: var(--card); border-bottom: 2px solid var(--rust); padding: 12px 16px;
  box-shadow: none;
  visibility: hidden; opacity: 0; transition: opacity .15s ease, visibility .15s;
}
.pin-bar.done { border-bottom-color: var(--navy); }
.pin-bar.show { visibility: visible; opacity: 1; }
.pin-drop { display: none; position: absolute; left: 0; right: 0; top: 100%; max-height: 60vh; overflow: auto;
  background: var(--card); border-bottom: 2px solid var(--line); padding: 4px 14px 12px; box-shadow: 0 12px 24px rgba(33, 37, 41, .18); }
.pin-bar.expanded .pin-drop { display: block; }
.pc-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.pc-l1, .pc-l2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-l1 { font-size: 26px; line-height: 32px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -.005em; }
.pc-l1 .pc-seg { white-space: nowrap; }
.pc-l1 .pc-ap { font-weight: 800; letter-spacing: .02em; }
.pc-l1 .pc-tm { font-weight: 600; }
.pc-l1 .arrow { color: var(--rust); font-weight: 600; }
.pc-l1 .day { font-size: .5em; font-weight: 700; color: var(--rust); letter-spacing: .04em; vertical-align: .45em; margin-left: 2px; }
.pc-l2 { font-size: 17px; line-height: 24px; color: var(--mute); font-variant-numeric: tabular-nums; }
.pc-l2 b { color: var(--ink); }
.pc-l2 .pc-fn { font-size: 1.1em; font-weight: 800; letter-spacing: .01em; color: var(--navy); }
.pin-bar:not(.done) .pc-l2 .pc-fn { color: var(--rust); }
.pc-chev { flex: none; color: var(--mute); font-size: 16px; }
.pc-btn { flex: none; }
.pin-bar .pc-btn { min-height: 42px; padding: 0 18px; font-size: 15px; }
@media (max-width: 700px) {
  .pin-bar { padding: 10px 12px; max-height: 25vh; }
  .pin-bar.expanded { max-height: none; }
  .pin-compact { gap: 8px; min-height: 0; }
  .pin-drop { max-height: 65vh; padding: 4px 10px 10px; }
  .pc-text { gap: 3px; }
  .pin-bar .pc-btn { width: auto; min-height: 40px; padding: 0 12px; font-size: 14px; }
  .pc-chev { font-size: 14px; }
  .pc-l1 { font-size: 21px; line-height: 27px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
  .pc-l2 { font-size: 14px; line-height: 19px; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
}

/* ---------- delayed departures: scheduled struck through, new time large + red */
.t-old { font-size: 12px; font-weight: 600; color: var(--mute); text-decoration: line-through; text-decoration-thickness: 1.5px; margin-right: 6px; font-variant-numeric: tabular-nums; }
.tbl .t.t-new { font-size: 19px; font-weight: 800; color: var(--delay); }
.pin-route .t-new, .pc-l1 .t-new { font-weight: 800; color: var(--delay); font-size: 1.08em; }
.pin-route .t-old, .pc-l1 .t-old { margin-right: 2px; }
.pc-l1 .t-old { font-size: .6em; }
@media (max-width: 700px) { .tbl .t.t-new { font-size: 18px; } }

/* ===================== saved plans (Plan A / B / C) ===================== */
.pin-bar .pc-save { min-height: 42px; padding: 0 16px; font-size: 15px; flex: none; }
@media (max-width: 1199px) { .pin-bar .pc-save { display: none; } } /* narrow panes: the save button lives in the full card */

/* in-board strip: compact, stacked mini cards */
.plans-strip { margin: 10px 12px 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: color-mix(in srgb, var(--paper) 60%, var(--card)); }
.ps-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.ps-head .spacer { flex: 1; }
.ps-title { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); }
.ps-title span { color: var(--mute); letter-spacing: .04em; margin-left: 4px; }
.ps-title .ps-account { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--navy); }
.plans-strip .btn { width: auto; }
.ps-list { display: flex; flex-direction: column; gap: 6px; }
.ps-card { display: flex; align-items: stretch; border: 1px solid var(--line); border-left: 5px solid var(--navy); border-radius: 10px; background: var(--card); transition: box-shadow .3s ease, border-color .3s ease; }
.ps-card.plan-b { border-left-color: var(--rust); }
.ps-card.plan-c { border-left-color: var(--bs-success); }
.ps-card.new { box-shadow: 0 0 0 3px color-mix(in srgb, var(--rust) 35%, transparent); animation: psIn .45s ease both; }
@keyframes psIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.ps-open { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; text-align: left; padding: 7px 10px; }
.ps-label { flex: none; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--navy); }
.plan-b .ps-label { color: var(--rust); } .plan-c .ps-label { color: var(--bs-success); }
.ps-text { min-width: 0; display: flex; flex-direction: column; }
.ps-route, .ps-meta { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ps-route { font-size: 15px; line-height: 20px; font-variant-numeric: tabular-nums; }
.ps-route .t-old { font-size: 11px; margin-right: 3px; } .ps-route .t-new { color: var(--delay); font-weight: 800; }
.ps-meta { font-size: 12px; line-height: 16px; color: var(--mute); }
.ps-x { flex: none; width: 40px; border: 0; border-left: 1px solid var(--line); background: transparent; color: var(--mute); font-size: 22px; line-height: 1; border-radius: 0 10px 10px 0; }
.ps-x:hover { color: var(--bs-danger-text-emphasis); background: var(--bs-danger-bg-subtle); }

/* "Show my plans": board hidden, only the plans on screen (screenshot-friendly) */
.plans-view { display: none; }
body.plans-mode .masthead, body.plans-mode .notice, body.plans-mode .panes, body.plans-mode .footer { display: none !important; }
body.plans-mode .app { height: auto; min-height: 100dvh; overflow: visible; }
body.plans-mode .plans-view { display: block; }
.plans-view { width: 100%; max-width: 1360px; margin: 0 auto; padding: 20px 24px 24px; }
.pv-head { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.pv-share-status { flex: 1 1 100%; margin: 0; font-size: 13px; line-height: 18px; font-weight: 700; color: var(--navy); }
.pv-titles { flex: 1; min-width: 0; }
.pv-route { margin: 0; font-family: var(--display); font-weight: 600; font-size: 28px; line-height: 34px; letter-spacing: -.02em; color: var(--ink); }
.pv-actions { display: flex; gap: 8px; flex: none; }
.pv-actions .btn { width: auto; }
.pv-list { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1024px) {
  .pv-list[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pv-list[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.pv-empty { padding: 32px 16px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--mute); font-size: 16px; text-align: center; background: var(--card); }
.pv-note { margin: 14px 2px 0; font-size: 13px; color: var(--mute); }

.plan-card { min-width: 0; background: var(--card); color: var(--ink); border: 1px solid var(--navy); border-radius: var(--radius); padding: 14px 16px 16px; }
.plan-card.plan-b { border-color: var(--rust); }
.plan-card.plan-c { border-color: var(--bs-success); }
.pl-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.pl-label { flex: none; padding: 3px 9px; border-radius: 999px; background: var(--fill); color: var(--on-fill); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.plan-b .pl-label { background: var(--rust); } .plan-c .pl-label { background: var(--bs-success); }
.pl-sum { flex: 1; min-width: 0; font-size: 16px; line-height: 22px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.pl-sum b { color: var(--ink); font-weight: 800; }
.pl-x { flex: none; width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--mute); font-size: 22px; line-height: 1; display: grid; place-items: center; padding: 0 0 2px; }
.pl-x:hover { color: var(--bs-danger-text-emphasis); border-color: var(--bs-danger-border-subtle); background: var(--bs-danger-bg-subtle); }
.pl-leg { padding: 8px 0 2px; border-top: 1px solid var(--line); }
.pl-fl { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; font-size: 15px; line-height: 20px; }
.pl-fl .ac-line { order: 3; flex: 1 1 100%; max-width: none; margin: 0; white-space: normal; }
.pl-fn { flex: none; font-size: 17px; font-weight: 800; color: var(--ink); letter-spacing: .01em; }
.pl-al { min-width: 0; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-fl .badge.cargo { flex: none; }
.pl-date { margin-left: auto; flex: none; font-size: 14px; font-weight: 700; color: var(--navy); }
.pl-route { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 8px; margin-top: 4px; }
.pl-end { min-width: 0; }
.pl-end.r { text-align: right; }
.pl-ap { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.pl-end.r .pl-ap { justify-content: flex-end; }
.pl-ap b { flex: none; font-size: 26px; line-height: 30px; font-weight: 800; letter-spacing: .02em; color: var(--ink); }
.pl-city { min-width: 0; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-time { font-variant-numeric: tabular-nums; line-height: 26px; white-space: nowrap; }
.pl-t { font-size: 22px; font-weight: 700; color: var(--ink); }
.pl-time .t-old { font-size: 14px; }
.pl-time .t-new { font-size: 22px; font-weight: 800; color: var(--delay); }
.pl-tz { margin-left: 5px; font-size: 13px; font-weight: 700; color: var(--mute); letter-spacing: .03em; }
.pl-day { margin-left: 5px; padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--rust) 12%, transparent); color: var(--rust); font-size: 12px; font-weight: 800; vertical-align: 3px; }
.pl-mid { display: flex; flex-direction: column; align-items: center; color: var(--rust); }
.pl-arrow { font-size: 24px; line-height: 24px; font-weight: 700; }
.pl-dur { font-size: 12px; line-height: 14px; font-weight: 700; color: var(--mute); white-space: nowrap; }
.pl-lay { margin: 8px 0 2px; padding: 6px 12px; border-radius: 10px; background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-size: 15px; line-height: 20px; }
.pl-lay b { font-weight: 800; }

@media (max-width: 700px) {
  .plans-strip { margin: 8px 8px 2px; padding: 8px 10px; }
  .pv-actions { flex-wrap: wrap; max-width: 100%; }
  .tbl td.c-flight .ac-line, .pin-main .ac-line { width: auto; max-width: none; }
  .ps-route { font-size: 14px; }
  .plans-view { padding: 10px 10px 14px; }
  .pv-head { align-items: center; margin-bottom: 8px; gap: 8px; }
  .pv-route { font-size: 20px; line-height: 24px; }
  .pv-actions { gap: 4px; }
  .pv-actions .btn { min-height: 36px; padding: 0 10px; font-size: 13px; }
  .pv-list { gap: 8px; }
  .pv-note { margin-top: 8px; font-size: 12px; }
  .plan-card { padding: 8px 12px 10px; border-radius: 14px; }
  .pl-head { margin-bottom: 4px; gap: 8px; }
  .pl-label { font-size: 13px; padding: 3px 9px; }
  .pl-sum { font-size: 14px; line-height: 19px; }
  .pl-x { width: 32px; height: 32px; font-size: 20px; }
  .pl-leg { padding: 5px 0 0; }
  .pl-fl { font-size: 13px; line-height: 18px; gap: 6px; }
  .pl-fn { font-size: 15px; }
  .pl-date { font-size: 13px; }
  .pl-fl .badge.cargo { font-size: 10px; padding: 1px 6px; }
  .pl-route { margin-top: 2px; gap: 6px; }
  .pl-ap b { font-size: 22px; line-height: 25px; }
  .pl-city { font-size: 12px; }
  .pl-time { line-height: 23px; }
  .pl-t, .pl-time .t-new { font-size: 19px; }
  .pl-time .t-old { font-size: 12px; margin-right: 4px; }
  .pl-tz { font-size: 11px; margin-left: 4px; }
  .pl-arrow { font-size: 20px; line-height: 20px; }
  .pl-lay { margin: 5px 0 0; padding: 3px 10px; font-size: 13px; line-height: 18px; }
}
@media (prefers-reduced-motion: reduce) { .ps-card.new { animation: none; } }
/* plans: roomier on desktop, tighter on the narrowest phones */
@media (min-width: 1024px) {
  .plans-view { padding-top: 28px; }
  .pv-route { font-size: 40px; line-height: 46px; }
  .pv-actions .btn { min-height: 42px; font-size: 15px; padding: 0 16px; }
  .plan-card { padding: 18px 20px 20px; border-width: 3px; }
  .pl-label { font-size: 16px; padding: 5px 13px; }
  .pl-sum { font-size: 17px; }
  .pl-sum-route { display: none; }
  .pl-leg { padding-top: 12px; margin-top: 4px; }
  .pl-fl { font-size: 17px; line-height: 24px; }
  .pl-fn { font-size: 20px; }
  .pl-date { font-size: 16px; }
  .pl-ap b { font-size: 32px; line-height: 38px; }
  .pl-city { font-size: 15px; }
  .pl-time { line-height: 32px; }
  .pl-t, .pl-time .t-new { font-size: 27px; }
  .pl-time .t-old { font-size: 16px; }
  .pl-tz { font-size: 14px; }
  .pl-arrow { font-size: 28px; line-height: 28px; }
  .pl-dur { font-size: 14px; line-height: 18px; }
  .pl-lay { font-size: 17px; line-height: 24px; padding: 8px 14px; margin-top: 12px; }
}
@media (max-width: 700px) { .pv-titles .eyebrow { letter-spacing: .1em; } }
@media (max-width: 480px) {
  .ps-head .ps-title { flex: 1 1 100%; }
  .ps-head .spacer { display: none; }
  .ps-head .btn { flex: 1 1 0; justify-content: center; min-height: 38px; }
}
@media (max-width: 400px) { .pl-sum-route { display: none; } }

/* ===================== terminals / gates + gate-to-gate walk ===================== */
.tbl .gt { font-variant-numeric: tabular-nums; letter-spacing: .01em; color: var(--mute); font-weight: 600; }
.tbl .tchg-t { color: var(--rust); font-weight: 700; }
.pin-gates { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; margin-top: 2px; font-size: 14px; line-height: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.pin-gates .pg { white-space: nowrap; font-weight: 600; }
.pin-gates .pg-k, .lay-gates .lg-k { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); margin-right: 2px; }
.pin-gates .arrow { color: var(--rust); }
.pin-gates .pg-belt { color: var(--mute); font-weight: 500; }
.lay-gates { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; }
.lay-gates .lg-seg { white-space: nowrap; }
.lay-gates .arrow { color: var(--rust); font-weight: 700; }
.lay-gates.muted, .walk.muted { color: var(--mute); }
.tchg { display: inline-flex; align-items: center; padding: 0 7px; border-radius: 999px; background: color-mix(in srgb, var(--rust) 12%, transparent); color: var(--rust); font-size: 11px; line-height: 17px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.walk { margin-top: 3px; font-size: 14px; line-height: 20px; color: var(--ink); font-variant-numeric: tabular-nums; }
.walk .tight, .walk-s + .tight, .pc-l3 .tight, .ps-meta .tight { display: inline-flex; padding: 0 7px; border-radius: 999px; background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); font-size: 11px; line-height: 17px; font-weight: 800; letter-spacing: .03em; white-space: nowrap; vertical-align: 1px; }
.walk .osm-wrap { font-size: 11px; color: var(--mute); white-space: nowrap; }
.osm-credit { color: var(--mute); text-decoration: underline; text-underline-offset: 2px; }
.walk-s { white-space: nowrap; }
.footer .osm-foot { color: var(--mute); }
.footer .osm-foot a { color: var(--mute); }

/* plan cards: gate chip beside the airport code (city name gives way first) */
.pl-gate { flex: none; align-self: center; padding: 1px 6px; border-radius: 6px; background: var(--bs-primary-bg-subtle); color: var(--bs-primary-text-emphasis); font-size: 13px; line-height: 18px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pl-gate.miss { color: var(--mute); font-weight: 600; background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.pv-gatebar { flex: 1 1 100%; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.pv-gatebar[hidden] { display: none !important; }
.pv-gate-status { margin: 0; font-size: 13px; line-height: 18px; font-weight: 700; color: var(--navy); }
.walk-wait { white-space: normal; }
.pl-end.r .pl-city { text-align: right; }
.pl-lay .lay-gates { margin-top: 2px; font-size: 14px; }
.pl-lay .walk { margin-top: 1px; color: var(--navy); }
.ps-meta .walk-s { color: var(--navy); font-weight: 600; }
@media (min-width: 1024px) { .pl-gate { font-size: 15px; padding: 2px 8px; } .pl-lay .lay-gates, .pl-lay .walk { font-size: 16px; line-height: 22px; } }
@media (max-width: 700px) {
  .tbl td.c-time .sub.gsub { display: inline; margin: 0 0 0 6px; }
  .tbl td.c-to .sub.gsub { display: inline; margin-left: 6px; }
  .pin-gates { font-size: 13px; line-height: 18px; gap: 0 6px; }
  .lay-gates, .walk { font-size: 13px; line-height: 18px; }
  .pl-gate { font-size: 11px; line-height: 16px; padding: 0 5px; }
  .pl-lay .lay-gates, .pl-lay .walk { font-size: 12px; line-height: 16px; margin-top: 0; }
  .pl-lay .lay-gates .lg-k { font-size: 10px; }
  .pl-lay .walk .osm-wrap { display: none; } /* credit sits in the plans footer note on phones */
  .tchg, .walk .tight { font-size: 10px; line-height: 15px; padding: 0 5px; }
}

/* ===================== pinned bar: nothing ellipsized, buttons drop below the text when the pane is narrow ===================== */
.pin-compact { flex-wrap: wrap; column-gap: 14px; row-gap: 8px; }
.pc-text { flex: 1 1 340px; }
.pc-l1, .pc-l2, .pc-l3 { white-space: normal; overflow: visible; text-overflow: clip; }
.pc-l2 .pc-nw, .pc-l3 .pc-nw { white-space: nowrap; }
.pc-l3 { font-size: 15px; line-height: 21px; color: var(--ink); font-variant-numeric: tabular-nums; }
.pc-l3 b { color: var(--ink); }
.pc-actions { flex: 0 0 auto; margin-left: auto; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.pin-bar .pc-more { min-height: 42px; padding: 0 14px; font-size: 15px; width: auto; }
.pc-chev { display: none; }
/* 701–1280px: a step smaller so the full route + layover fit on one or two lines */
@media (min-width: 701px) and (max-width: 1280px) {
  .pin-bar { padding: 12px 16px; }
  .pin-compact { min-height: 0; }
  .pc-l1 { font-size: 22px; line-height: 28px; }
  .pc-l2 { font-size: 15px; line-height: 21px; }
  .pc-l3 { font-size: 14px; line-height: 19px; }
  .pin-bar .pc-btn, .pin-bar .pc-more { min-height: 36px; padding: 0 12px; font-size: 14px; }
  .pc-actions { gap: 6px; }
}
@media (max-width: 700px) {
  .pin-bar { max-height: none; }
  .pc-l1 { display: block; -webkit-line-clamp: unset; }
  .pc-l2 { display: block; -webkit-line-clamp: unset; }
  .pc-l3 { font-size: 13px; line-height: 18px; }
  .pc-text { flex-basis: 100%; }
  .pc-actions { width: 100%; justify-content: flex-start; gap: 6px; }
  .pin-bar .pc-btn, .pin-bar .pc-more { min-height: 36px; padding: 0 12px; font-size: 13px; width: auto; }
}
/* sticky header sits exactly under the bar (top = --pin-h, kept in sync by a ResizeObserver) and is clearly a layer */
.tbl th { background: var(--card); box-shadow: inset 0 -1px 0 var(--line), 0 2px 4px rgba(20, 32, 43, .06); }
.board-body { scroll-padding-top: calc(var(--pin-h, 0px) + 32px); }

/* ===================== non-rev listing lines (plans) ===================== */
.pl-listing { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; font-size: 14px; line-height: 20px; color: var(--ink); }
.pl-lk { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--mute); }
.pl-li b { color: var(--ink); font-weight: 800; margin-right: 3px; }
.ps-list { display: block; font-size: 12px; line-height: 16px; color: var(--ink); white-space: normal; }
.ps-list b { font-weight: 800; color: var(--navy); }
@media (min-width: 1024px) { .pl-listing { font-size: 16px; line-height: 23px; } .pl-lk { font-size: 12px; } }
@media (max-width: 700px) {
  .pl-listing { margin-top: 4px; padding-top: 3px; font-size: 12px; line-height: 16px; gap: 0 10px; }
  .pl-lk { font-size: 10px; }
  .ps-list { font-size: 11px; line-height: 15px; }
}

/* ===================== disclaimer ('Boarding' is an estimate) ===================== */
.board-note { flex: none; margin: 0; padding: 3px 10px; border-top: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 55%, var(--card)); font-size: 11px; line-height: 14px; color: var(--mute); }
.board-note.flash { animation: noteFlash 1.6s ease; }
@keyframes noteFlash { 0%, 40% { background: var(--bs-warning-bg-subtle); color: var(--bs-warning-text-emphasis); } }
.bn-i { color: var(--navy); font-weight: 700; }
.bn-link { display: inline-block; margin-left: 4px; color: var(--navy); font-size: 13px; line-height: 15px; cursor: help; vertical-align: middle; }
.pv-disclaimer { margin: 14px 2px 0; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); font-size: 13px; line-height: 18px; color: var(--mute); }
@media (max-width: 700px) {
  .board-card .toolbar { order: 0; }
  .board-note { order: 1; border-top: 0; border-bottom: 1px solid var(--line); padding: 3px 8px; font-size: 10px; line-height: 13px; }
  .board-card .board-body { order: 2; }
  .pv-disclaimer { margin-top: 8px; padding: 5px 9px; font-size: 11px; line-height: 15px; }
}
@media (prefers-reduced-motion: reduce) { .board-note.flash { animation: none; } }

/* plan layover block: desktop = 3 lines (layover / gate pair / walk); phones = 2 lines (labels + city dropped, chips show them) */
.pl-lay .pll-main, .pl-lay .pll-gates { display: block; }
.pl-lay .pll-gates { font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; }
.pl-lay .pll-gates .arrow { color: var(--rust); font-weight: 700; }
.pl-lay .pll-gates .lg-k { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mute); }
@media (min-width: 1024px) { .pl-lay .pll-gates { font-size: 16px; line-height: 22px; } }
@media (max-width: 700px) {
  .pl-lay .pll-main, .pl-lay .pll-gates { display: inline; }
  .pl-lay .pll-gates::before { content: " · "; color: var(--mute); }
  .pl-lay .pll-gates { font-size: 13px; line-height: 18px; }
  .pl-lay .pll-gates .lg-k, .pl-lay .pll-city { display: none; }
  .pl-lay .walk { font-size: 12px; line-height: 16px; }
  /* tighter plans view so three plans stay close to one 390x844 screen */
  .pv-titles .eyebrow { font-size: 10px; letter-spacing: .06em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .pv-head { margin-bottom: 6px; }
  .pv-list { gap: 6px; }
  .plan-card { padding: 6px 10px 8px; }
  .pl-head { margin-bottom: 2px; }
  .pl-x { width: 28px; height: 28px; font-size: 18px; }
  .pl-label { font-size: 12px; padding: 2px 8px; }
  .pl-leg { padding-top: 3px; }
  .pl-route { margin-top: 0; }
  .pl-lay { margin-top: 3px; padding: 2px 8px; }
  .pv-disclaimer { margin-top: 6px; }
  .pv-note { margin-top: 4px; font-size: 11px; line-height: 15px; }
}
/* desktop board pane: scroll-padding keeps keyboard focus below the bar + sticky header.
   Row scroll-snap is intentionally off — snapping a <tr> lands it underneath the sticky header. */
@media (min-width: 701px) {
  .board-body { scroll-padding-top: calc(var(--pin-h, 0px) + var(--th-h, 0px)); }
}

/* ===================== pickers: invalid state + hint ===================== */
.picker.invalid { border-color: var(--bs-danger); box-shadow: 0 0 0 3px color-mix(in srgb, var(--bs-danger) 14%, transparent); }
.pick-hint { margin: -2px 4px 0; font-size: 12px; line-height: 16px; color: var(--bs-danger-text-emphasis); font-weight: 600; }
.suggest li.active { outline: 2px solid color-mix(in srgb, var(--navy) 35%, transparent); outline-offset: -2px; }

/* ===================== fit-text + short names ===================== */
/* base sizes scale with the viewport; JS (fitText) then shrinks to ~60% until the line fits, wrapping only as a last resort */
.titles { flex: 1 1 auto; min-width: 0; }
.headline { font-size: clamp(24px, 1.2rem + 1.4vw, 36px); line-height: 1.12; white-space: nowrap; overflow: hidden; }
.headline.fit-wrap { overflow: visible; }
.pv-route { white-space: nowrap; overflow: hidden; }
.pv-route.fit-wrap { overflow: visible; }
/* pinned route wraps instead of clipping; fitText does not target .pc-l1 */
.stepbar > div { min-width: 0; flex: 1; }
.stepbar b { overflow: hidden; }
.stepbar b.fit-wrap { overflow: visible; }
.stat b, .stat span { white-space: nowrap; }
@media (min-width: 640px) {
  .stats { flex-wrap: nowrap; flex: none; }
  .stat { min-width: 84px; }
}
@media (min-width: 640px) and (max-width: 1100px) {
  .stat { min-width: 76px; padding: 8px 10px; }
  .stat.clock { min-width: 150px; }
}
@media (max-width: 700px) { .headline { font-size: clamp(20px, 4.5vw + 6px, 26px); } }

/* ===================== Build trip sort: "May add a stop" rows are de-emphasized ===================== */
tr.section.weak td { background: color-mix(in srgb, var(--mute) 14%, var(--card)); color: var(--mute); }
tr.row.weak td { color: var(--mute); }
tr.row.weak td b, tr.row.weak .city, tr.row.weak .t { color: var(--mute); font-weight: 600; }
tr.row.weak .t.t-new { color: var(--delay); }   /* delays stay visible */
tr.row.weak .badge.none { opacity: .8; }
.sort-select { max-width: 200px; }
@media (min-width: 701px) and (max-width: 1500px) { .toolbar .filters { flex-wrap: wrap; } }
@media (max-width: 700px) { .tbl tr.row.weak { background: color-mix(in srgb, var(--paper) 40%, var(--card)); } }
.pl-li.muted, .pl-li.muted b, .ps-list .muted, .ps-list .muted b { color: var(--mute); font-weight: 600; }
.pl-note { display: block; font-size: .85em; line-height: 1.3; color: var(--mute); font-weight: 400; }
.pl-sep { color: var(--mute); }
/* Narrow desktop board pane (701–1199 px, e.g. 1024 wide): keep all six columns inside the pane, no sideways scroll.
   Airline names ellipsize (full name in the flight number), the "Lands … · gate" line may wrap to two lines. */
@media (min-width: 701px) and (max-width: 1199px) {
  .tbl td, .tbl th { padding-left: 6px; padding-right: 6px; }
  .tbl td.c-flight { white-space: normal; }
  .tbl td.c-flight b { white-space: nowrap; }
  .tbl td.c-flight .badge.cargo { margin: 2px 0 0; }
  .tbl td.c-flight .sub { display: block; max-width: 11ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tbl td.c-flight .ac-line { width: 7.25rem; }
  .tbl td.c-to .sub { display: block; max-width: 15ch; white-space: normal; }
  .to-cell .to-line { max-width: 13ch; }
  .tbl td.c-onward .sub { display: block; margin-left: 0; }
  .tbl td.c-lay { white-space: normal; }
  .tbl td.c-lay .lay-txt { display: inline-block; max-width: 7ch; line-height: 1.25; }
  .tbl tr.onward td.c-to { white-space: normal; }
  .tbl tr.onward td.c-to .now-inline { display: block; }
  .tbl td.c-status .pill { padding: 2px 6px; }
  .tbl td.total, .tbl th:last-child { min-width: 3.6rem; padding-right: 8px; }
}
/* phones: plans footer as two compact muted lines (no box), so three plans + notes stay close to one 390x844 screen */
@media (max-width: 700px) {
  .pv-disclaimer { margin: 6px 2px 0; padding: 0; border: 0; background: none; font-size: 11px; line-height: 14px; }
  .pv-note { margin: 3px 2px 0; font-size: 11px; line-height: 14px; }
  .plans-view { padding-bottom: 8px; }
  .pl-note { font-size: 11px; line-height: 14px; }
}
/* 360–390 wide: three plan cards, the boarding note, and the OSM credit have to share one phone screen */
@media (max-width: 420px) {
  .plans-view { padding: 4px 8px 2px; }
  .pv-head { margin-bottom: 4px; flex-wrap: nowrap; align-items: center; }
  .pv-titles .eyebrow { font-size: 10px; line-height: 12px; }
  .pv-route { font-size: 16px; line-height: 20px; }
  .pv-actions .btn { min-height: 32px; padding: 0 8px; font-size: 12px; }
  .pv-list { gap: 2px; }
  .plan-card { padding: 2px 8px 3px; }
  .pl-head { margin-bottom: 0; }
  .pl-label { font-size: 11px; line-height: 14px; padding: 1px 7px; }
  .pl-sum { font-size: 12px; line-height: 16px; }
  .pl-x { width: 24px; height: 24px; font-size: 16px; }
  .pl-leg { padding-top: 2px; }
  .pl-fl { font-size: 12px; line-height: 15px; gap: 4px; flex-wrap: nowrap; }
  .pl-fl .ac-line { order: 0; flex: 1 1 auto; width: auto; min-width: 0; max-width: 46%; margin-top: 0; font-size: 10px; line-height: 13px; white-space: nowrap; }
  .pl-fn { font-size: 13px; }
  .pl-date { font-size: 11px; }
  .pl-route { margin-top: 0; gap: 4px; }
  .pl-ap b { font-size: 18px; line-height: 20px; }
  .pl-city { font-size: 11px; }
  .pl-time { line-height: 18px; }
  .pl-t, .pl-time .t-new { font-size: 16px; }
  .pl-arrow { font-size: 16px; line-height: 16px; }
  .pl-lay { margin: 2px 0 0; padding: 1px 8px; font-size: 12px; line-height: 16px; }
  .pl-lay .walk { display: inline; margin-left: .35em; font-size: 11px; line-height: 15px; }
  .pl-lay .walk.walk-wait { display: block; margin-left: 0; margin-top: 2px; }
  .pl-listing { margin-top: 1px; padding-top: 1px; font-size: 11px; line-height: 13px; gap: 0 8px; }
  .pl-note { display: inline; font-size: 10px; line-height: 13px; }
  .pl-note::before { content: " — "; }
  .pv-disclaimer { margin-top: 4px; font-size: 10px; line-height: 13px; }
  .pv-note { margin-top: 2px; font-size: 10px; line-height: 13px; }
}
.tchg-m, .walk.tchg-only { display: none; }
@media (max-width: 700px) {
  .pl-lay .pll-gates .tchg { display: none; }
  .pl-lay .tchg-m { display: inline-flex; margin-right: 4px; vertical-align: 1px; }
  .pl-lay .walk.tchg-only { display: block; }
  .pl-lay .walk .walk-x { display: none; } /* the tag already says it; the minutes still include the buffer */
}
.pl-how2 { display: block; } /* Delta: second instruction on its own line */

/* ---------- theme toggle + optional account controls ---------- */
.mast-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tool-ico { display: none; }
.filters-toggle { display: none; }
.theme-toggle { width: 44px; height: 44px; padding: 0; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--ink); display: grid; place-items: center; }
.theme-toggle .ico { width: 20px; height: 20px; }
.theme-toggle .theme-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
.account-btn { min-height: 44px; }
.mast-tools .btn { width: auto; }
.profile-hint { margin: 0; font-size: 13px; line-height: 18px; color: var(--mute); }
.profile-hint .linkbtn { font-size: 13px; }
.profile-view { display: none; width: 100%; max-width: 980px; margin: 0 auto; padding: 8px 24px 28px; }
body.profile-mode .panes, body.profile-mode .notice, body.profile-mode .footer, body.profile-mode .plans-view { display: none !important; }
body.profile-mode,
body.profile-mode .app { height: auto; min-height: 100dvh; max-height: none; overflow: visible; }
body.profile-mode .profile-view { display: block; }
.profile-grid { display: grid; gap: 12px; }
@media (min-width: 800px) { .profile-grid { grid-template-columns: 1fr 1fr; align-items: start; } }
.profile-block { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.profile-block h3 { margin: 0; font-size: 18px; line-height: 24px; font-weight: 600; }
.profile-block p { margin: 0; color: var(--mute); font-size: 14px; line-height: 20px; }
.airline-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.airline-chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 10px 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 14px; font-weight: 600; }
.chip b { color: var(--navy); font-variant-numeric: tabular-nums; }
.chip .x { color: var(--mute); font-size: 18px; line-height: 1; }
.chip:hover { border-color: var(--navy); }
.chip-empty { margin: 0; }
.airline-pick { flex: none; width: 100%; max-width: 440px; }
.checkline { display: flex; align-items: center; gap: 10px; min-height: 44px; padding-left: 0; margin-bottom: 0; font-size: 15px; font-weight: 600; color: var(--ink); text-transform: none; letter-spacing: 0; }
.checkline .form-check-input { float: none; margin-left: 0; width: 1.15em; height: 1.15em; }
.contact-grid { display: grid; gap: 10px; }
@media (min-width: 700px) { .contact-grid { grid-template-columns: 1.2fr 1.4fr 1fr; } }
.profile-routes { display: flex; flex-direction: column; gap: 8px; }
.profile-routes:empty { display: none; }
.plan-route { display: flex; justify-content: space-between; align-items: center; gap: 12px; width: 100%; text-align: left; min-height: 44px; padding: 8px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 15px; font-weight: 600; }
.plan-route span { color: var(--mute); font-weight: 500; font-size: 13px; }
.plan-route:hover { border-color: var(--navy); }
.profile-sync, .profile-cap { margin: 14px 2px 0; font-size: 14px; line-height: 20px; color: var(--mute); }
.profile-cap { color: var(--rust); font-weight: 600; }
@media (max-width: 700px) {
  .profile-view { padding: 4px 12px 20px; }
  .airline-pick { max-width: none; }
}
@media (min-width: 640px) { .mast-tools { align-self: flex-end; margin-bottom: 2px; } }

/* Sign-in and Admin use .app, which the board locks to the viewport on a desktop.
   These pages grow with their content and scroll with the document instead. */
.auth-app { width: 100%; max-width: 880px; margin: 0 auto; height: auto; max-height: none; overflow: visible; }
html:has(.auth-app),
html:has(.auth-app) body,
html:has(body.profile-mode),
html:has(body.profile-mode) body { height: auto; overflow-x: auto; overflow-y: auto; }
.auth-card { margin: 8px 16px 12px; padding: 18px 18px 20px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; gap: 12px; max-width: 440px; }
.admin-card { max-width: none; }
.auth-field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 0; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--navy); }
.auth-field input, .auth-field select, .auth-field textarea { text-transform: none; letter-spacing: 0; font-weight: 600; }
.auth-error { margin: 0; color: var(--delay); font-size: 15px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.auth-switch, .auth-note { margin: 0 16px 16px; color: var(--mute); font-size: 14px; line-height: 20px; }
.auth-card .auth-switch { margin: 0; }
.auth-card .btn.primary { justify-content: center; }
.oauth-row { display: flex; flex-direction: column; gap: 8px; }
.oauth-row .btn { width: 100%; justify-content: center; text-decoration: none; }
.btn.oauth { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn.oauth.apple { background: #111; color: #fff; border-color: #111; }
.oauth-mark { width: 18px; height: 18px; flex: none; }
.auth-or { margin: 0; text-align: center; color: var(--mute); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
html[data-theme="dark"] .btn.oauth.apple { background: #f6f1e7; color: #111; border-color: #f6f1e7; }
.inline-logout { display: inline; }
.admin-tbl td form { margin: 0; }
.admin-tbl td, .admin-tbl th { text-align: left; }
.admin-h { margin: 8px 0 0; font-size: 20px; line-height: 26px; font-weight: 600; }
.user-tools .pill-input { width: 100%; min-height: 40px; }
.user-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.user-card { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); min-width: 0; }
.user-card[hidden] { display: none; }
.user-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-name, .user-email, .user-air, .user-meta, .user-flags { margin: 0; overflow-wrap: anywhere; }
.user-name { font-size: 15px; line-height: 20px; font-weight: 700; }
.user-email { font-size: 14px; line-height: 18px; font-weight: 600; color: var(--navy); }
.user-air, .user-meta { font-size: 13px; line-height: 18px; color: var(--mute); }
.user-flags { font-size: 12px; line-height: 16px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--rust); }
.user-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.user-actions form { margin: 0; }
.user-actions .btn { width: auto; min-height: 36px; padding: 0 12px; }
.user-delete { color: var(--rust); border-color: color-mix(in srgb, var(--rust) 50%, var(--line)); }
.user-empty { margin: 0; color: var(--mute); font-size: 14px; }
#oauthAdmin .auth-note { margin: 0; }
.oauth-h { margin: 4px 0 0; font-size: 16px; line-height: 22px; font-weight: 600; }
.oauth-src { margin: 0; min-height: 16px; font-size: 12px; line-height: 16px; color: var(--mute); }
.oauth-file { display: flex; flex-direction: column; gap: 6px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--navy); }
.oauth-file input { text-transform: none; letter-spacing: 0; font-weight: 600; font-size: 14px; }
.redirect-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.redirect-row code { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; padding: 6px 8px; border-radius: 8px; background: var(--paper); border: 1px solid var(--line); font-size: 12px; line-height: 16px; }
.oauth-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.oauth-actions .btn, .redirect-row .btn { width: auto; min-height: 40px; }
@media (min-width: 800px) {
  .user-card { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 16px; }
  .user-actions { justify-content: flex-end; max-width: 320px; }
}
.require-form { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.require-form .auth-note, .listing-form .auth-note { margin: 0; flex: 1 1 100%; }
.auth-field textarea { resize: vertical; min-height: 88px; line-height: 1.4; }
.listing-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.listing-tools .pill-input { flex: 1 1 180px; min-height: 44px; }
.listing-layout { display: grid; gap: 12px; }
@media (min-width: 800px) { .listing-layout { grid-template-columns: minmax(220px, 280px) minmax(0, 1fr); align-items: start; } }
.listing-list { list-style: none; margin: 0; padding: 0; max-height: 420px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.listing-item { width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 8px 10px; font-size: 14px; line-height: 18px; }
.listing-item b { color: var(--navy); margin-right: 6px; }
.listing-item.on, .listing-item:hover { background: var(--card); }
.listing-gap { display: inline-block; margin-left: 6px; color: var(--rust); font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.listing-empty { padding: 12px; color: var(--mute); }
.listing-channels { border: 1px solid var(--line); border-radius: var(--radius); margin: 0; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.listing-channels legend { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--navy); padding: 0 4px; }
.listing-form { display: flex; flex-direction: column; gap: 10px; }
.route-hits { width: 100%; border-collapse: collapse; font-size: 14px; }
.route-hits th, .route-hits td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: baseline; }
.route-hits th { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--mute); }
.route-hits td:nth-child(2) { font-variant-numeric: tabular-nums; font-weight: 700; }
.listing-code { margin: 0; font-weight: 700; color: var(--navy); letter-spacing: .04em; }
.listing-status { margin: 0; min-height: 20px; font-size: 14px; font-weight: 700; color: var(--navy); }
@media (max-width: 700px) {
  .listing-list { max-height: 240px; }
  .require-form .btn { width: auto; }
}

/* Dark mode follows Bootstrap’s data-bs-theme colors. Text accents use the lighter link blue. */
html[data-theme="dark"] {
  color-scheme: dark;
  --navy: var(--bs-link-color);
}
html[data-theme="dark"] .pinned,
html[data-theme="dark"] .pin-bar,
html[data-theme="dark"] .pin-drop,
html[data-theme="dark"] .plan-card,
html[data-theme="dark"] .ps-card,
html[data-theme="dark"] .pl-x { background: var(--card); color: var(--ink); }
html[data-theme="dark"] .pl-gate.miss { background: transparent; color: var(--mute); }
html[data-theme="dark"] .leaflet-container { background: var(--bs-body-bg); }
html[data-theme="dark"] .leaflet-bar a,
html[data-theme="dark"] .leaflet-control-zoom a { background: var(--bs-tertiary-bg); color: var(--ink); }
html[data-theme="dark"] .picker.invalid { border-color: var(--delay); }

/* Phones (360–430): search and flights first. Desktop and the 431–1023 layout stay as they are. */
@media (max-width: 430px) {
  .masthead {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "titles tools" "stats stats";
    align-items: center;
    gap: 4px 8px;
    padding: 8px 10px 4px;
  }
  .titles { grid-area: titles; }
  .titles .eyebrow, .titles .blurb { display: none; }
  .headline { font-size: 22px; line-height: 26px; }
  .mast-tools { grid-area: tools; justify-self: end; flex-wrap: nowrap; gap: 4px; }
  .mast-tools .btn, .theme-toggle {
    position: relative;
    width: 36px; min-width: 36px; height: 36px; min-height: 36px;
    padding: 0; gap: 0; justify-content: center;
  }
  .theme-toggle .ico, .mast-tools .tool-ico { display: block; width: 18px; height: 18px; }
  .mast-tools .tool-lbl {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
  }
  .stats { grid-area: stats; flex-wrap: nowrap; gap: 4px; width: 100%; min-width: 0; overflow: hidden; }
  .stat {
    flex: 0 1 auto; min-width: 0;
    display: inline-flex; align-items: baseline; gap: 3px;
    padding: 2px 7px; border-radius: 999px;
  }
  .stat b { display: inline; font-size: 12px; line-height: 16px; }
  .stat .stat-lbl { font-size: 10px; line-height: 14px; letter-spacing: 0; text-transform: none; }
  .stat.clock {
    flex: 0 1 auto; max-width: 42%; min-width: 0; padding: 2px 8px;
    display: inline-flex; flex-direction: row; align-items: baseline; gap: 3px;
  }
  .stat.clock b { display: inline; font-size: 12px; }
  .stat.clock .clock-cap {
    display: inline; margin: 0; max-width: 4.2rem;
    font-size: 10px; line-height: 14px; letter-spacing: 0;
    overflow: hidden; text-overflow: ellipsis;
  }
  .stat.clock .clock-hint, .stat.clock .clock-cycle { display: none; }

  #demoBanner.notice.demo {
    margin: 0 8px 6px; padding: 3px 10px;
    font-size: 11px; line-height: 16px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  #demoBanner.notice.demo b { font-size: 11px; line-height: 16px; letter-spacing: .03em; }
  #demoBanner .demo-more { display: none; }

  .panes { gap: 6px; padding: 0 8px 6px; }
  .legend { display: none !important; }
  .map-card.collapsed { height: 40px !important; min-height: 40px; }
  .map-card.collapsed .map-toggle {
    position: static; top: auto; right: auto;
    display: flex; width: 100%; height: 40px; min-height: 40px;
    border: 0; border-radius: 0; box-shadow: none; justify-content: center;
    background: transparent;
  }

  .toolbar { padding: 8px; gap: 6px; }
  .pickers {
    grid-template-columns: minmax(0, 1fr) 36px;
    grid-template-areas: "from swap" "to swap" "start start" "go go";
    align-items: center;
    gap: 6px;
  }
  #swapBtn { width: 36px; height: 36px; font-size: 16px; align-self: center; justify-self: center; }
  .picker { min-height: 40px; width: 100%; padding-left: 12px; }
  .locate { min-height: 32px; min-width: 32px; }
  #searchForm > #goBtn { justify-self: stretch; width: 100%; height: 44px; max-height: 44px; }
  #startNote { display: none; }

  .filters-toggle { display: flex; align-items: center; justify-content: center; width: 100%; }
  .toolbar .filters { display: none; width: 100%; min-width: 0; max-width: 100%; }
  .toolbar .filters.open {
    display: flex; flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 6px;
  }
  .toolbar .filters.open .tabs {
    width: 100%; min-width: 0; max-width: 100%; overflow-x: hidden;
  }
  .toolbar .filters.open .tab {
    flex: 1 1 0; min-width: 0; min-height: 32px; padding: 0 6px; gap: 4px;
    font-size: 12px; justify-content: center;
  }
  .toolbar .filters.open .pill-input,
  .toolbar .filters.open .pill-select {
    flex: 1 1 auto; width: 100%; max-width: 100%; min-width: 0; min-height: 40px;
  }

  .tbl tr.row { padding: 6px 10px; row-gap: 1px; column-gap: 6px; }
  .tbl .t { font-size: 16px; line-height: 20px; }
  .tbl td.c-flight b { font-size: 14px; line-height: 18px; }
  .tbl td.c-to .t, .tbl td.c-to b { font-size: 14px; }
  .tbl td.c-flight .sub { font-size: 12px; line-height: 15px; font-weight: 600; }
  .tbl td.c-flight .ac-line,
  .tbl td.c-to .sub,
  .tbl td.c-onward .sub,
  .mlabel, .lay-txt {
    font-size: 10px; line-height: 13px; font-weight: 500; color: var(--mute);
  }
  .tbl td.c-flight .ac-line { margin-top: 0; }
  .mlabel { margin-right: 4px; letter-spacing: .04em; }
  .pill, .badge { font-size: 11px; }
  .board-note { font-size: 10px; line-height: 13px; padding: 3px 8px; }

  .footer { justify-content: flex-end; gap: 0; padding: 2px 10px 4px; }
  #metaInfo, #attribution, .osm-foot, .footer .spacer { display: none !important; }
  .footer .prov { font-size: 11px; }
}

/* Phones: one Leaving row, the same height as From and To. The date picker opens under it. */
@media (max-width: 700px) {
  .start-slot { width: 100%; justify-self: stretch; }
  .picker.start-pick {
    width: 100%; height: auto; min-height: 44px; max-height: none;
    overflow: hidden; padding: 0 4px 0 16px;
    border: 1px solid var(--line); background: var(--paper); border-radius: 999px;
  }
  .picker.start-pick:focus-within { border-color: var(--navy); box-shadow: 0 0 0 3px color-mix(in srgb, var(--navy) 14%, transparent); }
  .picker.start-pick > .leave-chips { display: none; }
  .start-lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  .leave-face {
    display: flex; align-items: center; flex: 1 1 auto; min-width: 0; box-sizing: border-box;
    margin: 0; padding: 10px 0; border: 0; background: transparent;
    color: inherit; text-align: left; line-height: 20px;
  }
  .leave-k {
    flex: none; margin-right: 8px;
    font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--navy);
  }
  .leave-v {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 14px; font-weight: 600; color: var(--ink);
  }
  .leave-x {
    display: grid; place-items: center; flex: none;
    width: 32px; height: 32px; margin-left: 4px; padding: 0;
    border: 0; border-radius: 999px; background: transparent; color: var(--mute);
    font-size: 20px; line-height: 1; font-weight: 600;
  }
  .leave-x[hidden] { display: none !important; }
  .leave-x:hover { background: color-mix(in srgb, var(--navy) 8%, transparent); color: var(--ink); }
  .picker.start-pick:not(.open) #startInput {
    position: absolute; width: 1px; height: 1px; min-height: 0; max-height: 1px;
    margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
  }
  .leave-sheet {
    position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0;
    display: flex; flex-direction: column; gap: 8px;
    padding: 10px; border: 1px solid var(--line); border-radius: 16px;
    background: var(--card); box-shadow: 0 12px 32px rgba(20, 32, 43, .16);
  }
  .leave-sheet[hidden] { display: none !important; }
  .leave-sheet .leave-chips { display: flex; gap: 6px; width: 100%; }
  .leave-sheet .leave-chips > .btn.leave-chip {
    flex: 1 1 0; min-width: 0; min-height: 36px; padding: 0 8px;
    border-radius: 999px !important; border: 1px solid var(--line);
    background: var(--paper); color: var(--ink); font-size: 13px; font-weight: 700;
    --bs-btn-color: var(--ink); --bs-btn-bg: var(--paper); --bs-btn-border-color: var(--line);
  }
  .leave-sheet .leave-chips > .btn.leave-chip.on {
    background: var(--fill); border-color: var(--fill); color: var(--on-fill);
    --bs-btn-color: var(--on-fill); --bs-btn-bg: var(--fill); --bs-btn-border-color: var(--fill);
  }
  .leave-native { height: 44px; min-height: 44px; max-height: 44px; overflow: hidden; }
  .leave-native #startInput {
    display: block; position: static; width: 100%; max-width: none; height: 44px; min-height: 0; max-height: 44px;
    margin: 0; padding: 0 14px; clip: auto; overflow: hidden;
    border: 1px solid var(--line); border-radius: 999px; background: var(--paper);
    font-size: 16px; font-weight: 600; line-height: 44px; color: var(--ink); color-scheme: light;
  }
  .leave-native #startInput::-webkit-datetime-edit,
  .leave-native #startInput::-webkit-datetime-edit-fields-wrapper { padding: 0; max-height: 44px; }
  .leave-hint { margin: 0; font-size: 12px; line-height: 16px; color: var(--mute); }
}
@media (max-width: 430px) {
  .picker.start-pick { min-height: 40px; }
}
html[data-theme="dark"] .leave-native #startInput { color-scheme: dark; }

/* Back to the board: top-left of the Admin and Profile headers, and it stays put while the page scrolls. */
.back-board {
  display: none;
  align-items: center;
  width: auto;
  max-width: 100%;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--fill);
  background: var(--fill);
  color: var(--on-fill);
  font-size: 15px;
  font-weight: 700;
  line-height: 20px;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: none;
  white-space: nowrap;
}
.back-board:hover { filter: brightness(1.08); }
.brand-home { color: inherit; text-decoration: none; pointer-events: none; }
.masthead.has-home,
body.profile-mode .masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--paper);
  box-shadow: 0 1px 0 var(--line);
}
.has-home .back-board,
body.profile-mode .back-board {
  display: inline-flex;
  justify-self: start;
  align-self: start;
}
.has-home .brand-home,
body.profile-mode .brand-home {
  pointer-events: auto;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.has-home .brand-home:hover,
body.profile-mode .brand-home:hover { color: var(--navy); }
.masthead.has-home {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "back back" "titles theme";
  align-items: center;
  gap: 8px 12px;
}
.has-home .back-board { grid-area: back; }
.has-home .titles { grid-area: titles; }
.has-home .theme-toggle { grid-area: theme; justify-self: end; align-self: center; }
.has-home .titles .eyebrow { display: block; white-space: normal; }
body.profile-mode .masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "back back" "titles tools" "stats stats";
  align-items: center;
  gap: 8px 12px;
}
body.profile-mode .back-board { grid-area: back; }
body.profile-mode .titles { grid-area: titles; }
body.profile-mode .titles .eyebrow { display: block; white-space: normal; }
body.profile-mode .mast-tools { grid-area: tools; justify-self: end; align-self: center; }
body.profile-mode .stats { grid-area: stats; }

