/* N82PG dashboard - mobile first, one hand, outdoors, sunlight.
   One type scale: 14 (fine print), 15 (labels, notes), 17 (body), 20 (headings), 22 (numbers), 28 (titles).
   One 16px side gutter, one card radius. Red, amber and green mean status only;
   the category colors (trip, fuel, time, schedule, logbook, maintenance) tell things apart. */

:root {
  --ink: #101418;
  --paper: #f7f8fa;
  --card: #ffffff;
  --line: #d8dde3;
  --line-soft: #e8ebef;
  --muted: #5c6670;
  --navy: #12314f;
  --navy-bg: #e8edf3;
  --red: #c0181f;
  --red-bg: #fdecec;
  --amber: #9a6a00;      /* bars, borders, icons */
  --amber-ink: #805a00;  /* amber text */
  --amber-bg: #fdf3d7;
  --green: #1b6e34;
  --green-bg: #e6f4ea;
  --stale: #8a939c;      /* graphics only, too light for text */

  --cat-trip: #1a5fb4;  --cat-trip-bg: #e8f0fa;
  --cat-fuel: #0a6b80;  --cat-fuel-bg: #e4f2f5;
  --cat-time: #4338ca;  --cat-time-bg: #eceafb;
  --cat-sched: #1a5fb4; --cat-sched-bg: #e8f0fa;
  --cat-book: #952a8a;  --cat-book-bg: #f6e9f4;
  --cat-maint: #4f5966; --cat-maint-bg: #edeff2;

  --gutter: 16px;
  --r-card: 14px;
  --r-control: 12px;

  /* Line icons: --i-* are masks (take the text color), --w-* are white on a colored square */
  --i-plane: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17.8 19.2 16 11l3.5-3.5C21 6 21.5 4 21 3c-1-.5-3 0-4.5 1.5L13 8 4.8 6.2c-.5-.1-.9.1-1.1.5l-.3.5c-.2.5-.1 1 .3 1.3L9 12l-2 3H4l-1 1 3 2 2 3 1-1v-3l3-2 3.5 5.3c.3.4.8.5 1.3.3l.5-.2c.4-.3.6-.7.5-1.2z'/%3E%3C/svg%3E");
  --i-alert: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z'/%3E%3Cpath d='M12 9v4'/%3E%3Cpath d='M12 17h.01'/%3E%3C/svg%3E");
  --i-pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3a2.85 2.85 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5z'/%3E%3Cpath d='M15 5l4 4'/%3E%3C/svg%3E");
  --i-map: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6l6-3 6 3 6-3v15l-6 3-6-3-6 3z'/%3E%3Cpath d='M9 3v15'/%3E%3Cpath d='M15 6v15'/%3E%3C/svg%3E");
  --i-book: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20'/%3E%3C/svg%3E");
  --i-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3Cpath d='M12 7v5l4 2'/%3E%3C/svg%3E");
  --i-fuel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 22h12'/%3E%3Cpath d='M4 9h10'/%3E%3Cpath d='M14 22V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v18'/%3E%3Cpath d='M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 4 0V9.8a2 2 0 0 0-.6-1.4L18 5'/%3E%3C/svg%3E");
  --i-pin: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 10c0 6-8 12-8 12s-8-6-8-12a8 8 0 0 1 16 0z'/%3E%3Cpath d='M12 7a3 3 0 1 0 0 6a3 3 0 1 0 0-6z'/%3E%3C/svg%3E");
  --i-gauge: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 14l4-4'/%3E%3Cpath d='M3.34 19a10 10 0 1 1 17.32 0'/%3E%3C/svg%3E");
  --i-wrench: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94z'/%3E%3C/svg%3E");
  --i-calendar: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 4h14a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z'/%3E%3Cpath d='M16 2v4'/%3E%3Cpath d='M8 2v4'/%3E%3Cpath d='M3 10h18'/%3E%3C/svg%3E");
  --i-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Cpath d='M12 3a4 4 0 1 0 0 8a4 4 0 1 0 0-8z'/%3E%3C/svg%3E");
  --i-chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 6l6 6-6 6'/%3E%3C/svg%3E");
  --i-back: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M15 6l-6 6 6 6'/%3E%3C/svg%3E");
  --w-pencil: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M17 3a2.85 2.85 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5z'/%3E%3Cpath d='M15 5l4 4'/%3E%3C/svg%3E");
  --w-map: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 6l6-3 6 3 6-3v15l-6 3-6-3-6 3z'/%3E%3Cpath d='M9 3v15'/%3E%3Cpath d='M15 6v15'/%3E%3C/svg%3E");
  --w-book: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H20v20H6.5a2.5 2.5 0 0 1 0-5H20'/%3E%3C/svg%3E");
  --w-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8'/%3E%3Cpath d='M3 3v5h5'/%3E%3Cpath d='M12 7v5l4 2'/%3E%3C/svg%3E");
  --w-fuel: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 22h12'/%3E%3Cpath d='M4 9h10'/%3E%3Cpath d='M14 22V4a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v18'/%3E%3Cpath d='M14 13h2a2 2 0 0 1 2 2v2a2 2 0 0 0 4 0V9.8a2 2 0 0 0-.6-1.4L18 5'/%3E%3C/svg%3E");
  --g-chevdown: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235c6670' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom);
}
button, input, select, textarea { font: inherit; color: inherit; }
select {
  -webkit-appearance: none; appearance: none;
  background-image: var(--g-chevdown); background-repeat: no-repeat;
  background-position: right 12px center; background-size: 16px 16px;
}

