
:root {
  --c-navy: #1c2b4a;
  --c-navy-2: #14203a;
  --c-navy-deep: #0f1a30;
  --c-ink: #1b2230;
  --c-muted: #5c6675;
  --c-line: #e4e7ec;
  --c-line-strong: #cfd4dc;
  --c-surface: #ffffff;
  --c-surface-soft: #f6f7f9;
  --c-ivory: #faf8f4;
  --c-ivory-deep: #f3eee4;
  --c-gold: #b08a46;
  --c-gold-light: #c9a35f;
  --c-gold-fill: #96702e;
  --c-gold-ink: #8a6a2f;
  --c-ok: #3f6b52;
  --c-ok-soft: #eef4ef;
  --c-ok-line: #bcd6c2;
  --c-danger: #a3403a;
  --c-danger-soft: #fbeceb;
  --c-danger-line: #e6b9b5;
  --c-block-ink: #7a3e2a;
  --c-block-soft: #f4e8e1;
  --c-navy-soft: #e7ebf3;
  --c-on-navy: #e9edf4;
  --c-on-navy-muted: rgba(233, 237, 244, 0.72);
  --fs-xs: 0.78rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.125rem;
  --fs-lg: 1.375rem;
  --fs-xl: 1.75rem;
  --fs-xxl: 2.25rem;
  --fs-display: 2.75rem;
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;
  --sp-8: 32px;
  --sp-10: 40px;
  --sp-12: 48px;
  --sp-16: 64px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;
  --sh-sm: 0 1px 2px rgba(20, 32, 58, 0.05), 0 2px 8px rgba(20, 32, 58, 0.05);
  --sh-md: 0 10px 28px rgba(15, 26, 48, 0.10);
  --sh-lg: 0 18px 44px rgba(15, 26, 48, 0.14);
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --maxw: 1120px;
  --formw: 640px;
  --tap: 44px;
  --tabbar-h: 64px;

  /* Short aliases used in this sheet and by a few inline styles in views
     (var(--cream), var(--ok), var(--line)...). */
  --navy: var(--c-navy);
  --navy-2: var(--c-navy2);
  --navy-deep: var(--c-navy-deep);
  --ink: var(--c-ink);
  --muted: var(--c-muted);
  --line: var(--c-line);
  --bg: var(--c-surface);
  --bg-soft: var(--c-surface-soft);
  --bg-cream: var(--c-ivory);
  --gold: var(--c-gold);
  --gold-light: var(--c-gold-light);
  --gold-ink: var(--c-gold-ink);
  --radius: var(--r-lg);
  --radius-sm: var(--r-sm);
  --shadow-sm: var(--sh-sm);
  --shadow: var(--sh-lg);
  --cream: var(--c-ivory);
  --ok: var(--c-ok);
  --danger: var(--c-danger);
  --gray: var(--c-muted);
  --border: var(--c-line);
  --max-width: var(--maxw);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: var(--fs-base);
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg-cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-variant-numeric: lining-nums proportional-nums;
  color: var(--navy);
  line-height: 1.15;
  letter-spacing: 0.005em;
  margin: 0 0 var(--sp-3);
}
h1 { font-size: var(--fs-xxl); }
h2 { font-size: var(--fs-xl); margin-top: var(--sp-8); }
h3 { font-size: var(--fs-lg); }
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }

/* A page's title carries a short gold rule beneath it, as on the
   marketing site's section headings. */
main > h1:first-child,
main > h1:first-of-type {
  padding-bottom: var(--sp-3);
  margin-bottom: var(--sp-6);
  position: relative;
}
main > h1:first-child::after,
main > h1:first-of-type::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 48px;
  height: 2px;
  background: var(--gold);
}

p { margin: 0 0 var(--sp-3); }
p:last-child { margin-bottom: 0; }
strong { font-weight: 700; }
code { font-family: var(--mono); font-size: 0.9em; }

