/* Observer Log — offline kneeboard app */

*, *::before, *::after { box-sizing: border-box; }

:root {
  /* App chrome (top bar, tab bar) stays dark navy in both themes. */
  --chrome-bg: #1c2632;
  --chrome-line: #0e151c;
  --chrome-text: #f2f6fa;
  --chrome-muted: #9aa9b8;
  --chrome-active: #4ea8f5;
  --chrome-press: rgba(255, 255, 255, .09);

  --bg: #dde2e8;
  --bg-2: #d3d9e1;
  --card: #ffffff;
  --card-2: #f1f4f7;
  --input-bg: #ffffff;
  --text: #17212b;
  --muted: #5b6977;
  --line: #d2d9e1;
  --line-strong: #b1bdc9;
  --head-bg: #3a4959;
  --head-text: #eef3f7;
  --head-muted: #b9c5d0;
  --blue: #1270c0;
  --blue-btn: #1877cc;
  --blue-deep: #0d4f8a;
  --blue-soft: #e1eefb;
  --red: #b3261e;
  --red-soft: #fbe9e7;
  --green: #1c7148;
  --green-soft: #e3f3ea;
  --amber: #a36100;
  --amber-soft: #fdf0d9;
  --focus: rgba(24, 119, 204, .35);
  --shadow: 0 1px 2px rgba(15, 30, 45, .08);
  --sketch-bg: #ffffff;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0c1218;
  --bg-2: #111921;
  --card: #18212b;
  --card-2: #1f2a36;
  --input-bg: #10181f;
  --text: #e8eef4;
  --muted: #93a3b3;
  --line: #2a3644;
  --line-strong: #3d4c5c;
  --head-bg: #283545;
  --head-text: #eef3f7;
  --head-muted: #a9b7c4;
  --blue: #58adf6;
  --blue-btn: #1f7fd4;
  --blue-deep: #a3d0fa;
  --blue-soft: #12324f;
  --red: #f08d82;
  --red-soft: #351c1a;
  --green: #7ed3a4;
  --green-soft: #112d21;
  --amber: #f1bd6b;
  --amber-soft: #33260f;
  --focus: rgba(88, 173, 246, .4);
  --shadow: none;
  --sketch-bg: #ffffff;
  color-scheme: dark;
}

/* Dark bars and header bands re-point the shared tokens, so the controls
   inside them pick up light-on-dark colours without their own rules. */
.topbar, .tabbar {
  --text: var(--chrome-text);
  --muted: var(--chrome-muted);
  --line: var(--chrome-line);
  --card-2: var(--chrome-press);
  --blue: var(--chrome-active);
  --green: #6ad59c;
  --amber: #f1bd6b;
  --red: #f08d82;
  color: var(--chrome-text);
}
.sheet-head {
  --text: var(--head-text);
  --muted: var(--head-muted);
  --card-2: rgba(255, 255, 255, .1);
  --line: transparent;
  background: var(--head-bg);
}
.card-head { --muted: var(--head-muted); }

html, body { margin: 0; padding: 0; }

html {
  /* iPadOS tints its top-edge fade with this colour, so it must not be the
     navy of the bars. Bounce is switched off here (the root scroller) so no
     strip of it shows above the top bar when the page is pulled down. */
  background: var(--bg);
  overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(68px + env(safe-area-inset-bottom));
  min-height: 100vh;
  overscroll-behavior-y: none;
}

button, input, select, textarea { font-family: inherit; }
button { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }

.mono {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-variant-numeric: tabular-nums;
}
.small { font-size: 12.5px; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: max(8px, env(safe-area-inset-top));
  /* navy with a faint chart texture (contours, a river, a graticule) that
     thins out towards the bottom edge */
  background:
    linear-gradient(to bottom, transparent 35%, var(--chrome-bg) 100%),
    var(--chrome-bg) url(icons/header-map.svg) repeat-x left top / 600px 160px;
}

/* no hard line under the bar: it fades into the page */
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 18px;
  background: linear-gradient(to bottom, var(--chrome-bg), transparent);
  opacity: .75;
  pointer-events: none;
}

.topbar-row {
  max-width: 1240px;
  margin: 0 auto;
  padding: 4px 16px 8px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; cursor: pointer; }

.brand-icon {
  width: 34px; height: 34px;
  border-radius: 6px;
  display: block;
  box-shadow: 0 2px 6px rgba(15, 30, 45, .18);
}
.brand-icon.mark {
  width: 42px;
  height: 42px;
  border-radius: 0;
  box-shadow: none;
  object-fit: contain;
}

/* GPS in the header, on every tab, after the logo: position · grid | fix quality */
.gps-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 40px;
  padding: 2px 8px;
  margin-left: -8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--chrome-text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.gps-chip:active { background: var(--chrome-press); }
/* position, with the CAP grid and cell on the line below */
.gps-where { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.2; }
.gps-where:not(:has(:not([hidden]))) { display: none; }
.gps-pos { font-size: 13px; font-weight: 600; letter-spacing: .01em; }
.gps-grid { font-size: 11.5px; font-weight: 600; color: var(--chrome-muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.gps-pos[hidden], .gps-grid[hidden], .gps-sep[hidden] { display: none; }
.gps-sep { flex: none; width: 1px; height: 18px; background: rgba(255, 255, 255, .28); }
.gps-meta { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 650; color: var(--chrome-muted); }
/* satellite icon, coloured by fix quality */
.gps-icon { width: 15px; height: 15px; flex: none; color: var(--chrome-muted); }
.gps-chip[data-level="ok"] .gps-icon { color: var(--green); }
.gps-chip[data-level="warn"] .gps-icon { color: var(--amber); }
.gps-chip[data-level="bad"] .gps-icon { color: var(--red); }
@media (max-width: 700px) { .gps-pos { display: none; } }
/* Slide Over and narrow Split View: just the satellite icon, coloured by fix quality */
@media (max-width: 440px) { #gpsLabel, .gps-grid, .gps-sep { display: none; } }
/* hidden until the sortie's first checkpoint */
.gps-chip[hidden], .brand-pipe[hidden], .header-rec[hidden] { display: none; }
/* the flight track is being recorded */
.header-rec { flex: none; }
.header-rec::before { animation: rec-pulse 1.6s ease-in-out infinite; }
@keyframes rec-pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .header-rec::before { animation: none; } }
@media (max-width: 440px) { .header-rec { font-size: 0; gap: 0; padding: 4px; } }

/* the header logo: airplane and wordmark in one image */
.brand-logo { display: block; width: auto; height: 46px; }
.top-actions .brand-sub { margin: 0 6px 0 0; white-space: nowrap; }
@media (max-width: 700px) { .top-actions .brand-sub { display: none; } }
/* tight header: just the save dot, no "Saved 12:27" */
@media (max-width: 900px) { #saveLabel { display: none; } }

.brand-text { min-width: 0; }
.brand-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.15;
}
.brand-sub {
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 5px;
  line-height: 1.3;
  margin-top: 1px;
}
.save-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  flex: none;
}
.save-dot.saving { background: var(--amber); }
.save-dot.error { background: var(--red); }

.top-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex: none; }

.icon-btn {
  width: 42px; height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}
.icon-btn:hover { background: var(--card-2); border-color: var(--line); }
.icon-btn:active { transform: scale(.96); }
.icon-btn svg { width: 21px; height: 21px; }