header, main, footer {
  max-width: 720px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
header {
  padding-top: calc(12px + env(safe-area-inset-top));
  padding-bottom: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 10px;
}
header h1 { margin: 0; font-size: 28px; line-height: 34px; font-weight: 700; }
.subtitle { color: var(--muted); font-size: 15px; line-height: 20px; }
main { padding-bottom: 32px; }
footer { padding-top: 8px; padding-bottom: 32px; }

.back-link {
  display: inline-flex; align-items: center; gap: 2px;
  min-height: 44px; margin-left: -10px; padding: 0 10px 0 2px;
  font-size: 17px; font-weight: 600; color: var(--navy); text-decoration: none;
}
.back-link::before {
  content: ""; width: 24px; height: 24px; background: currentColor;
  -webkit-mask: var(--i-back) center / contain no-repeat; mask: var(--i-back) center / contain no-repeat;
}

.loading { padding: 40px 16px; text-align: center; color: var(--muted); }
.hidden { display: none !important; }

h2 { font-size: 20px; line-height: 26px; font-weight: 700; color: var(--ink); margin: 28px 0 10px; }

/* Grounding banner: the one loud element, and the only solid status fill */
#grounding-banner {
  background: var(--red);
  color: #fff;
  font-size: 20px;
  line-height: 26px;
  font-weight: 700;
  padding: calc(14px + env(safe-area-inset-top)) max(16px, calc((100% - 688px) / 2)) 14px;
}
#grounding-banner .sub { font-weight: 400; font-size: 15px; line-height: 20px; margin-top: 4px; }
#grounding-banner ~ header { padding-top: 12px; }

/* Status tiles (Apple Health: category icon and name in color, big value, note pinned to the bottom) */
.tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: row dense;
  gap: 12px;
  margin: 8px 0 12px;
}
.tile {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 14px 16px 16px;
}
.tile.wide { grid-column: 1 / -1; }
@media (max-width: 559px) {
  #tile-fuel, #tile-due { grid-column: 1 / -1; }
}
@media (max-width: 359px) {
  #status-tiles, #totals { grid-template-columns: minmax(0, 1fr); }
}
.tile-label {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 4px;
  font-size: 15px; line-height: 20px; font-weight: 600;
  color: var(--cat, var(--muted));
}
.tile-value {
  font-size: 22px; line-height: 28px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere; text-wrap: balance;
}
.tile-note { margin-top: auto; padding-top: 4px; font-size: 15px; line-height: 20px; color: var(--muted); }

#status-tiles .tile-label::before {
  content: ""; flex: none; width: 18px; height: 18px; background: currentColor;
  -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat;
}
#tile-location { --cat: var(--navy); --glyph: var(--i-pin); }
#tile-fuel { --cat: var(--cat-fuel); --glyph: var(--i-fuel); }
#tile-hours { --cat: var(--cat-time); --glyph: var(--i-gauge); }
#tile-due { --cat: var(--cat-maint); --glyph: var(--i-wrench); }
#tile-next-flight { --cat: var(--cat-sched); --glyph: var(--i-calendar); }
#totals .tile { --cat: var(--cat-time); }
#totals .tile.wide { --cat: var(--cat-sched); }

.tile.status-red { background: var(--red-bg); border-color: var(--red-bg); box-shadow: inset 4px 0 0 var(--red); }
.tile.status-amber { background: var(--amber-bg); border-color: var(--amber-bg); box-shadow: inset 4px 0 0 var(--amber); }
.tile.status-red .tile-label, .tile.status-red .tile-note { color: var(--red); }
.tile.status-amber .tile-label, .tile.status-amber .tile-note { color: var(--amber-ink); }
.tile.status-stale { border-style: dashed; border-color: #b9c1c9; }
.tile.status-stale .tile-value { color: var(--muted); font-weight: 600; }
#fuel-value { display: flex; flex-wrap: wrap; align-items: center; column-gap: 8px; row-gap: 4px; }
.badge-unverified {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--muted);
  color: #fff;
  font-size: 14px; line-height: 18px; font-weight: 600; font-style: normal;
  white-space: nowrap;
}
.badge-unverified::first-letter { text-transform: uppercase; }

