/* V2 — editorial design (after the Hallstätter Gletscher site): black grotesk type on white, data as typography,
   thin rules, arrows in their own column. Two colours only; dark mode swaps them. V1's stylesheet is v1/styles.css. */
:root {
  --paper: #ffffff; --ink: #0a0a0a; --mute: #4a4a4a; --photo: #d9d9d9; --heat: #e5231b; /* the map's soft circles: red on paper, white in the dark */
  --ok: #0b7a3b; --warn: #b45309; --bad: #d1231b; /* safety status: all good / watch it / lapsed or expired */
  --sans: "Helvetica Neue", Helvetica, "Inter", Arial, "Noto Sans Thai", sans-serif;
  --pad: clamp(12px, 1.25vw, 20px);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --paper: #0a0a0a; --ink: #f2f2f2; --mute: #b5b5b5; --photo: #2a2a2a; --heat: #f2f2f2; --ok: #5fd68a; --warn: #ffab4a; --bad: #ff6b5e; color-scheme: dark; }
}
:root[data-theme="dark"] { --paper: #0a0a0a; --ink: #f2f2f2; --mute: #b5b5b5; --photo: #2a2a2a; --heat: #f2f2f2; --ok: #5fd68a; --warn: #ffab4a; --bad: #ff6b5e; color-scheme: dark; }

* { box-sizing: border-box; }
html, body { margin: 0; overflow-x: clip; }
body { background: var(--paper); color: var(--ink); font: 500 15px/1.25 var(--sans); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* header: label · links · organisation, like the reference's small top line */
.top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: baseline; gap: 16px; padding: max(18px, env(safe-area-inset-top)) var(--pad) 12px;
  position: sticky; top: 0; z-index: 20; background: none;
  color: #fff; mix-blend-mode: difference; } /* no bar: white text that inverts against what scrolls under it, black on white, white on black */
.top > span:last-child { text-align: right; }
.top nav { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.top nav a { text-decoration: none; padding: 6px 0; }
@media (max-width: 640px) {
  .top { grid-template-columns: auto 1fr; gap: 12px; padding-bottom: 6px; }
  .top > span:last-child { display: none; } /* the organisation: on Profile */
  .top nav { justify-content: flex-end; gap: 14px; flex-wrap: nowrap; }
  .top .brand, .top nav a { padding: 8px 0; }
}
.top nav a:hover { text-decoration: underline; }

/* six big lines; each slides up out of its own line box on load */
.big { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); column-gap: 40px; padding: 18px var(--pad) 0;
  font-size: clamp(30px, 4.3vw, 64px); font-weight: 700; letter-spacing: -0.045em; line-height: 0.98; }
.big i { font-style: normal; }
.line { display: block; overflow: hidden; padding-bottom: .12em; } /* room for descenders when a line wraps */
.line > span { display: inline-block; animation: slideUp .9s cubic-bezier(.2, .75, .15, 1) both; }
@keyframes slideUp { from { transform: translateY(105%); } }
.still .line > span { animation: none; }

/* tables: [key] [→] [text] [label] [→] [value] — one fact per row, arrows aligned in their own columns */
.tables { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 560px), 1fr)); gap: 28px 40px; padding: clamp(56px, 9vw, 120px) var(--pad) 0; position: relative; z-index: 2; }
.tables > div { display: flex; flex-direction: column; gap: 24px; }
.tbl { display: grid; grid-template-columns: 96px 26px minmax(0, 1fr) minmax(0, 132px) 26px minmax(0, 150px); }
.tbl > span { padding: 4px 0 5px; border-top: 1px solid var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tbl > span.k { border-top-color: transparent; white-space: normal; padding-right: 6px; max-height: calc(1.25em + 10.5px); overflow: visible; }
/* a long key ("Rolling hours") wraps instead of running into its arrow, and hangs into the empty key cell below so every row keeps the same height */
.tbl > span.first { border-top: 1.5px solid var(--ink); }
.tbl a { font-weight: 600; }
/* a block across the label..value columns of a table's first row: Home's activity calendar */
.tbl > span.block { grid-column: 3 / -1; padding: 8px 0 10px; overflow: visible; white-space: normal; }
.cal { display: grid; grid-template-columns: repeat(var(--w), minmax(0, 1fr)); grid-template-rows: repeat(7, auto); grid-auto-flow: column; gap: 2px; }
.cal i { aspect-ratio: 1; background: color-mix(in srgb, var(--ink) 6%, transparent); }
/* one ink square a day, darker for more hours (none, ≤1 h, ≤2 h, ≤3 h, more) */
.cal i.l1 { background: color-mix(in srgb, var(--ink) 30%, transparent); } .cal i.l2 { background: color-mix(in srgb, var(--ink) 55%, transparent); }
.cal i.l3 { background: color-mix(in srgb, var(--ink) 80%, transparent); } .cal i.l4 { background: var(--ink); }
.cal i.t { outline: 1.5px solid var(--ink); outline-offset: 1px; }
.cal i.f { visibility: hidden; }
.tbl .ph { display: none; }
@media (max-width: 640px) { .tbl .ph { display: block; font-size: 12px; font-weight: 400; color: var(--mute); } } /* Recent on a phone: the date on a small line above the route */
@media (max-width: 640px) {
  .tbl { grid-template-columns: 74px 22px minmax(0, 1fr) 22px minmax(0, 122px); } /* fixed value column: arrows line up across tables */
  .tbl > span.d { display: none; } /* on a phone each row reads key → label → value */
}

/* photo: small and centred, the big name runs over it */
/* first screen: big lines at the top, the tables pinned to the bottom of the window */
.fold { min-height: calc(100svh - var(--top-h, 48px)); display: flex; flex-direction: column; padding-bottom: 28px; }
.fold > .tables { margin-top: auto; }

/* the photo: halftone dots in ink, fixed on screen, dragged by the user */
.ht { position: fixed; left: 62vw; top: 30vh; z-index: 15; width: clamp(96px, 20vw, 280px); aspect-ratio: var(--ar, 4 / 3); mix-blend-mode: multiply;
  cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ht-img { position: absolute; inset: 0; background: var(--ink); opacity: .6; transition: opacity .3s;
  -webkit-mask: var(--m) center / 100% 100% no-repeat; mask: var(--m) center / 100% 100% no-repeat; }
.ht.held { cursor: grabbing; }
/* B&W: the photo itself in grey tones, not dots */
.ht.bw img { display: block; width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.05); pointer-events: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ht.bw { mix-blend-mode: normal; } }
:root[data-theme="dark"] .ht.bw { mix-blend-mode: normal; }
/* Profile: one row per photo, a small grey thumbnail → style / remove */
.photo-row .thumb img { display: block; width: 44px; height: 44px; object-fit: cover; filter: grayscale(1); }
.ht.held .ht-img { opacity: .7; }
/* adjust mode (hold still): a thin frame and a corner handle to resize */
.ht.adjust { outline: 1px dashed var(--ink); outline-offset: 4px; }
.ht-size { display: none; position: absolute; right: -14px; bottom: -14px; width: 28px; height: 28px; cursor: nwse-resize; }
.ht-size::after { content: ''; position: absolute; inset: 7px; background: var(--ink); }
.ht.adjust .ht-size { display: block; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ht { mix-blend-mode: screen; } }
:root[data-theme="dark"] .ht { mix-blend-mode: screen; }
.pick { cursor: pointer; }
.pick input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pick:focus-within { outline: 2px solid var(--ink); outline-offset: 2px; }

/* heatmap: country outlines as islands, airports as dots with small monospace labels */
.heat { padding-top: clamp(56px, 9vw, 120px); }
.map { position: relative; height: clamp(320px, 62vh, 680px); margin-top: 8px; overflow: hidden; }
.map svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: pan-y; cursor: grab; user-select: none; -webkit-user-select: none; }
.map .sea { pointer-events: none; }
.map .seadot { fill: var(--ink); opacity: .3; }
.map .g0 { stop-color: var(--heat); stop-opacity: .9; }
.map .g1 { stop-color: var(--heat); stop-opacity: .5; }
.map .g2 { stop-color: var(--heat); stop-opacity: 0; }
.map .land path { fill: var(--paper); stroke: var(--mute); stroke-width: .7; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map .land path.mine { stroke: var(--ink); stroke-width: 1.4; }
.map .route { stroke: var(--ink); stroke-width: .8; stroke-dasharray: 3 3; }
.map .hit { fill: transparent; }
.map .pt { cursor: pointer; outline: none; }
.map .pt:focus-visible .dot { stroke: var(--ink); stroke-width: 1.5; }
.map .lab { pointer-events: none; }
.map .lab rect { fill: var(--paper); }
.map .lab text { fill: var(--ink); font: 500 11px var(--mono); letter-spacing: .04em; }
.map .lab.sel rect { fill: var(--ink); }
.map .lab.sel text { fill: var(--paper); }
.map-ctl { position: absolute; top: 6px; right: 0; display: flex; gap: 4px; }
.map-ctl button { min-width: 34px; height: 34px; padding: 0 10px; border: 1px solid var(--ink); background: var(--paper); color: var(--ink); font: 500 16px/1 var(--sans); cursor: pointer; }
.map-ctl button:hover { background: var(--ink); color: var(--paper); }

/* the name: huge, full width, over the photo; soft while scrolling */
.name { margin: clamp(40px, 6vw, 96px) 0 0; padding: 0 2vw 2vw; font-size: 17vw; font-weight: 700; letter-spacing: -0.06em; line-height: 0.8; position: relative; z-index: 16;
  mix-blend-mode: multiply; pointer-events: none; transition: filter .55s cubic-bezier(.2, .7, .2, 1); overflow-wrap: anywhere; }
.name span { display: block; }
/* the last screen is the name's alone, whatever size fitName() gives it: the name sits at the bottom of a full-height section */
.finale { min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; }
.name.measuring span { display: block; width: max-content; white-space: nowrap; } /* fitName(): each line's natural width */
.name span:not(:last-child) { text-transform: uppercase; } /* capitals only: no descenders, so every line has the same visible gap */
.name.moving { filter: blur(14px); transition-duration: .12s; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .name { mix-blend-mode: screen; } }
:root[data-theme="dark"] .name { mix-blend-mode: screen; }

.hint { margin: 0; padding: 0 var(--pad); font-size: 13px; }
.foot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 24px var(--pad) max(24px, env(safe-area-inset-bottom)); font-size: 13px; color: var(--mute); }