a { color: var(--navy); text-decoration-color: rgba(28, 43, 74, 0.35); text-underline-offset: 3px; }
a:hover { color: var(--gold-ink); text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* ---------- Header ---------- */

header.app-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--navy);
  border-bottom: 1px solid rgba(201, 163, 95, 0.55);
  padding: env(safe-area-inset-top) var(--sp-4) 0;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
}

header.app-header .brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-3);
  color: #fff;
  text-decoration: none;
  min-height: var(--tap);
}
header.app-header .brand img { height: 36px; width: auto; display: block; }
header.app-header .brand .brand-app {
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--c-gold-light);
  padding-left: var(--sp-3);
  border-left: 1px solid rgba(255, 255, 255, 0.25);
  line-height: 1.2;
}

/* Nav: a fixed bottom tab bar on phones (thumb reach, and it stops the
   links wrapping into two or three rows of header), a plain top nav from
   720px up. Same markup either way. */
header.app-header nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: var(--navy);
  border-top: 1px solid rgba(201, 163, 95, 0.45);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -6px 20px rgba(15, 26, 48, 0.18);
}
header.app-header nav a,
header.app-header nav form.nav-logout button {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: var(--tabbar-h);
  padding: 0 var(--sp-1);
  margin: 0;
  color: var(--c-on-navy-muted);
  font-family: var(--sans);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  position: relative;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  line-height: 1.2;
  letter-spacing: normal;
  cursor: pointer;
  width: 100%;
}
/* On phones Log out lives on the Account page, not in the tab bar,
   so a stray tap can't sign someone out on the ramp. */
header.app-header nav form.nav-logout,
header.app-header nav a.nav-logout { display: none; }
header.app-header nav a:hover,
header.app-header nav form.nav-logout button:hover { color: #fff; }
header.app-header nav a.active { color: #fff; }
header.app-header nav a.active::before {
  content: "";
  position: absolute;
  top: 0;
  left: 22%;
  right: 22%;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--c-gold-light);
}
/* Room for the tab bar so it never covers the end of the page. */
body:has(header.app-header nav) { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }

@media (min-width: 720px) {
  header.app-header { padding: 0 var(--sp-6); min-height: 68px; }
  header.app-header .brand img { height: 42px; }
  header.app-header nav {
    position: static;
    background: none;
    border: 0;
    box-shadow: none;
    padding: 0;
    gap: var(--sp-1);
    justify-content: flex-end;
  }
  header.app-header nav a,
  header.app-header nav form.nav-logout button {
    flex: none;
    width: auto;
    min-height: var(--tap);
    padding: 0 var(--sp-3);
    font-size: 0.94rem;
    border-radius: var(--r-sm);
  }
  header.app-header nav form.nav-logout { display: flex; flex: none; margin: 0; }
  header.app-header nav a.nav-logout { display: flex; }
  header.app-header nav a.active::before { top: auto; bottom: 4px; left: var(--sp-3); right: var(--sp-3); height: 2px; border-radius: 2px; }
  body:has(header.app-header nav) { padding-bottom: 0; }
}

/* ---------- Layout ---------- */

main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--sp-6) var(--sp-4) var(--sp-12);
}
@media (min-width: 720px) {
  main { padding: var(--sp-10) var(--sp-6) var(--sp-16); }
  h1 { font-size: var(--fs-display); }
}

.card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  box-shadow: var(--sh-sm);
}
@media (min-width: 720px) { .card { padding: var(--sp-6); } }

.muted { color: var(--muted); font-size: var(--fs-sm); }
.lead { font-size: var(--fs-md); color: var(--muted); max-width: 60ch; }

/* A row of actions: wraps, consistent gap. */
.actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }

/* ---------- Buttons (pills, as on the marketing site) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 10px 22px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--navy);
  background: var(--navy);
  color: #fff;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.btn:hover { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn.secondary { background: transparent; color: var(--navy); border-color: var(--c-line-strong); }
.btn.secondary:hover { background: var(--bg); border-color: var(--navy); color: var(--navy); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--c-danger-line); }
.btn.danger:hover { background: var(--c-danger-soft); border-color: var(--danger); color: var(--danger); }
.btn.gold { background: var(--c-gold-fill); border-color: var(--c-gold-fill); color: #fff; }
.btn.gold:hover { background: var(--gold-ink); border-color: var(--gold-ink); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- Forms ---------- */