.warn-box {
  background: var(--amber-bg);
  box-shadow: inset 4px 0 0 var(--amber);
  color: var(--amber-ink);
  font-size: 15px; line-height: 21px; font-weight: 600;
  border-radius: var(--r-card);
  padding: 12px 16px;
  margin: 0 0 12px;
}

/* Trip estimator: the most-used tool, first thing under the title */
.hero-tile {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: center;
  min-height: 92px;
  margin: 8px 0 4px;
  padding: 16px;
  border-radius: var(--r-card);
  background: var(--cat-trip);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(26, 95, 180, 0.25);
}
.hero-tile:active { opacity: 0.85; }
.hero-tile::before {
  content: ""; grid-column: 1; grid-row: 1 / 3;
  width: 48px; height: 48px; border-radius: var(--r-control);
  background: var(--w-map) center / 26px 26px no-repeat, rgba(255, 255, 255, 0.18);
}
.hero-tile::after {
  content: ""; grid-column: 3; grid-row: 1 / 3;
  width: 22px; height: 22px; background: #fff;
  -webkit-mask: var(--i-chev) center / contain no-repeat; mask: var(--i-chev) center / contain no-repeat;
}
.hero-title { grid-column: 2; grid-row: 1; align-self: end; font-size: 22px; line-height: 28px; font-weight: 700; }
.hero-sub { grid-column: 2; grid-row: 2; align-self: start; font-size: 15px; line-height: 20px; color: #dde7f4; }

/* Home actions: two big action tiles, then a grouped list like iPhone Settings */
#entry-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 8px;
}
.action-tile {
  position: relative;
  display: flex; flex-direction: column; justify-content: space-between; gap: 12px;
  min-height: 96px;
  padding: 14px 16px;
  border-radius: var(--r-card);
  font-size: 17px; line-height: 22px; font-weight: 700;
  text-decoration: none;
}
.action-tile::before {
  content: ""; flex: none; width: 26px; height: 26px; background: currentColor;
  -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat;
}
.action-tile:active { opacity: 0.85; }
#btn-postflight { background: var(--navy); color: #fff; border: 1px solid var(--navy); --glyph: var(--i-plane); }
#btn-squawk { background: var(--card); color: var(--navy); border: 1px solid var(--line); --glyph: var(--i-alert); }
.btn-count {
  position: absolute; top: 14px; right: 12px;
  min-width: 28px; padding: 3px 9px; border-radius: 999px; text-align: center;
  background: var(--amber-bg); color: var(--amber-ink);
  font-size: 14px; line-height: 18px; font-weight: 700; white-space: nowrap;
}