/* App name | mission number, callsign, crew — tap the mission part to edit it. */
.brand { flex: none; }
.brand-pipe {
  flex: none;
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, .28);
}
/* mission number, sortie, then callsign and crew */
.mission-bar {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}
.mission-strip {
  /* shrinks no further than "Start Here" plus a little of the name */
  flex: 0 1 auto;
  min-height: 42px;
  display: flex;
  align-items: center;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.mission-strip:active, .mission-strip-sub:active { background: var(--card-2); }
.mission-strip-main {
  min-width: 0;
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* "+ Add Mission" while no mission is picked */
.strip-plus { width: 15px; height: 15px; margin-right: 5px; vertical-align: -2px; }
.sortie-name {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  margin-left: 2px;
  padding: 0 6px 0 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  color: var(--chrome-text);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
}
.mission-strip-sub {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 4px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  font-size: 14px;
  color: var(--muted);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

/* "Start Here" callout: a pill with an arrowhead pointing back at New Mission. */
.mission-strip { align-items: center; }
.start-here {
  position: relative;
  flex: none;
  margin-left: 8px;
  padding: 5px 11px;
  border-radius: 6px;
  background: #f1bd6b;
  color: #1c2632;
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
  white-space: nowrap;
  animation: startHere 1.3s ease-in-out infinite;
}
.start-here[hidden] { display: none; }
.start-here::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  margin-top: -7px;
  border: 7px solid transparent;
  border-right-color: #f1bd6b;
}
@keyframes startHere {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(6px); }
}
@media (prefers-reduced-motion: reduce) {
  .start-here { animation: none; }
}

/* Narrow screens: the mission line drops under the app name. */
/* Below a wide landscape iPad the bar takes two rows: logo, GPS and buttons on
   top; mission, sortie and crew underneath with the full width to themselves. */
@media (max-width: 1199px) {
  .topbar-row { flex-wrap: wrap; row-gap: 0; padding-bottom: 4px; }
  .brand-pipe:not(.gps-pipe) { display: none; }
  /* basis 0: the GPS line shrinks (the grid trims) rather than pushing the buttons onto a new line */
  .gps-chip { flex: 1 1 0; }
  .mission-bar {
    order: 3;
    flex-basis: 100%;
    margin: 0 -6px;
    padding-top: 2px;
    border-top: 1px solid rgba(255, 255, 255, .08);
  }
}

/* ---------- layout ---------- */

.app-main {
  max-width: 1020px;
  margin: 0 auto;
  padding: 14px 16px 32px;
}

.stack { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  margin: -16px -16px 14px;
  padding: 6px 10px 6px 16px;
  background: var(--head-bg);
  border-radius: 9px 9px 0 0;
}
.card-head h2 {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--head-text);
}
.card-head .head-left { display: flex; align-items: center; gap: 8px; min-width: 0; }

.count-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11.5px;
  font-weight: 700;
}

@media (min-width: 900px) {
  .wide-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
}

