/* HBFC Club — mobile-first stylesheet in the sdmp visual language
   (navy photo background, white header, white cards). Phones first; wider
   layouts are progressive enhancements under min-width queries. */

:root {
  --navy: #1a3a5c;
  --navy-2: #2c5a9e;
  --blue: #2563a8;
  --blue-hover: #1d4f87;
  --link: #3b7dc4;
  --ink: #1f2d3d;
  --muted: #5b6b7d;
  --line: #dce3ea;
  --surface: #ffffff;
  --surface-2: #f4f7fa;
  --ok: #1e8449;
  --ok-bg: #e3f4ea;
  --warn: #9a6700;
  --warn-bg: #fff4d6;
  --danger: #b03a2e;
  --danger-bg: #fbe5e2;
  --info-bg: #e5effa;
  --radius: 10px;
  --tap: 44px;
  --tabbar-h: 60px;
  --header-h: 56px;
  --shadow: 0 2px 10px rgba(0, 0, 0, 0.15);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 1rem); }  /* #anchors land below the sticky header */
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--navy);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(rgba(26, 58, 92, 0.35), rgba(26, 58, 92, 0.55)), url("img/background.51eade55078e.jpg") center / cover no-repeat, var(--navy);
}
img { max-width: 100%; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--blue-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 0.75rem; font-weight: 600; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
[hidden] { display: none !important; }  /* author display rules (e.g. .field { display: flex }) must never beat the hidden attribute */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.nowrap { white-space: nowrap; }

/* ── Header ─────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: var(--header-h);
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 max(1rem, env(safe-area-inset-right)) 0 max(1rem, env(safe-area-inset-left));
}
.brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; color: var(--navy); }
.brand img { height: 36px; width: auto; flex: none; }
.brand-name { font-weight: 700; font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topnav { display: none; margin-left: auto; gap: 0.25rem; align-items: center; }
.topnav a, .topnav button {
  display: inline-flex; align-items: center; min-height: var(--tap); padding: 0 0.9rem;
  border-radius: 8px; color: var(--navy); font-weight: 600; font-size: 0.95rem;
  background: none; border: 0; cursor: pointer; font-family: inherit;
}
.topnav a:hover, .topnav button:hover { background: var(--surface-2); }
.topnav a[aria-current="page"] { background: var(--info-bg); color: var(--blue); }
.topbar-me { margin-left: auto; display: flex; align-items: center; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%; background: var(--navy); color: #fff;
  font-weight: 700; font-size: 0.85rem; letter-spacing: 0.02em;
}
.avatar-lg { width: 56px; height: 56px; font-size: 1.2rem; }
.topbar-me a { display: inline-flex; align-items: center; justify-content: center; min-width: var(--tap); min-height: var(--tap); }

/* ── Bottom tab bar (phones) ────────────────────────────── */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  background: var(--surface); border-top: 1px solid var(--line);
  box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.12);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--tabbar-h); color: var(--muted); font-size: 0.72rem; font-weight: 600;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a[aria-current="page"] { color: var(--blue); }
main.site {
  max-width: 1400px; margin: 0 auto;
  padding: 1rem max(0.75rem, env(safe-area-inset-left)) calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 1.5rem);
}

@media (min-width: 1024px) {
  .topnav { display: flex; }
  .topbar-me { margin-left: 0.5rem; }
  .tabbar { display: none; }
  main.site { padding: 1.5rem 1.5rem 3rem; }
  h1 { font-size: 1.6rem; }
}

/* ── Page header on the photo background ────────────────── */
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin-bottom: 1rem; color: #fff; }
.page-head h1 { margin: 0; color: #fff; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45); flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.page-head .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.back-link { display: inline-flex; align-items: center; min-height: var(--tap); color: #fff; font-weight: 600; margin-bottom: 0.25rem; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.back-link:hover { color: #fff; text-decoration: underline; }

/* ── Cards ──────────────────────────────────────────────── */
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1rem; overflow-wrap: anywhere; }
.card > h2:first-child, .card-head h2 { color: var(--navy); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; margin-bottom: 0.75rem; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-flush { padding: 0; overflow: hidden; }
.grid { display: grid; gap: 1rem; }
.grid > * { min-width: 0; }
@media (min-width: 1024px) {
  .grid-2 { grid-template-columns: 1fr 1fr; align-items: start; }
  .grid-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); align-items: start; }
  .card { padding: 1.25rem; }
}
.dl { display: grid; grid-template-columns: minmax(7rem, auto) 1fr; gap: 0.35rem 1rem; margin: 0; }
.dl dt { color: var(--muted); font-size: 0.9rem; }
.dl dd { margin: 0; min-width: 0; }
.empty { color: var(--muted); text-align: center; padding: 1.5rem 0.5rem; margin: 0; }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: var(--tap); padding: 0 1rem; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 0.95rem; line-height: 1.2; text-align: center;
  cursor: pointer; text-decoration: none; white-space: nowrap; touch-action: manipulation;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); color: #fff; }