/* sections rise in as they scroll into view (scroll-driven where supported, once on load elsewhere) */
.reveal { animation: rise .9s cubic-bezier(.2, .7, .2, 1) both; animation-timeline: view(); animation-range: entry 0% entry 55%; }
@keyframes rise { from { opacity: 0; transform: translateY(56px); } }

@media (prefers-reduced-motion: reduce) { .line > span, .reveal { animation: none; } .name.moving { filter: none; } }

/* header links: the current page is bold and underlined */
.top .brand { display: inline-flex; align-self: center; padding: 0; text-decoration: none; }
.top .logo { display: block; width: 26px; height: 26px; }
.top a[aria-current] { font-weight: 700; text-decoration: underline; }

/* ---------- Logbook: search, filters as text toggles, one ruled row per entry ---------- */
.controls { display: flex; flex-direction: column; gap: 12px; padding: clamp(36px, 6vw, 72px) var(--pad) 0; }
.search { display: grid; grid-template-columns: 96px 26px minmax(0, 1fr); align-items: baseline; padding-top: 5px; border-top: 1.5px solid var(--ink); }
.search input { min-width: 0; padding: 2px 0 6px; border: 0; border-bottom: 1px solid var(--ink); background: none; color: inherit; font: inherit; outline: none; }
.search input:focus-visible { border-bottom-width: 2px; }
.filters { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 20px; }
.kinds { display: inline-flex; align-items: baseline; gap: 6px; }
.filters button { min-height: 36px; padding: 6px 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.filters button[aria-pressed="true"] { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.pick select { min-height: 36px; padding: 4px 0; border: 0; border-bottom: 1px solid var(--ink); background: none; color: inherit; font: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.log { padding: clamp(32px, 5vw, 56px) var(--pad) 0; }
/* months off screen skip layout until scrolled near, so a long logbook stays fast */
/* rows off screen are skipped until scrolled to (long logbooks); on the rows, not the month, so the heading can blend */
.month { margin-bottom: 40px; }
.month > .rows { content-visibility: auto; contain-intrinsic-size: auto 600px; }
/* the month heading: no bar, ink text over the rows that scroll under it */
.month h2 { position: sticky; top: var(--top-h, 0); z-index: 15; display: flex; justify-content: space-between; gap: 16px; margin: 0 0 6px; padding: 10px 0 6px;
  background: none; font-size: clamp(26px, 3.2vw, 46px); font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.entry { display: grid; grid-template-columns: 72px minmax(0, 150px) minmax(0, 124px) minmax(0, 90px) minmax(0, 1fr) minmax(0, 76px) 26px 56px;
  padding: 5px 0 6px; border-top: 1px solid var(--ink); text-decoration: none; }
.entry > span { padding-right: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.entry > span[aria-hidden] { padding-right: 0; overflow: visible; }
.entry .r, .entry .t { font-weight: 700; }
.entry .t { padding-right: 0; text-align: right; font-variant-numeric: tabular-nums; }
.entry abbr { margin-left: 4px; text-decoration: none; }
.entry:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.empty { margin: 0; font-size: clamp(24px, 3vw, 40px); font-weight: 700; letter-spacing: -0.03em; }
@media (max-width: 640px) {
  .search { grid-template-columns: 74px 22px minmax(0, 1fr); }
  .entry { grid-template-columns: 68px minmax(0, 1fr) 22px 52px; }
  .entry .m { display: none; } /* on a phone a row is date · route → time; open it for the rest */
}

/* ---------- Add / edit: one ruled row per field, label → value; the value is the bold part ---------- */
.ttl { margin: 18px var(--pad) 0; font-size: clamp(40px, 6vw, 88px); font-weight: 700; letter-spacing: -0.05em; line-height: 0.9; }
.kindbar { padding: 18px var(--pad) 0; }
.kindbar .frow { border-top: 0; }
.eform { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 520px), 1fr)); gap: 0 40px; padding: 24px var(--pad) 0; }
.eform [hidden] { display: none; }
.frow { display: grid; grid-template-columns: 150px 26px minmax(0, 1fr); align-items: baseline; padding: 6px 0 7px; border-top: 1px solid var(--ink); }
.frow .fin { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; min-width: 0; }
.frow input:not([type="checkbox"]) { flex: 1; min-width: 0; padding: 0 0 1px; border: 0; border-bottom: 1px solid transparent; border-radius: 0; background: none; color: inherit; font: inherit; font-weight: 700; outline: none; }
.frow input:focus-visible { border-bottom-color: var(--ink); }
.frow input::placeholder { color: var(--mute); font-weight: 500; }
.frow input.caps { text-transform: uppercase; }
.frow input.num { font-variant-numeric: tabular-nums; }
.frow input[type="checkbox"] { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }
.frow input[aria-invalid] { border-bottom: 2px solid var(--ink); }
.frow .err { font-size: 13px; font-weight: 700; }
.frow .err:not(:empty)::before { content: "! "; }
.frow .hint { grid-column: 3; font-size: 13px; color: var(--mute); }
.toggles { display: inline-flex; flex-wrap: wrap; align-items: baseline; gap: 6px; }
.toggles button { min-height: 32px; padding: 2px 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.toggles button[aria-pressed="true"] { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.more summary { padding: 8px 0; border-top: 1px solid var(--ink); font-weight: 700; cursor: pointer; }
.msgs { grid-column: 1 / -1; margin-top: 18px; }
.msgs p { display: grid; grid-template-columns: 150px 26px minmax(0, 1fr); margin: 0; padding: 6px 0; border-top: 1.5px solid var(--ink); font-weight: 600; }
.actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 28px; margin-top: 18px; padding: 24px 0 8px; border-top: 1.5px solid var(--ink); }
.actions button, .actions a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }
.actions .go { padding: 10px 22px; background: var(--ink); color: var(--paper); text-decoration: none; font-size: clamp(22px, 2.4vw, 32px); font-weight: 700; letter-spacing: -0.03em; }
.note { position: fixed; left: var(--pad); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 10; margin: 0; padding: 10px 14px; background: var(--ink); color: var(--paper); font-weight: 600; }
@media (max-width: 640px) { .frow, .msgs p { grid-template-columns: 126px 22px minmax(0, 1fr); } }

/* ---------- Stats: period toggles, big totals, a two-tone bar chart, breakdown tables ---------- */
.pad { padding-left: var(--pad); padding-right: var(--pad); }
.periods { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; padding-top: 18px; }
.periods .years { display: inline-flex; align-items: baseline; gap: 10px; margin-left: 14px; }
.periods .years button { font-weight: 700; }
.periods .years button:disabled { opacity: .3; cursor: default; }
.periods .range { margin-left: auto; color: var(--mute); }
.sub { margin: 0 0 14px; font-size: clamp(26px, 3.2vw, 46px); font-weight: 700; letter-spacing: -0.04em; line-height: 1; }
.chartbox { padding-top: clamp(48px, 7vw, 96px); }
.chart-scroll { overflow-x: auto; scrollbar-width: none; }
.chart { display: grid; grid-template-columns: repeat(var(--n), minmax(26px, 1fr)); gap: 6px; min-width: calc(var(--n) * 32px); height: 250px; }
.chart button { display: flex; flex-direction: column; min-width: 0; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
.chart .stack { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; border-bottom: 1.5px solid var(--ink); }
.chart .stack i { display: block; background: var(--ink); }
.chart .stack i.sim { background: none; box-shadow: inset 0 0 0 1.5px var(--ink); }
.chart .lbl { height: 24px; padding-top: 5px; font-size: 12px; white-space: nowrap; }
.chart button[aria-pressed="true"] .lbl { font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.readout { margin-top: 22px; grid-template-columns: 180px 26px minmax(0, 1fr) 0 26px minmax(0, 150px); }
.legend { display: flex; gap: 18px; margin: 12px 0 0; font-size: 13px; color: var(--mute); }
.legend i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; background: var(--ink); }
.legend i.sim { background: none; box-shadow: inset 0 0 0 1.5px var(--ink); }
.empty.pad { padding-top: 40px; }
@media (max-width: 640px) {
  .periods .range { margin-left: 0; width: 100%; }
  .readout { grid-template-columns: 118px 22px minmax(0, 1fr) 22px minmax(0, 96px); }
  .tbl.brk { grid-template-columns: 74px 22px minmax(0, 1fr) 22px minmax(0, 116px); }
  .tbl.brk > span.d { display: block; } /* breakdowns keep the name and drop the note */
  .tbl.brk > span.sub-note { display: none; }
}

/* ---------- Profile ---------- */
.big.pad-top { padding-top: 22px; }
.sub.gap { margin-top: 40px; }
.fcol .sub { margin-top: 8px; }
.hint-line { margin: 8px 0 0; font-size: 13px; color: var(--mute); }
.links a, .links button { display: grid; grid-template-columns: minmax(0, 190px) minmax(0, 1fr) 26px; gap: 12px; align-items: baseline; padding: 6px 0 7px; border-top: 1px solid var(--ink); text-decoration: none; }
.links a span:nth-child(2), .links button span:nth-child(2) { overflow: hidden; color: var(--mute); white-space: nowrap; text-overflow: ellipsis; }
.links a:hover b, .links button:hover b { text-decoration: underline; }
.links button { width: 100%; border: 0; border-top: 1px solid var(--ink); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
@media (max-width: 640px) { .links a, .links button { grid-template-columns: minmax(0, 1fr) auto; } .links a span:nth-child(2), .links button span:nth-child(2) { display: none; } }

/* ---------- Licences: name · number · status → expiry; the open item shows its fields below ---------- */
.sub.split { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.add-btn { min-height: 36px; padding: 4px 0; border: 0; background: none; color: inherit; font: 600 15px/1.2 var(--sans); letter-spacing: 0; text-decoration: underline; cursor: pointer; }
.lics > div { gap: 0; margin-bottom: 36px; }
.lrow { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(0, 170px) 26px minmax(0, 96px); align-items: baseline; width: 100%; padding: 7px 0 8px;
  border: 0; border-top: 1px solid var(--ink); background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; }
.lrow > * { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding-right: 10px; }
.lrow .m { color: var(--mute); }
.lrow b { white-space: normal; }
.lrow > [aria-hidden] { padding-right: 0; overflow: visible; }
.lrow .x { padding-right: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.lrow:hover b { text-decoration: underline; }
.lic.open .lrow { border-top-width: 1.5px; }
.lic-edit { padding: 0 0 14px 24px; }
.lic-edit .actions { margin-top: 10px; padding-top: 12px; }
@media (max-width: 640px) {
  .lrow { grid-template-columns: minmax(0, 1fr) minmax(0, 116px) 22px minmax(0, 78px); }
  .lrow .m { display: none; }
  .lic-edit { padding-left: 0; }
}

/* ---------- Import & backup ---------- */
.imp-msg { margin: 14px 0 0; padding: 8px 0; border-top: 1.5px solid var(--ink); font-weight: 600; }
.review { margin-top: 22px; }
.rev { display: grid; grid-template-columns: minmax(0, 1fr) 26px minmax(0, 80px); align-items: baseline; padding: 6px 0 7px; border-top: 1px solid var(--ink); }
details.rev { display: block; }
details.rev summary { display: grid; grid-template-columns: minmax(0, 1fr) 26px minmax(0, 80px); cursor: pointer; list-style: none; }
details.rev summary::-webkit-details-marker { display: none; }
details.rev summary > span:first-child { text-decoration: underline; text-underline-offset: 3px; }
.rev b { text-align: right; font-variant-numeric: tabular-nums; }
.rev ul { margin: 6px 0 4px; padding-left: 18px; font-size: 13px; }
.review .frow { cursor: pointer; }
.file-link { position: relative; min-height: 44px; padding: 8px 0; text-decoration: underline; cursor: pointer; }
.file-link input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-link:focus-within { outline: 2px solid var(--ink); outline-offset: 3px; }
.actions .go:disabled { opacity: .4; cursor: default; }

/* ---------- Aircraft & airports ---------- */
.acrow, .aptrow { display: grid; align-items: baseline; gap: 0 12px; padding: 6px 0 7px; border-top: 1px solid var(--ink); }
.acrow { grid-template-columns: minmax(0, 90px) minmax(0, 90px) minmax(0, 1fr) auto 32px; }
.aptrow { grid-template-columns: 56px minmax(0, 1fr) minmax(0, 130px) 32px; }
.acrow .m, .aptrow .m { overflow: hidden; color: var(--mute); white-space: nowrap; text-overflow: ellipsis; }
.aptrow > span:nth-child(2) { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.acrow input { min-width: 0; padding: 0 0 1px; border: 0; border-bottom: 1px solid transparent; background: none; color: inherit; font: inherit; font-weight: 700; text-transform: uppercase; outline: none; }
.acrow input:focus-visible { border-bottom-color: var(--ink); }
.x-btn { width: 32px; min-height: 32px; padding: 0; border: 0; background: none; color: inherit; font: 500 22px/1 var(--sans); cursor: pointer; }
.x-btn:hover { font-weight: 700; }
#aptAdd .actions { border-top: 0; margin-top: 4px; }
@media (max-width: 640px) {
  .acrow { grid-template-columns: minmax(0, 80px) minmax(0, 1fr) auto 28px; }
  .acrow .m, .aptrow .m { display: none; }
  .aptrow { grid-template-columns: 52px minmax(0, 1fr) 28px; }
}

/* ---------- Rules: a ruled row per rule; open it for the summary and its source ---------- */
.lede { max-width: 900px; margin: 18px 0 0; font-size: clamp(17px, 1.6vw, 21px); line-height: 1.35; }
.lede .hint-line { display: block; }
.rules .sub { margin-top: 36px; }
.rule summary { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 220px) 22px; gap: 12px; align-items: baseline; padding: 6px 0 7px; border-top: 1px solid var(--ink); cursor: pointer; list-style: none; }
.rule summary::-webkit-details-marker { display: none; }
.rule summary .m { overflow: hidden; color: var(--mute); white-space: nowrap; text-overflow: ellipsis; }
.rule[open] summary > span:last-child { transform: rotate(180deg); }
.rule-body { padding: 0 0 14px; }
.rule-body p { margin: 0 0 8px; max-width: 70ch; }
.sources { padding-top: 48px; }
.aptrow.src { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, 120px); }
@media (max-width: 640px) {
  .rule summary { grid-template-columns: minmax(0, 1fr) 22px; }
  .rule summary .m { display: none; }
  .aptrow.src { grid-template-columns: minmax(0, 1fr); }
}

/* All checks: the value column says the state; a lapsed check is marked with ! */
.rule.check summary { grid-template-columns: minmax(0, 1fr) minmax(0, 160px) 22px; }
.rule.check summary > span:nth-child(2) { font-weight: 700; text-align: right; }
.rule.check.bad summary > span:nth-child(2)::before { content: "! "; }
@media (max-width: 640px) { .rule.check summary { grid-template-columns: minmax(0, 1fr) minmax(0, 120px) 22px; } }

.links.start { margin-top: 40px; font-size: clamp(20px, 2.4vw, 30px); }

.note button { margin-left: 10px; padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; min-height: 32px; }
.quick { padding-top: 4px; }
.quick[hidden] { display: none; }
.sub.split .sub-note { font-size: 13px; font-weight: 400; letter-spacing: 0; color: var(--mute); text-align: right; }

/* safety status colours (licences, currency, recency, flight-time limits); the text always says the state as well */
.tone-ok { color: var(--ok); }
.tone-warn { color: var(--warn); }
.tone-bad { color: var(--bad); }

/* terms & privacy: two reading columns; the one-time agreement notice under the header */
.legal-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 24px 48px; padding-top: 24px; }
.legal { scroll-margin-top: calc(var(--top-h, 48px) + 12px); }
.legal h3 { margin: 22px 0 6px; font-size: 15px; font-weight: 700; }
.legal p { margin: 0 0 8px; max-width: 62ch; font-weight: 400; line-height: 1.5; }
.notice { margin: 0; padding-top: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--ink); font-size: 13px; font-weight: 400; }
.notice button { padding: 0; border: 0; background: none; color: inherit; font: 700 13px var(--sans); text-decoration: underline; cursor: pointer; margin-left: 6px; }
.agree { display: flex; gap: 10px; align-items: flex-start; margin-top: 18px; padding-top: 12px; border-top: 1px solid var(--ink); font-size: 14px; font-weight: 400; cursor: pointer; }
.agree input { margin-top: 3px; width: 18px; height: 18px; flex: none; }

/* form checkboxes: a comfortable tap target */
.frow input[type=checkbox] { width: 22px; height: 22px; margin: 0; }
.src a { display: inline-block; padding: 4px 0; } /* source links: easier to tap */
.aptrow.src .m { white-space: normal; } /* a source's issue and note are read in full */
.tbl.brk > span.d { white-space: normal; } /* breakdown names wrap rather than being cut ("Medical certificate", long course requirements) */

/* Import & backup → Keep it safe: one ruled row each, label → state, then what to do */
.safe { padding-top: clamp(32px, 5vw, 56px); scroll-margin-top: var(--top-h, 48px); } /* Home's "How" lands below the sticky header */
.saferow { display: grid; grid-template-columns: minmax(0, 160px) 26px minmax(0, 170px) minmax(0, 1fr); align-items: baseline; gap: 0 10px; padding: 7px 0 8px; border-top: 1px solid var(--ink); }
.saferow .how { color: var(--mute); font-weight: 400; font-size: 14px; }
.saferow .how .go { font-size: 15px; }
@media (max-width: 640px) {
  .saferow { grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1.2fr); }
  .saferow .how { grid-column: 1 / -1; padding-top: 4px; }
  .saferow .how:empty { display: none; }
}
.notice button + button { margin-left: 10px; }

/* a table label that opens its explanation (Home → Rolling hours → All checks) */
.tbl a.rowlink { font-weight: inherit; text-decoration: none; }
.tbl a.rowlink:hover, .tbl a.rowlink:focus-visible { text-decoration: underline; }
.rule { scroll-margin-top: calc(var(--top-h, 48px) + 8px); }

/* Activity: tap a day → its flights underneath; the chosen square is outlined */
.cal i[data-d] { cursor: pointer; }
.cal i.sel { outline: 2px solid var(--ink); outline-offset: 1px; }
.cal { position: relative; }
.cal-tip { position: absolute; z-index: 2; transform: translate(-50%, calc(-100% - 6px)); padding: 3px 7px; background: var(--ink); color: var(--paper);
  font-size: 12px; font-weight: 500; white-space: nowrap; pointer-events: none; }
.cal-tip[hidden] { display: none; }
.tap-hint { color: var(--mute); font-weight: 400; }

/* first-run setup: ← Back beside "Step 2 of 3" at the top */
.wl-step { display: flex; align-items: baseline; gap: 14px; }
.wl-back { padding: 6px 0; border: 0; background: none; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; }

/* phone: the photos sit in the space above the name (in the page, not floating), centred, side by side when several */
.finale-photos { flex: 1; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px; padding: calc(var(--top-h, 48px) + 12px) var(--pad) 20px; }
.finale-photos .ht { position: relative; left: auto; top: auto; z-index: 1; width: min(62vw, 280px, calc(44svh * (var(--ar, 1)))); cursor: default; touch-action: auto; } /* a tall photo stays under 44% of the screen height, shape kept */
.finale-photos[data-n="2"] .ht { width: calc(50% - 7px); }
.finale-photos[data-n="3"] .ht { width: calc(33.3% - 10px); }
.finale-photos .ht-size { display: none; }

/* Stats: how the hours split — three full-width bars, a key line above each */
.splits { padding-top: clamp(48px, 7vw, 96px); }
.hsplit { margin-bottom: 26px; }
.split-k { display: flex; flex-wrap: wrap; gap: 4px 22px; margin: 0 0 8px; font-size: 14px; color: var(--mute); }
.split-k b { color: var(--ink); font-weight: 700; }
.split-k i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: 0; }
.split-bar { display: flex; gap: 2px; height: clamp(14px, 2vw, 22px); }
.split-bar i { min-width: 2px; }
.splits .s0 { background: var(--ink); } .splits .s1 { background: color-mix(in srgb, var(--ink) 55%, transparent); }
.splits .s2 { background: color-mix(in srgb, var(--ink) 22%, transparent); } .splits .sim { box-shadow: inset 0 0 0 1.5px var(--ink); }
/* Stats: total hours over time */
.climb { padding-top: clamp(48px, 7vw, 96px); }
.climb-box { position: relative; height: clamp(200px, 34vw, 420px); margin: 8px 0 52px; border-bottom: 1px solid var(--ink); }
.climb-box svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.climb-box path { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.cl-rule { position: absolute; left: 0; right: 0; border-top: 1px dashed color-mix(in srgb, var(--ink) 30%, transparent); }
.cl-rule span, .cl-x { position: absolute; font-size: 12px; color: var(--mute); }
.cl-rule span { left: 0; bottom: 3px; }
.cl-tick { position: absolute; top: 100%; width: 1px; height: 6px; background: var(--ink); }
.cl-x { top: 100%; margin-top: 9px; transform: translateX(-50%); text-align: center; line-height: 1.25; letter-spacing: .02em; }
.cl-x b { color: var(--ink); }
.cl-x.first { transform: none; text-align: left; } .cl-x.last { transform: translateX(-100%); text-align: right; }
.cl-rule.ceil span { bottom: auto; top: 3px; } /* the top line's label sits just under it, clear of the title */
.cl-dot { position: absolute; right: -5px; width: 10px; height: 10px; margin-bottom: -5px; border-radius: 50%; background: var(--ink); }
.cl-end { position: absolute; right: 0; margin-bottom: 12px; font-size: clamp(18px, 2.4vw, 30px); letter-spacing: -0.03em; }
/* Stats: aircraft as type */
.fleet { padding-top: clamp(48px, 7vw, 96px); }
.ac { margin: 0 0 clamp(14px, 2vw, 26px); }
.ac b { display: block; font-size: calc(var(--k) * clamp(64px, 15vw, 230px)); font-weight: 700; letter-spacing: -0.06em; line-height: .82; overflow-wrap: anywhere; }
.ac span { display: block; margin-top: 6px; font-size: 13px; color: var(--mute); }

/* first-run steps 2 and 3: the choices side by side, each a column whose button line sits at the same height */
.wl-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 40px; padding-top: 32px; }
.wl-opt { display: flex; flex-direction: column; min-width: 0; }
.wl-opt .sub { font-size: clamp(24px, 2.4vw, 34px); }
.wl-body { flex: 1; }
.wl-opt > .actions { margin-top: 18px; }
.wl-opt .frow { margin-top: 10px; }
.wl-done { margin: 12px 0 0; font-weight: 700; }
.wl-end { margin-top: 40px; }
.wl-end .agree { margin-top: 0; }
#wlErr:empty { display: none; }
/* Stats lists: the top 4, the rest behind Show all, in the same table */
.tbl.brk.folded > span.xr { display: none; }
.tbl-more { align-self: flex-start; margin: -18px 0 0 122px; padding: 8px 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
@media (max-width: 640px) { .tbl-more { margin-left: 96px; } }
/* the organisation's colour: a soft circle coming out of the top right corner, fading out like an airport on the map.
   Above everything but it only tints (multiply on light, screen on dark), so text and buttons stay as they are. */
#glow { position: fixed; top: 0; right: 0; z-index: 30; width: min(80vw, 620px); aspect-ratio: 1; transform: translate(50%, -50%); pointer-events: none;
  background: radial-gradient(circle closest-side, color-mix(in srgb, var(--org) 80%, transparent) 0%, color-mix(in srgb, var(--org) 66%, transparent) 15%, color-mix(in srgb, var(--org) 47%, transparent) 30%, color-mix(in srgb, var(--org) 29%, transparent) 45%, color-mix(in srgb, var(--org) 15%, transparent) 60%, color-mix(in srgb, var(--org) 6%, transparent) 75%, color-mix(in srgb, var(--org) 1.5%, transparent) 90%, transparent); /* a bell-shaped fade, no visible edge */
  mix-blend-mode: multiply; }
#glow[hidden] { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) #glow { mix-blend-mode: screen; } }
:root[data-theme="dark"] #glow { mix-blend-mode: screen; }
.agree-inline { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; }
input[type="color"] { width: 44px; height: 32px; padding: 0; border: 1px solid var(--ink); background: none; cursor: pointer; }
#nameNote { margin: 2px 0 10px; } /* Profile: the note under Name of holder */