label {
  display: block;
  margin: var(--sp-4) 0 var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--ink);
}
label[style*="font-weight:normal"] { font-weight: 400; }

input[type=text], input[type=email], input[type=number], input[type=date], input[type=tel], input[type=url], input[type=password], textarea, select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  font-family: var(--sans);
  font-size: var(--fs-base);
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-md);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
input::placeholder, textarea::placeholder { color: #7d8693; }
input:hover, textarea:hover, select:hover { border-color: #b7bec9; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(176, 138, 70, 0.25);
}
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%231c2b4a' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
}
select[multiple] { background-image: none; padding-right: 14px; }
textarea { min-height: 104px; line-height: 1.5; }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; vertical-align: -4px; margin: 0 var(--sp-2) 0 0; accent-color: var(--navy); }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-weight: 600; font-size: var(--fs-sm); padding: 0; margin-bottom: var(--sp-2); }

/* Native file input is visually hidden (kept in the tab order and fully
   functional — a <label for=...> click on its dropzone still opens the
   camera/file picker) in favor of the styled .dropzone label that follows
   it; input:focus-visible + .dropzone gives it a visible focus ring. */
input[type=file].sr-only:focus-visible + .dropzone { outline: 2px solid var(--gold); outline-offset: 2px; }

.dropzone {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  width: 100%;
  min-height: 56px;
  padding: var(--sp-4);
  border: 1.5px dashed var(--c-line-strong);
  border-radius: var(--r-md);
  background: var(--bg-soft);
  color: var(--ink);
  font-size: var(--fs-sm);
  cursor: pointer;
}
.dropzone:hover { border-color: var(--gold); background: var(--c-ivory-deep); }
.dropzone-icon { display: inline-flex; color: var(--navy); line-height: 1; flex: none; }
.dropzone-icon svg { width: 24px; height: 24px; }
.dropzone-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.dropzone-text { font-weight: 600; }
.dropzone-filename { color: var(--muted); font-size: var(--fs-xs); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 6-digit login code: large, spaced, numeric entry. */
#code {
  font-family: var(--sans);
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5em;
  text-align: center;
  padding-left: 0.6em;
  min-height: 60px;
}