/* ---------- forms ---------- */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span, .field-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.3;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.input::placeholder { color: var(--muted); opacity: .62; }
.input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus);
}
.input.invalid { border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.input.time { max-width: 116px; text-align: center; letter-spacing: .08em; font-weight: 600; }
.input.hobbs { max-width: 128px; }
.input.centered { text-align: center; }

textarea.input { min-height: 88px; resize: vertical; line-height: 1.45; }
textarea.obs-text { min-height: 96px; }

select.input {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(50% + 1px), calc(100% - 13px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
.form-grid.four { grid-template-columns: repeat(4, 1fr); }
.span-2 { grid-column: span 2; }

@media (max-width: 620px) {
  .form-grid.three, .form-grid.four { grid-template-columns: 1fr 1fr; }
  .form-grid.four .span-2 { grid-column: span 2; }
}

.coord-help {
  font-size: 11.5px;
  color: var(--muted);
  min-height: 15px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.coord-help.error { color: var(--red); }

.input-btn { display: flex; align-items: stretch; gap: 6px; }
.input-btn .input { flex: 1; min-width: 0; }

.mini {
  min-height: 40px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--card-2);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.mini svg { width: 14px; height: 14px; flex: none; }

.gps-row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.gps-status {
  font-size: 11.5px;
  font-weight: 650;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.gps-status.error { color: var(--red); }
.gps-hint {
  margin-top: 9px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}
.gps-mark { margin-top: 10px; }
.gps-mini { color: var(--blue); background: var(--blue-soft); border-color: transparent; }
.mini:active { transform: scale(.97); }
.mini.on { background: var(--blue-btn); border-color: var(--blue-btn); color: #fff; }

/* ---------- buttons ---------- */

.btn {
  min-height: 44px;
  padding: 0 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--text);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.btn:active { transform: scale(.985); }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--blue-btn); border-color: var(--blue-btn); color: #fff; }
.btn.soft { background: var(--blue-soft); border-color: transparent; color: var(--blue); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; border-radius: 7px; }
.btn.tiny { min-height: 30px; padding: 0 9px; font-size: 12px; border-radius: 8px; }
.btn.danger { color: var(--red); background: var(--red-soft); border-color: transparent; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; pointer-events: none; }

.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }


/* ---------- rows ---------- */

.row-del {
  width: 30px; height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  margin-top: 2px;
}
.row-del:active { background: var(--red-soft); color: var(--red); }

.empty {
  padding: 20px 10px;
  text-align: center;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.5;
}
.empty strong { color: var(--text); display: block; font-size: 14.5px; margin-bottom: 3px; }

/* ---------- times ---------- */

.trow {
  display: grid;
  grid-template-columns: 108px minmax(0, 1.15fr) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.trow:last-child { border-bottom: 0; }
.trow .tlabel { font-size: 14px; font-weight: 650; line-height: 1.2; }
.trow .tlabel small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 500; margin-top: 1px; }
.trow .tfield { display: flex; align-items: center; gap: 5px; }
.trow .tfield .input { min-height: 42px; font-size: 16px; }
.trow .tfield .mini { min-height: 42px; }

@media (max-width: 620px) {
  .trow { grid-template-columns: 1fr 1fr; }
  .trow .tlabel { grid-column: 1 / -1; }
}

.totals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}
@media (max-width: 620px) { .totals { grid-template-columns: 1fr 1fr; } }
.total { background: var(--card-2); border-radius: 8px; padding: 9px 11px; }
.total .tl { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.total .tv { font-size: 18px; font-weight: 700; margin-top: 2px; font-variant-numeric: tabular-nums; }
.total .tv.muted { color: var(--muted); font-weight: 500; }

.ops-list { display: flex; flex-direction: column; gap: 10px; }
.ops-row {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px;
  background: var(--card-2);
}
.ops-top { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.ops-index { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.ops-fields { display: grid; grid-template-columns: 100px 100px 1fr 100px; gap: 7px; }
@media (max-width: 700px) { .ops-fields { grid-template-columns: 1fr 1fr; } }
.ops-fields .input { min-height: 40px; padding: 8px 9px; font-size: 15px; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.toggle .tick {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: transparent;
  flex: none;
}
.toggle.on { background: var(--green-soft); border-color: color-mix(in srgb, var(--green) 40%, var(--line)); color: var(--green); }
.toggle.on .tick { background: var(--green); border-color: var(--green); color: #fff; }

.note-strip {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ---------- nav aids / frequencies ---------- */

.nav-grid { display: flex; flex-direction: column; gap: 8px; }
/* crew: role, name, CAPID, remove */
.crew-list { display: flex; flex-direction: column; gap: 8px; }
.crew-row {
  display: grid;
  grid-template-columns: 84px 2fr 120px 30px;
  gap: 7px;
  align-items: center;
}
.crew-row .input { min-height: 42px; font-size: 15px; }
@media (max-width: 620px) {
  .crew-row { grid-template-columns: 1fr 1fr 30px; }
  .crew-row [data-bind$=".name"] { grid-column: 1 / 3; grid-row: 2; }
  .crew-row .mono { grid-row: 1; grid-column: 2; }
}

.nav-row {
  display: grid;
  grid-template-columns: 26px 1fr 1fr 1fr 30px;
  gap: 7px;
  align-items: center;
}
.nav-row .num { font-size: 12px; font-weight: 800; color: var(--muted); text-align: center; }
.nav-row .input { min-height: 42px; font-size: 15px; }
@media (max-width: 620px) {
  .nav-row { grid-template-columns: 22px 1fr 1fr 30px; }
  .nav-row .radial { grid-column: 2 / 4; }
}

.freq-list { display: flex; flex-direction: column; }
.freq-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.freq-row:last-child { border-bottom: 0; }
.freq-row .fl { color: var(--muted); }
.freq-row .fv { font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, monospace; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

.subhead {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
}
.subhead:first-child { margin-top: 0; }

/* ---------- observations ---------- */

.obs {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  background: var(--card-2);
  margin-bottom: 10px;
}
.obs:last-child { margin-bottom: 0; }
.obs-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.badge {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .05em;
  text-transform: uppercase;
}
.obs-head .obs-time { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.obs-head .spacer { flex: 1; }
.obs-fields { display: grid; grid-template-columns: 96px 96px 1fr 1fr; gap: 7px; margin-bottom: 8px; }
@media (max-width: 700px) { .obs-fields { grid-template-columns: 1fr 1fr; } }
.obs-fields .input { min-height: 40px; padding: 8px 9px; font-size: 15px; }
.obs textarea { min-height: 90px; }

.obs-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.obs-photo {
  width: 78px;
  height: 78px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  cursor: pointer;
  flex: none;
}
.obs-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.obs-photo:active { transform: scale(.98); }
.obs-photo.add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border-style: dashed;
  border-color: var(--line-strong);
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 10px;
  font-weight: 700;
}
.obs-photo.add svg { width: 21px; height: 21px; }
.photo-full {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  background: #000;
  border-radius: 8px;
}

/* ---------- notes & sketch: each fills the page ---------- */

html.page-full, html.page-full body { overflow: hidden; overscroll-behavior: none; }
.page-fill {
  position: fixed; left: 0; right: 0;
  top: var(--page-top, 110px);
  bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 10;
  display: flex; flex-direction: column;
  padding: 12px max(12px, env(safe-area-inset-right)) 12px max(12px, env(safe-area-inset-left));
}
.page-fill > .card { flex: 1; min-height: 0; margin: 0 auto; width: 100%; max-width: 1100px; display: flex; flex-direction: column; }
/* the keyboard takes the tab bar's place */
body.keyboard-open .page-fill { bottom: 0; }
.help-steps { margin: 6px 0 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; line-height: 1.4; }

/* the notes: a lined page, with its tools above */
.notes-tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.notes-tools .btn svg { width: 17px; height: 17px; margin-right: 6px; vertical-align: -3px; }
.notes-tools .btn.listening { background: var(--red); border-color: var(--red); color: #fff; animation: rec-pulse 1.6s ease-in-out infinite; }
.notes-sep { width: 1px; height: 24px; background: var(--line); }
.notes-quick { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn {
  min-height: 34px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--line-strong); background: var(--card-2); color: var(--text);
  font-size: 13px; font-weight: 650; cursor: pointer;
}
.chip-btn:active { background: var(--blue-soft); border-color: var(--blue); }
textarea.notes-full {
  flex: 1; min-height: 0; width: 100%;
  resize: none;
  font-size: 17px;
  line-height: 30px;
  padding: 6px 16px 30px 52px;
  /* ruled lines and a red margin, the lines scrolling with the text */
  background-color: var(--input-bg);
  background-image:
    linear-gradient(to right, transparent 39px, color-mix(in srgb, var(--red) 35%, transparent) 39px, color-mix(in srgb, var(--red) 35%, transparent) 41px, transparent 41px),
    linear-gradient(to bottom, transparent 29px, var(--line) 29px, var(--line) 30px);
  background-size: 100% 100%, 100% 30px;
  background-position: 0 0, 0 6px;
  background-attachment: local;
  font-variant-numeric: tabular-nums;
}


.swatch {
  width: 34px; height: 34px;
  border-radius: 6px;
  border: 2px solid var(--line);
  background: #1b2733;
  cursor: pointer;
  padding: 0;
}
.swatch.red { background: #b3261e; }
.swatch.eraser {
  background: var(--card);
  color: var(--muted);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-style: dashed;
}
.swatch.active { border-color: var(--blue); box-shadow: 0 0 0 2px var(--focus); }

.canvas-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--sketch-bg);
  box-shadow: inset 0 0 0 1px rgba(15, 30, 45, .03);
}
/* The page, 4:5, sized to fit the screen below the header and above the
   tab bar: the background canvas under, the ink canvas on top. */
/* the stage takes the room left in the card; the 4:5 page is as large as fits in it */
.sketch-stage {
  flex: 1; min-height: 0;
  display: flex; justify-content: center; align-items: center;
  container-type: size;
}
.sketch-stage .canvas-wrap {
  width: min(100cqw, 80cqh);
  aspect-ratio: 4 / 5;
}
#sketch-bg, #sketch {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}
#sketch-bg { background: #fff; }
#sketch {
  touch-action: none;
  cursor: crosshair;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
/* ---------- the sketch pad: the page fills the screen ---------- */
.sketch-shell {
  position: fixed; left: 0; right: 0;
  top: var(--page-top, 110px);
  bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 10;
  background: #151d27;   /* shows only if the page's shape differs (the iPad turned) */
  overflow: hidden;
}
.sketch-shell .sketch-stage { position: absolute; inset: 0; }
.sketch-shell .canvas-wrap {
  width: min(100cqw, calc(100cqh * var(--ar, .8)));
  aspect-ratio: var(--ar, .8);
  border: 0; border-radius: 0; box-shadow: none;
}

/* a map page: the live chart, drawn on */
.sketch-map { position: absolute; inset: 0; z-index: 1; background: #e8edf1; }
.sketch-map .leaflet-control-attribution { font-size: 10px; }
.sketch-map.drawing .leaflet-container, .sketch-map.drawing { cursor: crosshair; }
.sk-mapzoom { position: absolute; right: 12px; bottom: 14px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.sk-mapzoom .fly-round {
  background: rgba(20, 28, 38, .72); color: #f2f6fa;
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 4px 16px rgba(0, 0, 0, .22);
}
.sk-hand.on { background: #fff; color: #14212f; }

/* its tools: a row of the header */
.topbar-tools { max-width: 1240px; margin: 0 auto; padding: 0 16px 8px; }
.topbar-tools[hidden] { display: none; }
.sk-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sk-spacer { flex: 1; }
.sk-glass {
  display: inline-flex; align-items: center; gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .1);
}
.sk-bgs button { min-height: 34px; padding: 0 12px; border-radius: 999px; border: 0; background: transparent; color: rgba(242, 246, 250, .8); font-weight: 650; font-size: 13px; cursor: pointer; }
.sk-bgs button.active { background: #fff; color: #14212f; }
.sk-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 36px; height: 34px; padding: 0 8px;
  border: 0; border-radius: 999px;
  background: transparent; color: #f2f6fa;
  font-size: 14px; font-weight: 650; cursor: pointer;
}
.sk-btn svg { width: 19px; height: 19px; }
.sk-btn:active { background: rgba(255, 255, 255, .14); }
.sk-btn[disabled] { opacity: .3; pointer-events: none; }
.sk-pens { gap: 5px; padding: 3px 6px; }
.sk-pens .swatch { width: 28px; height: 28px; border-radius: 50%; border-color: rgba(255, 255, 255, .3); }
.sk-pens .swatch.eraser { background: rgba(255, 255, 255, .12); color: #fff; }
.sk-page-label { min-width: 44px; text-align: center; font-size: 13px; font-weight: 700; color: #f2f6fa; font-variant-numeric: tabular-nums; }

.sketch-hint {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.45;
}

.sig-wrap {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}
#signature {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  touch-action: none;
  cursor: crosshair;
}

/* ---------- tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  align-items: stretch;
  padding: 0 6px env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--chrome-bg) 94%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(16px);
  backdrop-filter: saturate(140%) blur(16px);
  border-top: 1px solid var(--chrome-line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 -2px 10px rgba(5, 10, 16, .1);
}
.tab {
  flex: 1;
  max-width: 180px;
  height: 58px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  letter-spacing: .02em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .18s ease;
}
/* the icon sits in a pill that fills in for the open tab */
.tab-icon {
  position: relative;
  display: grid;
  place-items: center;
  width: 54px;
  height: 30px;
  border-radius: 15px;
  transition: background-color .2s ease, transform .12s ease;
}
.tab svg { width: 22px; height: 22px; transition: stroke-width .18s ease; }
.tab.active { color: var(--chrome-text); }
.tab.active .tab-icon { background: color-mix(in srgb, var(--chrome-active) 22%, transparent); color: var(--chrome-active); }
.tab.active svg { stroke-width: 2.1; }
.tab:active .tab-icon { transform: scale(.9); background: var(--chrome-press); }
.tab.active:active .tab-icon { background: color-mix(in srgb, var(--chrome-active) 30%, transparent); }
.tab:focus-visible { outline: none; }
.tab:focus-visible .tab-icon { box-shadow: 0 0 0 2px var(--chrome-active); }
.tab-label { line-height: 1; }
/* Missions is the mission; the rest are the open sortie's */
.tab-sep {
  flex: none;
  width: 1px;
  margin: 15px 4px;
  background: linear-gradient(transparent, rgba(255, 255, 255, .14), transparent);
}
/* status dots: recording on Fly, closed on Close */
.tab-dot {
  position: absolute;
  top: 1px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--chrome-bg);
  box-sizing: content-box;
  display: none;
}
.tab.recording .tab-dot { display: block; background: #ff4d4f; animation: rec-pulse 1.6s ease-in-out infinite; }
.tab.done .tab-dot { display: block; background: #6ad59c; }
/* landscape and the bigger iPads: icon beside the label, like the iPadOS tab bar */
@media (min-width: 1000px) {
  .tab { flex-direction: row; gap: 8px; font-size: 13px; max-width: 190px; }
  .tab-icon { width: 40px; }
}

body.keyboard-open .tabbar { display: none; }

/* ---------- sheets ---------- */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(7, 14, 22, .46);
  -webkit-backdrop-filter: blur(2px);
  backdrop-filter: blur(2px);
}
.overlay.show { display: flex; }

.sheet {
  width: min(780px, 100%);
  max-height: 92dvh;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border-radius: 14px 14px 0 0;
  box-shadow: 0 -12px 50px rgba(0, 0, 0, .3);
  padding-bottom: env(safe-area-inset-bottom);
  animation: sheetIn .22s cubic-bezier(.2, .8, .2, 1);
  overflow: hidden;
}
@keyframes sheetIn {
  from { transform: translateY(22px); opacity: .6; }
  to { transform: translateY(0); opacity: 1; }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  flex: none;
}
.sheet-head h2 { font-size: 17px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--text); }
.sheet-head .sheet-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.sheet-body {
  padding: 16px 18px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

.sheet-foot {
  padding: 12px 18px 14px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  flex: none;
}
.sheet-foot .left { margin-right: auto; }

.sheet-section { margin-bottom: 20px; }
.sheet-section:last-child { margin-bottom: 4px; }
.sheet-section h3 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 9px;
}
.sheet-note {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.5;
  margin: 6px 0 12px;
}

.menu-list { display: flex; flex-direction: column; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 10px 4px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: var(--text);
  text-align: left;
  font-size: 15px;
  font-weight: 550;
  cursor: pointer;
}
.menu-item:last-child { border-bottom: 0; }
a.menu-item { text-decoration: none; }
.menu-item svg { width: 20px; height: 20px; color: var(--muted); flex: none; }
.menu-item .mi-sub { display: block; font-size: 12px; color: var(--muted); font-weight: 400; margin-top: 1px; }
.menu-item.danger { color: var(--red); }
.menu-item.danger svg { color: var(--red); }

.log-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.log-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card-2);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.log-row.active { border-color: var(--blue); background: var(--blue-soft); }
.mission-group { display: flex; flex-direction: column; gap: 6px; }
.mission-group + .mission-group { margin-top: 8px; }
.mission-group-name {
  font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}
.mission-group.active .mission-group-name { color: var(--blue); }
.sortie-row { padding-left: 16px; }
.sortie-signed {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px;
  background: var(--green-soft); color: var(--green); font-size: 11px; font-weight: 700;
}
/* the two steps of a new mission */
.steps { display: flex; gap: 10px; flex-wrap: wrap; }
.step {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 12px 7px 7px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  font-size: 13.5px; font-weight: 650;
}
.step-num {
  width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: var(--card-2); color: var(--muted); font-size: 12px; font-weight: 800;
}
.step.done { color: var(--green); }
.step.done .step-num { background: var(--green-soft); color: var(--green); }
.step.now { color: var(--text); border-color: var(--blue); }
.step.now .step-num { background: var(--blue-btn); color: #fff; }
.sortie-name[hidden] { display: none; }
/* a pipe between the mission number and the sortie */
.sortie-name::before { content: ''; width: 1px; height: 16px; margin-right: 6px; background: rgba(255, 255, 255, .28); }
.sortie-name svg { width: 14px; height: 14px; color: var(--chrome-muted); }
.sortie-name:active { background: var(--chrome-press); }
.card-current { border-color: var(--blue); box-shadow: 0 0 0 2px var(--focus); }
/* sortie tabs stay shut until the mission has a sortie */
.tabbar.locked .tab:not([data-tab="logbook"]) { opacity: .32; }
.tabbar.locked .tab:not([data-tab="logbook"]):active .tab-icon { transform: none; background: none; }
.logbook-mission.current { border-color: color-mix(in srgb, var(--blue) 45%, var(--line)); }

.back-link {
  align-self: flex-start;
  border: 0;
  background: none;
  color: var(--blue);
  font-size: 15px;
  font-weight: 650;
  padding: 4px 2px;
  cursor: pointer;
}
.log-name { font-size: 14.5px; font-weight: 650; }
.log-meta { font-size: 11.5px; color: var(--muted); }

.seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.seg button {
  border: 0;
  background: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 8px 13px;
  border-radius: 8px;
  cursor: pointer;
  min-height: 36px;
}
.seg button.active { background: var(--blue-btn); color: #fff; }
.seg.wrap { display: flex; flex-wrap: wrap; }

/* ---------- Fly: the moving map ----------
   The chart fills the space between the header and the tab bar; the controls
   float over it on dark glass. */
html.fly-open, html.fly-open body { overflow: hidden; overscroll-behavior: none; }
.fly-shell {
  position: fixed;
  left: 0; right: 0;
  top: 110px;   /* set to the header's bottom edge by placeFlyShell() */
  bottom: calc(58px + env(safe-area-inset-bottom));
  z-index: 10;
  background: #e8edf1;
  overflow: hidden;
}
.fly-shell .pos-map { position: absolute; inset: 0; z-index: 1; }
.pos-map .leaflet-control-attribution { font-size: 10px; }
/* no smoothing seams between chart tiles */
.pos-map .leaflet-tile { image-rendering: auto; outline: 1px solid transparent; }
.fly-ui { position: absolute; inset: 0; z-index: 500; pointer-events: none; }
.fly-ui > * { pointer-events: auto; }

/* shared glass */
.pos-panel, .fly-chip, .fly-cp, .fly-btn, .fly-round, .pos-layers {
  background: rgba(20, 28, 38, .72);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  backdrop-filter: blur(12px) saturate(1.3);
  color: #f2f6fa;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .22);
  border: 1px solid rgba(255, 255, 255, .1);
}

/* position, top left */
.fly-top {
  position: absolute; top: 12px; left: 12px;
  right: 216px; max-width: 560px;
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px;
  pointer-events: none;
}
.pos-panel { padding: 12px 14px 10px; border-radius: 14px; pointer-events: auto; cursor: pointer; }
.pos-panel[hidden] { display: none; }
.pos-big { display: flex; flex-wrap: wrap; gap: 0 18px; font-size: 24px; font-weight: 700; letter-spacing: .01em; line-height: 1.15; }
.pos-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-top: 6px; }
.pos-facts div { display: flex; flex-direction: column; }
.pos-facts span { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: rgba(242, 246, 250, .65); }
.pos-facts b { font-size: 15px; }
.pos-other { display: none; }
.pos-none { font-size: 15px; color: rgba(242, 246, 250, .85); }
.pos-note { margin-top: 6px; font-size: 10.5px; color: rgba(242, 246, 250, .6); }
.fly-chip {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 14px;
  border-radius: 999px;
  font-size: 13px; font-weight: 650; cursor: pointer;
}
.fly-chip .sb-dot { width: 9px; height: 9px; border-radius: 50%; background: #6ad59c; }
.fly-chip.none .sb-dot { background: #9aa9b8; }
.fly-chip.due { background: rgba(163, 97, 0, .85); }
.fly-chip.due .sb-dot { background: #ffd28a; animation: rec-pulse 1.4s ease-in-out infinite; }

/* checkpoints, down the right */
.fly-rail {
  position: absolute; top: 12px; right: 12px; bottom: 70px;
  width: 188px;
  display: flex; flex-direction: column; justify-content: flex-start; gap: 6px;
}
.fly-cp {
  flex: 1 1 0; min-height: 42px; max-height: 62px;
  display: flex; align-items: center; gap: 10px;
  padding: 0 12px;
  border-radius: 14px;
  text-align: left; cursor: pointer;
  transition: transform .1s ease, background-color .15s ease;
}
.fly-cp svg { width: 24px; height: 24px; flex: none; color: #8cc8ff; }
.fly-cp-text { display: flex; flex-direction: column; min-width: 0; }
.fly-cp-label { font-size: 14px; font-weight: 650; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fly-cp-time { font-size: 12.5px; font-weight: 700; color: #8ee6b4; font-variant-numeric: tabular-nums; }
.fly-cp:active { transform: scale(.97); }
.fly-cp.done { background: rgba(22, 74, 50, .78); border-color: rgba(106, 213, 156, .35); }
.fly-cp.done svg { color: #8ee6b4; }
.fly-cp.next { border-color: #4ea8f5; box-shadow: 0 0 0 2px rgba(78, 168, 245, .55), 0 4px 16px rgba(0, 0, 0, .22); }
.fly-cp.custom { border-style: dashed; }
.fly-cp.custom svg { color: #f2f6fa; }
/* + Observation: styled like + Checkpoint; its count in the muted second line */
.fly-cp.obs { border-style: dashed; }
.fly-cp.obs svg { color: #f2f6fa; }
.fly-cp.obs .fly-cp-time { color: rgba(242, 246, 250, .65); font-weight: 600; }

/* zoom and centre, left above the actions */
.fly-mapctl {
  position: absolute; left: 12px; bottom: 74px;
  display: flex; flex-direction: column; gap: 8px;
}
.fly-round {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
}
.fly-round svg { width: 22px; height: 22px; }
.fly-round.small { width: 38px; height: 38px; }
.fly-round:active, .fly-btn:active { transform: scale(.95); }

/* the actions, bottom left */
.fly-actions {
  position: absolute; left: 12px; bottom: 14px;
  display: flex; gap: 8px;
}
.fly-btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 48px; padding: 0 16px;
  border-radius: 999px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.fly-btn svg { width: 21px; height: 21px; }
.fly-btn.primary { background: rgba(24, 119, 204, .88); border-color: rgba(140, 200, 255, .35); }
.fly-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
  background: rgba(255, 255, 255, .2); font-size: 12px; line-height: 20px; text-align: center;
}

/* map choice: sectional, topographic, terrain; bottom right */
.pos-layers {
  position: absolute; right: 12px; bottom: 18px;
  border-radius: 999px; padding: 4px; gap: 2px;
}
.pos-layers button { min-height: 38px; padding: 0 13px; border-radius: 999px; border: 0; background: transparent; color: rgba(242, 246, 250, .8); font-weight: 650; font-size: 13px; }
.pos-layers button.active { background: #fff; color: #14212f; }
.fly-shell .leaflet-control-attribution { margin-bottom: 0 !important; opacity: .75; }
.fly-shell .leaflet-bottom.leaflet-right { bottom: 0; right: 0; }

/* the Hobbs keypad, as a popover beside the checkpoint button */
.kp-pop {
  position: absolute; z-index: 700;
  width: 300px;
  padding: 12px 12px 12px;
  border-radius: 18px;
  background: rgba(24, 33, 44, .9);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
  color: #f2f6fa;
  /* light-on-dark versions of the tokens the keypad uses */
  --text: #f2f6fa; --muted: rgba(242, 246, 250, .65); --line: rgba(255, 255, 255, .14);
  --card-2: rgba(255, 255, 255, .08); --input-bg: rgba(0, 0, 0, .25); --blue: #8cc8ff;
  --blue-soft: rgba(78, 168, 245, .25); --focus: rgba(78, 168, 245, .45);
  animation: kpIn .16s ease-out;
}
@keyframes kpIn { from { opacity: 0; transform: translateX(8px) scale(.97); } }
.kp-pop-arrow {
  position: absolute; right: -8px;
  width: 16px; height: 16px; margin-top: -8px;
  background: rgba(24, 33, 44, .9);
  border-top: 1px solid rgba(255, 255, 255, .12);
  border-right: 1px solid rgba(255, 255, 255, .12);
  transform: rotate(45deg);
}
.kp-pop-head { display: flex; justify-content: space-between; align-items: baseline; margin: 0 2px 10px; font-size: 14px; }
.kp-pop-head span { color: #8ee6b4; font-weight: 700; }
.kp-pop .meter-entries { max-width: none; }
.kp-pop .input.hobbs-big { min-height: 54px; font-size: 28px; background: var(--input-bg); color: #fff; border-color: var(--line); }
.kp-pop .meter-entries.two .input.hobbs-big { font-size: 22px; min-height: 50px; }
.kp-pop .input.fresh { background: rgba(78, 168, 245, .22); border-color: #4ea8f5; }
.kp-pop .keypad { gap: 6px; margin-top: 10px; max-width: none; }
.kp-pop .key { min-height: 46px; font-size: 22px; border-radius: 10px; }
.kp-pop .key.aux { font-size: 14px; }
.kp-pop-foot { display: flex; gap: 8px; margin-top: 10px; }
.kp-pop-foot .btn { flex: 1; min-height: 44px; }
.kp-pop-foot .btn:not(.primary) { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .14); }
.fly-cp.kp-anchor { border-color: #fff; box-shadow: 0 0 0 2px rgba(255, 255, 255, .6), 0 4px 16px rgba(0, 0, 0, .22); }
@media (max-height: 640px) {
  .kp-pop { width: 280px; padding: 10px; }
  .kp-pop .key { min-height: 38px; font-size: 19px; }
  .kp-pop .input.hobbs-big { min-height: 44px; font-size: 22px; }
  .kp-pop-head { margin-bottom: 6px; }
}

/* a new observation: a note box at the top of the map, above the keyboard */
.obs-pop {
  position: absolute; z-index: 700;
  top: 12px; left: 12px; right: 216px;
  max-width: 620px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(24, 33, 44, .92);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, .12);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .4);
  color: #f2f6fa;
  --text: #f2f6fa; --muted: rgba(242, 246, 250, .65); --line: rgba(255, 255, 255, .14);
  --card-2: rgba(255, 255, 255, .1); --input-bg: rgba(0, 0, 0, .25); --focus: rgba(78, 168, 245, .45);
  animation: obsIn .16s ease-out;
}
@keyframes obsIn { from { opacity: 0; transform: translateY(-8px); } }
.obs-pop-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin: 0 2px 8px; font-size: 14px; }
.obs-pop-head > .mono:first-of-type { color: #8ee6b4; font-weight: 700; }
.obs-pop-where { font-size: 12px; color: var(--muted); }
.obs-pop-text { width: 100%; min-height: 84px; resize: none; font-size: 16px; background: var(--input-bg); color: #fff; border-color: var(--line); }
.obs-pop-foot { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.obs-pop-photos { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; overflow-x: auto; }
.obs-pop-photos img { width: 38px; height: 38px; object-fit: cover; border-radius: 8px; flex: none; }
.obs-pop-photos .btn svg { width: 17px; height: 17px; }
.obs-pop .btn:not(.primary) { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .14); }
@media (max-width: 820px) { .obs-pop { right: 188px; } }
@media (max-width: 600px) { .obs-pop { right: 12px; } }

/* the flight log slides up over the map; dragged by its head to half or full height */
.fly-log {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: calc(100% - 10px);
  z-index: 600;
  display: flex; flex-direction: column;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 30px rgba(0, 0, 0, .3);
  transform: translateY(102%);
  transition: transform .28s cubic-bezier(.2, .8, .2, 1);
  visibility: hidden;
  will-change: transform;
}
.fly-shell.log-open .fly-log { visibility: visible; }
.fly-log-head {
  position: relative;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 14px 10px 20px;
  border-bottom: 1px solid var(--line);
  touch-action: none;
  cursor: grab;
  user-select: none; -webkit-user-select: none;
}
.fly-log-head:active { cursor: grabbing; }
.fly-grab {
  position: absolute; top: 7px; left: 50%;
  width: 44px; height: 5px; margin-left: -22px;
  border-radius: 3px;
  background: var(--line-strong);
}
.fly-log-head h2 { margin: 0; font-size: 13px; letter-spacing: .1em; text-transform: uppercase; }
.fly-log-head .fly-round { background: var(--card-2); color: var(--text); box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; border-color: var(--line); }
.fly-log-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding: 14px; }

/* ---------- the flight log timeline ---------- */
.tl-card-wrap { padding: 14px 14px 10px; }
.tl-summary {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
  margin-bottom: 16px;
}
.tl-stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 9px 11px; border-radius: 12px;
  background: var(--card-2); border: 1px solid var(--line);
}
.tl-stat span { font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.tl-stat b { font-size: 18px; font-variant-numeric: tabular-nums; }
.tl-stat b small { font-size: 11.5px; font-weight: 600; color: var(--muted); margin-left: 4px; }
@media (max-width: 560px) { .tl-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* time | node on the line | card */
.tl { position: relative; display: flex; flex-direction: column; }
.tl-item, .tl-gap {
  position: relative;
  display: grid; grid-template-columns: 58px 40px minmax(0, 1fr);
  align-items: start;
}
/* the line through every node */
.tl-item::before, .tl-gap::before {
  content: ""; position: absolute; top: 0; bottom: 0;
  left: calc(58px + 19px); width: 2px;
  background: var(--line);
}
.tl > .tl-item:first-child::before { top: 20px; }
.tl > .tl-item:last-child::before { bottom: calc(100% - 20px); }
.tl-item.next::before { background: repeating-linear-gradient(to bottom, var(--line) 0 4px, transparent 4px 8px); }
.tl-time {
  padding-top: 11px; padding-right: 6px;
  text-align: right; font-size: 13px; font-weight: 700;
  font-variant-numeric: tabular-nums; color: var(--text);
}
.tl-node {
  position: relative; z-index: 1;
  width: 34px; height: 34px; margin: 4px 3px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--card); border: 2px solid var(--line-strong); color: var(--muted);
}
.tl-node svg { width: 17px; height: 17px; }
.tl-card {
  position: relative;
  margin: 0 0 10px 8px;
  padding: 10px 40px 10px 13px;
  border-radius: 12px;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.tl-item[role="button"] { cursor: pointer; }
.tl-item[role="button"]:active .tl-card { background: var(--card-2); }
.tl-title { font-size: 15px; font-weight: 700; line-height: 1.25; }
.tl-meta { margin-top: 3px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.tl-meta b { color: var(--text); font-weight: 650; }
.tl-dot { margin: 0 6px; opacity: .6; }
.tl-note, .tl-text { margin-top: 5px; font-size: 14px; line-height: 1.4; white-space: pre-wrap; }
.tl-text.empty { color: var(--muted); font-style: italic; }
.tl-del { position: absolute; top: 6px; right: 6px; }
.tl-tag {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px; vertical-align: 2px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  background: var(--green-soft); color: var(--green);
}
.tl-photos { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tl-photo { width: 52px; height: 52px; padding: 0; border: 0; border-radius: 8px; overflow: hidden; cursor: pointer; }
.tl-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* node colours: checkpoints green, your own checkpoints and observations blue, OPS by state */
.tl-item.cp .tl-node { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.tl-item.custom .tl-node, .tl-item.tl-obs .tl-node { background: var(--blue-soft); border-color: var(--blue); color: var(--blue); }
.tl-item.tl-obs .tl-card { border-left: 3px solid var(--blue); }
.tl-item.ops .tl-node { background: var(--card); border-color: var(--green); color: var(--green); }
.tl-item.ops.flagged .tl-node { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.tl-item.ops.flagged .tl-tag { background: var(--amber-soft); color: var(--amber); }
.tl-item.ops .tl-card { background: transparent; box-shadow: none; border-style: dashed; padding-top: 8px; padding-bottom: 8px; }
.tl-item.next { opacity: .7; }
.tl-item.next .tl-time { color: var(--blue); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; padding-top: 13px; }
.tl-item.next .tl-node { border-style: dashed; border-color: var(--blue); color: var(--blue); }
.tl-item.next .tl-card { background: transparent; box-shadow: none; border-style: dashed; border-color: var(--blue); }
.tl-item.next .tl-title { color: var(--blue); }

/* the minutes between two items, on the line */
.tl-gap { height: 24px; margin-top: -6px; margin-bottom: 4px; }
.tl-gap span {
  grid-column: 2 / 4; justify-self: start; position: relative; z-index: 1;
  margin-left: 3px; padding: 1px 8px; border-radius: 999px;
  font-size: 11px; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--bg); color: var(--muted); border: 1px solid var(--line);
}

/* an observation opened for editing */
.tl-obs-edit { padding: 0; border: 0; background: transparent; box-shadow: none; }
.tl-obs-edit .obs { margin: 0; }
.tl-collapse { margin: 8px 0 0; }


/* narrow (iPad mini upright and smaller): tighter rail, labels kept */
/* the header's position, while its card shows on the map */
.gps-chip.open { background: var(--chrome-press); box-shadow: inset 0 0 0 1px rgba(78, 168, 245, .55); }

@media (max-width: 820px) {
  .fly-rail { width: 164px; }
  .fly-top { right: 188px; }
  .fly-cp { gap: 8px; padding: 0 10px; }
  .fly-cp-label { font-size: 13px; }
  .pos-big { font-size: 20px; }
  .fly-btn { padding: 0 13px; font-size: 14px; }
}
/* short (landscape): the actions shrink to icons with short words */
@media (max-height: 640px) {
  .fly-rail { bottom: 64px; gap: 4px; }
  .fly-cp { min-height: 36px; border-radius: 11px; }
  .fly-cp-time { font-size: 11.5px; }
  .pos-note { display: none; }
}
@media (max-width: 600px) {
  .fly-actions .fly-btn[data-act="fly-log"] { font-size: 0; gap: 0; padding: 0 13px; }
  .fly-actions .fly-btn .fly-count { display: none; }
  .pos-layers button { padding: 0 9px; font-size: 12px; }
}

/* recording indicator on the Flight track card */
.rec-dot {
  display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px;
  background: rgba(216, 27, 96, .18); color: #ff6b9a; font-size: 11px; font-weight: 800; letter-spacing: .06em;
}
.rec-dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #ff3b7f; }

/* aviation data on Topo and Terrain: airports, navaids and waypoints, sectional-style */
.av-apt, .av-nav, .av-fix { position: relative; width: 0; height: 0; pointer-events: none; }
.av-apt i, .av-nav i, .av-fix i { position: absolute; left: 0; top: 0; transform: translate(-50%, -50%); display: block; }
.av-apt i { width: 12px; height: 12px; border-radius: 50%; border: 2.5px solid #1f5fbf; background: #fff; box-shadow: 0 0 0 1.5px rgba(255, 255, 255, .85); }
.av-apt.private i { width: 9px; height: 9px; border-width: 2px; border-color: #a8287d; }
.av-apt.sea i { border-style: dotted; }
.av-nav i { width: 14px; height: 14px; background: #1f5fbf; clip-path: polygon(25% 5%, 75% 5%, 100% 50%, 75% 95%, 25% 95%, 0 50%); }
.av-nav i::after { content: ""; position: absolute; inset: 3px; background: #fff; clip-path: inherit; }
.av-fix i { width: 10px; height: 9px; background: #1d2a38; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.av-fix.rpt i { background: #a8287d; }
.av-apt span, .av-nav span, .av-fix span {
  position: absolute; left: 9px; top: -7px; white-space: nowrap;
  font: 700 11px/1.2 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #14243a; text-shadow: 0 0 2px #fff, 0 0 2px #fff, 0 0 3px #fff;
}
.av-apt.private span { color: #6b1d52; font-weight: 600; }
.av-fix span { font-size: 10px; font-weight: 600; }

/* CAP grid numbers on the sectional */
.grid-label {
  transform: translate(-50%, -50%);
  white-space: nowrap;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, .82);
  color: #5b157a;
  font: 700 12px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  pointer-events: none;
}

/* ---------- install prompt ---------- */

.install-banner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 14px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--blue) 35%, var(--line));
  background: var(--blue-soft);
}
.install-banner img { flex: none; width: 52px; height: 52px; border-radius: 12px; }
.install-text { min-width: 0; }
.install-text h3 { font-size: 15.5px; font-weight: 700; margin-bottom: 3px; }
.install-text p { font-size: 13.5px; line-height: 1.45; }
.install-text .install-warn { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.install-text .btn-row { margin-top: 10px; }
.inline-icon { width: 17px; height: 17px; vertical-align: -3px; color: var(--blue); }

/* ---------- Hobbs keypad ---------- */

.keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  max-width: 380px;
  margin: 12px auto 0;
}
.key {
  min-height: 60px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-2);
  color: var(--text);
  font-size: 26px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}
.key:active { background: var(--blue-soft); transform: scale(.97); }
.key.aux { font-size: 16px; font-weight: 700; color: var(--blue); }
.input.hobbs-big {
  display: block;
  max-width: 380px;
  min-height: 68px;
  margin: 0 auto;
  font-size: 36px;
  font-weight: 700;
  text-align: center;
  letter-spacing: .03em;
}
/* one or two readings above the keypad; the highlighted one takes the keys */
.meter-entries { display: grid; grid-template-columns: 1fr; gap: 10px; max-width: 380px; margin: 0 auto; }
.meter-entries.two { grid-template-columns: 1fr 1fr; }
.meter-entry { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.meter-entry > span {
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
  color: var(--muted); text-align: center;
}
.meter-entries.two .input.hobbs-big { font-size: 26px; min-height: 60px; }
.meter-entries.two .input.hobbs-big.kp-active { border-color: var(--blue); box-shadow: 0 0 0 3px var(--focus); }

/* Hobbs and tach summary on the Sign tab: end above start, as on the CAP form */
.meter-grid {
  display: grid;
  grid-template-columns: 110px 1fr 1fr;
  gap: 8px 12px;
  align-items: center;
}
.meter-head {
  font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.meter-label { font-size: 14px; font-weight: 650; line-height: 1.2; }
.meter-label small { display: block; font-size: 10.5px; color: var(--muted); font-weight: 500; margin-top: 1px; }
.meter-value { font-size: 17px; padding: 0 12px; min-height: 44px; display: flex; align-items: center; }
.meter-value.strong { font-weight: 700; }
@media (max-width: 620px) { .meter-grid { grid-template-columns: 70px 1fr 1fr; } }

/* a carried-forward reading that the next digit will replace */
.input.fresh { background: var(--blue-soft); border-color: var(--blue); }

/* ---------- disclaimer & terms ---------- */

.terms h3 {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 18px 0 8px;
}
.terms h3:first-child { margin-top: 0; }
.terms p { font-size: 14.5px; line-height: 1.5; margin-bottom: 10px; }

/* ---------- SAR results worksheet ---------- */

.sar-grid {
  display: grid;
  grid-template-columns: minmax(120px, .7fr) 1fr 1fr;
  gap: 10px 12px;
  align-items: center;
}
.sar-head {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.sar-label { font-size: 13.5px; font-weight: 600; color: var(--text); }
.sar-rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
}
.sar-rating .sar-label { min-width: 104px; }
.sar-score-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (max-width: 620px) {
  .sar-grid { grid-template-columns: 1fr 1fr; }
  .sar-head { display: none; }
  .sar-grid .sar-label { grid-column: 1 / -1; margin-top: 6px; }
  .sar-grid [data-col]::before {
    content: attr(data-col);
    display: block;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 4px;
  }
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.setting-row:last-child { border-bottom: 0; }
.setting-label { font-size: 14px; font-weight: 600; }
.setting-label small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; margin-top: 2px; }

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(76px + env(safe-area-inset-bottom));
  transform: translate(-50%, 14px);
  z-index: 200;
  max-width: calc(100% - 28px);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 15px;
  border-radius: 9px;
  background: #1c2632;
  border: 1px solid rgba(255, 255, 255, .14);
  color: #fff;
  font-size: 13.5px;
  font-weight: 550;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .3);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
/* on Fly the bottom is the map's controls (and the Hobbs keypad): toasts drop in from the top */
html.fly-open .toast { bottom: auto; top: calc(var(--page-top, 110px) + 12px); transform: translate(-50%, -14px); }
html.fly-open .toast.show { transform: translate(-50%, 0); }
/* on Notes and the sketch pad (PencilKit sits over the page in the app) toasts drop in from the top too */
html.page-full .toast { bottom: auto; top: calc(var(--page-top, 110px) + 12px); transform: translate(-50%, -14px); }
html.page-full .toast.show { transform: translate(-50%, 0); }
.toast button {
  border: 0;
  background: none;
  color: #8ec7ff;
  font-size: 13.5px;
  font-weight: 700;
  padding: 4px 2px;
  cursor: pointer;
  white-space: nowrap;
}

/* ---------- print ---------- */

#print { display: none; }

@media print {
  html, body {
    background: #fff !important;
    color: #000 !important;
    padding: 0 !important;
    font-size: 10pt;
  }
  #app, #overlay, #toast { display: none !important; }
  #print { display: block !important; }

  @page { size: letter portrait; margin: 0.5in; }

  .print-page { break-after: page; page-break-after: always; }
  .print-page:last-child { break-after: auto; page-break-after: auto; }

  .p-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    border-bottom: 2.5pt solid #000;
    padding-bottom: 5pt;
    margin-bottom: 7pt;
  }
  .p-brand { display: flex; align-items: center; gap: 9pt; }
  .p-title { font-size: 19pt; font-weight: 800; letter-spacing: -.01em; color: #000; line-height: 1.05; }
  .p-sub { font-size: 7.5pt; letter-spacing: .13em; text-transform: uppercase; color: #555; margin-top: 2pt; }
  .p-head-right { text-align: right; font-size: 8.5pt; line-height: 1.5; }
  .p-head-right b { color: #000; }

  .p-meta {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: .6pt solid #999;
    border-radius: 2pt;
    margin-bottom: 7pt;
  }
  .p-cell { padding: 3pt 5pt; border-right: .6pt solid #c4c4c4; border-bottom: .6pt solid #c4c4c4; min-height: 25pt; }
  .p-cell:nth-child(4n) { border-right: 0; }
  .p-cell:nth-last-child(-n+4) { border-bottom: 0; }
  .p-cell .pl { font-size: 6.5pt; letter-spacing: .07em; text-transform: uppercase; color: #555; font-weight: 700; }
  .p-cell .pv { font-size: 9.4pt; font-weight: 600; margin-top: 2pt; min-height: 10pt; word-break: break-word; }
  .p-cell.wide { grid-column: span 2; }
  .p-meta.two .p-cell { border-right: .6pt solid #c4c4c4; border-bottom: .6pt solid #c4c4c4; }
  .p-meta.two .p-cell:nth-child(2n) { border-right: 0; }
  .p-meta.two .p-cell:nth-last-child(-n+2) { border-bottom: 0; }

  .p-section { margin-top: 7pt; break-inside: avoid; page-break-inside: avoid; }
  .p-section-title {
    font-size: 7pt; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
    color: #000; border-bottom: .8pt solid #000; padding-bottom: 2pt; margin-bottom: 4pt;
  }

  table.p-table { width: 100%; border-collapse: collapse; font-size: 8.2pt; }
  table.p-table th {
    background: #ebebeb; color: #000; text-align: left; font-size: 6.6pt;
    letter-spacing: .06em; text-transform: uppercase; padding: 2.4pt 4pt;
    border: .6pt solid #999; font-weight: 800;
  }
  table.p-table td { border: .6pt solid #999; padding: 2.4pt 4pt; vertical-align: top; }
  table.p-table td.c, table.p-table th.c { text-align: center; }
  table.p-crew td:nth-child(3n+1), table.p-crew th:nth-child(3n+1) { width: 7%; }
  table.p-crew td:nth-child(3n), table.p-crew th:nth-child(3n) { width: 13%; }
  table.p-table td.mono { font-family: "SF Mono", Menlo, Consolas, monospace; font-size: 8pt; }
  table.p-table tr { break-inside: avoid; page-break-inside: avoid; }
  table.p-table td.remark { white-space: pre-wrap; }

  .p-cols { display: grid; grid-template-columns: 1.15fr .85fr; gap: 10pt; }
  .p-times td { padding: 2.4pt 4pt; }
  .p-wmirs .lbl { font-weight: 700; width: 24%; vertical-align: top; }
  .p-times .lbl { font-weight: 700; width: 30%; }
  .p-times .t { width: 18%; text-align: center; font-family: "SF Mono", Menlo, Consolas, monospace; }
  .p-times .h { width: 22%; text-align: center; font-family: "SF Mono", Menlo, Consolas, monospace; }

  .p-totals { display: grid; grid-template-columns: 1fr 1fr; gap: 4pt; }
  .p-total { border: .6pt solid #999; border-radius: 2pt; padding: 3.5pt 5pt; }
  .p-total .tl { font-size: 6.4pt; text-transform: uppercase; letter-spacing: .06em; color: #555; font-weight: 700; }
  .p-total .tv { font-size: 11pt; font-weight: 700; margin-top: 1pt; }

  .p-note { font-size: 8.2pt; color: #333; margin-top: 4pt; }
  .p-empty { font-size: 8.5pt; color: #777; font-style: italic; padding: 4pt 0; }

  .p-notes-text {
    font-size: 9pt; line-height: 1.45; white-space: pre-wrap;
    border: .6pt solid #c4c4c4; border-radius: 2pt; padding: 6pt; min-height: 55pt;
  }
  .p-sketch {
    margin-top: 6pt; text-align: center; break-inside: avoid;
  }
  .p-sketch img {
    max-width: 100%; max-height: 3.1in; display: block; margin: 0 auto;
    border: .6pt solid #999; border-radius: 2pt; padding: 2pt; background: #fff;
  }

  .p-obs { border: .6pt solid #999; border-radius: 2pt; margin-bottom: 5pt; break-inside: avoid; }
  .p-obs-head {
    display: flex; gap: 12pt; background: #f2f2f2; padding: 3pt 5pt;
    font-size: 7.6pt; border-bottom: .6pt solid #c4c4c4;
  }
  .p-obs-head b { color: #000; }
  .p-obs-body { padding: 4pt 6pt; font-size: 9pt; line-height: 1.42; white-space: pre-wrap; min-height: 30pt; }
  .p-obs-photos { display: flex; flex-wrap: wrap; gap: 4pt; padding: 0 6pt 6pt; }
  .p-obs-photos img { width: 1.25in; height: .95in; object-fit: cover; border: .6pt solid #999; border-radius: 2pt; }

  .p-sign {
    margin-top: 12pt; display: grid; grid-template-columns: 1.5fr 1.15fr .75fr 1.15fr; gap: 12pt;
    break-inside: avoid;
  }
  .p-sign .sig-block { min-width: 0; }
  .p-sign .line { border-bottom: .8pt solid #333; height: 26pt; display: flex; align-items: flex-end; }
  .p-sign .line img { display: block; max-height: 26pt; max-width: 100%; }
  .p-sign .cap { font-size: 6.5pt; letter-spacing: .08em; text-transform: uppercase; color: #555; margin-top: 2pt; }
  .p-footer {
    margin-top: 14pt; border-top: .6pt solid #c4c4c4; padding-top: 3pt;
    display: flex; justify-content: space-between; font-size: 6.8pt; color: #666;
    letter-spacing: .04em;
  }
}

@media (min-width: 800px) {
  .overlay { align-items: center; }
  .sheet { border-radius: 22px; max-height: 88vh; }
}

.mission-row { display: grid; grid-template-columns: 1fr auto; column-gap: 10px; align-items: center; }
.mission-row .log-name, .mission-row .log-meta { grid-column: 1; }
.mission-row .row-chevron { grid-column: 2; grid-row: 1 / span 2; width: 18px; height: 18px; color: var(--muted); }

.active-mission-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin: 2px 0 10px; }
.active-mission-number { font-size: 24px; font-weight: 750; letter-spacing: .01em; }

/* WMIRS fields: long text boxes with WMIRS's character limit, closed missions */
.text-field + .text-field { margin-top: 12px; }
.text-field > span { display: flex; justify-content: space-between; gap: 8px; }
.char-count { font-weight: 600; letter-spacing: 0; color: var(--muted); }
.char-count.full { color: var(--red, #b3261e); }
.mission-closed {
  margin-left: 6px; padding: 1px 7px; border-radius: 999px; vertical-align: middle;
  background: var(--surface-2, rgba(127,127,127,.15)); color: var(--muted); font-size: 11px; font-weight: 700;
  letter-spacing: .02em;
}
.check-row { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 2px 0 12px; }
.check-row input { width: 22px; height: 22px; }

/* checkpoints on the flight track, with their Fly button icons */
.cp-marker { background: none; border: 0; }
.cp-pin {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: #fff; color: #d81b60; border: 2px solid #d81b60;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
}
.cp-pin.custom { color: #1d5fa8; border-color: #1d5fa8; }
.cp-pin svg { width: 16px; height: 16px; }

/* Brief › Offline maps */
.map-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.map-row-text { flex: 1; min-width: 0; }
.map-row-text .small { margin-top: 2px; }
.map-row-btns { display: flex; gap: 8px; flex-shrink: 0; }
.map-progress {
  height: 6px;
  margin-top: 6px;
  border-radius: 3px;
  background: var(--card-2);
  overflow: hidden;
}
.map-progress span { display: block; height: 100%; background: var(--blue-btn); transition: width .2s; }
.warn-text { color: var(--amber); }

/* CAPF 104 checkboxes: qualifications, equipment, attachments */
.crew-item { display: flex; flex-direction: column; gap: 6px; }
.crew-item + .crew-item { padding-top: 8px; border-top: 1px solid var(--line); }
.chip-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { position: relative; cursor: pointer; }
.chip-check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chip-check span {
  display: inline-block;
  padding: 6px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  background: var(--card);
}
.chip-check input:checked + span { background: var(--blue-btn); border-color: var(--blue-btn); color: #fff; }
.chip-check input:focus-visible + span { box-shadow: 0 0 0 3px var(--focus); }
.check-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; margin-bottom: 6px; }
