:root {
  color-scheme: dark;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --bg: #0a1220;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-border: rgba(255, 255, 255, 0.1);
  --text: #f3f6fb;
  --muted: #94a3b8;
  --accent: #2d90ff;
  --accent-2: #6f4df5;
  --danger: #ef4444;
  --grid-line: rgba(255, 255, 255, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: linear-gradient(160deg, #07111f, #14233b);
  color: var(--text);
  min-height: 100vh;
  /* Baseline for primary readable text (buttons, nav links, form fields,
     and any plain text without its own smaller override all inherit this
     via font: inherit) — at least 14pt. Compact/dense UI chrome (badges,
     ribbons, table headers, mini-calendar, chips) keeps its own smaller
     explicit rem sizes, unaffected since rem is relative to the root
     element's font-size, not body's. */
  font-size: 14pt;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 14px;
  gap: 12px;
  max-width: 1600px;
  margin: 0 auto;
}

/* --- Top bar ------------------------------------------------------- */

.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.3px;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-size: 1.1rem;
}

.nav-menu {
  display: flex;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  margin: 0 auto;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  border: none;
  background: transparent;
  color: inherit;
  text-decoration: none;
  font: inherit;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
}

.nav-link:hover { background: rgba(255, 255, 255, 0.08); }

.nav-link.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}

.nav-item-dropdown {
  position: relative;
  display: flex;
  align-items: center;
}

.nav-item-caret {
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.7;
  font-size: 0.7em;
  cursor: pointer;
  padding: 8px 10px 8px 0;
}

.nav-item-caret:hover { opacity: 1; }

.nav-item-submenu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  background: #101c30;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 8px;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item-submenu.hidden { display: none; }

.nav-item-submenu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

.nav-item-submenu a:hover { background: rgba(255, 255, 255, 0.06); }
.nav-item-submenu a small { margin-left: auto; font-weight: 500; }
.nav-item-submenu .muted { padding: 6px 8px; }

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-toggle {
  display: none;
  font-size: 1.3rem;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 6px 12px;
}

.subbar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cal-legend {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: var(--muted);
}

/* Overrides .check-inline's modal-row default (flex: 1 1 100%, meant to
   fill its own row) so it sits inline in the toolbar instead of stretching
   or wrapping. */
.toolbar .cal-toggle {
  flex: 0 0 auto;
  margin-left: auto;
  font-size: 0.78rem;
  color: var(--muted);
}

.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }

.cal-legend-dot {
  width: 11px;
  height: 11px;
  border-radius: 3px;
  display: inline-block;
}

.aircraft-picker {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
}

#aircraft-dropdown-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  width: 100%;
}

.aircraft-picker .caret { font-size: 0.7em; opacity: 0.7; }

.aircraft-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 30;
  background: #101c30;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 8px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.aircraft-photo {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 10px;
  background: rgba(255, 255, 255, 0.04);
}

.aircraft-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.85rem;
}

.aircraft-option:hover { background: rgba(255, 255, 255, 0.06); }
.aircraft-option input { accent-color: var(--accent); }
.aircraft-option small { margin-left: auto; }

.user-menu {
  position: relative;
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  flex-shrink: 0;
}

.avatar-lg {
  width: 52px;
  height: 52px;
}

/* A vendor's logo is a brand mark, not a face — show the whole thing at its
   own aspect ratio instead of cropping it into the circular avatar shape. */
.vendor-logo {
  height: 30px;
  width: auto;
  max-width: 110px;
  object-fit: contain;
  border-radius: 4px;
  flex-shrink: 0;
  vertical-align: middle;
}

.vendor-logo-lg {
  height: 52px;
  max-width: 180px;
}

.crop-hint { margin: -4px 0 4px; font-size: 0.8rem; }

.crop-viewport {
  position: relative;
  width: 260px;
  height: 260px;
  margin: 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  cursor: grab;
  touch-action: none;
  box-shadow: 0 0 0 3px var(--panel-border);
}

.crop-viewport:active { cursor: grabbing; }

#crop-image {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: none;
  pointer-events: none;
  user-select: none;
}

.crop-zoom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  margin-top: 14px;
}

.crop-zoom-row input[type="range"] { flex: 1; accent-color: var(--accent); }

.user-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
}

.user-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--panel-border);
}