.tool-list {
  grid-column: 1 / -1;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
.tool-row {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 54px; margin: 0;
  padding: 10px 14px 10px 12px;
  border: 0; border-radius: 0;
  background: none; color: var(--ink);
  font-size: 17px; line-height: 22px; font-weight: 400;
  text-align: left; text-decoration: none; cursor: pointer;
}
.tool-row:not(:last-child) {
  background-image: linear-gradient(var(--line-soft), var(--line-soft));
  background-size: calc(100% - 54px) 1px;
  background-position: right bottom;
  background-repeat: no-repeat;
}
.tool-row:active { background-color: #eef1f4; }
.tool-row::before {
  content: ""; flex: none; width: 30px; height: 30px; border-radius: 8px;
  background: var(--wglyph) center / 18px 18px no-repeat, var(--cat);
}
.tool-row::after {
  content: ""; flex: none; width: 18px; height: 18px; margin-left: auto; background: var(--stale);
  -webkit-mask: var(--i-chev) center / contain no-repeat; mask: var(--i-chev) center / contain no-repeat;
}
.tool-row .row-value { margin-left: auto; color: var(--muted); font-size: 15px; white-space: nowrap; }
.tool-row:has(.row-value)::after { margin-left: 4px; }
#btn-fix { --cat: var(--navy); --wglyph: var(--w-pencil); }
.tool-row[href="/estimate.html"] { --cat: var(--cat-trip); --wglyph: var(--w-map); }
.tool-row[href="/records.html"] { --cat: var(--cat-book); --wglyph: var(--w-book); }
.tool-row[href="/history.html"] { --cat: var(--cat-time); --wglyph: var(--w-clock); }
#btn-fuel-update { --cat: var(--cat-fuel); --wglyph: var(--w-fuel); }

/* Home section headings carry their category icon */
#squawks-section { --cat: var(--navy); --glyph: var(--i-alert); }
#schedule-section { --cat: var(--cat-sched); --glyph: var(--i-calendar); }
#maintenance-section { --cat: var(--cat-maint); --glyph: var(--i-wrench); }
#squawks-section > h2, #schedule-section > h2, #maintenance-section > h2,
.section-label[class*="sec-"] { display: flex; align-items: center; gap: 8px; }
#squawks-section > h2::before, #schedule-section > h2::before, #maintenance-section > h2::before,
.section-label[class*="sec-"]::before {
  content: ""; flex: none; width: 20px; height: 20px; background: var(--cat);
  -webkit-mask: var(--glyph) center / contain no-repeat; mask: var(--glyph) center / contain no-repeat;
}

/* Big buttons */
.big-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; min-height: 52px;
  padding: 12px 14px;
  border: 2px solid var(--navy);
  border-radius: var(--r-control);
  background: var(--navy);
  color: #fff;
  font-size: 17px; line-height: 22px; font-weight: 600;
  text-align: center; text-decoration: none; text-wrap: balance;
  cursor: pointer;
}
.big-btn.secondary { background: var(--card); color: var(--navy); }
.big-btn:active { opacity: 0.8; }
.big-btn:disabled { opacity: 0.6; }

/* Lists */
.row {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  padding: 12px 16px;
  margin-bottom: 8px;
}
.row .primary { font-weight: 600; }
.row .secondary { font-size: 15px; line-height: 20px; color: var(--muted); margin-top: 2px; }
.row.sev-grounding { box-shadow: inset 4px 0 0 var(--red); }
.row.sev-monitor { box-shadow: inset 4px 0 0 var(--amber); }
/* Rows with a status chip: title leads, chip on the right */
.row:has(> .chip) { display: flow-root; }
.row > .chip { float: right; margin: 1px 0 0 10px; }
#squawks-list .primary { font-weight: 400; }

/* Schedule and maintenance: one grouped card each */
#maintenance-list, #schedule-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  overflow: hidden;
}
#maintenance-list:empty, #schedule-list:empty { display: none; }
#maintenance-list > .row, #schedule-list > .row { margin: 0; border: 0; border-radius: 0; }
#maintenance-list > .row + .row, #schedule-list > .row + .row { border-top: 1px solid var(--line-soft); }
#maintenance-list > .empty, #schedule-list > .empty { padding: 12px 16px; }

.chip {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 14px; line-height: 18px; font-weight: 600;
  white-space: nowrap;
  vertical-align: 1px;
  margin-right: 8px;
}
.chip::first-letter { text-transform: uppercase; }
.chip.red { background: var(--red-bg); color: var(--red); }
.chip.amber { background: var(--amber-bg); color: var(--amber-ink); }
.chip.green { background: var(--green-bg); color: var(--green); }
.chip.gray { background: #eceff2; color: var(--muted); }

.empty { color: var(--muted); font-size: 15px; line-height: 21px; padding: 8px 0; margin: 0; }

/* Fuel update dialog */
#fuel-dialog {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(16, 20, 24, 0.55);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.dialog-card {
  background: var(--card); border-radius: var(--r-card); padding: 20px;
  width: 100%; max-width: 420px;
}
.dialog-card label {
  display: block; margin-bottom: 6px;
  font-size: 15px; line-height: 20px; font-weight: 600; color: var(--muted);
}
.dialog-card input, .dialog-card select {
  width: 100%; min-height: 48px; font-size: 17px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: var(--r-control);
  background-color: var(--paper); color: var(--ink);
}

/* Resolve button on a squawk row */
.btn-resolve {
  min-height: 44px; margin-top: 8px; padding: 10px 16px;
  font-size: 15px; line-height: 20px; font-weight: 600;
  background: var(--card); color: var(--navy);
  border: 2px solid var(--navy); border-radius: var(--r-control);
  cursor: pointer;
}
.btn-resolve:disabled { opacity: 0.5; }

.error-card {
  background: var(--red-bg);
  box-shadow: inset 4px 0 0 var(--red);
  border-radius: var(--r-card);
  padding: 12px 16px;
  color: var(--red);
  margin-top: 12px;
}

.disclaimer { font-size: 14px; line-height: 20px; color: var(--muted); margin: 8px 0 0; }