.error { color: var(--danger); font-size: var(--fs-sm); margin-top: var(--sp-2); }
.notice {
  background: var(--c-ivory-deep);
  border: 1px solid rgba(176, 138, 70, 0.45);
  border-left: 3px solid var(--gold);
  color: var(--gold-ink);
  border-radius: var(--r-md);
  padding: var(--sp-3) var(--sp-4);
  margin-bottom: var(--sp-4);
  font-size: var(--fs-sm);
}
.notice.success { background: var(--c-ok-soft); border-color: var(--c-ok-line); border-left-color: var(--ok); color: #2f5240; }
/* Error summary cards render with an inline border-color: give them the
   same tinted treatment as a notice. */
.card[style*="border-color:#a33"] { background: var(--c-danger-soft); border-color: var(--c-danger-line) !important; border-left: 3px solid var(--danger) !important; box-shadow: none; }
.card[style*="border-color:#a33"] .error:first-child { margin-top: 0; }

/* ---------- Tables (stack into labelled rows on narrow screens) ---------- */

table { border-collapse: collapse; width: 100%; margin: var(--sp-3) 0; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
th, td { padding: var(--sp-3); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
th {
  color: var(--muted);
  font-family: var(--sans);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--c-line-strong);
}
tbody tr:last-child td { border-bottom: 0; }
td input[type=text] { min-height: 44px; }

/* Wide owner tables (Lessees, Users) scroll sideways inside the page at
   tablet widths instead of pushing the whole page wider than the screen. */
@media (min-width: 720px) {
  .table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll > table { min-width: 100%; }
}
/* Stack tables everywhere the tab bar shows (below the 720px breakpoint);
   at tablet widths the owner tables are wider than the viewport. */
@media (max-width: 719.98px) {
  table.stack, table:not(.no-stack) { border: 0; margin: var(--sp-2) 0; }
  table.stack thead, table:not(.no-stack) thead { display: none; }
  table.stack tr, table:not(.no-stack) tr {
    display: block;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: var(--sp-3);
    padding: var(--sp-1);
  }
  /* Inside a card, a stacked row is a quiet well rather than a second card. */
  .card table.stack tr, .card table:not(.no-stack) tr { background: var(--bg-soft); border-color: transparent; }
  table.stack td, table:not(.no-stack) td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--sp-3);
    border-bottom: 1px solid var(--line);
    padding: var(--sp-2) var(--sp-3);
    text-align: right;
    /* A long unbroken value (a raw JSON audit blob, a user-agent string, a
       UUID) has no spaces to break on, so without this it forces the cell
       (and the page) wider than the viewport. */
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  table.stack td:last-child, table:not(.no-stack) td:last-child { border-bottom: 0; }
  table.stack td::before, table:not(.no-stack) td::before {
    content: attr(data-label);
    font-weight: 600;
    font-size: var(--fs-xs);
    color: var(--muted);
    text-align: left;
    margin-right: auto;
    flex: none;
  }
  /* A cell with no label (an action column) lays its controls out from the left. */
  table.stack td[data-label=""], table:not(.no-stack) td[data-label=""],
  table.stack td:not([data-label]), table:not(.no-stack) td:not([data-label]) { justify-content: flex-start; text-align: left; flex-wrap: wrap; }
  table.stack td[data-label=""]::before, table:not(.no-stack) td[data-label=""]::before,
  table.stack td:not([data-label])::before, table:not(.no-stack) td:not([data-label])::before { display: none; }
}

/* ---------- Status pills ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: var(--fs-xs);
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.01em;
  text-transform: capitalize;
  white-space: nowrap;
  border: 1px solid transparent;
}
.badge.confirmed, .badge.booked { background: var(--c-navy-soft); color: var(--navy); }
.badge.requested { background: var(--c-ivory-deep); color: var(--gold-ink); border-color: rgba(176, 138, 70, 0.5); }
.badge.declined, .badge.cancelled { background: var(--bg-soft); color: var(--muted); border-color: var(--line); }
.badge.completed { background: var(--c-ok-soft); color: var(--ok); }
.badge.maintenance, .badge.unavailable { background: var(--c-block-soft); color: var(--c-block-ink); }

/* ---------- Trip ticket (booking detail header) ---------- */

.ticket {
  background: var(--navy-deep);
  color: var(--c-on-navy);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  margin-bottom: var(--sp-4);
  box-shadow: var(--sh-md);
  position: relative;
  overflow: hidden;
}
.ticket::after {
  /* A fine gold arc, echoing the logo's ring. Decorative only. */
  content: "";
  position: absolute;
  right: -90px;
  top: -130px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 1px solid rgba(201, 163, 95, 0.35);
  pointer-events: none;
}
.ticket-top { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.ticket-tail {
  font-family: var(--serif);
  font-variant-numeric: lining-nums proportional-nums;
  font-weight: 600;
  font-size: var(--fs-lg);
  color: #fff;
  letter-spacing: 0.03em;
}
.ticket-tail span { font-family: var(--sans); font-size: var(--fs-sm); color: var(--c-on-navy-muted); letter-spacing: 0; font-weight: 500; margin-left: var(--sp-2); }
.ticket-pills { display: flex; gap: 6px; flex-wrap: wrap; }
.ticket-dates {
  font-family: var(--serif);
  font-variant-numeric: lining-nums proportional-nums;
  font-weight: 600;
  font-size: var(--fs-xxl);
  line-height: 1.15;
  color: #fff;
  margin: var(--sp-5) 0 var(--sp-1);
}
.ticket-sub { color: var(--c-on-navy-muted); font-size: var(--fs-sm); }
.ticket-sub::first-letter { text-transform: uppercase; }
.ticket-rule { border: 0; border-top: 1px dashed rgba(201, 163, 95, 0.55); margin: var(--sp-5) 0 var(--sp-4); }
.ticket dl { display: grid; grid-template-columns: max-content 1fr; gap: var(--sp-2) var(--sp-5); margin: 0; font-size: var(--fs-sm); }
.ticket dt { color: var(--c-on-navy-muted); }
.ticket dd { margin: 0; color: #fff; overflow-wrap: anywhere; }
.ticket .badge.confirmed, .ticket .badge.booked { background: rgba(255, 255, 255, 0.12); color: #fff; }
.ticket .badge.requested { background: rgba(201, 163, 95, 0.16); color: var(--c-gold-light); border-color: rgba(201, 163, 95, 0.5); }
.ticket .badge.completed { background: rgba(120, 180, 140, 0.18); color: #cfe6d6; }
.ticket .badge.declined, .ticket .badge.cancelled { background: rgba(255, 255, 255, 0.08); color: var(--c-on-navy-muted); border-color: transparent; }
@media (min-width: 720px) {
  .ticket { padding: var(--sp-8); }
  .ticket-dates { font-size: var(--fs-display); }
}

/* Booking page: actions grouped by what they do. */
.action-group + .action-group { border-top: 1px solid var(--line); margin-top: var(--sp-5); padding-top: var(--sp-5); }
.action-group h4 { margin: 0 0 var(--sp-2); font-size: var(--fs-sm); font-weight: 700; color: var(--ink); }
.action-group > .muted { margin-bottom: var(--sp-3); }
.inline-form { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; }
.inline-form > input { flex: 1 1 200px; width: auto; }
@media (max-width: 480px) { .action-group .btn { width: 100%; } .inline-form > input { flex-basis: 100%; } }

/* ---------- Calendar ---------- */

.cal-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-2); margin: var(--sp-2) 0 var(--sp-3); }
.cal-toolbar h2 { margin: 0; font-size: var(--fs-xl); text-align: center; flex: 1; }
.cal-toolbar .btn { padding: 8px 16px; }

/* Aircraft switcher: a segmented control. */
nav.aircraft-tabs {
  display: inline-flex !important;
  gap: 2px !important;
  padding: 3px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  margin-bottom: var(--sp-4) !important;
  max-width: 100%;
  overflow-x: auto;
}
nav.aircraft-tabs .btn { border-color: transparent; padding: 8px 18px; min-height: 40px; }
nav.aircraft-tabs .btn.secondary { background: transparent; color: var(--muted); }
nav.aircraft-tabs .btn.secondary:hover { color: var(--navy); background: var(--bg-soft); }

/* minmax(0,1fr), not a bare 1fr: a grid track's default min-width is its
   content's min-content size, so 7 equal tracks with any wide-enough
   content (a status pill) refuse to shrink and blow the grid, and the page,
   past a narrow viewport. min-width:0 + overflow:hidden on each cell is the
   matching second line of defense. */
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; }
.cal-day {
  position: relative;
  min-height: 52px;
  min-width: 0;
  padding: 5px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
}
.cal-day .num { font-weight: 700; color: var(--ink); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.cal-day.today { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.cal-day.today .num { color: var(--gold-ink); }
.cal-day.booked { background: var(--c-navy-soft); border-color: #d3dae7; }
.cal-day.own { background: var(--c-ivory-deep); border-color: rgba(176, 138, 70, 0.55); }
.cal-day.own.today { box-shadow: 0 0 0 1px var(--gold) inset, 0 0 0 3px rgba(176, 138, 70, 0.18); }

.cal-day .cal-badge { display: flex; margin-top: 3px; padding: 2px 6px; overflow: hidden; text-overflow: ellipsis; }

/* A free day's "+": the whole cell is the tap target (the glyph sits in
   the corner), so requesting a day doesn't need a 12px aim. */
.cal-day a.add {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 3px 6px;
  color: var(--gold);
  text-decoration: none;
  font-size: 0.95rem;
  line-height: 1;
  border-radius: inherit;
}
.cal-day a.add:hover, .cal-day a.add:focus-visible { background: rgba(176, 138, 70, 0.08); color: var(--gold-ink); }

.cal-dow { font-size: var(--fs-xs); text-align: center; color: var(--muted); font-weight: 600; padding: var(--sp-1) 0; }

/* ≤480px: swap the full pill for a compact colored bar along the cell's
   bottom edge. Booked (someone else, navy) is solid; an own confirmed or
   completed booking (gold) is solid; an own still-requested booking is a
   gold outline only: not yet on the books, so it reads lighter. */
@media (max-width: 480px) {
  .cal-day .cal-badge { display: none; }
  .cal-day.own, .cal-day.booked { padding-bottom: 9px; }
  .cal-day.own::after, .cal-day.booked::after {
    content: "";
    position: absolute;
    left: 5px;
    right: 5px;
    bottom: 4px;
    height: 4px;
    border-radius: 2px;
    background: var(--gold);
  }
  .cal-day.booked::after { background: var(--navy); }
  .cal-day.own[data-own-status="requested"]::after { background: transparent; border: 1.5px solid var(--gold); height: 2px; }
}

/* Per-aircraft colors (0010), used only when the viewer has more than one aircraft. */
.ac-c0 { --ac: #1c2b4a; }
.ac-c1 { --ac: #1f7a8c; }
.ac-c2 { --ac: #7a3e6b; }
.ac-c3 { --ac: #6b7a2a; }
.badge.ac-stripe { box-shadow: inset 4px 0 0 var(--ac); padding-left: 10px; }
.ac-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ac); flex: none; }
.cal-legend-swatch.ac-c0, .cal-legend-swatch.ac-c1, .cal-legend-swatch.ac-c2, .cal-legend-swatch.ac-c3 { background: var(--ac); }
.cal-day .ac-dots { display: none; gap: 3px; margin-top: 2px; }
@media (max-width: 480px) { .cal-day .ac-dots { display: flex; flex-wrap: wrap; } }
.feed-list { padding-left: 18px; margin: 6px 0 0; }
.feed-list li { margin-bottom: 8px; }

.cal-legend { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin: var(--sp-3) 0 0; font-size: var(--fs-xs); color: var(--muted); align-items: center; }
.cal-legend-item { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend-swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex: none; }
.cal-legend-booked { background: var(--navy); }
.cal-legend-own-confirmed { background: var(--gold); }
.cal-legend-own-requested { background: transparent; border: 1.5px solid var(--gold); }
.cal-legend .badge { padding: 1px 8px; }

@media (min-width: 640px) {
  .cal-grid { gap: 4px; }
  .cal-day { min-height: 92px; padding: 7px; font-size: 0.8rem; }
}

/* Subscribe card's copyable feed URL. */
.feed-url {
  display: block;
  word-break: break-all;
  padding: var(--sp-3);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  color: var(--ink);
  user-select: all;
}

/* A card that opens and closes (<details class="card disclosure">). */
details.disclosure > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-height: var(--tap);
}
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure > summary::after {
  content: "";
  width: 9px;
  height: 9px;
  border-right: 1.6px solid var(--navy);
  border-bottom: 1.6px solid var(--navy);
  transform: rotate(45deg) translateY(-3px);
  transition: transform 180ms cubic-bezier(0.2, 0, 0, 1);
  flex: none;
  margin-right: 4px;
}
details.disclosure[open] > summary::after { transform: rotate(-135deg) translateY(-2px); }
details.disclosure > summary h2, details.disclosure > summary h3 { margin: 0; }
details.disclosure[open] > summary { margin-bottom: var(--sp-3); }

/* ---------- Owner ---------- */

/* Owner section switcher: the owner's pages, at the top of every owner
   page instead of a row of buttons at the very bottom. */
.subnav {
  display: flex;
  gap: var(--sp-1);
  overflow-x: auto;
  margin: calc(-1 * var(--sp-2)) 0 var(--sp-6);
  scrollbar-width: none;
  border-bottom: 1px solid var(--line);
}
.subnav::-webkit-scrollbar { display: none; }
/* On phones the row runs past the edge: fade the right edge so it reads as
   scrollable rather than cut off. */
@media (max-width: 719.98px) {
  .subnav {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
    padding-right: 32px;
  }
}
/* Skip link: hidden until it gets keyboard focus. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  display: inline-block;
  margin: 0 0 var(--sp-2);
  padding: var(--sp-2) var(--sp-3);
  background: var(--navy);
  color: #fff;
  border-radius: var(--r-sm);
  text-decoration: none;
}
.subnav a {
  flex: none;
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0 var(--sp-3);
  color: var(--muted);
  font-size: var(--fs-sm);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
}
.subnav a:hover { color: var(--navy); }
.subnav a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--gold); }

.kpi-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-6); }
@media (min-width: 720px) { .kpi-row { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.kpi-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
  padding: var(--sp-4);
}
.kpi-card .kpi-num {
  font-family: var(--serif);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: 2.4rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1;
}
.kpi-card .kpi-label { color: var(--muted); font-size: var(--fs-sm); margin-top: var(--sp-2); }
.kpi-card.attn { border-color: rgba(176, 138, 70, 0.6); background: var(--c-ivory-deep); }
.kpi-card.attn .kpi-num { color: var(--gold-ink); }

.photo-thumb { width: 92px; height: 92px; object-fit: cover; border-radius: var(--r-sm); border: 1px solid var(--line); margin: 4px; display: inline-flex; align-items: center; justify-content: center; vertical-align: top; }
a.photo-heic { background: var(--bg-soft); color: var(--muted); font-size: var(--fs-xs); font-weight: 600; text-decoration: none; }

/* ---------- Footer ---------- */

footer.app-footer {
  max-width: var(--maxw);
  margin: 0 auto;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-xs);
  padding: var(--sp-6) var(--sp-4) var(--sp-8);
}
footer.app-footer p { margin-bottom: var(--sp-2); }

/* ---------- Login ---------- */

.login-wrap { max-width: 420px; margin: 0 auto; }
.login-wordmark {
  text-align: center;
  background: var(--navy);
  border-radius: var(--r-lg);
  padding: var(--sp-8) var(--sp-5) var(--sp-6);
  margin-bottom: var(--sp-5);
  box-shadow: var(--sh-md);
}
.login-wordmark img { width: min(260px, 78%); height: auto; display: block; margin: 0 auto; }
.login-wordmark .brand-name {
  font-family: var(--serif);
  font-weight: 600;
  color: #fff;
  font-size: var(--fs-xl);
  display: block;
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid rgba(201, 163, 95, 0.4);
}
.login-wordmark .tagline { display: block; color: var(--c-on-navy-muted); font-size: var(--fs-sm); margin-top: 2px; }
.login-wrap h1 { text-align: center; }
.login-wrap .card .btn { width: 100%; }
#passkey-status:empty { display: none; }
/* The passkey card stays empty until /passkey.js unhides its button. */
.login-wrap .card:has(#passkey-login-btn[hidden]):not(:has(a.btn)) { display: none; }
/* The login page carries its own brand panel; the header bar would repeat it. */
body:has(.login-wrap) header.app-header { display: none; }
body:has(.login-wrap) main { padding-top: var(--sp-6); }
@media (min-width: 720px) { .login-wrap { margin-top: var(--sp-6); } }

/* ---------- Form helpers ---------- */

/* Two fields side by side from 480px (start/end dates). */
.field-pair { display: grid; grid-template-columns: 1fr; gap: 0 var(--sp-3); }
@media (min-width: 480px) { .field-pair { grid-template-columns: 1fr 1fr; } }
@media (max-width: 480px) { .submit-wide { width: 100%; } }

/* Account identity card. */
.card.profile { display: flex; align-items: center; gap: var(--sp-4); }
.profile-initial {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: var(--c-gold-light);
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
}
.card.profile .muted { margin-top: 2px; overflow-wrap: anywhere; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 720px) {
  /* A form standing alone as its own card (login, request, handoff, trip
     log, settings) reads better at a document width than stretched across
     a wide screen; tables and the owner dashboard's cards are untouched. */
  form.card { max-width: var(--formw); }
}