.user-menu-name {
  font-weight: 600;
  font-size: 0.88rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  background: #101c30;
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 12px;
  min-width: 230px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-menu-dropdown.hidden { display: none; }

.user-menu-header {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-menu-identity { min-width: 0; }

.user-menu-fullname {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-menu-upload {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.85rem;
  cursor: pointer;
}

.user-menu-upload:hover { background: rgba(255, 255, 255, 0.06); }

.hidden-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.weather-strip {
  display: flex;
  align-items: center;
  gap: 14px;
  overflow-x: auto;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 2px 2px;
  white-space: nowrap;
}

.wx-loc { font-weight: 700; color: var(--text); }

.wx-icon { font-size: 1.15rem; line-height: 1; }
.wx-icon-lg { font-size: 1.7rem; }

.metar-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow-x: auto;
  font-size: 0.8rem;
  color: var(--muted);
  padding: 2px 2px 8px;
  white-space: nowrap;
}

.metar-icao { font-weight: 700; color: var(--text); flex-shrink: 0; }

.metar-raw {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.76rem;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 3px 8px;
  color: var(--text);
}

.metar-taf { color: var(--muted); }

.metar-badge {
  display: inline-block;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
}

/* Standard aviation flight-category colours. */
.fltcat-vfr { background: rgba(34, 197, 94, 0.18); color: #4ade80; }
.fltcat-mvfr { background: rgba(45, 144, 255, 0.18); color: #7cb8ff; }
.fltcat-ifr { background: rgba(239, 68, 68, 0.18); color: #fca5a5; }
.fltcat-lifr { background: rgba(217, 70, 239, 0.18); color: #f0abfc; }
.fltcat-unknown { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }

.wx-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 999px;
  padding: 3px 10px 3px 5px;
  flex-shrink: 0;
}

.range-label {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
  white-space: nowrap;
}

.nav-arrows { display: flex; gap: 4px; }

.btn {
  border: 1px solid var(--panel-border);
  background: var(--panel);
  color: inherit;
  border-radius: 10px;
  padding: 8px 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover { background: rgba(255, 255, 255, 0.1); }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
}

.btn-primary:hover { filter: brightness(1.1); }

.btn-ghost { background: transparent; }

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.btn-warn {
  background: rgba(217, 161, 60, 0.15);
  border-color: rgba(217, 161, 60, 0.4);
  color: #fcd34d;
}

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover { text-decoration: underline; }

/* Loading state for buttons whose action takes a moment (e.g. adding a user
   waits on the invite email). The label is hidden and a spinner takes its
   place, keeping the button's size stable so nothing jumps. */
.btn.is-loading {
  color: transparent !important;
  position: relative;
  pointer-events: none;
  opacity: 0.85;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
}

@keyframes btn-spin { to { transform: rotate(360deg); } }

.icon-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
}

.icon-btn:hover { background: rgba(255, 255, 255, 0.1); color: var(--text); }

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

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-block;
}

.muted { color: var(--muted); font-size: 0.82rem; padding: 4px 8px; }

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

.calendar-body {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

.calendar-sidebar {
  flex-shrink: 0;
  width: 240px;
  position: sticky;
  top: 14px;
}

.mini-cal {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 12px;
}

.mini-cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mini-cal-label { font-size: 0.85rem; font-weight: 600; }

.mini-cal-dow-row, .mini-cal-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.mini-cal-dow {
  text-align: center;
  font-size: 0.62rem;
  text-transform: uppercase;
  color: var(--muted);
  padding: 2px 0 6px;
}

.mini-cal-cell {
  appearance: none;
  margin: 0;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.mini-cal-cell:hover, .mini-cal-cell:focus-visible { background: rgba(255, 255, 255, 0.1); outline: none; }
/* Dim just the number, not the whole cell — an outside-month day that's
   also part of the selected week still needs its highlight visible. */
.mini-cal-cell.is-outside { color: var(--muted); opacity: 0.6; }
.mini-cal-cell.is-outside.is-selected-week { opacity: 1; }
.mini-cal-cell.is-selected-week { background: rgba(45, 144, 255, 0.12); border-radius: 0; }
.mini-cal-cell.is-selected-week:hover { background: rgba(45, 144, 255, 0.2); }
.mini-cal-cell.is-today { box-shadow: inset 0 0 0 1.5px var(--accent); font-weight: 700; }

.mini-cal-cell.has-bookings::after {
  content: '';
  position: absolute;
  bottom: 4px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.calendar {
  flex: 1;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
}

.empty-state {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--muted);
  padding: 40px;
  text-align: center;
}

/* --- Time grid (week) ------------------------------------------------ */

.time-grid {
  display: flex;
  flex-direction: column;
}

.grid-head {
  display: grid;
  grid-template-columns: 56px repeat(7, 1fr);
  background: #0e1c33;
  border-bottom: 1px solid var(--panel-border);
  border-radius: 14px 14px 0 0;
  position: sticky;
  top: 0;
  z-index: 5;
}

.grid-head-cell {
  padding: 10px 6px;
  text-align: center;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
}

.grid-head-cell .dow { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; }
.grid-head-cell .dom { font-size: 1.05rem; font-weight: 700; }

.wx-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  padding: 1px 8px 1px 3px;
}

.wx-chip small { font-weight: 500; opacity: 0.8; }

.grid-head-cell.is-today .dom {
  background: var(--accent);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
}

.grid-body {
  display: flex;
  position: relative;
}

.gutter {
  width: 56px;
  flex-shrink: 0;
  position: relative;
}

.hour-label {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  font-size: 0.68rem;
  color: var(--muted);
  white-space: nowrap;
}

.cols {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.day-col {
  position: relative;
  border-left: 1px solid var(--grid-line);
  background-image: linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 100% 48px;
  cursor: crosshair;
  /* Swipes scroll normally; long-press drag-create is handled in JS. */
  touch-action: auto;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.day-col.is-today { background-color: rgba(45, 144, 255, 0.05); }

.booking {
  position: absolute;
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 0.98rem;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  color: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.25);
  z-index: 2;
  transition: filter 0.15s;
}

.booking:hover { filter: brightness(1.15); z-index: 3; }
.booking strong { font-size: 1.02rem; }
.booking small { font-size: 0.88rem; opacity: 0.85; }

/* Full-width band behind the booking blocks — the whole aircraft is out,
   not just competing for a lane like an individual booking would. */
.blackout-band {
  position: absolute;
  left: 0;
  right: 0;
  border-radius: 8px;
  padding: 4px 7px;
  font-size: 0.98rem;
  overflow: hidden;
  color: #fff;
  background: repeating-linear-gradient(135deg, #7a1f1f, #7a1f1f 10px, #5c1616 10px, #5c1616 20px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  flex-direction: column;
  gap: 1px;
  z-index: 1;
  cursor: pointer;
}

.blackout-band strong { font-size: 1.02rem; }
.blackout-band small { font-size: 0.88rem; opacity: 0.9; }

.booking-user {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.booking-avatar {
  width: 54px;
  height: 54px;
  border: none;
  flex-shrink: 0;
}

/* Diagonal sash across the top-right corner, flagging a booking's status at
   a glance without opening it — needs-log/logged/used/cancelled for past
   bookings, editable/late-notice for upcoming ones. Classic banner
   technique: an oversized strip rotated 45° through the corner, clipped to
   the block's own rounded corner by its overflow:hidden. */
.diag-ribbon {
  position: absolute;
  top: 15px;
  right: -42px;
  width: 155px;
  padding: 3px 0;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  transform: rotate(45deg);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
  pointer-events: none;
  z-index: 3;
}

.diag-ribbon.diag-grace { background: #ffd60a; color: #201a04; }
.diag-ribbon.diag-editable { background: #2d90ff; color: #ffffff; }
.diag-ribbon.diag-in-progress { background: #fb7185; color: #2a0a10; }
.diag-ribbon.diag-needs-log { background: #fcd34d; color: #201a04; }
.diag-ribbon.diag-logged { background: #6ee7b7; color: #06301f; }
.diag-ribbon.diag-cancelled { background: #cbd5e1; color: #1f2937; }

/* Drag the top/bottom edge of your own booking to move its start/end. */
.resize-handle {
  position: absolute;
  left: 0;
  right: 0;
  height: 7px;
  cursor: ns-resize;
  touch-action: none;
  z-index: 4;
}

.resize-handle.resize-top { top: 0; }
.resize-handle.resize-bottom { bottom: 0; }

.booking.is-editable:hover .resize-handle { background: rgba(255, 255, 255, 0.4); }
.booking.is-resizing { filter: brightness(1.15); z-index: 5; box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.6); }
.booking.is-resizing .resize-handle { background: rgba(255, 255, 255, 0.6); }

/* The block body itself (not the resize handles) can be dragged to a new
   time/day — see attachMoveBooking() in calendar.js. */
.booking.is-editable { cursor: grab; }
.booking.is-editable:active { cursor: grabbing; }
.booking.is-dragging {
  cursor: grabbing;
  z-index: 6;
  opacity: 0.9;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), 0 0 0 2px rgba(255, 255, 255, 0.6);
}

.booking.is-cancelled {
  opacity: 0.45;
  text-decoration: line-through;
  border-style: dashed;
}

.booking.ghost {
  left: 0;
  width: calc(100% - 3px);
  background: rgba(45, 144, 255, 0.35);
  border: 1.5px dashed var(--accent);
  color: var(--text);
  font-weight: 600;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 4;
}

.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: #ef4444;
  z-index: 5;
  pointer-events: none;
}

.now-line::before {
  content: '';
  position: absolute;
  left: -4px;
  top: -3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ef4444;
}

/* .month-dow is shared with the Summary page's per-aircraft mini calendars
   (public/js/summary.js) — the day-of-week header row. */
.month-dow {
  padding: 8px;
  text-align: center;
  font-size: 0.72rem;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

/* --- Summary (vendor-admin landing page) -------------------------------- */

.summary-page {
  padding: 20px;
  overflow-y: auto;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.summary-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px;
}

.summary-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.summary-card-head h3 { margin: 0; font-size: 1rem; }

.summary-month {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  overflow: hidden;
}

.summary-month-head {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  border-bottom: 1px solid var(--panel-border);
}

.summary-month-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.summary-cell {
  appearance: none;
  margin: 0;
  border-top: none;
  border-right: none;
  border-left: 1px solid var(--grid-line);
  border-bottom: 1px solid var(--grid-line);
  border-radius: 0;
  padding: 4px 6px;
  min-height: 44px;
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transition: filter 0.1s;
}

.summary-cell:hover, .summary-cell:focus-visible { filter: brightness(1.25); outline: none; }
.summary-cell.is-outside { opacity: 0.35; }
.summary-cell.is-today { box-shadow: inset 0 0 0 1px var(--accent); }

.summary-daynum { font-size: 0.72rem; font-weight: 600; }
.summary-pct { font-size: 0.72rem; color: var(--muted); align-self: flex-end; }

.summary-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  margin-bottom: 14px;
}

.summary-legend-swatch {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1px solid var(--panel-border);
}

.day-detail-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 50vh;
  overflow-y: auto;
}

.day-detail-row {
  appearance: none;
  margin: 0;
  display: grid;
  grid-template-columns: auto auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
}

.day-detail-row:hover { background: rgba(255, 255, 255, 0.08); }
.day-detail-row.is-cancelled { opacity: 0.6; }
.day-detail-time { font-variant-numeric: tabular-nums; }
.day-detail-user { font-weight: 600; }
.day-detail-purpose { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* --- Analytics --------------------------------------------------------- */

.analytics {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* The reports body stacks its own sections (identity, tiles, chart, table),
   so give it the same spacing the analytics layout uses between blocks. */
#report-body {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.stat-tile {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stat-icon {
  position: absolute;
  top: 14px;
  right: 16px;
  font-size: 1.5rem;
  opacity: 0.45;
}

.stat-tile-upcoming { border-color: rgba(45, 144, 255, 0.4); }
.stat-tile-used { border-color: rgba(110, 231, 183, 0.4); }
.stat-tile-legs { border-color: rgba(167, 139, 250, 0.4); }
.stat-tile-hours { border-color: rgba(251, 191, 36, 0.4); }
.stat-tile-cancelled { border-color: rgba(148, 163, 184, 0.4); }

.stat-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.stat-value {
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.15;
}

.stat-sub { font-size: 0.8rem; color: var(--muted); }

.analytics-block h3 {
  margin: 0 0 12px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.block-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.block-heading h3 { margin-bottom: 0; }

/* --- Vendors (merged vendor + fleet view) -------------------------------- */

.vendor-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.vendor-card {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.03);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.vendor-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.vendor-card-head h4 { margin: 0; }

.vendor-settings-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.vendor-admins-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.vendor-fleet {
  border-top: 1px solid var(--panel-border);
  padding-top: 12px;
}

.vendor-fleet h5 {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.aircraft-admin-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 24px;
  margin-top: 12px;
}

.aircraft-admin-photo {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.aircraft-admin-photo-btn { justify-content: center; }

.day-check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 14px;
}

.day-check {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 0.85rem;
  cursor: pointer;
}

.day-check input { accent-color: var(--accent); }
.day-check input:disabled { cursor: not-allowed; }

.analytics-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 640px;
}

.bar-row {
  display: grid;
  grid-template-columns: 76px 1fr 64px;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
}

.bar-label { color: var(--muted); }

.bar-track {
  display: flex;
  gap: 2px; /* surface gap between stacked segments */
}

.bar-fill {
  display: block;
  height: 20px;
  min-width: 2px;
  border-radius: 0;
}

.bar-fill.is-end { border-radius: 0 4px 4px 0; }
.bar-fill.booked { background: var(--accent); }
.bar-fill.cancelled { background: #5b6b80; }

.bar-value { font-variant-numeric: tabular-nums; }

.chart-legend {
  display: flex;
  gap: 16px;
  margin-bottom: 10px;
  font-size: 0.78rem;
  color: var(--muted);
}

.chart-legend > span { display: inline-flex; align-items: center; gap: 6px; }

.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

.swatch.booked { background: var(--accent); }
.swatch.cancelled { background: #5b6b80; }

.mini-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.mini-table th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  font-weight: 600;
}

.mini-table th, .mini-table td {
  padding: 7px 10px 7px 0;
  border-bottom: 1px solid var(--grid-line);
}

.mini-table td { font-size: 14pt; }
.mini-table td:not(:first-child) { font-variant-numeric: tabular-nums; }

.mini-table .dot { display: inline-block; margin-right: 4px; }
.mini-table .avatar { width: 22px; height: 22px; vertical-align: middle; margin-right: 2px; }

.bookings-toolbar { display: flex; justify-content: flex-end; }

.booking-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.booking-tile {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.15s;
}

.booking-tile:hover { border-color: var(--accent); transform: translateY(-2px); }

.booking-tile-photo {
  position: relative;
  height: 110px;
  background-color: rgba(255, 255, 255, 0.06);
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: flex-end;
}

.booking-tile-body {
  padding: 12px 14px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.booking-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.booking-tile-user {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.booking-tile-date {
  width: 100%;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  padding: 5px 10px;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.65), rgba(0, 0, 0, 0));
}

.booking-tile-wx {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(4, 10, 20, 0.6);
  color: #fff;
  backdrop-filter: blur(2px);
}

.booking-tile-purpose { font-size: 0.85rem; color: var(--text); }
.booking-tile-starts { margin-top: 2px; font-weight: 700; }

.user-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 600;
}

.booking-row { cursor: pointer; }
.booking-row:hover td { background: rgba(255, 255, 255, 0.04); }
.bookings-table { font-size: 0.9rem; }
.bookings-table th, .bookings-table td { padding-top: 10px; padding-bottom: 10px; }
.bookings-table td { padding-right: 14px; }
.cell-purpose { color: var(--muted); max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-photo { white-space: nowrap; }

.leg-breakdown {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: nowrap;
}

.leg-line {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 0.8rem;
}

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 10px;
}

.badge-upcoming { background: rgba(45, 144, 255, 0.18); color: #7cb8ff; }
.badge-grace { background: rgba(255, 214, 10, 0.18); color: #ffd60a; }
.badge-editable { background: rgba(45, 144, 255, 0.18); color: #7cb8ff; }
.badge-in-progress { background: rgba(244, 63, 94, 0.18); color: #fda4af; }
.badge-logged { background: rgba(55, 211, 154, 0.15); color: #6ee7b7; }
.badge-needs-log { background: rgba(217, 161, 60, 0.18); color: #fcd34d; }
.badge-cancelled { background: rgba(148, 163, 184, 0.15); color: #cbd5e1; }
.badge-amended { background: rgba(45, 144, 255, 0.12); color: #a8c8f0; }
.badge-admin { background: rgba(111, 77, 245, 0.2); color: #c4b5fd; margin-left: 4px; }
.badge-vendor-admin { background: rgba(45, 144, 255, 0.2); color: #7cb8ff; margin-left: 4px; }
.badge-pending { background: rgba(217, 161, 60, 0.18); color: #fcd34d; margin-left: 4px; }
.badge-sent { background: rgba(55, 211, 154, 0.15); color: #6ee7b7; }
.badge-failed { background: rgba(239, 68, 68, 0.15); color: #fca5a5; }

.log-summary-line {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

#booking-user-line {
  display: flex;
  align-items: center;
  gap: 8px;
}

.required-mark {
  color: var(--danger);
  margin-left: 3px;
  font-weight: 700;
}

.form-required-note {
  margin: -8px 0 14px;
  font-size: 0.78rem;
  color: var(--muted);
}

.totalizer-field {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.totalizer-field label:first-child { flex: 1; min-width: 0; }

.totalizer-field .totalizer-unknown {
  flex: 0 0 auto;
  padding-bottom: 9px;
  white-space: nowrap;
}

.totalizer-field input:disabled { opacity: 0.5; }

.legs-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.legs-head-actions { display: flex; align-items: baseline; gap: 14px; }
.skydemon-upload-label { cursor: pointer; }

#legs-list { display: flex; flex-direction: column; gap: 8px; }

.leg-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.leg-row input { flex: 1; text-align: center; min-width: 0; }
.leg-sep { color: var(--muted); }

.leg-duration {
  min-width: 42px;
  text-align: right;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.leg-pilot {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 140px;
  font-size: 0.8rem;
  padding: 6px 8px;
}

.legs-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-top: 1px solid var(--panel-border);
  padding: 8px 34px 0 2px; /* right pad aligns with leg duration column */
  font-size: 0.85rem;
  font-weight: 600;
}

.legs-total span:last-child { font-variant-numeric: tabular-nums; }

/* --- Modals ----------------------------------------------------------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 10, 20, 0.65);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  z-index: 50;
  padding: 16px;
}

.modal {
  background: #101c30;
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}

/* Booking and flight-log both open as a tray sliding in from the right,
   instead of the centered popup every other modal uses — see
   openTrayModal()/closeTrayModal() in common.js for the two-step (unhide,
   then next frame flip the transform) needed to animate it in at all. */
.modal-tray {
  justify-items: end;
  align-items: stretch;
  padding: 0;
  background: rgba(4, 10, 20, 0);
  transition: background 0.28s ease;
}

.modal-tray.is-open { background: rgba(4, 10, 20, 0.65); }

.modal-tray .modal {
  width: 560px;
  max-width: 92vw;
  height: 100%;
  max-height: 100vh;
  border-radius: 16px 0 0 16px;
  margin: 0;
  transform: translateX(100%);
  transition: transform 0.28s ease;
}

.modal-tray.is-open .modal { transform: translateX(0); }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.modal-head h3 { margin: 0; }

/* Book / Blackout tab strip at the top of the new-booking tray — vendor
   admins only, see canBlackout in openBookingModal(). */
.tab-strip {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--panel-border);
}

.tab-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 14pt;
  font-weight: 600;
  padding: 8px 4px 10px;
  margin-right: 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab-btn.is-active {
  color: var(--text);
  border-bottom-color: var(--accent, #2d90ff);
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 14pt;
  font-weight: 600;
  color: var(--muted);
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* Without this, a grid track's minimum width defaults to its content's
   min-content size — for a text input that's wide enough to blow the
   track past 1fr and overflow the modal entirely, clipped at its edge. */
.field-row > label { min-width: 0; }

/* Custom Start/End date picker — see the "Custom Start/End date picker"
   comment block in common.js for why this exists (the native
   datetime-local popup can't be resized via CSS at all). */
.dt-field { display: flex; flex-direction: column; gap: 5px; }
.dt-field-label { font-size: 14pt; font-weight: 600; color: var(--muted); }
.dt-inputs { display: flex; gap: 8px; }

.dt-date-trigger {
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.dt-date-trigger:hover { background: rgba(255, 255, 255, 0.12); }
.dt-date-trigger:disabled { cursor: not-allowed; opacity: 0.6; }
.dt-time-input { width: 120px; flex-shrink: 0; }

.dt-calendar-popover {
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.03);
}

.dt-calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dt-calendar-label { font-size: 1.3rem; font-weight: 700; }

.dt-calendar-dow-row, .dt-calendar-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.dt-calendar-dow {
  text-align: center;
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  padding: 6px 0 10px;
}

.dt-calendar-cell {
  appearance: none;
  margin: 3px;
  border: none;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.1rem;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dt-calendar-cell:hover { background: rgba(255, 255, 255, 0.12); }
.dt-calendar-cell.is-outside { color: var(--muted); opacity: 0.5; }
.dt-calendar-cell.is-today { box-shadow: inset 0 0 0 2px var(--accent); font-weight: 700; }
.dt-calendar-cell.is-selected { background: var(--accent); color: #fff; font-weight: 700; }

input, select, textarea {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 11px;
  font: inherit;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

input:focus, select:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
}

.field-static {
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 9px 11px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-weight: 500;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--panel-border);
}

.form-section-title {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.booking-history-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 160px;
  overflow-y: auto;
}

.history-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
}

.history-range { flex: 1; min-width: 0; }
.history-when { font-size: 0.72rem; white-space: nowrap; }

.booking-weather {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 8px 12px;
}

.booking-weather .wx-none { color: var(--muted); }

.filter-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.filter-text strong { font-size: 0.85rem; }
.filter-text small { color: var(--muted); font-size: 0.72rem; }

.wx-recorded {
  color: var(--muted);
  font-size: 0.75rem;
  padding: 0 2px;
}

.cancelled-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  background: rgba(217, 161, 60, 0.1);
  border: 1px solid rgba(217, 161, 60, 0.35);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.cancelled-info small { color: var(--muted); }


.booking-options {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* One row per option: its button, then a plain-language explanation of what
   it does — the button and its own consequence read together at a glance. */
.booking-option-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.82rem;
  color: var(--muted);
}

.booking-option-row .btn { flex-shrink: 0; }

/* Within the grace period, deleting is good news — a distinct green tone
   from the neutral/amber notes elsewhere in this modal. */
.booking-option-row.is-grace { color: #86efac; }

/* --- Settings page: one policy per row, field beside its explanation --- */

.settings-section-title {
  margin: 20px 0 10px;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--muted);
}

.settings-section-title:first-of-type { margin-top: 4px; }

.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--grid-line);
}

.settings-row p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
  flex: 1;
}

.settings-row .settings-info { flex: 1; }

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  flex-shrink: 0;
  width: 200px;
}

.settings-row .check-inline {
  flex: 0 0 200px;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
}

.spacer { flex: 1; }

.entity-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  max-width: 720px;
}

.entity-form input:not([type="hidden"]) { flex: 1 1 160px; }

.check-inline {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 6px;
  flex: 1 1 100%;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}

/* Beat `.modal label`'s column layout when the checkbox sits in a modal. */
.modal label.check-inline { flex-direction: row; align-items: center; }

.check-inline input {
  flex: 0 0 auto;
  width: auto;
  accent-color: var(--accent);
}

.btn-small { padding: 4px 10px; font-size: 0.78rem; }

.row-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

/* --- Auth -------------------------------------------------------------- */

.auth-screen {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
  background: radial-gradient(ellipse 900px 520px at 50% -8%, rgba(45, 144, 255, 0.16), transparent 70%), var(--bg);
}

.auth-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--panel-border);
  border-radius: 18px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.auth-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 2px;
}

.auth-logo {
  height: 120px;
  width: auto;
  filter: drop-shadow(0 8px 20px rgba(45, 144, 255, 0.3));
}

.auth-tagline {
  margin: -8px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.88rem;
}


.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-card label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.auth-error {
  margin: 0;
  text-align: center;
  color: #fca5a5;
  font-size: 0.85rem;
}

.auth-notice {
  margin: 0;
  text-align: center;
  color: #6ee7b7;
  font-size: 0.85rem;
}

.auth-link {
  align-self: center;
  font-size: 0.82rem;
}

/* --- Syndicate members --------------------------------------------------- */

.cell-members {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  max-width: 340px;
}

.member-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 2px 4px 2px 10px;
  font-size: 0.78rem;
}

.member-remove {
  border: none;
  background: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 5px;
  border-radius: 50%;
}

.member-remove:hover { color: var(--text); background: rgba(255, 255, 255, 0.12); }

.add-member {
  font-size: 0.78rem;
  padding: 4px 8px;
  border-radius: 8px;
}

/* --- Toast ------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #16283f;
  border: 1px solid rgba(55, 211, 154, 0.5);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 0.88rem;
  font-weight: 600;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.toast.is-error { border-color: rgba(239, 68, 68, 0.6); }

.hidden { display: none !important; }

/* --- Responsive --------------------------------------------------------- */

@media (max-width: 900px) {
  .app { padding: 10px; gap: 10px; }

  /* Nav collapses behind the hamburger. */
  .topbar { position: relative; }
  .nav-toggle { display: block; }
  .nav-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    flex-direction: column;
    background: #101c30;
    border-radius: 14px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
    z-index: 40;
    padding: 6px;
  }
  .nav-menu.open { display: flex; }
  .nav-link { text-align: left; border-radius: 8px; padding: 12px 14px; }
  .nav-item-dropdown { width: 100%; }
  .nav-item-dropdown .nav-link { flex: 1; }
  .nav-item-submenu { left: 8px; right: 8px; min-width: 0; }

  .brand-name { font-size: 1.05rem; }
  .btn-primary { padding: 8px 12px; }
  .range-label { font-size: 0.92rem; }
  .subbar { gap: 8px; }
  .toolbar { flex-wrap: wrap; }
  .aircraft-admin-grid { grid-template-columns: 1fr; }
  .aircraft-admin-photo { max-width: 220px; }

  /* Mini calendar moves above the week grid instead of squeezing it.
     align-items:flex-start (needed so the row layout doesn't stretch the
     sidebar/grid to equal heights) means "don't stretch cross-axis" —
     which becomes horizontal once flex-direction flips to column, leaving
     both children shrunk to their content width. Override back to stretch. */
  .calendar-body { flex-direction: column; align-items: stretch; }
  .calendar-sidebar { width: 100%; position: static; }
  .mini-cal-cell { font-size: 0.85rem; }

  /* Week view compresses to fit the screen width instead of scrolling
     horizontally — columns just get narrower via the grid's 1fr tracks. */
  .gutter, .gutter-head { width: 40px; }
  .grid-head { grid-template-columns: 40px repeat(7, 1fr); }
  .hour-label { font-size: 0.6rem; right: 4px; }
  .booking { padding: 3px 4px; font-size: 0.82rem; gap: 0; }
  .time-grid .booking small { display: none; }
  /* A 54px avatar and a 155px diagonal ribbon both assume a full-width
     desktop block — in a narrow compressed day column they'd overflow the
     booking entirely, so shrink the avatar hard and drop the ribbon (the
     colour/border already carries mine-vs-others; the modal has the rest). */
  .booking-avatar { width: 20px; height: 20px; }
  .time-grid .diag-ribbon { display: none; }
  .booking strong { font-size: 0.85rem; }

  .grid-head-cell { flex-direction: column; gap: 2px; padding: 6px 2px; }
  .wx-chip { font-size: 0.64rem; }
  .time-grid .wx-chip { display: none; }

  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
  .stat-tile { padding: 12px; }
  .stat-value { font-size: 1.5rem; }
  .analytics { padding: 12px; gap: 14px; }

  .summary-page { padding: 12px; }
  .summary-grid { grid-template-columns: 1fr; }
  .summary-cell { min-height: 34px; padding: 2px 4px; }
  .summary-daynum, .summary-pct { font-size: 0.64rem; }

  /* Tables scroll inside their block rather than breaking the page. */
  .analytics-block { overflow-x: auto; }
  .mini-table th, .mini-table td { white-space: nowrap; }

  .modal { padding: 16px; }
  .modal-backdrop { padding: 8px; }
}

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
  #btn-new-booking { font-size: 0.82rem; }
  .toolbar { flex-wrap: wrap; }

  /* Phone-width week view: squeeze further still — every remaining pixel
     goes to the 7 day columns, since that's the actual content. */
  .gutter, .gutter-head { width: 28px; }
  .grid-head { grid-template-columns: 28px repeat(7, 1fr); }
  .hour-label { font-size: 0.56rem; }
  .grid-head-cell .dow { font-size: 0.62rem; }
  .grid-head-cell .dom { font-size: 0.88rem; }
  .grid-head-cell.is-today .dom { width: 22px; height: 22px; }
  .booking { padding: 2px 3px; font-size: 0.72rem; }
  .booking strong { font-size: 0.74rem; }
  .booking-avatar { display: none; }
  .cal-legend { display: none; }

  .aircraft-photo { max-height: 120px; object-fit: cover; }
}