/* ---------- Forms (trip estimator, flight log) ---------- */
.field { position: relative; min-width: 0; margin-bottom: 16px; }
.field label { display: block; margin-bottom: 6px; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--muted); }
.field input:not([type="checkbox"]):not([type="range"]), .field select, .field textarea {
  display: block;
  width: 100%; min-width: 0; max-width: 100%; min-height: 48px;
  padding: 12px 14px;
  font-size: 17px; line-height: 22px;
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  background-color: var(--card);
  color: var(--ink);
}
.field select { padding-right: 36px; }
.field textarea { min-height: 88px; resize: vertical; }
.field input[type="date"], .field input[type="time"] { -webkit-appearance: none; appearance: none; }
.field input::-webkit-date-and-time-value { text-align: left; }
.field input:disabled { background-color: var(--paper); color: var(--muted); -webkit-text-fill-color: var(--muted); opacity: 1; }
input::placeholder, textarea::placeholder { color: #6b747d; }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 12px; }
/* Paired fields: inputs line up even when only one label wraps */
@supports (grid-template-rows: subgrid) {
  .field-row { grid-template-rows: repeat(4, auto); }
  .field-row > .field { display: grid; grid-row: span 4; grid-template-rows: subgrid; row-gap: 0; align-content: start; }
  .field-row > .field > label { align-self: end; }
  .field-row > .field > .suggest { grid-row: 2; }
}
.airport-name, .hint, .fuel-note, .field-note { font-size: 15px; line-height: 20px; color: var(--muted); margin-top: 4px; }
.airport-name:empty, .fbo-row:empty { display: none; }
.field-note { margin: -8px 0 16px; }

/* iPhone-style switches (navy when on: green means status here) */
.toggle { display: flex; align-items: center; gap: 12px; min-height: 48px; margin-bottom: 8px; font-size: 17px; }
.toggle label { order: -1; flex: 1; padding: 10px 0; }
.toggle input {
  -webkit-appearance: none; appearance: none;
  flex: none; position: relative;
  width: 51px; height: 31px; margin: 0;
  border-radius: 999px; background: var(--stale);
  transition: background 0.2s; cursor: pointer;
}
.toggle input::before {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  transition: transform 0.2s;
}
.toggle input:checked { background: var(--navy); }
.toggle input:checked::before { transform: translateX(20px); }

/* Tap-to-pick chips (FBOs, FlightAware legs, map stop tabs): one look, navy when chosen */
.fbo-chip, .leg-chip, .rm-tab {
  display: inline-flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 1px;
  min-height: 44px; max-width: 100%;
  padding: 8px 14px;
  border: 1px solid var(--line); border-radius: var(--r-control);
  background: var(--card); color: var(--ink);
  font-size: 15px; line-height: 20px; font-weight: 600;
  text-align: left; cursor: pointer;
}
.fbo-chip .sub, .leg-chip .sub { font-size: 14px; line-height: 18px; font-weight: 400; color: var(--muted); }
.fbo-chip.chosen, .leg-chip.chosen, .rm-tab.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.fbo-chip.chosen .sub, .leg-chip.chosen .sub { color: #cdd6e0; }

/* ---------- Trip estimator ---------- */
.est-banner {
  background: var(--navy-bg); color: var(--navy);
  border-radius: var(--r-card); padding: 12px 16px; margin: 8px 0 16px;
  font-size: 15px; line-height: 21px; font-weight: 600;
}
.result-card .est-banner { background: var(--amber-bg); color: var(--amber-ink); box-shadow: inset 4px 0 0 var(--amber); margin: 12px -16px 0; border-radius: 0; }
@media (max-width: 559px) {
  .est-banner + .field-row { grid-template-columns: minmax(0, 1fr); }
}
.fbo-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fbo-label { width: 100%; font-size: 14px; line-height: 18px; font-weight: 600; color: var(--muted); }
.suggest {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 30; margin-top: 4px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-control);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12); max-height: 300px; overflow-y: auto;
}
.suggest-item { padding: 12px 14px; border-bottom: 1px solid var(--line-soft); cursor: pointer; }
.suggest-item:last-child { border-bottom: none; }
.suggest-item .si-code { font-weight: 700; color: var(--navy); }
.suggest-item .si-meta { font-size: 14px; line-height: 19px; color: var(--muted); }
.suggest-item:active { background: var(--paper); }
.suggest-head { padding: 8px 14px; font-size: 14px; line-height: 19px; color: var(--muted); background: var(--paper); }

