/* REQ-13: app-like layout. Colours from the company brand extract; fonts per DEC-11 (SIL OFL, self-hosted). */
@font-face { font-family: "Montserrat"; src: url("fonts/montserrat-latin.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; src: url("fonts/montserrat-latin-ext.woff2") format("woff2"); font-weight: 100 900; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Michroma"; src: url("fonts/michroma-latin.woff2") format("woff2"); font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Michroma"; src: url("fonts/michroma-latin-ext.woff2") format("woff2"); font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

/* REQ-13.5: one set of colours; dark mode follows the device. Sky is only decoration on light surfaces. */
:root {
  color-scheme: light dark;
  --font-body: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Michroma", "Montserrat", sans-serif;
  --bg: #f4f7fa; --surface: #ffffff; --ink: #090f1b; --muted: #4a5a6b; --line: #d3dee7;
  --accent: #0b3f67; --accent-ink: #ffffff; --accent-soft: #e6eff7; --today: #eef5fb;
  --bar: #0b233c; --sky: #0ba6df; --sky-light: #add4ee;
  --danger: #b42318; --danger-bg: #fee4e2; --danger-ink: #7a271a; --offline: #fdead7;
  /* status (REQ-19.11): approved, draft, flown, cancelled (kept apart from the brand blues) */
  --p-bg: #e2ecf5; --p-ink: #0b3f67; --w-bg: #fef0c7; --w-ink: #7a4b00;
  --f-bg: #dcfae6; --f-ink: #05603a; --n-bg: #e9eef3; --n-ink: #3d4b5a;
  --x-bg: #fee4e2; --x-ink: #a11b12;  /* cancelled: red (user, 2026-10-25) */
  /* REQ-13.5: pale card tints; the badge (status bg + ink) carries the colour (style A, user 2026-10-27) */
  --p-tint: #f5f9fc; --w-tint: #fffbf0; --f-tint: #f3fdf6; --x-tint: #fef6f5;
  --off: #eaeef3;  /* REQ-19.13: weekends and holidays */
  --o-bg: #ffe2cc; --o-ink: #9a2e00;  /* REQ-19.12 overdue: orange, apart from draft amber and cancelled red */
  --ctl-h: 44px; --mini-h: 34px;  /* control heights (REQ-13.4); desktop density lowers them */
  --tabbar-h: 61px; --side-w: 240px; --page-w: 87.5rem;  /* REQ-13.7: desktop content up to 1400 px */
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090f1b; --surface: #0b233c; --ink: #ffffff; --muted: #add4ee; --line: #1c3350;
    --accent: #0ba6df; --accent-ink: #090f1b; --accent-soft: #12365a; --today: #0e2a47; --bar: #090f1b;
    --danger: #f97066; --danger-bg: #55160c; --danger-ink: #fecdca; --offline: #3a2410;
    --p-bg: #12365a; --p-ink: #add4ee; --w-bg: #3a2410; --w-ink: #fdb022;
    --f-bg: #0b3324; --f-ink: #75e0a7; --n-bg: #1a2b40; --n-ink: #b9c6d3; --x-bg: #55160c; --x-ink: #fecdca;
    --p-tint: #0e2b48; --w-tint: #241f1a; --f-tint: #0b2a2c; --x-tint: #2c1a22; --o-bg: #4a1d06; --o-ink: #ffb38a;
    --off: #0d1a2c;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.45 var(--font-body); color: var(--ink); background: var(--bg); }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h2 { font-size: 18px; font-weight: 600; margin: 1.5rem 0 .5rem; }
h2.day { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 1.25rem 2px .5rem; }
.muted { color: var(--muted); font-size: .875rem; }
.errorlist { color: var(--danger); padding-left: 1.2rem; }
.helptext { display: block; color: var(--muted); font-size: .875rem; }

/* REQ-13.1: phone/portrait tablet: short top bar, bottom tabs */
.side { display: none; }
/* REQ-13.4: 52 px bar below any status bar, notch or cut-out the device reports (safe-area insets) */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 4px; min-height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) max(8px, env(safe-area-inset-right)) 0 max(8px, env(safe-area-inset-left));
  background: var(--bar); color: #fff; border-bottom: 2px solid var(--sky); view-transition-name: topbar; }
.topbar h1 { flex: 1; margin: 0; padding: 0 8px; font: 400 14px/1.3 var(--font-display); letter-spacing: .04em;
  text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--sky-light); border-radius: 8px; }
.back[href=""] { display: none; }
main { max-width: 60rem; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left)); }
body.signed-in main { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); }
main.wide { max-width: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px env(safe-area-inset-right) calc(6px + env(safe-area-inset-bottom)) env(safe-area-inset-left); view-transition-name: tabbar; }
.tab { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 48px; color: var(--muted); font-size: 11px; font-weight: 600; text-decoration: none; }
.tab.on { color: var(--accent); }
.tab.on::before { content: ""; position: absolute; top: -7px; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--sky); }
#offline { margin: 0; padding: .5rem 1rem; background: var(--offline); }

