/* iOS-style grouped interface. Colours follow the system palette: grouped background, secondary
   grouped background for cards, hairline separators, the app tint for actions. */
:root {
  --bg: #f2f2f7; --card: #ffffff; --fill: rgba(120,120,128,.12); --fill-strong: rgba(120,120,128,.2);
  --label: #000000; --secondary: rgba(60,60,67,.6); --tertiary: rgba(60,60,67,.3);
  --separator: rgba(60,60,67,.12); --bar: rgba(242,242,247,.8);
  --tint: #C8102E; --tint-soft: rgba(200,16,46,.1); /* PICKAXE heritage red, PMS 186 */
  --orange: #c77700; --green: #248a3d; --red: #d70015;
  --radius: 14px; --row: 50px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --card: #1c1c1e; --fill: rgba(118,118,128,.24); --fill-strong: rgba(118,118,128,.36);
    --label: #ffffff; --secondary: rgba(235,235,245,.6); --tertiary: rgba(235,235,245,.3);
    --separator: rgba(84,84,88,.6); --bar: rgba(22,22,24,.78);
    --tint: #F04256; --tint-soft: rgba(240,66,86,.18); /* the heritage red, lifted for contrast on black */
    --orange: #ffb340; --green: #30d158; --red: #ff6961;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--label);
  font: 17px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.01em; -webkit-font-smoothing: antialiased;
}
.sprite { position: absolute; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.secondary { color: var(--secondary); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
button, .seg-option, .row-action { transition: transform .15s ease, opacity .15s ease, background-color .15s ease; }
button:active:not(:disabled), .seg-option:active { transform: scale(.97); opacity: .7; }
button:disabled { opacity: .4; cursor: default; }
[hidden] { display: none !important; }

/* Navigation bar: sticky, translucent, title appears once the large title scrolls away */
.navbar {
  position: sticky; top: 0; z-index: 50; padding-top: env(safe-area-inset-top);
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: .5px solid transparent; transition: border-color .2s;
}
body.scrolled .navbar { border-bottom-color: var(--separator); }
.navbar-inner { max-width: 1120px; margin: 0 auto; height: 52px; padding: 0 16px;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.nav-side.end { justify-self: end; }
.nav-title { font-weight: 600; font-size: 17px; opacity: 0; transition: opacity .2s; }
body.scrolled .nav-title { opacity: 1; }
.nav-logo img { display: block; height: 42px; width: auto; margin-left: -10px; }
.welcome-logo img { display: block; width: 200px; height: auto; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--fill-strong); color: var(--label);
  font-size: 13px; font-weight: 600; letter-spacing: 0; }

/* Page */
.page { max-width: 1120px; margin: 0 auto; padding: 0 16px calc(32px + env(safe-area-inset-bottom)); }
.title-block { display: flex; align-items: center; gap: 10px; padding: 4px 4px 14px; }
.large-title { font-size: 34px; line-height: 1.12; font-weight: 700; letter-spacing: -.025em; margin: 0; }
.test-pill { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--tint); background: var(--tint-soft); border-radius: 999px; padding: 3px 9px; }
.status { color: var(--secondary); text-align: center; font-size: 15px; margin: 24px 0; }
.status:empty { display: none; }
.status.error { color: var(--red); }

/* Welcome / sign-in */
.welcome { min-height: 72vh; display: grid; place-content: center; justify-items: center; text-align: center; gap: 14px; padding: 24px 8px; }
.welcome h1 { font-size: 28px; font-weight: 700; letter-spacing: -.025em; margin: 6px 0 0; }
.welcome p { margin: 0 0 12px; font-size: 17px; line-height: 1.4; max-width: 320px; }
.welcome .btn-primary { width: 100%; max-width: 320px; }

/* Grouped sections */
.section-header { font-size: 13px; text-transform: uppercase; letter-spacing: .02em; color: var(--secondary);
  margin: 26px 16px 7px; display: flex; justify-content: space-between; align-items: baseline; }
.section-footer { font-size: 13px; line-height: 1.35; color: var(--secondary); margin: 7px 16px 0; }
.group { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.row { position: relative; display: flex; align-items: center; gap: 12px; min-height: var(--row);
  padding: 7px 16px; width: 100%; text-align: left; }
.row + .row::before { content: ""; position: absolute; top: 0; left: 16px; right: 0; border-top: .5px solid var(--separator); }
.row-label { flex: none; min-width: 92px; }
.row-value { flex: 1; min-width: 0; text-align: right; }
input, textarea { font: inherit; color: var(--label); background: none; border: 0; outline: none; padding: 0; min-width: 0; }
input::placeholder, textarea::placeholder { color: var(--tertiary); }
.row-textarea { display: block; width: 100%; padding: 14px 16px; resize: vertical; min-height: 96px; line-height: 1.4; }
.row-action { color: var(--tint); gap: 10px; }
.row-action:active { background: var(--fill); transform: none; opacity: 1; }

/* Segmented controls */
.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 2px;
  background: var(--fill); border-radius: 10px; }
.segmented button, .seg-option { min-height: 36px; border-radius: 8px; font-size: 15px; font-weight: 500; }
.segmented [aria-selected="true"] { background: var(--card); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); font-weight: 600; }
.segmented.aircraft { border-radius: 14px; padding: 3px; }
.seg-option { display: grid; place-content: center; text-align: center; padding: 9px 6px; cursor: pointer; border-radius: 11px; min-height: 58px; }
.seg-option input { position: absolute; opacity: 0; pointer-events: none; }
.seg-option b { font-size: 16px; font-weight: 600; }
.seg-option small { font-size: 13px; color: var(--secondary); margin-top: 2px; }
.seg-option:has(input:checked) { background: var(--card); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 0 0 .5px rgba(0,0,0,.04); }
.seg-option:has(input:focus-visible) { outline: 2px solid var(--tint); }
.tabs { margin: 0 0 4px; }