/* Results: label over value on a phone (banking-app detail rows), Total as the hero band */
.result-card {
  container-type: inline-size;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 0 16px 16px; margin-top: 16px;
}
.result-line { padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.result-line .k { display: block; font-size: 15px; line-height: 20px; color: var(--muted); }
.result-line .v { display: block; margin-top: 2px; font-size: 17px; line-height: 24px; font-weight: 600; font-variant-numeric: tabular-nums; }
.result-line.route { order: -2; padding: 16px 0 12px; }
.result-line.route .k { font-size: 17px; line-height: 22px; font-weight: 600; color: var(--ink); }
.result-line.route .v { font-size: 22px; line-height: 28px; font-weight: 700; }
.result-line.total {
  order: -1; margin: 0 -16px 4px; padding: 12px 16px; border-bottom: 0;
  background: var(--navy-bg); box-shadow: inset 4px 0 0 var(--navy);
}
.result-line.total .k { color: var(--navy); font-weight: 600; }
.result-line.total .v { font-size: 22px; line-height: 28px; font-weight: 700; color: var(--navy); }
@container (min-width: 520px) {
  .result-line { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, auto); column-gap: 16px; align-items: baseline; }
  .result-line .v { margin: 0; text-align: right; }
}
.stop-note {
  margin: 12px -16px 0; padding: 12px 16px;
  background: var(--cat-fuel-bg); box-shadow: inset 4px 0 0 var(--cat-fuel);
  font-size: 15px; line-height: 21px;
}
.result-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.result-actions > :last-child { grid-column: 1 / -1; }
.result-actions .big-btn { padding: 10px 8px; }
details { margin-top: 12px; }
summary { display: flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; color: var(--navy); cursor: pointer; list-style: none; }
summary::-webkit-details-marker { display: none; }
summary::before {
  content: ""; flex: none; width: 20px; height: 20px; background: currentColor; transition: transform 0.2s;
  -webkit-mask: var(--i-chev) center / contain no-repeat; mask: var(--i-chev) center / contain no-repeat;
}
details[open] > summary::before { transform: rotate(90deg); }
.assump { font-size: 15px; line-height: 24px; color: var(--muted); }