/* REQ-13.2: main action fixed at the bottom on phones, above the tabs */
.actions { position: fixed; left: 0; right: 0; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: 12px;
  align-items: center; padding: 10px max(16px, env(safe-area-inset-right)) 10px max(16px, env(safe-area-inset-left));
  background: var(--surface); border-top: 1px solid var(--line); }
body.signed-in main:has(.actions) { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 90px); }
.actions > button, .actions > a.button { flex: 1; }
a.button.secondary.danger-text { color: var(--danger); }

/* Controls: 16 px text so iPhone does not zoom (REQ-13.4), 44 px tap targets */
label { display: block; font-weight: 600; margin-bottom: 4px; }
input, select, textarea { width: 100%; max-width: 28rem; min-height: 44px; padding: .5rem .75rem; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
textarea { max-width: 40rem; }
input[type=checkbox], input[type=radio] { width: auto; min-height: 0; accent-color: var(--accent); }
button, a.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px;
  font: 600 16px var(--font-body); color: var(--accent-ink); background: var(--accent); border: 1px solid var(--accent); border-radius: 8px;
  text-decoration: none; cursor: pointer; }
button.secondary, a.button.secondary, .suggestions button { color: var(--accent); background: var(--surface); border-color: var(--line); }
button.danger { color: #fff; background: var(--danger); border-color: var(--danger); }
button.busy { opacity: .7; pointer-events: none; }  /* REQ-13.6 "Saving…" */
label.inline { display: inline-flex; align-items: center; gap: 6px; margin-right: 1rem; font-weight: normal; }
.field { margin: 1rem 0; }
.field fieldset { border: 0; margin: 0; padding: 0; }
.field legend { font-weight: 600; padding: 0; margin-bottom: 4px; }
.field fieldset > div > div { display: inline-block; margin-right: 1.25rem; }  /* radio choices in one row */
.field fieldset label { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: normal; }
/* REQ-13.7: forms as section rows: title above its fields here, left of them on wide pages (below);
   fields in fixed steps of 1, 2 or 3 columns by the section's own width, so every page width looks alike */
.sect { min-width: 0; padding: 0 0 8px; border-top: 1px solid var(--line); }
form > .sect:first-of-type { border-top: 0; }
.sect > h2 { margin: 1rem 0 .25rem; }
.sect-body { min-width: 0; container: sect / inline-size; }
@container sect (min-width: 34rem) {
  .form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 24px; }
  .crew-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .crew-grid .crew-row { margin: 0; }
}
@container sect (min-width: 54rem) {  /* a section's widest step is its own (SECTIONS in forms.py) */
  .form-grid.cols-3, .crew-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
#field-experience_date { grid-column: 1 / -1; }  /* "as at" date on its own line; the hours below fill whole rows */
.form-grid .field:has(textarea), .form-grid .field:has(fieldset) { grid-column: 1 / -1; }
/* REQ-13.7: hints under the input, so inputs side by side stay on one line */
.form-grid .field { display: flex; flex-direction: column; align-items: flex-start; }
.form-grid .field[hidden] { display: none; }  /* e.g. work area fields while not needed (REQ-02.14) */
.form-grid .field > * { max-width: 100%; }
.form-grid .field > .helptext { order: 1; margin-top: 3px; }
.form-grid .field > .quick-add { order: 2; align-self: stretch; }
table.mb input { min-width: 6rem; }
table.mb input[type=checkbox] { min-width: 0; }
/* iOS/iPadOS Safari draws a date field stretched to 100% a little wider than its cell, whatever the
   cell's width (user's iPad, 2026-10-28). In row tables it keeps its own width, so the column fits it.
   (Not appearance: none: that left the value blank until the field was touched.) */
@media (min-width: 1024px) { table.mb input[type=date] { width: auto; } }  /* tables, not phone cards */
input::-webkit-date-and-time-value { text-align: left; }
table.quals select { min-width: 7.5rem; }
table.quals td { padding: .5rem .25rem; }
table.quals .q-desc input { min-width: 10rem; }
table.quals .q-type input, table.quals .q-num input { min-width: 0; width: 5rem; }
.table-scroll { overflow-x: auto; }
.crew-row { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); margin: 0 0 .75rem; padding: .5rem .75rem; }
.roles div, .roles label { display: inline-block; font-weight: normal; margin-right: .75rem; }
.suggestions { margin-top: .35rem; font-size: .875rem; color: var(--muted); }
.suggestions button { min-height: 36px; margin: 0 .35rem .25rem 0; padding: 0 .7rem; font-size: .875rem; }
.pdf-form input { width: auto; }
.inline-form { display: inline; margin-left: .5rem; }
.day-actions { margin: -.25rem 0 .5rem; }
.filters { font-size: .875rem; }
.filter-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 1rem; }  /* REQ-24.1 */
.filter-form input[type=search] { flex: 1 1 14rem; max-width: 22rem; }
.filter-form select { width: auto; flex: 0 1 auto; }
.filter-form label.inline { margin-right: 0; }
dl.compact { display: grid; grid-template-columns: max-content auto; column-gap: 1rem; }
dl.compact dt { margin-top: .35rem; }
dl.compact dd { margin: .35rem 0 0; }
tr.total td { border-top: 2px solid var(--line); }
details { margin: 1rem 0; }
summary { cursor: pointer; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

/* Cards and status (REQ-13.2, REQ-13.5: colour plus text, never colour alone) */
.schedule-item, .card { display: block; margin: 0 0 10px; padding: 12px 14px; color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
a.schedule-item:active { background: var(--accent-soft); }
.card-head { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; margin-bottom: 4px; }
.card-head > :first-child { margin-right: auto; }  /* times left; labels and badges (REQ-19.12: maybe two) right */
.card p { margin: .4rem 0; }
.times { font-size: 17px; font-weight: 600; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap;
  color: var(--n-ink); background: var(--n-bg); border-radius: 999px; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.status-draft { color: var(--w-ink); background: var(--w-bg); }
.badge.status-flown { color: var(--f-ink); background: var(--f-bg); }
.badge.status-cancelled { color: var(--x-ink); background: var(--x-bg); }
.badge.status-overdue { color: var(--o-ink); background: var(--o-bg); }
.badge.inactive { color: var(--w-ink); background: var(--w-bg); }  /* REQ-24.7: as the edit page's status box */
.overdue-note { margin: 0 0 12px; padding: 8px 12px; color: var(--o-ink); background: var(--o-bg); border-radius: 8px; }
.overdue-note a { color: inherit; font-weight: 600; }
.local { display: none; color: var(--muted); font-weight: normal; }
body.show-local .local { display: inline; }
ul.plain { list-style: none; padding: 0; }
ul.plain li { padding: .5rem 0; border-bottom: 1px solid var(--line); }
dl.details { margin: 0; }
dt { font-weight: 600; font-size: .875rem; color: var(--muted); margin-top: .75rem; }
dd { margin: 2px 0 0; }
dd ul { margin: 0; padding-left: 1.2rem; }
.history li { margin-bottom: .5rem; }
/* REQ-13.10: history folded; its summary row is the Show/Hide control */
details.history-box { margin: 1rem 0; padding: 0 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
details.history-box > summary { justify-content: space-between; gap: 12px; list-style: none; }
details.history-box > summary::-webkit-details-marker { display: none; }
details.history-box > summary::after { content: "Show"; color: var(--accent); font-size: 14px; }
details.history-box[open] > summary::after { content: "Hide"; }
details.history-box .history { margin: 0 0 12px; padding-left: 1.2rem; }
.delete-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 1.5rem 0; }

/* Tables (desktop) */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .5rem; border-bottom: 1px solid var(--line); }
th { font-size: 13px; font-weight: 600; color: var(--muted); }
tr.inactive { color: var(--muted); }

/* Planning grid (desktop) and day agenda (phone) */
.grid-scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
/* REQ-13.7: day columns never narrower than a block's times on one line ("08:00–09:30" ≈ 88 px + padding ≈ 112 px);
   the side menu turns to icons (< 1200 px) and phones' layout takes over (< 1024 px) before that happens. */
table.planning { table-layout: fixed; min-width: 56rem; }
table.planning th:first-child { width: 7rem; }
table.planning tr > th:first-child { position: sticky; left: 0; z-index: 2; background: var(--surface); }  /* stays while the grid scrolls */
table.planning td, table.planning th { vertical-align: top; border: 1px solid var(--line); padding: .25rem; }
table.planning tr > :first-child { border-left: 0; }
table.planning tr > :last-child { border-right: 0; }
table.planning thead th { border-top: 0; }
table.planning .off { background: var(--off); }  /* REQ-19.13 */
table.planning .today { background: var(--today); }
table.planning .hol { min-height: 1.4em; overflow: hidden; font-size: 11px; font-weight: 600; color: var(--x-ink); white-space: nowrap; text-overflow: ellipsis; }
.block { display: block; margin-bottom: .35rem; padding: .35rem .375rem; font-size: .85rem; color: var(--ink); text-decoration: none;
  background: var(--p-tint); border: 1px solid var(--p-bg); border-radius: 8px; }
.block > span { display: block; }
.block .badge { display: flex; width: fit-content; max-width: 100%; margin: 4px auto 0; padding: 1px 6px; font-size: 11px; }  /* centred (user) */
.block .badge::before { display: none; }  /* narrow day columns (iPad): the word must fit; colour and text stay */
.block.status-draft { background: var(--w-tint); border-color: var(--w-bg); }
.block.status-flown { background: var(--f-tint); border-color: var(--f-bg); }
.block.status-cancelled { background: var(--x-tint); border-color: var(--x-bg); }
.add { display: block; text-align: center; color: var(--muted); text-decoration: none; border-radius: 8px; }
.add:hover { color: var(--accent); background: var(--accent-soft); }
.chips { display: flex; gap: 6px; margin: 0 0 4px; }
.chip { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 0; height: 56px;
  font-size: 12px; color: var(--ink); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.chip b { font-size: 17px; font-weight: 600; }
.chip.today { border-color: var(--sky); }
.chip.off { background: var(--off); }  /* REQ-19.13 */
.chip.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.add-card { display: flex; align-items: center; justify-content: center; min-height: 44px; margin-bottom: 6px; font-size: 14px;
  color: var(--muted); text-decoration: none; border: 1px dashed var(--line); border-radius: 12px; }

/* REQ-19: Flight Schedule (week grid / list, Mine, UTC or local times, day release state) */
.sched-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: 0 0 14px; }
.weeknav { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
a.button.square { min-width: 44px; padding: 0; font-size: 20px; }
.this-week { font-size: .875rem; margin-left: 4px; }
.seg { display: inline-flex; }
.seg > a, .seg > button { display: inline-flex; align-items: center; min-height: 44px; margin-left: -1px; padding: 0 14px;
  font: 600 14px var(--font-body); color: var(--accent); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 0; }
.seg > :first-child { margin-left: 0; border-radius: 8px 0 0 8px; }
.seg > :last-child { border-radius: 0 8px 8px 0; }
.seg > .on, .seg > [aria-pressed="true"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.toggle { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px; font-size: 14px; font-weight: 600;
  color: var(--accent); text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; }
.knob { position: relative; width: 30px; height: 18px; border-radius: 9px; background: var(--line); }
.knob::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; }
.toggle.on { background: var(--accent-soft); border-color: var(--accent); }
.toggle.on .knob { background: var(--accent); }
.toggle.on .knob::after { left: 14px; }
.wide-only { display: none; }
.t-loc { display: none; }
body.show-local .t-loc { display: inline; }
body.show-local .t-utc { display: none; }
.t-utc sup, .t-loc sup { margin-left: 1px; font-size: .65em; font-weight: 700; color: var(--w-ink); }
.dayh { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin: 1.25rem 2px .5rem; }
.dayh h2.day { margin: 0; }
.dayh.off { padding: 6px 10px; background: var(--off); border-radius: 8px; }  /* REQ-19.13 */
.hol { color: var(--x-ink); }
.day-meta { font-size: 12px; color: var(--muted); }
.drafts { font-weight: 700; color: var(--w-ink); }
.day-acts { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.day-acts form { margin: 0; }
button.mini, a.button.mini { min-height: 34px; padding: 0 10px; font-size: 13px; }
table.planning thead th .dh { font-size: 14px; color: var(--ink); }
table.planning thead th .day-meta { display: block; min-height: 2.9em; margin-top: 2px; font-weight: 500; }  /* two lines in every day */
table.planning thead th .day-meta .sep { display: none; }
table.planning thead th .drafts { display: block; }
table.planning thead th .day-acts { margin-top: 6px; }
.block.dim { opacity: .35; }
.block.mine { box-shadow: 0 0 0 2px var(--accent); }
.now { padding: 2px 8px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #090f1b;
  background: var(--sky); border-radius: 999px; }
.today-box { margin: 8px 0 18px; overflow: hidden; background: var(--today); border: 1px solid var(--line); border-radius: 12px; }
.today-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 12px 16px; color: #fff; background: var(--bar); }
.today-head h2 { margin: 0; font: 400 14px var(--font-display); letter-spacing: .05em; text-transform: uppercase; }
.today-head .day-meta { color: var(--sky-light); }
.today-head .drafts { color: #fdb022; }
.today-body { padding: 12px; }
.sched-card { margin: 0 0 10px; }
.sched-card .schedule-item { margin: 0; }
/* REQ-19.4: today's cards: larger times, the room used for details (not bigger text) */
.today-card .schedule-item { padding: 14px 18px; }
/* REQ-19.4: timeline: each time on the row of its airport; names cut with "…" rather than wrapping */
.tl { display: grid; grid-template-columns: auto 14px auto minmax(0, 1fr); column-gap: 10px; row-gap: 2px; align-items: center; margin: 2px 0; }
.tl-t { font-size: 20px; font-weight: 600; font-variant-numeric: tabular-nums; }
.tl-dot { justify-self: center; width: 10px; height: 10px; border: 2px solid var(--accent); border-radius: 50%; background: var(--surface); }
.tl-dot.arr { background: var(--accent); }
.tl-line { justify-self: center; width: 2px; height: 12px; background: var(--sky-light); }
.tl-place { font-size: 16px; font-weight: 700; white-space: nowrap; }
.tl-name { min-width: 0; overflow: hidden; font-size: 13px; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.tl-zone { display: block; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.alt-utc { display: none; }
body.show-local .alt-utc { display: inline; }
body.show-local .alt-loc { display: none; }
.tc-grid { display: grid; gap: 0 32px; margin: 6px 0 8px; }
.tc-col { margin: 0; }
.tc-col dt { margin: 8px 0 0; font-size: 12px; font-weight: 500; }  /* phones: label above the value */
.tc-col dd { margin: 0; }
.tc-col strong { font-weight: 600; }
.sched-card a.button.record { width: 100%; margin-top: 8px; }
.close-acts { display: flex; gap: 8px; margin-top: 6px; }  /* REQ-19.12 */
.close-acts .button { flex: 1; padding: 0 10px; white-space: nowrap; }
.sched-card:has(.close-acts) { margin-bottom: 20px; }  /* buttons belong to the card above them */
.schedule-item.status-approved { background: var(--p-tint); border-color: var(--p-bg); }
.schedule-item.status-draft { background: var(--w-tint); border-color: var(--w-bg); }
.schedule-item.status-flown { background: var(--f-tint); border-color: var(--f-bg); }
.schedule-item.status-cancelled { background: var(--x-tint); border-color: var(--x-bg); }
.crew { color: var(--muted); }
.empty { margin: .25rem 2px .75rem; font-size: 14px; color: var(--muted); }
details.earlier { margin: 0 0 8px; }
.ac-head { margin: 14px 2px 6px; font-size: 15px; }
.note { padding: 10px 12px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: 8px; }
details.quick-add { margin: .35rem 0 .5rem; }
details.quick-add summary { min-height: 36px; font-size: 14px; color: var(--accent); }
details.quick-add[open] { padding: 0 12px 8px; background: var(--accent-soft); border-radius: 8px; }
.pill { margin-left: auto; padding: 1px 8px; font-size: 11px; font-weight: 700; color: #3a2410; background: #fdb022; border-radius: 999px; }
.review { padding: 12px 14px; background: var(--w-bg); border-radius: 12px; }
.note.warn { color: var(--w-ink); background: var(--w-bg); border: 1px solid var(--w-ink); margin-bottom: 1rem; }  /* REQ-23.3 */
.note.warn ul { margin: .35rem 0 0; padding-left: 1.2rem; }
.message.warning { color: var(--w-ink); background: var(--w-bg); border-color: var(--w-ink); animation-delay: 0s, 10s; }
.q-expired { font-weight: 700; color: var(--danger); }  /* REQ-23.2 */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* REQ-24.7: status switch; its text and the form's tint follow it at once */
.status { display: flex; flex-wrap: wrap; align-items: center; gap: 0 16px; margin: 0 0 .5rem; padding: 4px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.status p { margin: 6px 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 44px; margin: 0; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 44px; height: 26px; margin: 0; }
.switch .track { position: relative; flex: none; width: 44px; height: 26px; border-radius: 13px;
  background: var(--line); box-shadow: inset 0 0 0 1px var(--muted); transition: background .15s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .3); transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); box-shadow: none; }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
form:has(.switch input:checked) .when-off, form:has(.switch input:not(:checked)) .when-on { display: none; }
form:has(.switch input:not(:checked)) .status { color: var(--w-ink); background: var(--w-bg); border-color: var(--w-ink); }
form.entry:has(.switch input:not(:checked)) { background: var(--w-tint); box-shadow: 0 0 0 12px var(--w-tint); }

/* REQ-24.4/24.5: rows removed on Save, calculated arm or moment */
tr.removed td:not(.row-remove) { opacity: .4; pointer-events: none; }
tr.removed td:not(.row-remove) input, tr.removed td:not(.row-remove) select { text-decoration: line-through; }
td.row-remove { white-space: nowrap; }
.calc { display: none; color: var(--muted); font-size: 12px; }
tr[data-source=arm] .mb-moment .calc, tr[data-source=moment] .mb-arm .calc { display: block; }
tr[data-source=arm] .mb-moment input, tr[data-source=moment] .mb-arm input { background: var(--bg); border-style: dashed; }

/* REQ-24.3/24.6: dialogs over the page */
dialog.sheet { width: min(32rem, calc(100% - 32px)); padding: 20px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgb(0 0 0 / .3); }
dialog.sheet::backdrop { background: rgb(9 15 27 / .5); }
dialog.sheet h2 { margin-top: 0; }
dialog.sheet ul.changes { margin: 0 0 1rem; padding-left: 1.2rem; }
dialog.sheet .choices { display: grid; gap: 10px; }
dialog.sheet [hidden] { display: none; }  /* REQ-24.3: parts the save review shows only for some changes */
dialog.sheet .choices button { flex-direction: column; align-items: flex-start; gap: 2px; padding: 10px 14px; text-align: left; }
dialog.sheet .choices small { font-weight: 400; color: var(--muted); }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; margin: 1rem 0 0; }
.q-expiring { font-weight: 700; color: var(--w-ink); }
.review h2 { margin-top: 0; }
.menu-btn { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; color: var(--sky-light); }
body.no-tabs main, body.no-tabs main:has(.actions) { padding-bottom: calc(env(safe-area-inset-bottom) + 24px); }
body.no-tabs .actions { bottom: 0; padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
body.no-tabs .toasts { bottom: calc(env(safe-area-inset-bottom) + 24px); }

/* More page */
.menu-list { list-style: none; margin: 0 0 16px; padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.menu-list li + li { border-top: 1px solid var(--line); }
.menu-list form { margin: 0; }
.menu-list a, .menu-list button { display: flex; align-items: center; justify-content: flex-start; gap: 12px; width: 100%; min-height: 52px; padding: 0 14px;
  font: 500 16px var(--font-body); color: var(--ink); text-decoration: none; background: none; border: 0; border-radius: 0; }
.menu-list .icon { color: var(--accent); }
.menu-list .muted { margin-left: auto; }
.menu-list button, .menu-list button .icon { color: var(--danger); }

/* REQ-13.6: short confirmation after saving; success fades, errors stay a little longer */
.toasts { position: fixed; z-index: 20; left: 16px; right: 16px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 76px);
  display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.message { width: 100%; max-width: 28rem; margin: 0; padding: 12px 14px; color: #fff; background: #0b233c; border: 1px solid var(--sky);
  border-radius: 8px; box-shadow: 0 2px 12px rgb(9 15 27 / .25); pointer-events: auto; cursor: pointer;
  animation: toast-in .2s ease-out, toast-out .3s ease-in 4s forwards; }
.message.error { color: var(--danger-ink); background: var(--danger-bg); border-color: var(--danger); animation-delay: 0s, 10s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@keyframes toast-out { to { opacity: 0; visibility: hidden; } }

/* Login */
main.login { max-width: 26rem; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 8px 0 24px; padding: 28px;
  background: var(--bar); border-radius: 12px; }
.login-brand img { max-width: 100%; height: auto; }
.appname { font: 400 13px var(--font-display); letter-spacing: .08em; text-transform: uppercase; color: #fff; }

/* REQ-13.6: smooth page changes (browsers without support just switch pages) */
/* Desktop only: on the iPhone home-screen app the fade showed the status bar strip white (user, 2026-10-26). */
@media (min-width: 1024px) {
  @view-transition { navigation: auto; }
}
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .15s; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  .message { animation: none; }
}

/* REQ-13.2: phones show lists as cards */
@media (max-width: 1023px) {
  .grid-scroll { display: none; }
  table.cards thead { display: none; }
  table.cards, table.cards tbody { display: block; }
  table.cards tr { display: block; margin-bottom: 10px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
  table.cards td { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; border: 0; text-align: right; }
  table.cards td::before { content: attr(data-label); color: var(--muted); font-size: 14px; text-align: left; }
  table.cards td:first-child { font-size: 17px; font-weight: 600; text-align: left; }
  table.cards td:first-child::before { content: none; }
  table.cards td:empty { display: none; }
  /* REQ-24.4/24.5: row cards on phones: labels in one column, inputs in the other, notes under the input */
  table.cards.mb td { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); align-items: center; gap: 2px 12px; text-align: left; }
  table.cards.mb td:empty { display: none; }  /* e.g. a variant's Review cell when nothing is to review */
  table.cards.mb td::before, table.cards.mb td:first-child::before { content: attr(data-label); grid-column: 1; grid-row: 1;
    align-self: start; padding-top: calc((var(--ctl-h) - 1.45em) / 2); font-size: 14px; font-weight: 400; }
  table.cards.mb td > * { grid-column: 2; }
  table.cards.mb td > input[type=checkbox] { justify-self: start; }
  table.cards.mb td:has(> input[type=checkbox])::before { align-self: center; padding-top: 0; }
  table.cards.mb td.row-remove > button { justify-self: end; }
}

/* REQ-13.3: desktop: side menu, full-width grid, denser forms */
@media (min-width: 1024px) {
  body.signed-in { padding-left: var(--side-w); }
  .side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 10; width: var(--side-w); display: flex; flex-direction: column; gap: 2px;
    padding: 20px 12px; overflow-y: auto; color: #fff; background: var(--bar); border-right: 1px solid var(--line); view-transition-name: side; }
  .brand { display: flex; flex-direction: column; gap: 10px; padding: 4px 12px 22px; text-decoration: none; }
  .brand img { width: 150px; height: auto; }  /* digital minimum 130 px wide (brand extract) */
  .navsec { padding: 16px 12px 6px; font-size: 12px; color: var(--sky-light); text-transform: uppercase; letter-spacing: .05em; }
  .nav { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: 40px; padding: 0 12px;
    font: 400 15px var(--font-body); color: #fff; text-decoration: none; background: none; border: 0; border-radius: 8px; }
  .nav .icon { width: 20px; height: 20px; opacity: .85; }
  .nav:hover { background: rgb(255 255 255 / .07); }
  .nav.on { color: var(--sky); background: rgb(11 166 223 / .16); font-weight: 600; }
  .side-foot { margin-top: auto; padding-top: 16px; }
  .side-foot form { margin: 0; }
  .tabbar { display: none; }
  body.signed-in main { padding-bottom: 32px; }
  /* REQ-13.7: title row of a fixed height; the page's main actions sit at its right (.page-actions) */
  .topbar { position: static; max-width: var(--page-w); height: 76px; min-height: 0; margin: 0 auto; padding: 24px 16px 0; color: var(--ink); background: none; border: 0; }
  .page:has(main.wide) .topbar { max-width: none; }
  .page:has(main.login) .topbar { max-width: 26rem; }
  .topbar h1 { padding: 0; font-size: 22px; }
  .page:has(.page-actions) .topbar h1 { margin-right: 18rem; }
  main { position: relative; max-width: var(--page-w); container-type: inline-size; }
  .page-actions, .page-actions.actions { position: absolute; top: -52px; right: 16px; left: auto; display: flex; align-items: center; gap: 12px; height: 52px; margin: 0; }
  .page-actions p, .page-actions .actions { margin: 0; }
  .back { margin-left: -12px; color: var(--accent); }
  .actions { position: static; margin: 16px 0; padding: 0; background: none; border: 0; }
  body.signed-in main:has(.actions) { padding-bottom: 32px; }
  .actions > button, .actions > a.button { flex: 0 0 auto; }
  .form-grid .field { margin: .6rem 0; }
  /* REQ-13.7: Save/Cancel stay in view at the bottom of the window */
  form .actions { position: sticky; bottom: 0; z-index: 5; margin: 16px 0 0; padding: 12px 0; background: var(--bg); border-top: 1px solid var(--line); }
  /* REQ-13.7: lists as tables in a panel; the header stays visible; the whole row opens the item (app.js) */
  table.cards:not(.mb) { border-collapse: separate; border-spacing: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
  table.cards:not(.mb) th { position: sticky; top: 0; z-index: 1; padding: .6rem .75rem; background: var(--surface); }
  table.cards:not(.mb) td { padding: .55rem .75rem; }
  table.cards:not(.mb) tr:first-child > th:first-child { border-top-left-radius: 12px; }
  table.cards:not(.mb) tr:first-child > th:last-child { border-top-right-radius: 12px; }
  table.cards:not(.mb) tbody tr:last-child > td { border-bottom: 0; }
  table.cards td a { font-weight: 600; text-decoration: none; }
  table.cards td a:hover { text-decoration: underline; }
  tr.rowlink { cursor: pointer; }
  tr.rowlink:hover > td { background: var(--accent-soft); }
  th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
  main > p, main > .muted { max-width: 80ch; }
  /* REQ-13.7: detail pages: data left, the rest right; data as label/value rows */
  .detail-main dl.details { max-width: 40rem; }
  .detail-main dl.details { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 0 16px; padding: 4px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
  .detail-main dl.details dt, .detail-main dl.details dd { margin: 0; padding: .55rem 0; border-bottom: 1px solid var(--line); }
  .detail-main dl.details dt:last-of-type, .detail-main dl.details dd:last-of-type { border-bottom: 0; }
  .detail-main dl.details dt { max-width: 11rem; }
  .agenda { display: none; }
  .wide-only { display: inline; }
  .narrow-only { display: none; }
  .menu-btn { display: none; }
  .sched-card a.button.record { width: auto; }
  .tc-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }  /* REQ-19.4: two columns of details */
  .tc-col { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 4px 12px; align-content: start; }
  .tc-col dt { margin: 0; font-size: 13px; }
  .close-acts .button { flex: 0 0 auto; }
  .toasts { left: auto; right: 24px; bottom: 24px; align-items: flex-end; }
}

/* REQ-24.5: row tables align on their inputs, so a "calculated" note under one does not shift the row */
@media (min-width: 1024px) {
  table.mb td { vertical-align: top; }
  table.mb td > input[type=checkbox] { margin-top: calc((var(--ctl-h) - 13px) / 2); }
  table.mb td.row-remove button { margin-top: calc((var(--ctl-h) - var(--mini-h)) / 2); }
  .actions .push { margin-left: auto; }
}

/* REQ-13.7: side by side only when the content area (not the window) has room for both columns */
@container (min-width: 66rem) {
  .detail-cols { display: grid; grid-template-columns: minmax(18rem, 26rem) minmax(0, 1fr); gap: 32px; align-items: start; }
  .detail-cols.main-wide { grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem); }  /* flights: data wide, history aside */
  .detail-cols > section > h2:first-child { margin-top: 0; }
  .detail-main dl.details { max-width: none; }
  .main-wide .detail-main dl.details dt { max-width: 16rem; }
}
@container (min-width: 62rem) {  /* titles left only when a row table still fits beside them */
  form:has(> .sect) { max-width: 80rem; }
  .sect { display: grid; grid-template-columns: 11rem minmax(0, 1fr); gap: 0 32px; padding: 8px 0 12px; }
  .sect > h2 { margin: .7rem 0 0; }
}

/* REQ-13.7: narrow desktop windows (and small landscape tablets): side menu as icons, labels on hover */
@media (min-width: 1024px) and (max-width: 1199px) {
  :root { --side-w: 64px; }
  .side { padding: 16px 8px; }
  .brand { display: none; }
  .navsec { margin: 10px 8px; padding: 0; font-size: 0; border-top: 1px solid rgb(255 255 255 / .15); }  /* sections as dividers */
  .side .nav { position: relative; justify-content: center; padding: 0; font-size: 0; min-height: 44px; }  /* .side: beats the density rule */
  .nav .icon { width: 22px; height: 22px; }
  .side .pill { position: absolute; top: 2px; right: 4px; margin: 0; padding: 0 5px; font-size: 10px; }
}

/* REQ-13.7: mouse/trackpad: desktop density (touch screens keep 16 px text and 44 px targets, REQ-13.4) */
@media (min-width: 1024px) and (pointer: fine) {
  body { font-size: 14px; }
  h2 { font-size: 16px; }
  .muted, .helptext, .filters { font-size: 13px; }
  label { margin-bottom: 3px; }
  input, select, textarea { min-height: 36px; padding: .375rem .625rem; font-size: 14px; }
  button, a.button { min-height: 36px; padding: 0 14px; font-size: 14px; }
  :root { --ctl-h: 36px; --mini-h: 28px; }
  button.mini, a.button.mini { min-height: 28px; padding: 0 8px; font-size: 12px; }
  a.button.square { min-width: 36px; font-size: 18px; }
  .seg > a, .seg > button, .toggle { min-height: 36px; font-size: 13px; }
  .field fieldset label { min-height: 32px; }
  summary { min-height: 36px; }
  .nav { min-height: 36px; font-size: 14px; }
  .times { font-size: 15px; }
  th { font-size: 12px; }
  .crew-row { padding: .35rem .75rem; }
  .crew-row label { margin-bottom: 2px; }
}