/* Stepper */
.stepper { margin-left: auto; display: flex; align-items: center; background: var(--fill); border-radius: 9px; }
.stepper .step { width: 44px; height: 34px; display: grid; place-items: center; color: var(--label); }
.stepper .step svg { width: 17px; height: 17px; }
.stepper input { width: 34px; text-align: center; font-weight: 600; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper input::-webkit-inner-spin-button, .stepper input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Legs */
.leg .remove { font-size: 15px; color: var(--red); text-transform: none; letter-spacing: 0; min-height: 30px; }
.airport-row { align-items: flex-start; padding-top: 13px; padding-bottom: 11px; }
.airport-row .row-label { padding-top: 1px; }
.airport-field { flex: 1; min-width: 0; position: relative; text-align: right; }
.airport-field input { width: 100%; text-align: right; font-weight: 600; text-transform: uppercase; }
.airport-field input::placeholder { text-transform: none; font-weight: 400; }
.airport-info { font-size: 13px; color: var(--secondary); margin-top: 3px; line-height: 1.3; }
.airport-info.warn { color: var(--red); }
.airport-fixed { flex: 1; text-align: right; }
.airport-fixed .code { font-weight: 600; display: block; }
.airport-fixed .secondary { font-size: 13px; }
.date-time { margin-left: auto; display: flex; gap: 6px; }
.date-time input { background: var(--fill); border-radius: 8px; padding: 0 10px; height: 36px; font-size: 16px;
  -webkit-appearance: none; appearance: none; min-width: 0; text-align: center; }
.date-time input[type=date] { width: 9.2em; }
.date-time input[type=time] { width: 6.2em; }
.est { color: var(--tint); }
ul.suggestions { position: absolute; z-index: 20; right: -8px; left: -104px; top: calc(100% + 6px); list-style: none; margin: 0; padding: 0;
  background: var(--card); border-radius: 12px; overflow: hidden; text-align: left;
  box-shadow: 0 12px 32px rgba(0,0,0,.18), 0 0 0 .5px var(--separator); }
ul.suggestions li { padding: 12px 14px; min-height: 48px; cursor: pointer; font-size: 15px; line-height: 1.3; }
ul.suggestions li + li { border-top: .5px solid var(--separator); }
ul.suggestions li:active, ul.suggestions li:hover { background: var(--fill); }
ul.suggestions .secondary { display: block; font-size: 13px; }
.actions { margin-top: 20px; }

/* Bottom action bar: frosted, pinned while the form is on screen */
.action-bar { position: sticky; bottom: 0; z-index: 30; margin: 24px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--separator); display: grid; gap: 8px; }
#summary { margin: 0; font-size: 13px; color: var(--secondary); text-align: center; font-variant-numeric: tabular-nums; }
.btn-primary { min-height: 50px; border-radius: 14px; background: var(--tint); color: #fff; font-size: 17px; font-weight: 600; padding: 0 24px; }

/* Schedule */
.pane-head { display: flex; justify-content: space-between; align-items: center; }
.pane-head .section-header { margin-right: 0; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; color: var(--tint); margin: 12px 4px 0 0; }
.aircraft-title { font-size: 20px; font-weight: 700; letter-spacing: -.015em; margin: 18px 4px 8px; display: flex; gap: 8px; align-items: baseline; }
.aircraft-title .secondary { font-size: 15px; font-weight: 400; }
.event { display: flex; gap: 14px; align-items: flex-start; padding: 12px 16px; position: relative; }
.event + .event::before { content: ""; position: absolute; top: 0; left: 72px; right: 0; border-top: .5px solid var(--separator); }
.date-chip { flex: none; width: 42px; text-align: center; line-height: 1.1; }
.date-chip small { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--tint); }
.date-chip b { display: block; font-size: 22px; font-weight: 600; }
.event-main { flex: 1; min-width: 0; }
.event-main .title { font-weight: 600; overflow-wrap: anywhere; }
.event-main .meta { font-size: 15px; color: var(--secondary); margin-top: 2px; }
.event-main details { margin-top: 6px; font-size: 14px; color: var(--secondary); }
.event-main summary { color: var(--tint); cursor: pointer; }
.event-main .notes { white-space: pre-line; margin-top: 4px; }
.pill { flex: none; font-size: 12px; font-weight: 600; border-radius: 999px; padding: 3px 9px; margin-top: 2px; }
.pill.pending { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); }
.pill.confirmed { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.empty { padding: 16px; color: var(--secondary); font-size: 15px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 16px; font-size: 15px; line-height: 1.35; }
.notice svg { color: var(--orange); margin-top: 1px; }

/* Phone: one pane at a time, chosen by the tabs */
body[data-tab="book"] .pane-side, body:not([data-tab="book"]) .pane-book,
body[data-tab="requests"] #schedule-section, body[data-tab="schedule"] #mine-section { display: none; }

/* Wide screens: both panes side by side, no tabs */
@media (min-width: 960px) {
  .page { padding-left: 24px; padding-right: 24px; }
  .tabs { display: none; }
  body .pane-book, body .pane-side, body #mine-section, body #schedule-section { display: block !important; }
  .columns { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 32px; align-items: start; }
  .pane-side { position: sticky; top: calc(64px + env(safe-area-inset-top)); max-height: calc(100vh - 80px); overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .action-bar { margin: 24px 0 0; border-radius: 16px; border: .5px solid var(--separator); bottom: 16px;
    grid-template-columns: 1fr auto; align-items: center; }
  #summary { text-align: left; font-size: 15px; }
  .row-label { min-width: 110px; }
  ul.suggestions { left: -118px; }
}

/* Confirmation sheet */
.sheet { border: 0; border-radius: 22px; padding: 28px 24px 20px; width: min(92vw, 380px); text-align: center;
  background: var(--card); color: var(--label); box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.sheet::backdrop { background: rgba(0,0,0,.35); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
.sheet h2 { font-size: 22px; font-weight: 700; letter-spacing: -.015em; margin: 12px 0 6px; }
.sheet p { margin: 0 0 20px; font-size: 15px; line-height: 1.4; }
.sheet .btn-primary { width: 100%; }
.sheet-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; }
.sheet-icon svg { width: 30px; height: 30px; stroke-width: 2.5; }
.sheet-icon.ok { background: color-mix(in srgb, var(--green) 15%, transparent); color: var(--green); }
.sheet-icon.error { background: color-mix(in srgb, var(--red) 13%, transparent); color: var(--red); }
.sheet p { white-space: pre-line; }
ul.suggestions:empty { display: none; }
/* Date and time shrink to fit beside the row label on narrow phones. */
.date-time { flex: 1; min-width: 0; justify-content: flex-end; }
.date-time input[type=date] { flex: 1 1 8.4em; width: auto; max-width: 9.2em; }
.date-time input[type=time] { flex: 1 1 5.4em; width: auto; max-width: 6.2em; }
@media (max-width: 400px) { .row-label { min-width: 76px; } .date-time input { padding: 0 6px; font-size: 15px; } }
/* iOS draws the selected segment lighter than the track in dark mode. */
@media (prefers-color-scheme: dark) {
  .segmented [aria-selected="true"], .seg-option:has(input:checked) { background: #636366; box-shadow: none; }
}
/* Group: multi-select pills */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border-radius: 999px; background: var(--fill); font-size: 15px; font-weight: 500; cursor: pointer;
  box-shadow: inset 0 0 0 .5px var(--separator); transition: transform .15s ease, opacity .15s ease, background-color .15s ease; }
.chip:active { transform: scale(.97); opacity: .7; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip svg { width: 16px; height: 16px; stroke-width: 2.6; display: none; }
.chip:has(input:checked) { background: var(--tint); color: #fff; box-shadow: none; }
.chip:has(input:checked) svg { display: block; }
.chip:has(input:focus-visible) { outline: 2px solid var(--tint); outline-offset: 2px; }
/* Sign-in page: the large stacked logo is the only branding, so the bar is hidden */
body.signed-out .navbar { display: none; }
body.signed-out .welcome { min-height: 100vh; min-height: 100dvh; padding-top: env(safe-area-inset-top); }
.welcome-logo img { width: 240px; }
/* Group row: collapsed summary with a disclosure chevron; the pills open beneath it */
.row-disclosure .row-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-disclosure .chev { width: 16px; height: 16px; color: var(--tertiary); stroke-width: 2.5; transition: transform .2s ease; }
.row-disclosure[aria-expanded="true"] .chev { transform: rotate(90deg); }
.row-disclosure:active { background: var(--fill); transform: none; opacity: 1; }
.group-panel { padding: 4px 16px 14px; }
.group-panel .chip { box-shadow: none; }
.panel-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 10px; font-size: 13px; }
.panel-foot .done { color: var(--tint); font-size: 17px; font-weight: 600; min-height: 44px; padding: 0 4px; }
/* My Requests: each booking with its status and a Cancel action */
.event-side { flex: none; display: grid; justify-items: end; gap: 4px; }
.cancel-btn { color: var(--red); font-size: 15px; min-height: 36px; padding: 0 2px; }
.pill.declined { color: var(--red); background: color-mix(in srgb, var(--red) 12%, transparent); }
#schedule-section .section-header { margin-top: 30px; }