/* Route map */
:root { --rm-caa: #004281; --rm-posted: #0a6b80; --rm-water: #e9eff3; --rm-land: #fbfcfb; --rm-border: #c3ccd4; --rm-ring: #2f6f8f; --rm-zone: rgba(47, 111, 143, 0.14); }
.rm-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 16px; margin-top: 16px; overflow: hidden; }
.rm-title { margin-bottom: 10px; font-size: 17px; line-height: 22px; font-weight: 700; color: var(--ink); }
.rm-title span { font-size: 15px; font-weight: 400; color: var(--muted); }
.rm-close-title { margin-top: 20px; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--muted); }
#rm-route, #rm-close { display: block; width: 100%; height: auto; border-radius: 8px; touch-action: manipulation; }
.rm-water { fill: var(--rm-water); }
.rm-state { fill: var(--rm-land); stroke: var(--rm-border); stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.rm-zone { fill: var(--rm-zone); }
.rm-ring { fill: none; stroke: var(--rm-ring); stroke-width: 1.3; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.rm-gc { fill: none; stroke: var(--navy); stroke-width: 1.2; stroke-dasharray: 2 4; opacity: 0.6; vector-effect: non-scaling-stroke; }
.rm-leg { fill: none; stroke: var(--navy); stroke-width: 2.6; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.rm-leg.over { stroke: var(--red); }
.rm-end { fill: #fff; stroke: var(--navy); stroke-width: 3.5; vector-effect: non-scaling-stroke; }
.rm-stop { stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.rm-stop.sel { stroke: var(--ink); stroke-width: 2.5; }
.rm-hit { fill: transparent; cursor: pointer; }
.rm-hit:focus-visible { outline: none; stroke: var(--navy); stroke-width: 2; vector-effect: non-scaling-stroke; }
.rm-lbl { font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--rm-land); stroke-linejoin: round; pointer-events: none; }
.rm-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; font-size: 14px; line-height: 18px; color: var(--muted); }
.rm-legend span { display: inline-flex; align-items: center; gap: 6px; }
.rm-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.rm-swatch { width: 16px; height: 10px; border-radius: 2px; background: var(--rm-zone); border: 1px dashed var(--rm-ring); display: inline-block; }
.rm-wind { margin-top: 16px; }
.rm-wind label { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--muted); }
.rm-wind output { color: var(--ink); }
.rm-wind input { display: block; width: 100%; height: 44px; margin: 0; accent-color: var(--navy); }
.rm-hint { font-size: 14px; line-height: 19px; color: var(--muted); }
.rm-verdict { margin: 16px -16px 0; padding: 12px 16px; background: var(--paper); box-shadow: inset 4px 0 0 var(--amber); font-size: 15px; line-height: 21px; }
.rm-verdict.ok { box-shadow: inset 4px 0 0 var(--green); }
.rm-verdict.no { box-shadow: inset 4px 0 0 var(--red); }
.rm-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.rm-picked { margin: 12px -16px 0; padding: 12px 16px; background: var(--paper); }
.rm-picked h4 { margin: 0; font-size: 20px; line-height: 26px; }
.rm-sub { color: var(--muted); font-size: 15px; line-height: 20px; }
.rm-kv { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; margin-top: 8px; font-size: 15px; line-height: 20px; }
.rm-kv .k { color: var(--muted); min-width: 0; }
.rm-kv .v { font-weight: 700; text-align: right; text-wrap: balance; font-variant-numeric: tabular-nums; }
.rm-kv .v small { font-size: 14px; font-weight: 400; color: var(--muted); }
.rm-kv .good { color: var(--green); } .rm-kv .thin { color: var(--amber-ink); } .rm-kv .bad { color: var(--red); }
.rm-phone { user-select: all; white-space: nowrap; color: var(--ink); }
.rm-caa { display: inline-block; padding: 0 6px; border-radius: 6px; background: var(--rm-caa); color: #fff; font-size: 14px; line-height: 18px; font-weight: 700; letter-spacing: 0.02em; vertical-align: 1px; }
.rm-list-title { margin-top: 20px; font-size: 17px; line-height: 22px; font-weight: 700; }
.rm-list { display: flex; flex-direction: column; margin: 8px -16px 0; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.rm-row {
  display: grid; grid-template-columns: 3.4em minmax(0, 1fr) auto; gap: 2px 8px; align-items: start;
  width: 100%; padding: 12px 16px;
  text-align: left; font: inherit; color: inherit;
  background: var(--card); border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0;
  cursor: pointer;
}
.rm-row:last-child { border-bottom: 0; }
.rm-row.sel { background: var(--navy-bg); box-shadow: inset 4px 0 0 var(--navy); }
.rm-row .id { font-weight: 700; }
.rm-row .nm { min-width: 0; display: flex; flex-direction: column; }
.rm-row .n1 { font-weight: 600; }
.rm-row .n2 { color: var(--muted); font-size: 15px; line-height: 20px; }
.rm-row .pr { font-weight: 700; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rm-row .pr small { display: block; font-weight: 400; color: var(--muted); font-size: 14px; line-height: 18px; }
.rm-pill { display: inline-block; padding: 1px 7px; border-radius: 999px; background: var(--paper); font-size: 14px; line-height: 18px; font-weight: 600; white-space: nowrap; vertical-align: 1px; }
.rm-pill.good { background: var(--green-bg); color: var(--green); }
.rm-pill.thin { background: var(--amber-bg); color: var(--amber-ink); }
.rm-pill.bad { background: var(--red-bg); color: var(--red); }
.rm-pill.best { background: var(--card); color: var(--navy); box-shadow: inset 0 0 0 1.5px var(--navy); }

/* ---------- Flight log ---------- */
.section-label { font-size: 20px; line-height: 26px; font-weight: 700; color: var(--ink); margin: 28px 0 12px; }
.section-label.sec-legs { --cat: var(--navy); --glyph: var(--i-plane); }
.section-label.sec-aircraft { --cat: var(--cat-time); --glyph: var(--i-gauge); }
.section-label.sec-fuel { --cat: var(--cat-fuel); --glyph: var(--i-fuel); }
.section-label.sec-people { --cat: var(--cat-sched); --glyph: var(--i-user); }
.section-label.sec-squawks { --cat: var(--navy); --glyph: var(--i-alert); }
.prefill-note {
  background: var(--navy-bg); color: var(--navy);
  border-radius: var(--r-card); padding: 12px 16px; margin-bottom: 16px;
  font-size: 15px; line-height: 21px; font-weight: 600;
}
#done-card { text-align: center; padding: 40px 0; }
#done-card .big { font-size: 28px; line-height: 34px; font-weight: 700; margin-bottom: 8px; }
.leg-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.leg-chip { font-size: 17px; line-height: 22px; }
.leg-chip > span:first-child { white-space: pre-wrap; }
#fa-leg-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
#fa-leg-list .leg-chip { width: 100%; min-height: 56px; }
#fa-legs { margin-bottom: 20px; }
/* Squawk question: a two-part switch like the segmented controls in Apple Health */
#squawk-answer {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px;
  padding: 2px; border-radius: var(--r-control); background: #e3e7ec;
}
#squawk-answer .leg-chip {
  align-items: center; min-height: 44px; border: 0; border-radius: 10px;
  background: transparent; color: var(--ink); font-weight: 600;
}
#squawk-answer .leg-chip.chosen { background: var(--navy); color: #fff; box-shadow: 0 1px 3px rgba(16, 20, 24, 0.25); }
.fix-entry { display: flex; width: 100%; min-height: 56px; margin-bottom: 8px; }
.fix-entry .gaps { display: block; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--amber-ink); }

/* ---------- Flight history ---------- */
.month { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 10px; margin: 28px 0 8px; }
.month h2 { margin: 0; white-space: nowrap; }
.month .sum { font-size: 15px; color: var(--muted); white-space: nowrap; }
/* One grouped card per month, like Apple Wallet transactions */
#flight-list > .row { margin: 0; border-radius: 0; border-top-width: 0; border-bottom-color: var(--line-soft); }
#flight-list > .month + .row { border-top-width: 1px; border-top-left-radius: var(--r-card); border-top-right-radius: var(--r-card); }
#flight-list > .row:has(+ .month), #flight-list > .row:last-child {
  border-bottom-color: var(--line); border-bottom-left-radius: var(--r-card); border-bottom-right-radius: var(--r-card);
}
.row .top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
#flight-list .row .primary { padding-left: 4.15em; text-indent: -4.15em; }
#flight-list .row .primary .date { text-indent: 0; }
.row .date { display: inline-block; width: 3.9em; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.row .air { font-weight: 700; color: var(--cat-time); font-variant-numeric: tabular-nums; }
.unsure {
  margin-top: 8px; padding: 8px 12px;
  background: var(--paper); box-shadow: inset 3px 0 0 var(--amber); border-radius: 8px;
  color: var(--muted); font-size: 15px; line-height: 20px;
}

/* ---------- Logbook search ---------- */
.search-box { display: contents; }
#q {
  position: sticky; top: 8px; z-index: 5;
  display: block; width: 100%; min-height: 50px; margin-top: 8px;
  padding: 12px 14px;
  font-size: 17px;
  border: 2px solid var(--navy); border-radius: var(--r-control);
  background: var(--card); color: var(--ink);
  box-shadow: 0 0 0 8px var(--paper);
  -webkit-appearance: none; appearance: none;
}
.filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.years { display: contents; }
.filters #sort { grid-column: 1 / -1; }
.filters { margin: 12px 0 4px; }
.filters select, .filters input {
  width: 100%; min-width: 0; min-height: 44px;
  padding: 10px 12px; font-size: 16px;
  border: 1px solid var(--line); border-radius: var(--r-control);
  background-color: var(--card); color: var(--ink);
}
.filters select { padding-right: 34px; }
.note { font-size: 15px; line-height: 20px; color: var(--muted); margin: 8px 0 4px; }
.count { font-size: 15px; font-weight: 600; color: var(--cat-book); margin: 12px 0 8px; }
.hit { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: 12px 16px; margin-bottom: 8px; }
.hit .top { display: block; }
.hit .date { font-size: 20px; line-height: 26px; font-weight: 700; }
.hit > .date { font-weight: 600; line-height: 1.35; }
.hit .hours { display: block; margin-top: 2px; font-size: 15px; font-weight: 600; color: var(--navy); font-variant-numeric: tabular-nums; }
.hit .hours:empty { display: none; }
.hit .shop { font-size: 15px; line-height: 20px; color: var(--muted); margin-top: 2px; }
.hit ul { list-style: none; margin: 8px 0 4px; padding: 0; }
.hit li { padding: 6px 0; }
.hit li + li { border-top: 1px solid var(--line-soft); }
.hit li.dim { color: var(--muted); font-size: 15px; }
.parts { font-size: 14px; line-height: 20px; font-family: ui-monospace, Menlo, monospace; color: #253545; margin: 2px 0 0; }
.src {
  display: flex; align-items: center; gap: 12px;
  margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft);
  font-size: 15px; line-height: 20px; color: var(--muted);
}
.src span { flex: 1 1 auto; min-width: 0; }
.src a {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  font-size: 16px; font-weight: 700; color: var(--navy); text-decoration: none; white-space: nowrap;
  border: 2px solid var(--navy); border-radius: var(--r-control);
}
mark { background: #ffe58a; color: inherit; padding: 0 1px; border-radius: 2px; }
.snippet { font-size: 15px; line-height: 21px; margin-top: 6px; color: #253545; }
.more { margin: 8px 0 16px; }
.tips { font-size: 15px; padding-left: 20px; }
.tips li { margin-bottom: 4px; }

/* ---------- PIN login (iPhone passcode screen) ---------- */
.pin-wrap {
  display: flex; flex-direction: column; justify-content: center;
  max-width: 340px; min-height: 100vh; min-height: calc(100svh - env(safe-area-inset-bottom));
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 16px 32px;
  text-align: center;
}
.pin-title { font-size: 28px; line-height: 34px; font-weight: 700; margin: 0 0 4px; }
.pin-sub { color: var(--muted); margin-bottom: 22px; }
.dots { display: flex; justify-content: center; gap: 16px; margin-bottom: 14px; }
.dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--navy); }
.dot.on { background: var(--navy); }
.msg { min-height: 24px; color: var(--red); font-weight: 600; margin-bottom: 10px; }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.pad button {
  min-height: 64px; padding: 0;
  font-size: 28px; line-height: 1; font-weight: 600;
  border-radius: var(--r-card); border: 1.5px solid #c3ccd5;
  background: var(--card); color: var(--ink);
  touch-action: manipulation; cursor: pointer;
}
.pad button:active { background: #e8edf2; }
.pad .ghost { border-color: transparent; background: transparent; font-size: 17px; color: var(--navy); }