.btn-secondary { background: var(--surface); color: var(--navy); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-2); color: var(--navy); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #8e2e25; color: #fff; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.btn-ghost { background: transparent; color: var(--blue); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { display: flex; width: 100%; }
.btn.btn-big { min-height: 64px; font-size: 1.15rem; font-weight: 700; border-radius: 14px; }
.today-flight { display: grid; gap: 0.6rem; padding: 0.9rem 0; border-top: 1px solid var(--line); }
.card-head + .today-flight { border-top: 0; padding-top: 0; }
.today-when { font-size: 1.05rem; }
.today-page { max-width: 640px; margin: 0 auto; }
.btn-icon { width: var(--tap); padding: 0; }
.btn svg { width: 20px; height: 20px; flex: none; }
.page-head .btn-secondary { border-color: transparent; }
.button-row { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.button-row form { display: contents; }
.fab {
  position: fixed; right: max(1rem, env(safe-area-inset-right)); z-index: 55;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 1rem);
  width: 56px; height: 56px; border-radius: 50%; background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.fab:hover { color: #fff; background: var(--blue-hover); }
.fab svg { width: 28px; height: 28px; }
@media (min-width: 1024px) { .fab { bottom: 1.5rem; } }

/* ── Badges ─────────────────────────────────────────────── */
.badge { display: inline-block; padding: 0.1rem 0.5rem; border-radius: 999px; font-size: 0.75rem; font-weight: 700; line-height: 1.5; white-space: nowrap; background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.badge-ok, .badge-active, .badge-valid, .badge-confirmed, .badge-available { background: var(--ok-bg); color: var(--ok); }
.badge-warn, .badge-warning, .badge-notice, .badge-applicant, .badge-maintenance { background: var(--warn-bg); color: var(--warn); }
.badge-danger, .badge-expired, .badge-suspended, .badge-grounded, .badge-cancelled { background: var(--danger-bg); color: var(--danger); }
.badge-info, .badge-role { background: var(--info-bg); color: var(--blue); }
.badge-lapsed, .badge-left, .badge-retired, .badge-none { background: var(--surface-2); color: var(--muted); }

/* ── Forms ──────────────────────────────────────────────── */
.form-grid { display: grid; gap: 0.9rem 1rem; }
@media (min-width: 640px) { .form-grid-2 { grid-template-columns: 1fr 1fr; } .span-2 { grid-column: 1 / -1; } }
.field { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: 0.9rem; color: var(--navy); }
.field .help { font-size: 0.8rem; color: var(--muted); }
.field .errorlist, .errorlist { list-style: none; margin: 0; padding: 0; color: var(--danger); font-size: 0.85rem; font-weight: 600; }
.form-errors { background: var(--danger-bg); color: var(--danger); border-radius: 8px; padding: 0.75rem 1rem; margin-bottom: 1rem; }
.form-errors ul { margin: 0; padding-left: 1.1rem; }
/* 16px minimum: anything smaller makes iOS Safari zoom the page on focus. */
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="date"], input[type="time"], input[type="datetime-local"], input[type="search"], input[type="url"],
select, textarea {
  width: 100%; min-height: var(--tap); padding: 0.5rem 0.75rem; font: inherit; font-size: 16px; color: var(--ink);
  background: #fff; border: 1px solid #b8c4d0; border-radius: 8px; appearance: none; -webkit-appearance: none;
}
input[type="date"], input[type="time"] { min-width: 0; display: block; }
select {
  padding-right: 2.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%235b6b7d'%3E%3Cpath d='M5.3 7.3a1 1 0 0 1 1.4 0L10 10.6l3.3-3.3a1 1 0 1 1 1.4 1.4l-4 4a1 1 0 0 1-1.4 0l-4-4a1 1 0 0 1 0-1.4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.6rem center; background-size: 1.1rem;
}
select[multiple] { background-image: none; padding-right: 0.75rem; min-height: 8rem; }
textarea { min-height: 6rem; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid rgba(37, 99, 168, 0.35); outline-offset: 1px; border-color: var(--blue); }
input[type="file"] { font-size: 16px; max-width: 100%; min-height: var(--tap); padding: 0.5rem 0; }
input[type="file"]::file-selector-button { min-height: 36px; padding: 0 0.9rem; margin-right: 0.75rem; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--navy); font: inherit; font-weight: 600; cursor: pointer; }
.check { display: flex; align-items: center; gap: 0.6rem; min-height: var(--tap); font-weight: 500; color: var(--ink); cursor: pointer; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--blue); margin: 0; }
.check-list { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.check-list label { display: flex; align-items: center; gap: 0.5rem; min-height: var(--tap); cursor: pointer; }
.check-list input { width: 22px; height: 22px; accent-color: var(--blue); margin: 0; }
.check-list ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend { font-weight: 700; color: var(--navy); margin-bottom: 0.5rem; padding: 0; font-size: 1rem; }
.form-section + .form-section { margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
@media (max-width: 639px) { .form-actions .btn { flex: 1 1 auto; } }

/* ── Messages ───────────────────────────────────────────── */
.messages { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
.messages:empty { display: none; }
.messages li { padding: 0.75rem 1rem; border-radius: 8px; background: var(--surface); box-shadow: var(--shadow); border-left: 5px solid var(--blue); }
.messages .success { border-left-color: var(--ok); }
.messages .warning { border-left-color: #d4a017; }
.messages .error { border-left-color: var(--danger); }

/* ── Toolbar / filters ──────────────────────────────────── */
.toolbar { display: grid; gap: 0.5rem; margin-bottom: 1rem; }
.toolbar .search { display: flex; gap: 0.5rem; }
.toolbar .search input { flex: 1 1 auto; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
@media (min-width: 640px) { .filters { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.chips { display: flex; gap: 0.4rem; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 0 0.85rem; border-radius: 999px; background: rgba(255, 255, 255, 0.92); color: var(--navy); font-weight: 600; font-size: 0.85rem; border: 1px solid transparent; }
.chip[aria-current="true"] { background: var(--blue); color: #fff; }
.count-line { color: #fff; font-size: 0.9rem; margin: 0 0 0.5rem; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }

/* ── Lists (phones) / tables (wide) ─────────────────────── */
.list { list-style: none; margin: 0; padding: 0; }
.list > li + li { border-top: 1px solid var(--line); }
.list-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; min-height: 64px; color: var(--ink); }
a.list-row:hover { background: var(--surface-2); color: var(--ink); }
.list-row .main { flex: 1 1 auto; min-width: 0; }
.list-row .title { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .meta { font-size: 0.82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; align-items: center; }
.list-row .side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 0.25rem; }
.list-row .chev { flex: none; color: #9aa8b6; width: 18px; height: 18px; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.table th, .table td { text-align: left; padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.03em; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }

.pager { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; margin-top: 0.75rem; color: #fff; }

/* ── Tabs inside a page ─────────────────────────────────── */
.tabs { display: flex; gap: 0.25rem; overflow-x: auto; scrollbar-width: none; margin: 0 0 1rem; background: rgba(255, 255, 255, 0.92); border-radius: var(--radius); padding: 4px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 0.9rem; border-radius: 8px; color: var(--navy); font-weight: 600; font-size: 0.9rem; white-space: nowrap; }
.tabs a[aria-current="page"] { background: var(--blue); color: #fff; }

/* ── Member profile header ──────────────────────────────── */
.profile-head { display: flex; gap: 0.9rem; align-items: center; }
.profile-head .main { min-width: 0; }
.profile-head h1 { color: var(--navy); margin: 0 0 0.25rem; font-size: 1.3rem; }
.profile-head .meta { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.alert-strip { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.6rem 0.8rem; border-radius: 8px; margin-top: 0.75rem; font-size: 0.9rem; }
.alert-strip.danger { background: var(--danger-bg); color: var(--danger); }
.alert-strip.warn { background: var(--warn-bg); color: var(--warn); }
.alert-strip.ok { background: var(--ok-bg); color: var(--ok); }
.section-message { margin: 0 0 0.75rem; }
.alert-strip.info { background: var(--info-bg); color: var(--blue); }

/* ── Login ──────────────────────────────────────────────── */
.auth-wrap { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 1.25rem max(1rem, env(safe-area-inset-left)); }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 14px; box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35); padding: 1.75rem 1.25rem; text-align: center; }
.auth-card img.logo { height: 72px; width: auto; margin-bottom: 0.5rem; }
.auth-card h1 { color: var(--navy); font-size: 1.3rem; margin-bottom: 0.25rem; }
.auth-card form { text-align: left; margin-top: 1.25rem; display: grid; gap: 0.9rem; }
.auth-card .foot { margin-top: 1.25rem; font-size: 0.9rem; }

/* ═══ Booking calendar ═══════════════════════════════════
   Day view: one column per aircraft, time runs down. Booking blocks are
   absolutely positioned from server-computed minute offsets, so layout needs
   no JavaScript. The grid scrolls inside its own box (never the page) when
   the fleet is wider than the phone. */
.cal-bar { display: flex; align-items: center; gap: 0.4rem; margin-bottom: 0.6rem; flex-wrap: wrap; }
.cal-bar { flex-wrap: nowrap; }
.cal-bar .date-title { flex: 1 1 0; min-width: 0; color: #fff; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45); }
.cal-bar .date-title h1 { margin: 0; font-size: 1.2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-bar .date-title .sub { font-size: 0.85rem; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-nav { flex: none; }
.cal-nav { display: flex; align-items: center; gap: 0.35rem; }
.cal-nav .btn { padding: 0 0.75rem; }
.cal-nav .btn-icon { padding: 0; }
.date-jump { position: relative; display: inline-flex; }
.date-jump input[type="date"] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; min-height: 0; padding: 0; cursor: pointer; }
.cal-views { margin-bottom: 0.6rem; }

.daystrip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin-bottom: 0.6rem; }
.daystrip a { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 52px; border-radius: 8px; background: rgba(255, 255, 255, 0.9); color: var(--navy); font-size: 0.7rem; font-weight: 600; line-height: 1.2; }
.daystrip a .num { font-size: 1.05rem; font-weight: 700; }
.daystrip a.today { box-shadow: inset 0 0 0 2px var(--blue); }
.daystrip a[aria-current="date"] { background: var(--blue); color: #fff; }
.daystrip a .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: 0.55; margin-top: 2px; }
.daystrip a .dot.none { opacity: 0; }

.cal {
  --hour-h: 60px;           /* 30-minute rows of 30px: still easy to tap, half the scrolling of 44px */
  --time-w: 44px;
  --col-min: 76px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  max-height: calc(100vh - var(--header-h) - var(--tabbar-h) - 11.5rem);
  max-height: calc(100dvh - var(--header-h) - var(--tabbar-h) - env(safe-area-inset-bottom) - 11.5rem);
  min-height: 320px;
  position: relative;
}
@media (max-width: 360px) { .cal { --col-min: 62px; --time-w: 40px; } .cal-colhead .reg { font-size: 0.78rem; } .cal-nav { gap: 0.25rem; } }
@media (min-width: 1024px) { .cal { max-height: calc(100vh - var(--header-h) - 12rem); --col-min: 120px; --time-w: 56px; } }
.cal-grid { display: grid; grid-template-columns: var(--time-w) repeat(var(--cols), minmax(var(--col-min), 1fr)); min-width: min-content; position: relative; }
.cal-corner, .cal-colhead { position: sticky; top: 0; z-index: 4; background: var(--surface); border-bottom: 1px solid var(--line); min-height: 52px; }
.cal-corner { left: 0; z-index: 6; }
.cal-colhead { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 0.3rem 0.25rem; text-align: center; border-left: 1px solid var(--line); line-height: 1.15; }
.cal-colhead .reg { font-weight: 700; font-size: 0.85rem; color: var(--navy); white-space: nowrap; }
.cal-colhead .typ { font-size: 0.68rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.cal-colhead .swatch { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.cal-colhead.today { background: var(--info-bg); }
.cal-colhead .badge { margin-top: 2px; font-size: 0.62rem; padding: 0 0.35rem; }
.cal-times { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--line); }
.cal-time { height: calc(var(--hour-h) / 2); font-size: 0.7rem; color: var(--muted); text-align: right; padding-right: 6px; transform: translateY(-0.5em); font-variant-numeric: tabular-nums; }
.cal-time:first-child { transform: none; }
.cal-col { position: relative; border-left: 1px solid var(--line); }
.cal-col.unavailable { background: repeating-linear-gradient(135deg, #f6f1e7 0 8px, #efe7d6 8px 16px); }
.cal-slot { display: block; height: calc(var(--hour-h) / 2); border-top: 1px solid #edf1f5; touch-action: manipulation; -webkit-tap-highlight-color: rgba(37, 99, 168, 0.15); }
.cal-slot.hour { border-top-color: #d5dde6; }
.cal-slot.past { background: rgba(240, 243, 246, 0.7); }
a.cal-slot:hover { background: var(--info-bg); }
a.cal-slot:hover::after { content: "+"; display: flex; height: 100%; align-items: center; justify-content: center; color: var(--blue); font-weight: 700; }
.cal-event {
  position: absolute; left: 3px; right: 3px; z-index: 2;
  top: calc(var(--start) * var(--hour-h) / 60); height: max(calc(var(--dur) * var(--hour-h) / 60 - 2px), 22px);
  border-radius: 6px; padding: 3px 6px; overflow: hidden; font-size: 0.75rem; line-height: 1.25;
  background: var(--ev-bg, var(--blue)); color: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  border-left: 4px solid rgba(0, 0, 0, 0.25); display: block;
}
.cal-event:hover { color: #fff; filter: brightness(1.08); }
.cal-event .t { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cal-event .n { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.k-training { --ev-bg: #7d3c98; }
.cal-event.k-maintenance { --ev-bg: repeating-linear-gradient(135deg, #a04000 0 10px, #b9520f 10px 20px); }
.cal-event.k-club_event { --ev-bg: #117a65; }
.cal-event.mine { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--blue); }
.cal-event.clipped-top { border-top-left-radius: 0; border-top-right-radius: 0; }
.cal-event.clipped-bottom { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.cal-now { position: absolute; left: 0; right: 0; z-index: 3; height: 2px; background: #e74c3c; top: calc(var(--now) * var(--hour-h) / 60); pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: #e74c3c; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; margin-top: 0.6rem; color: #fff; font-size: 0.8rem; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.cal-legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }

/* Phones: the page scrolls, not the grid box, so the controls above scroll away and the bookings
   get the screen; the day / aircraft header sticks under the site header. A day with more aircraft
   than fit side by side ("wide") keeps its own scroll box for sideways scrolling. */
@media (max-width: 1023px) {
  .cal:not(.wide) { max-height: none; min-height: 0; overflow: clip; }  /* clip: rounded corners, but no scroll box */
  .cal:not(.wide) .cal-corner, .cal:not(.wide) .cal-colhead { top: var(--header-h); }
  .cal:not(.week) .cal-corner, .cal:not(.week) .cal-colhead { min-height: 36px; }
  .cal:not(.week) .cal-colhead { flex-direction: row; gap: 0.4rem; padding: 0.2rem 0.4rem; }
  .cal:not(.week) .cal-colhead .badge { margin-top: 0; }
  .cal.week .cal-corner, .cal.week .cal-colhead { min-height: 40px; }
  /* Day / Week / List and Local / UTC share one slim row */
  .cal-switches { display: flex; gap: 0.4rem; margin-bottom: 0.5rem; }
  .cal-switches .tabs { margin: 0; padding: 3px; }
  .cal-switches .tabs a { min-height: 34px; padding: 0 0.6rem; font-size: 0.85rem; }
  .cal-switches .cal-views { flex: 1 1 auto; }
  .cal-switches .clock-switch { flex: 0 0 auto; }
  .cal-switches .clock-switch a { flex: 0 0 auto; }
  /* NOTAM summary on one line; the full list opens below */
  .notam-day { padding: 0.35rem 0.7rem; margin-bottom: 0.5rem; font-size: 0.82rem; }
  .notam-day summary { display: block; min-height: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .notam-day[open] summary { white-space: normal; }
}

/* Week view (one aircraft, seven narrow day columns). */
.cal.week { --col-min: 40px; }
@media (min-width: 1024px) { .cal.week { --col-min: 110px; } }
.cal.week .cal-colhead .reg { font-size: 0.8rem; }
.cal.week .cal-event { left: 1px; right: 1px; padding: 2px 3px; font-size: 0.66rem; border-left-width: 3px; }
.cal-event .n-short, .cal-event .meta { display: none; }
@media (max-width: 1023px) {
  /* All seven days fit on any phone: no sideways scrolling in the week view. */
  .cal.week { --col-min: 0px; --time-w: 26px; }
  .cal.week .cal-grid { min-width: 0; }
  .cal.week .cal-time { padding-right: 3px; }
  .cal.week .cal-event { padding: 2px; font-size: 0.62rem; border-left-width: 2px; border-radius: 4px; }
  .cal.week .cal-event .end, .cal.week .cal-event .n { display: none; }
  .cal.week .cal-event .n-short { display: block; overflow: hidden; text-overflow: clip; white-space: nowrap; }
  .cal.week .cal-colhead { padding: 0.3rem 0; }
}
@media (min-width: 1024px) { .cal.week .cal-event { font-size: 0.75rem; padding: 3px 6px; } }

/* Agenda (list of upcoming bookings grouped by day). */
.agenda-day { margin-bottom: 1rem; }
.agenda-day h2 { color: #fff; font-size: 0.95rem; margin: 0 0 0.4rem; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5); }
.agenda-item { display: flex; gap: 0.75rem; align-items: stretch; padding: 0.7rem 1rem; color: var(--ink); min-height: 64px; }
a.agenda-item:hover { background: var(--surface-2); color: var(--ink); }
.agenda-item .bar { width: 5px; border-radius: 3px; flex: none; background: var(--c, var(--blue)); }
.agenda-item .when { flex: none; width: 3.6rem; font-variant-numeric: tabular-nums; font-weight: 700; font-size: 0.9rem; line-height: 1.3; }
.agenda-item .when small { display: block; font-weight: 500; color: var(--muted); }
.agenda-item .what { flex: 1 1 auto; min-width: 0; }
.agenda-item .what .title { font-weight: 600; display: block; }
.agenda-item .what .meta { font-size: 0.82rem; color: var(--muted); }

/* Booking form: date/time trio stays on one row even at 320px. */
.when-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem; }
.when-row .field > label { font-size: 0.8rem; }
.when-row input { padding-left: 0.5rem; padding-right: 0.4rem; }
.duration-chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.duration-chips button { min-height: 36px; padding: 0 0.75rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--navy); font: inherit; font-size: 0.85rem; font-weight: 600; cursor: pointer; }
.kind-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(7rem, 1fr)); gap: 0.5rem; }
.kind-picker label { display: flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: var(--tap); border: 1px solid #b8c4d0; border-radius: 8px; font-weight: 600; color: var(--navy); cursor: pointer; padding: 0 0.5rem; text-align: center; }
.kind-picker input { position: absolute; opacity: 0; pointer-events: none; }
.kind-picker label:has(input:checked) { background: var(--blue); border-color: var(--blue); color: #fff; }
.kind-picker label:has(input:focus-visible) { outline: 3px solid rgba(37, 99, 168, 0.35); }
.kind-picker ul { display: contents; list-style: none; }
.kind-picker li { display: contents; }

@media print { .topbar, .tabbar, .fab { display: none; } body::before { display: none; } }

/* ═══ Desktop (≥1024px) ═══════════════════════════════════
   A real desktop layout, not a stretched phone: dense controls, tables,
   sidebars and dropdown menus. Phones/tablets never see any of this. */
.d-only { display: none !important; }
.nav-menu { position: relative; }
.nav-menu > summary { list-style: none; cursor: pointer; }
.nav-menu > summary::-webkit-details-marker { display: none; }
.nav-menu-panel {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 70; min-width: 210px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 30, 50, 0.18);
  padding: 6px; display: grid;
}
.nav-menu-panel a, .nav-menu-panel button {
  display: flex; align-items: center; width: 100%; min-height: 36px; padding: 0 0.75rem; border-radius: 6px;
  color: var(--ink); font: inherit; font-size: 0.9rem; font-weight: 500; background: none; border: 0; text-align: left; cursor: pointer;
}
.nav-menu-panel a:hover, .nav-menu-panel button:hover { background: var(--surface-2); color: var(--ink); }
.nav-menu-panel form { margin: 4px 0 0; padding-top: 4px; border-top: 1px solid var(--line); }
.side-section h3, .eyebrow { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); font-weight: 700; margin: 0 0 0.5rem; }
tr[data-href] { cursor: pointer; }

@media (max-width: 1023px) {
  .nav-menu-panel { display: none; }
}

@media (min-width: 1024px) {
  :root { --tap: 38px; --header-h: 60px; --radius: 10px; }
  body { font-size: 15px; }
  .m-only { display: none !important; }
  .d-only { display: revert !important; }
  .d-flex.d-only { display: flex !important; }
  .d-grid.d-only { display: grid !important; }
  .fab { display: none; }

  /* Header */
  .topbar-inner { max-width: 1480px; padding: 0 2rem; gap: 1.5rem; }
  .brand img { height: 38px; }
  .brand-name { font-size: 1.05rem; }
  .topnav { margin-left: 1rem; gap: 2px; }
  .topnav > a, .nav-menu > summary { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 38px; padding: 0 0.8rem; border-radius: 8px; color: var(--navy); font-weight: 600; font-size: 0.92rem; }
  .topnav svg { width: 17px; height: 17px; opacity: 0.75; }
  .topnav > a:hover, .nav-menu > summary:hover, .nav-menu[open] > summary { background: var(--surface-2); color: var(--navy); }
  .topnav > a[aria-current="page"], .nav-menu > summary.current { background: var(--info-bg); color: var(--blue); }
  .topnav .nav-menu-panel { left: 0; right: auto; }
  .topbar-me { margin-left: auto; }
  .account-menu > summary { display: flex; align-items: center; gap: 0.6rem; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); color: var(--navy); font-weight: 600; font-size: 0.9rem; }
  .account-menu > summary:hover, .account-menu[open] > summary { background: var(--surface-2); }
  .account-menu .avatar { width: 32px; height: 32px; font-size: 0.78rem; }
  .account-menu .who { max-width: 14rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

  main.site { max-width: 1480px; padding: 1.5rem 2rem 3rem; }

  /* Controls: desktop density */
  input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
  input[type="date"], input[type="time"], input[type="datetime-local"], input[type="search"], input[type="url"],
  select, textarea { min-height: 38px; padding: 0.4rem 0.7rem; font-size: 0.92rem; border-radius: 7px; }
  select { padding-right: 2rem; background-size: 1rem; }
  input[type="file"] { font-size: 0.9rem; }
  .btn { min-height: 38px; padding: 0 0.95rem; font-size: 0.9rem; border-radius: 7px; }
  .btn-sm { min-height: 32px; padding: 0 0.7rem; font-size: 0.84rem; }
  .btn-icon { width: 38px; }
  .btn svg { width: 17px; height: 17px; }
  .check { min-height: 32px; }
  .check input, .check-list input { width: 18px; height: 18px; }
  .check-list label { min-height: 32px; }
  .field > label, .field-label { font-size: 0.84rem; }
  .form-grid { gap: 0.85rem 1.25rem; }
  .form-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kind-picker label { min-height: 38px; font-size: 0.9rem; }
  .duration-chips button { min-height: 30px; font-size: 0.8rem; }
  .when-row .field > label { font-size: 0.84rem; }

  /* Page header: title left, actions right, one row */
  .page-head { margin-bottom: 1.25rem; flex-wrap: nowrap; }
  .page-head h1 { font-size: 1.55rem; }
  .page-head .sub { color: rgba(255, 255, 255, 0.85); font-size: 0.9rem; margin-left: 0.25rem; white-space: nowrap; }
  .back-link { min-height: 28px; font-size: 0.9rem; }

  /* Segmented controls are compact, not full-width bars */
  .tabs { display: inline-flex; width: auto; padding: 3px; margin-bottom: 0; background: rgba(255, 255, 255, 0.95); }
  .tabs a { flex: none; min-height: 32px; padding: 0 0.95rem; font-size: 0.86rem; }
  .card .tabs, .toolbar-card .tabs { background: var(--surface-2); }

  .card { padding: 1.25rem 1.5rem; }
  .card-head h2 { font-size: 1.05rem; }
  .list-row { min-height: 0; padding: 0.6rem 0; }
  .card-flush .list-row { padding: 0.6rem 1.25rem; }

  /* Toolbar card: search + filters in one row above a table */
  .toolbar-card { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; background: var(--surface); border-radius: var(--radius) var(--radius) 0 0; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); }
  .toolbar-card .grow { flex: 1 1 16rem; min-width: 12rem; position: relative; }
  .toolbar-card .grow svg { position: absolute; left: 0.65rem; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
  .toolbar-card .grow input { padding-left: 2.1rem; }
  .toolbar-card select { width: auto; min-width: 9rem; }
  .toolbar-card .count { margin-left: auto; color: var(--muted); font-size: 0.85rem; white-space: nowrap; }
  .table-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; margin-bottom: 1rem; }
  .table-card .table-foot { display: flex; justify-content: space-between; align-items: center; padding: 0.6rem 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.85rem; }

  /* Data tables */
  table.table { font-size: 0.9rem; }
  .table th { position: sticky; top: 0; z-index: 1; padding: 0.55rem 0.9rem; font-size: 0.72rem; letter-spacing: 0.05em; white-space: nowrap; border-bottom: 1px solid var(--line); }
  .table th a { color: inherit; display: inline-flex; gap: 0.25rem; align-items: center; }
  .table th a:hover { color: var(--blue); }
  .table th .arrow { font-size: 0.7rem; color: var(--blue); }
  .table td { padding: 0.55rem 0.9rem; vertical-align: middle; }
  .table tbody tr:hover td { background: #f7fafd; }
  .table td.num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
  .table .cell-name { display: flex; align-items: center; gap: 0.65rem; font-weight: 600; color: var(--ink); }
  .table .cell-name .avatar { width: 30px; height: 30px; font-size: 0.72rem; }
  .table .muted-cell { color: var(--muted); }
  .table .actions-cell { text-align: right; white-space: nowrap; }
  .table .actions-cell form { display: inline; }
  .card .table th { background: transparent; position: static; padding-left: 0; }
  .card .table td { padding-left: 0; }
  .card .table td:last-child, .card .table th:last-child { padding-right: 0; }

  /* Two-column page layouts */
  .layout-side { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
  .layout-side > aside { position: sticky; top: calc(var(--header-h) + 1.5rem); }
  .layout-form { display: grid; grid-template-columns: minmax(0, 720px) minmax(260px, 1fr); gap: 1.5rem; align-items: start; }
  .layout-form > aside { position: sticky; top: calc(var(--header-h) + 1.5rem); }
  .layout-form .card { max-width: none !important; }

  /* Member profile */
  .profile-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
  .profile-layout .profile-head { flex-direction: column; text-align: center; gap: 0.6rem; }
  .profile-layout .profile-head .meta { justify-content: center; }
  .profile-layout .avatar-lg { width: 72px; height: 72px; font-size: 1.5rem; }
  .profile-layout .button-row { display: grid; grid-template-columns: 1fr 1fr; }
  .profile-layout .button-row .btn, .profile-layout .button-row button { width: 100%; }
  .dl { grid-template-columns: 7.5rem 1fr; font-size: 0.9rem; }

  /* Calendar: sidebar + dense grid */
  .cal-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .cal-side { position: sticky; top: calc(var(--header-h) + 1.5rem); display: grid; gap: 1rem; }
  .cal-side .card { padding: 1rem; margin: 0; }
  .cal-toolbar { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.9rem; color: #fff; }
  .cal-toolbar h1 { margin: 0 0 0 0.5rem; font-size: 1.35rem; color: #fff; text-shadow: 0 2px 4px rgba(0, 0, 0, 0.45); white-space: nowrap; }
  .cal-toolbar .spacer { flex: 1 1 auto; }
  /* The whole day fits the box (no scrolling) unless that would make hours shorter than 40px */
  .cal { --above: 7.5rem;  /* toolbar + page padding above the box */
         --hour-h: max(40px, calc((100vh - var(--header-h) - var(--above) - 50px) * 60 / var(--view-min, 960)));
         --time-w: 56px; --col-min: 140px; max-height: calc(100vh - var(--header-h) - var(--above)); min-height: 480px; }
  .notam-day ~ .cal, .notam-problem ~ .cal { --above: 11.5rem; }  /* the NOTAM line takes room too */
  .cal-colhead { min-height: 48px; flex-direction: row; gap: 0.5rem; justify-content: flex-start; padding: 0.4rem 0.75rem; text-align: left; }
  .cal-colhead .reg { font-size: 0.92rem; }
  .cal-colhead .typ { font-size: 0.75rem; }
  .cal-colhead .badge { margin: 0 0 0 auto; font-size: 0.68rem; }
  .cal-corner { min-height: 48px; }
  .cal-time { font-size: 0.72rem; padding-right: 8px; }
  .cal-slot { cursor: pointer; }
  a.cal-slot:hover::after { content: "+ Book " attr(data-time); font-size: 0.75rem; font-weight: 600; }
  .cal-event { left: 4px; right: 4px; padding: 4px 8px; font-size: 0.8rem; line-height: 1.3; }
  .cal-event .meta { display: block; opacity: 0.85; font-size: 0.72rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .cal-legend { color: var(--ink); text-shadow: none; display: grid; gap: 0.35rem; margin: 0; font-size: 0.85rem; }
  .cal.week { --col-min: 120px; }
  .cal.week .cal-colhead { justify-content: center; flex-direction: column; gap: 0; text-align: center; }

  /* Mini month calendar */
  .minical-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
  .minical-head strong { color: var(--navy); font-size: 0.92rem; }
  .minical-head a { display: inline-flex; width: 28px; height: 28px; align-items: center; justify-content: center; border-radius: 6px; color: var(--navy); }
  .minical-head a:hover { background: var(--surface-2); }
  .minical-head svg { width: 16px; height: 16px; }
  .minical { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.8rem; text-align: center; }
  .minical th { color: var(--muted); font-weight: 600; font-size: 0.7rem; padding: 2px 0 4px; }
  .minical td { padding: 1px; }
  .minical a { position: relative; display: flex; align-items: center; justify-content: center; height: 30px; border-radius: 7px; color: var(--ink); font-variant-numeric: tabular-nums; }
  .minical a:hover { background: var(--surface-2); }
  .minical a.other { color: #a7b3bf; }
  .minical a { flex-direction: column; gap: 1px; height: 34px; line-height: 1.1; }
  .minical .dots { display: flex; gap: 2px; height: 4px; }
  .minical .dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--blue); opacity: 0.75; }
  .minical a.today { box-shadow: inset 0 0 0 1.5px var(--blue); font-weight: 700; }
  .minical a.sel, .minical a.in-week { background: var(--info-bg); }
  .minical a.sel { background: var(--blue); color: #fff; font-weight: 700; }
  .minical a.sel .dots i { background: #fff; opacity: 0.9; }

  .side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
  .side-list a, .side-list .row { display: flex; align-items: center; gap: 0.55rem; padding: 0.4rem 0.5rem; border-radius: 7px; color: var(--ink); font-size: 0.88rem; }
  .side-list a:hover { background: var(--surface-2); color: var(--ink); }
  .side-list a[aria-current="true"] { background: var(--info-bg); color: var(--blue); font-weight: 600; }
  .side-list .swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; }
  .side-list .badge { margin-left: auto; font-size: 0.66rem; }

  /* Booking form availability panel */

  .messages li { padding: 0.65rem 1rem; }
  .profile-head h1 { font-size: 1.35rem; }
}

/* Member profile: one column on phones in a useful order, two columns on desktop. */
@media (max-width: 1023px) {
  .profile-layout { display: flex; flex-direction: column; }
  .profile-layout > .col { display: contents; }
  .profile-layout .o-1 { order: 1; } .profile-layout .o-2 { order: 2; } .profile-layout .o-3 { order: 3; } .profile-layout .o-4 { order: 4; }
  .profile-layout .o-5 { order: 5; } .profile-layout .o-6 { order: 6; } .profile-layout .o-7 { order: 7; } .profile-layout .o-8 { order: 8; }
}
.cal-legend .ringed::before { box-shadow: 0 0 0 2px var(--ring, var(--blue)); }

@media (min-width: 1024px) {
  .side-list a { flex-wrap: nowrap; white-space: nowrap; }
  .table .cell-name, .table td.type-cell { white-space: nowrap; }
  .profile-layout .button-row { display: flex; flex-wrap: wrap; }
  .profile-layout .button-row > .btn, .profile-layout .button-row > form { flex: 1 1 calc(50% - 0.5rem); }
  .profile-layout .button-row > form .btn { width: 100%; }
}
@media (min-width: 1024px) and (max-width: 1439px) {
  .wide-only { display: none !important; }
}
@media (min-width: 1024px) and (max-width: 1279px) {
  .mid-hide { display: none !important; }
}
input[type="color"] { width: 100%; min-height: var(--tap); padding: 4px; border: 1px solid #b8c4d0; border-radius: 8px; background: #fff; cursor: pointer; }

/* Appearance picker (profile). Shared by both themes. */
.theme-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.theme-option { display: flex; flex-direction: column; align-items: flex-start; gap: 0.25rem; padding: 0.7rem; min-height: var(--tap); border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.theme-option:hover { border-color: #b8c4d0; }
.theme-option.chosen { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37, 99, 168, 0.15); }
.theme-name { font-weight: 700; }
.theme-desc { font-size: 0.78rem; color: var(--muted); line-height: 1.3; }
.theme-swatch { display: flex; gap: 4px; width: 100%; height: 34px; padding: 5px; border-radius: 8px; margin-bottom: 0.2rem; }
.theme-swatch i { flex: 1; border-radius: 4px; }
.theme-swatch.classic { background: linear-gradient(135deg, #1a3a5c, #2c5a9e); }
.theme-swatch.classic i { background: #fff; } .theme-swatch.classic i:first-child { background: #2563a8; }
.theme-swatch.modern { background: #f6f7f9; border: 1px solid #e5e7eb; }
.theme-swatch.modern i { background: #fff; border: 1px solid #e5e7eb; } .theme-swatch.modern i:first-child { background: #0f172a; border-color: #0f172a; }
@media (max-width: 1023px) { .profile-layout .o-9 { order: 9; } }

/* Flight sharing */
.share-tag { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.05rem 0.45rem; border-radius: 999px; background: #e8f6ee; color: #1e7a46; font-size: 0.72rem; font-weight: 700; line-height: 1.5; white-space: nowrap; }
.share-tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.share-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.55rem 0.7rem; border-radius: 10px; background: var(--surface-2); border-left: 4px solid #1e7a46; }
.share-list .share-when { flex: 1 1 auto; min-width: 0; color: var(--ink); display: flex; flex-direction: column; line-height: 1.35; }
.share-list .share-when:hover { color: var(--ink); }
.share-list form { flex: none; }
.share-notice { display: flex; align-items: center; gap: 0.5rem; min-height: var(--tap); padding: 0.5rem 0.9rem; margin-bottom: 1rem; border-radius: 10px; background: #e8f6ee; color: #1e5c37; font-weight: 600; font-size: 0.92rem; }
.share-notice:hover { color: #164a2c; }
.share-notice .share-tag { flex: none; background: #fff; }
.form-side { display: grid; gap: 1rem; align-content: start; }
.form-side > .card { margin-bottom: 0; }
@media (max-width: 1023px) { .form-side { margin-top: 1rem; } }
/* Share tag pinned to the bottom-right corner of the booking block. */
.cal-event .share-tag { position: absolute; right: 4px; bottom: 4px; margin: 0; background: rgba(255, 255, 255, 0.94); color: #1e7a46; font-size: 0.66rem; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); pointer-events: none; }
.cal.week .cal-event .share-tag { right: 2px; bottom: 2px; padding: 0 0.3rem; font-size: 0.58rem; }
@media (max-width: 1023px) {
  /* Narrow week columns: just the green dot. */
  .cal.week .cal-event .share-tag { padding: 0; width: 12px; height: 12px; justify-content: center; font-size: 0; gap: 0; }
  .cal.week .cal-event .share-tag::before { width: 6px; height: 6px; }
}
/* "Already booked that day" panel on the booking form (all screen sizes). */
.avail-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; font-size: 0.9rem; }
.avail-list li { display: flex; flex-wrap: wrap; gap: 0.2rem 0.6rem; padding: 0.45rem 0.6rem; border-radius: 7px; background: var(--surface-2); border-left: 4px solid var(--c, var(--blue)); }
.avail-list .t { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Outside the club's bookable hours: visible (so nothing is cut off) but shaded. */
.cal-slot.closed { background: repeating-linear-gradient(135deg, #eef1f4 0 6px, #e6eaee 6px 12px); }
a.cal-slot.closed:hover { background: #dfe6ee; }
/* Home-base aerodrome closed per NOTAM: amber stripes (information only, still bookable). */
.cal-slot.notam { background: repeating-linear-gradient(135deg, #fbe7c6 0 6px, #f7dcae 6px 12px); }
a.cal-slot.notam:hover { background: #f3cf94; }
.notam-day { background: var(--surface); border-radius: 10px; padding: 0.55rem 0.8rem; margin: 0 0 0.75rem; box-shadow: var(--shadow); font-size: 0.9rem; }
.notam-day summary { cursor: pointer; min-height: 32px; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem; }
.notam-list { list-style: none; margin: 0.5rem 0 0; padding: 0; display: grid; gap: 0.6rem; }
.notam-list pre { margin: 0.2rem 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.8rem; font-family: ui-monospace, Menlo, Consolas, monospace; }
.notam-no { font-weight: 700; }
.notam-problem { margin: 0 0 0.75rem; }
/* Short bookings (≤45 min) on desktop: a half hour is only 32px tall there, so put time
   and name on one line instead of clipping the name. Phones have 44px rows and keep two lines. */
@media (min-width: 1024px) {
  .cal-event.compact { display: flex; align-items: center; gap: 0.4rem; padding-top: 0; padding-bottom: 0; white-space: nowrap; }
  .cal-event.compact .t { flex: none; }
  .cal-event.compact .n { flex: 1 1 auto; min-width: 0; }
  .cal-event.compact .n::before { content: "· "; opacity: 0.8; }
  .cal-event.compact .meta { display: none; }
  .cal-event.compact .share-tag { position: static; flex: none; margin-left: auto; }
}
@media (min-width: 1024px) {
  .cal.week .cal-event.compact .n { display: none; }
  .cal.week .cal-event.compact .n-short { display: block; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .cal.week .cal-event.compact .n-short::before { content: "· "; opacity: 0.8; }
}
@media (min-width: 1024px) { .cal.week .cal-event.compact .end { display: none; } }

/* Tech log */
.techlog { align-items: start; }
.accept-box { margin-top: 1rem; padding: 0.6rem 0.8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.accept-box .check { align-items: flex-start; font-weight: 600; }
.accept-box .check input { margin-top: 0.15rem; }
.counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; align-items: end; }
.counts .field > label { font-size: 0.8rem; }
.counts-at { margin: 0 0 -0.4rem; font-weight: 600; }
.other-airports { margin-top: 1rem; padding: 0.5rem 0.8rem; border: 1px dashed var(--line); border-radius: 10px; }
.other-airports summary { cursor: pointer; font-weight: 600; color: var(--navy); min-height: var(--tap); display: flex; align-items: center; }
.airport-rows { display: grid; gap: 0.6rem; }
.airport-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.4rem; align-items: end; border: 0; padding: 0 0 0.6rem; margin: 0; min-width: 0; border-bottom: 1px solid var(--line); }
.airport-row > .field:first-of-type { grid-column: 1 / -1; }
.airport-row:last-child { border-bottom: 0; }
.airport-row input[name$="-airport"] { text-transform: uppercase; }
@media (min-width: 640px) { .airport-row { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); border-bottom: 0; padding-bottom: 0; } .airport-row > .field:first-of-type { grid-column: auto; } }
.airport-row .field > label { font-size: 0.78rem; }
.airport-row input { width: 100%; min-width: 0; }
.airport-row-errors { grid-column: 1 / -1; color: var(--danger); font-size: 0.85rem; font-weight: 600; }
.flightlog-list, .option-list { display: grid; gap: 0.4rem; }
.flightlog-option, .option-list label { display: flex; align-items: center; gap: 0.6rem; min-height: var(--tap); padding: 0.5rem 0.7rem; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; font-variant-numeric: tabular-nums; }
.flightlog-option input, .option-list input { width: 22px; height: 22px; flex: none; accent-color: var(--blue); margin: 0; }
.flightlog-option:has(input:checked), .option-list label:has(input:checked) { border-color: var(--blue); background: var(--info-bg); }
.manual-times { margin-top: 1rem; padding: 0.5rem 0.8rem; border: 1px dashed var(--line); border-radius: 10px; }
.manual-times summary { cursor: pointer; font-weight: 600; color: var(--navy); min-height: 32px; display: flex; align-items: center; }
.cancel-flight { margin-top: 1rem; }
.cancel-flight summary { cursor: pointer; font-weight: 600; color: var(--danger); min-height: 44px; display: flex; align-items: center; }
.not-flown { margin: 0.75rem 0 0; padding-left: 1.1rem; }
.layout-form.techlog > section.card { max-width: none; }
.state-tag { position: absolute; top: 3px; right: 4px; padding: 0 0.4rem; border-radius: 999px; font-size: 0.62rem; font-weight: 700; line-height: 1.5; background: rgba(255, 255, 255, 0.94); pointer-events: none; }
.state-tag.inflight { color: #1d4ed8; }
.state-tag.flown { color: #4b5563; }
.state-tag.backup { color: #92400e; }
/* Backup bookings: hatched, in the right half; the booking they wait behind keeps the left half. */
.cal-event.has-backup { right: 50%; }
.cal-event.backup { left: 50%; opacity: 0.88; border-left-style: dashed;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.22) 0 6px, rgba(255, 255, 255, 0) 6px 12px), var(--ev-bg, var(--blue)); }
.cal.week .cal-event.has-backup { right: 50%; }
.cal.week .cal-event.backup { left: 50%; }
.badge-backup { background: var(--warn-bg); color: var(--warn); }
.cal-event.compact .state-tag { position: static; flex: none; }
@media (max-width: 1023px) { .cal.week .cal-event .state-tag { font-size: 0; padding: 0; width: 8px; height: 8px; background: #fff; top: 2px; right: 2px; } }

/* ── Defects ────────────────────────────────────────────── */
.defect-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.defect-item { display: block; padding: 0.55rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; color: inherit; text-decoration: none; }
.defect-item:hover { border-color: var(--blue); }
.defect-item.grounding { border-color: var(--danger); background: var(--danger-bg); }
.defect-item .head { display: flex; flex-wrap: wrap; gap: 0.35rem 0.5rem; align-items: center; font-size: 0.8rem; color: var(--muted); }
.defect-item .desc { margin-top: 0.2rem; white-space: pre-line; overflow-wrap: anywhere; }
.defect-item .limit { margin-top: 0.25rem; font-size: 0.85rem; font-weight: 600; color: var(--warn); }
.grounded-banner { display: flex; gap: 0.5rem; align-items: flex-start; padding: 0.7rem 0.9rem; border-radius: 10px; background: var(--danger); color: #fff; font-weight: 600; margin-bottom: 0.9rem; }
.defect-actions { display: grid; gap: 0.75rem; }
.defect-actions details { border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.8rem; }
.defect-actions summary { cursor: pointer; font-weight: 600; min-height: var(--tap); display: flex; align-items: center; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; font-size: 0.9rem; }
.history time { display: block; font-size: 0.78rem; color: var(--muted); }
.cal-colhead a.badge { text-decoration: none; }
.photo-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.6rem; }
.photo-grid li { display: grid; gap: 0.25rem; justify-items: start; }
.photo-grid a { display: block; width: 100%; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); background: var(--surface-2); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-file { display: flex; height: 100%; align-items: center; justify-content: center; padding: 0.5rem; text-align: center; font-size: 0.85rem; color: var(--muted); }
/* Local / UTC switch next to the date, and the clock shown in the grid corner */
.clock-switch { margin-bottom: 0.6rem; flex: 0 0 auto; }
.cal-toolbar .clock-switch { margin: 0 0.5rem 0 0; }
.clock-tag { display: flex; align-items: center; justify-content: center; height: 100%; font-size: 0.7rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.page-head .clock-switch { margin: 0; }
.clock-row { display: flex; justify-content: flex-end; margin: -0.25rem 0 0.75rem; }
.clock-row .clock-switch { margin: 0; }
/* Why a stretch is shaded, written in it (phones have no tooltips) */
.notam-band { position: absolute; left: 3px; right: 3px; z-index: 1; pointer-events: none; overflow: hidden;
  top: calc(var(--start) * var(--hour-h) / 60); height: calc(var(--dur) * var(--hour-h) / 60);
  display: flex; justify-content: flex-end; align-items: flex-start; padding: 2px 6px;
  font-size: 0.62rem; font-weight: 700; line-height: 1.3; color: #8a5a12; text-align: right; }
.notam-band .short { display: none; }
@media (max-width: 1023px) { .cal.week .notam-band .full { display: none; } .cal.week .notam-band .short { display: inline; } .cal.week .notam-band { padding: 2px; justify-content: center; } }

/* Billing: amounts never wrap; invoice tables stay readable on phones */
.list-row .amount { flex: 0 0 auto; margin-left: auto; padding-left: 0.75rem; white-space: nowrap; text-align: right; display: flex; align-items: center; gap: 0.4rem; }
.invoice-lines td.num, .invoice-lines th.num { white-space: nowrap; text-align: right; }
.invoice-lines td { vertical-align: top; }
.invoice-head { display: grid; gap: 0.75rem; margin-bottom: 0.75rem; }
@media (min-width: 640px) { .invoice-head { grid-template-columns: 1fr auto; } }
@media print {
  .topbar, .tabbar, .back-link, .layout-form > div:last-child, .fab { display: none !important; }
  body { background: #fff !important; }
  .layout-form { display: block; }
  .card { box-shadow: none; border: 0; }
}
@media (max-width: 1023px) { .invoice-layout { display: flex; flex-direction: column-reverse; } }  /* Pay before the lines on phones */
.invoice-club { display: flex; gap: 0.75rem; align-items: flex-start; }
.invoice-club img { flex: 0 0 auto; border-radius: 50%; }
/* Account statement: a table on desktop, a list on phones */
.table.statement { font-size: 0.85rem; }
.list-row .amount.stacked { flex-direction: column; align-items: flex-end; gap: 0; }
.statement-list .list-row { min-height: 0; padding: 0.55rem 0; }
.table.statement td, .table.statement th { padding: 0.45rem 0.5rem; vertical-align: top; }
.table.statement .num, .table.statement .nowrap { white-space: nowrap; text-align: right; }
.table.statement .nowrap { text-align: left; }
.statement-list .title { white-space: normal; overflow: visible; text-overflow: clip; overflow-wrap: anywhere; }
/* Post-flight: "no flight log yet" with its check button */
.no-flight-log { display: grid; gap: 0.6rem; }
.btn-link { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); text-decoration: underline; cursor: pointer; }
/* Other airports: a Remove link per row, "+ Add another airport" below */
.airport-row .airport-remove { justify-self: start; align-self: center; min-height: var(--tap); }
@media (min-width: 640px) { .airport-row { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)) auto; } .airport-row .airport-remove { align-self: end; } }
.airport-row[hidden] { display: none; }
.airport-actions .btn-link { min-height: var(--tap); }
/* Red count bubble (new defects), like an app badge */
.nav-bubble { display: inline-flex; align-items: center; justify-content: center; min-width: 1.15rem; height: 1.15rem; padding: 0 0.3rem; margin-left: 0.3rem;
  border-radius: 999px; background: #e0245e; color: #fff; font-size: 0.68rem; font-weight: 700; line-height: 1; vertical-align: middle; }
.tabbar a { position: relative; }
.tabbar a .nav-bubble { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; }
.nav-bubble.inline { margin-left: 0.35rem; }
.badge-new { background: #e0245e; color: #fff; }
.ack-strip { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin: 0 0 0.9rem; }
.today-flight.unfinished { border-left: 4px solid #d98e04; padding-left: 0.75rem; }
.unfinished-note { margin: 0 0 0.4rem; font-size: 0.88rem; color: #8a5a12; }
/* Flight logs page */
.flightlog-intro { margin: 0; padding: 0.75rem 1rem; border-bottom: 1px solid var(--line); }
.flightlog-row { align-items: flex-start; }
.flightlog-row .title { white-space: normal; overflow: visible; text-overflow: clip; }
.flightlog-row .meta { display: block; white-space: normal; }
.flightlog-row .badge { flex: 0 0 auto; }
