/* twisty.au (from the NAS trips app, seed/site/app.css). Phone first: big type and targets for gloves and sunlight;
   dark mode follows the device. Riding blue and break orange are a validated pair (light: #2a78d6/#eb6834 on
   #fcfcfb, dark: #3987e5/#d95926 on #1a1a19), used only for the timeline's marks; text stays in ink.
   The look is docs/style-guide.md: tests/site/style.test.mjs fails when this file strays from it. */
@font-face { font-family: "Barlow"; font-weight: 600; src: url(fonts/barlow-semibold.woff2) format("woff2"); font-display: swap; }
@font-face { font-family: "Barlow"; font-weight: 700; src: url(fonts/barlow-bold.woff2) format("woff2"); font-display: swap; }
:root {
  color-scheme: light;
  --bg: #eef1f4; --surface: #fcfcfb; --surface-2: #f3f5f7; --ink: #0f1419; --ink-2: #3f4650; --muted: #5d6876;
  --line: #dde2e8; --accent: #1f6fd1; --accent-ink: #fff; --accent-soft: #e5effc;
  --head: #16324f; --head-ink: #fff; --on-fill: #ffffff;
  --ride: #2a78d6; --brk: #eb6834;
  --ok: #1e7d32; --warn: #9a5700; --bad: #c62828;
  --ok-soft: #e7f4e8; --warn-soft: #fff1dc; --bad-soft: #fde8e8; --info-soft: #e5effc;
  --today: #fff6d6; --hot: #fff1e6; --hot-line: #eb6834;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .06);
  --shadow-float: 0 6px 24px rgba(0, 0, 0, .28); --shadow-up: 0 -4px 18px rgba(0, 0, 0, .18);
  --scrim: rgba(0, 0, 0, .45); --scrim-strong: rgba(0, 0, 0, .6); --photo-bg: #000000;
  --ctx: #8a96a3; --attrib-bg: rgba(255, 255, 255, .5);
  --r-sm: 8px; --r-ctl: 12px; --radius: 16px; --r-sheet: 20px;
  --font-display: "Barlow", system-ui, sans-serif;
  --font-text: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
  --tabs-h: 60px;
  font-family: var(--font-text);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1013; --surface: #1a1a19; --surface-2: #232427; --ink: #f0efec; --ink-2: #d2d1c9; --muted: #a2abb6;
    --line: #2f3338; --accent: #5b9cf0; --accent-ink: #0b1220; --accent-soft: #1b2b40;
    --head: #12243a; --ride: #3987e5; --brk: #d95926;
    --ok: #63c46f; --warn: #e5a54a; --bad: #ff7272;
    --ok-soft: #17301b; --warn-soft: #34260f; --bad-soft: #3a1a1a; --info-soft: #172739;
    --today: #33300f; --hot: #3a2416; --hot-line: #d95926;
    --shadow: none; --shadow-up: none; --attrib-bg: rgba(13, 16, 19, .7);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 17px; line-height: 1.45;
  padding-bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom)); -webkit-tap-highlight-color: transparent; }
body.noscroll { overflow: hidden; }
a { color: var(--accent); }
h1, h2, h3 { font-family: var(--font-display); }
h1 { font-size: 26px; line-height: 1.2; margin: 4px 0 8px; letter-spacing: -.01em; }
h1 a { color: inherit; text-decoration: none; }
h2 { font-size: 19px; margin: 24px 0 10px; }
h3 { font-size: 15px; margin: 0 0 6px; display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
p { margin: 8px 0; }
code { font-family: var(--font-mono); font-size: .88em; background: var(--surface-2); padding: 0 4px; border-radius: 4px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; flex-wrap: wrap; }
.eyebrow { font-family: var(--font-display); font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: .01em; }
.eyebrow a { color: var(--ink-2); text-decoration: none; }
.ic { width: 20px; height: 20px; flex: none; vertical-align: -4px; }
.ic.ok { color: var(--ok); } .ic.warn { color: var(--warn); }

/* ---------------------------------------------------------------- header, tabs */
#top { position: sticky; top: 0; z-index: 20; background: var(--head); color: var(--head-ink);
  padding: calc(6px + env(safe-area-inset-top)) 10px 6px; display: flex; align-items: center; gap: 4px; min-height: 52px; }
#top a { color: inherit; text-decoration: none; }
#top .back { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin-left: -6px; }
#top .back .ic { width: 26px; height: 26px; }
#top .title { flex: 1; font-family: var(--font-display); font-weight: 700; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 4px; }
#top .sync { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; background: color-mix(in srgb, var(--head-ink) 14%, transparent);
  border-radius: 99px; padding: 5px 10px; white-space: nowrap; }
#top .sync .ic { width: 16px; height: 16px; }
#top .sync[hidden], #top .back[hidden] { display: none; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; background: var(--surface);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.tabs[hidden] { display: none; }   /* signed out (D5): display:flex above would override hidden */
.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: var(--tabs-h);
  justify-content: center; color: var(--muted); text-decoration: none; font-family: var(--font-display); font-size: 12px; font-weight: 700; }
.tabs a .ic { width: 25px; height: 25px; }
.tabs a.on { color: var(--accent); }
main { max-width: 760px; margin: 0 auto; padding: 12px 14px 32px; }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 16px;
  border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-family: var(--font-display); font-weight: 700; text-decoration: none; cursor: pointer; text-align: center; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.queue { background: var(--warn); border-color: var(--warn); color: var(--on-fill); }
.btn.big { flex: 1 1 160px; min-height: 54px; font-size: 19px; }
.btn.wide { display: flex; width: 100%; margin-top: 8px; }
.btn.small { min-height: 38px; padding: 4px 12px; font-size: 15px; }
.btn.icon-only { padding: 8px 12px; flex: 0 0 auto !important; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.btn:disabled { opacity: .5; }
.btn.start { font-size: 21px; min-height: 60px; }
.btns, .actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.actions .btn { flex: 1 1 auto; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: transparent; color: var(--ink-2); cursor: pointer; flex: none; }
.icon-btn:disabled { opacity: .3; }
.linkish { background: none; border: 0; color: var(--accent); font: inherit; padding: 6px 0; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 99px; padding: 8px 14px; font: inherit; font-family: var(--font-display); font-size: 15px; font-weight: 600; cursor: pointer; text-decoration: none; min-height: 42px; }
.chip .ic { width: 18px; height: 18px; color: var(--ink-2); }
.chip.hot { background: var(--hot); border-color: var(--hot-line); }
.chip.own { border-style: dashed; }
.chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.chip.static { cursor: default; font-family: var(--font-text); font-weight: 400; font-size: 15px; min-height: 34px; padding: 4px 12px; background: var(--surface-2); }
.chip.static.off { color: var(--muted); }
.chip.static.seek { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.badge { display: inline-block; font-family: var(--font-display); font-size: 13px; font-weight: 700; padding: 2px 10px;
  border-radius: 99px; border: 0; white-space: nowrap; vertical-align: 1px; }
.badge.info { color: var(--accent); background: var(--accent-soft); } .badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); } .badge.bad { color: var(--bad); background: var(--bad-soft); }
.badge.muted { color: var(--muted); background: var(--surface-2); }
.field, textarea, select { width: 100%; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-ctl); padding: 12px; margin: 4px 0 10px; }
.field.big { font-size: 23px; }
textarea { min-height: 110px; resize: vertical; }
label.check { display: flex; gap: 12px; align-items: center; margin: 8px 0; min-height: 44px; }
label.check input { width: 24px; height: 24px; flex: none; }
details { margin: 8px 0; }
summary { cursor: pointer; font-weight: 600; min-height: 36px; display: flex; align-items: center; gap: 6px; }
summary::marker { content: ""; }
summary::before { content: "›"; display: inline-block; transition: transform .15s; font-size: 21px; line-height: 1; color: var(--muted); }
details[open] > summary::before { transform: rotate(90deg); }

/* ---------------------------------------------------------------- cards, banners, lists */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 12px 0; box-shadow: var(--shadow); }
.card h2:first-child { margin-top: 2px; }
a.card { display: block; color: inherit; text-decoration: none; }
.card.user { background: var(--today); }
.banner { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--r-ctl); padding: 10px 12px; margin: 10px 0; font-size: 15px; text-decoration: none; color: var(--ink); }
.banner .ic { margin-top: 2px; }
.banner.warn { background: var(--warn-soft); } .banner.warn .ic { color: var(--warn); }
.banner.bad { background: var(--bad-soft); font-weight: 600; } .banner.bad .ic { color: var(--bad); }
.banner.info { background: var(--info-soft); } .banner.info .ic { color: var(--accent); }
.list { list-style: none; padding: 0; margin: 6px 0; }
.list li { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list li .ic { margin-top: 2px; color: var(--ink-2); }
.list .km { font-variant-numeric: tabular-nums; font-weight: 600; min-width: 64px; color: var(--ink-2); font-size: 15px; }
.list.plain li { align-items: center; }
.offtrip { min-width: 0; overflow-wrap: anywhere; } .offtrip .ic { vertical-align: -4px; } .offtrip .btn.small { margin-left: 6px; }
.statrow { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 6px 0 10px; }
.stat { display: flex; flex-direction: column; }
.stat b { font-family: var(--font-display); font-size: 23px; font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); }
.stat.wide b { font-size: 17px; }
.skeleton div { height: 22px; border-radius: var(--r-sm); margin: 14px 0; background: linear-gradient(90deg, var(--line), var(--surface-2), var(--line));
  background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton div:first-child { width: 40%; } .skeleton div:nth-child(2) { height: 34px; width: 80%; } .skeleton div:nth-child(3) { height: 180px; }
@keyframes shimmer { to { background-position: -200% 0; } }
img.map { width: 100%; height: auto; display: block; border-radius: var(--r-ctl); background: var(--line); margin: 10px 0; cursor: zoom-in; }

/* ---------------------------------------------------------------- Today, trips */
.hero { display: block; background: var(--surface); border-radius: var(--radius); padding: 16px; margin: 10px 0 16px;
  border: 1px solid var(--line); border-top: 4px solid var(--accent); box-shadow: var(--shadow); color: inherit; text-decoration: none; }
.hero h1 { font-size: 26px; }
.big-count { font-family: var(--font-display); font-size: 34px; font-weight: 700; margin: 4px 0; }
.nowcard { display: flex; align-items: center; gap: 10px; margin: 12px 0 4px; padding: 12px 14px; border-radius: var(--r-ctl);
  background: var(--accent-soft); color: var(--ink); text-decoration: none; font-weight: 600; }
.nowcard .grow { display: flex; flex-direction: column; gap: 2px; }
.tripcard, .dayrow { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px; margin: 10px 0; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.dayrow.today { background: var(--today); }
/* a day's row: the card is the day's link (its own pen is the editor's, beside it, ADR S7-13) */
.dayrow { padding: 0; gap: 0; }
.dayrow .daymain { flex: 1; min-width: 0; display: flex; gap: 12px; align-items: center; padding: 10px; color: inherit; text-decoration: none; }
.dayrow .daypen { align-self: center; margin: 0 4px 0 0; }
.thumb { width: 84px; height: 84px; border-radius: var(--r-ctl); object-fit: cover; background: var(--line); flex: none; }
.thumb.none { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.dayrow strong { display: block; line-height: 1.25; }
.dayrow .chev { color: var(--muted); }
/* the Route summary's extra numbers on the day's second line (ADR S7-13): sealed, the fuel gap, the problems */
.dayline { margin-top: 2px; }
.dayline .ic { width: 16px; height: 16px; vertical-align: -2px; }
/* the trip's own title and description, edited in place (the leader's pen, ADR S7-13) */
.triphead { display: flex; align-items: flex-start; gap: 8px; }
.triphead h1 { flex: 1; min-width: 0; }
.triphead .pen { margin-top: 2px; }
.tripsum { display: flex; align-items: flex-start; gap: 8px; color: var(--ink-2); }
.tripsum .pen { flex: none; margin-top: -2px; }
/* a trip's page: the gap after each day card, ＋ Add a day (js/addchoice.js, ADR S7-13): a thin dashed line with a small + in the
   middle. The button is 44px tall (D1) and its negative margins give it 24px of room between the cards, so the gap
   isn't heavy and a row's own edge still opens the row. From 900px wide with a mouse, the gaps show while the list is hovered. */
.addgap { position: relative; display: block; width: 100%; height: 44px; margin: -20px 0; padding: 0; border: 0; background: none;
  color: var(--muted); font: inherit; cursor: pointer; }
.addgap::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; border-top: 2px dashed var(--muted); opacity: .45; }
.addgap span { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--surface); border: 1px solid var(--line); font-family: var(--font-display); font-weight: 700; font-size: 21px; line-height: 1; }
.addgap:last-child { margin-bottom: -8px; }
.addgap:hover span, .addgap:focus-visible span { color: var(--accent); border-color: var(--accent); }
.addgap:focus-visible { outline: none; }
.addgap:focus-visible span { outline: 2px solid var(--accent); outline-offset: 2px; }
.addgap:disabled { cursor: default; }
.addgap:disabled span { opacity: .5; }
@media (min-width: 900px) and (hover: hover) {
  .addgap { opacity: 0; pointer-events: none; transition: opacity .15s; }
  .daylist:hover .addgap, .addgap:focus-visible { opacity: 1; pointer-events: auto; }
}
/* the choices after a day (js/addchoice.js): a sheet of big buttons, Cancel last */
.addchoices { display: flex; flex-direction: column; gap: 8px; padding: 6px 0 4px; }
.addchoice { width: 100%; min-height: 56px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; text-align: left; }
.addchoice strong { font-size: 17px; }
/* a trip's page: People, History, Edit trip, Offline map and Archive as rows of one card under the days (D16) */
.triprows { padding: 0; overflow: hidden; margin-top: 18px; }
.triprows details { margin: 0; }
.trow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 8px 16px; margin: 0;
  background: none; border: 0; border-radius: 0; color: var(--ink); font: inherit; font-family: var(--font-display); font-weight: 600; text-align: left; cursor: pointer; }
.trow .ic { flex: none; color: var(--ink-2); }
.trow .chev { color: var(--muted); transition: transform .15s; }
.trow .hint { font-family: var(--font-text); display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 15px; font-weight: 400; white-space: nowrap; }
.trow .hint .ic { width: 18px; height: 18px; }
.trow .hint .ok { color: var(--ok); }
.trow .hint .warn { color: var(--warn); }
.trow:disabled { opacity: .5; cursor: default; }
.triprows > :not(:first-child) { border-top: 1px solid var(--line); }          /* after .trow's border: 0 */
summary.trow::before { content: none; }
details[open] > summary.trow .chev { transform: rotate(90deg); }
.trow-body { padding: 0 16px 10px 48px; }
.trow-body > p:first-child { margin-top: 0; }
/* the route summary's day and camp cards (js/summary.js) */
.sumday { display: flex; gap: 10px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 10px 12px 14px; margin: 10px 0; color: inherit; text-decoration: none; box-shadow: var(--shadow); }
.sumday .grow { min-width: 0; }
.sumday strong { display: block; line-height: 1.25; margin: 2px 0 8px; }
.sumday .chev { color: var(--muted); flex: none; }
.sumstats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 10px; margin-bottom: 6px; }
.sumstats .stat b { font-family: var(--font-display); font-size: 19px; white-space: nowrap; }
.sumstats .stat span { line-height: 1.2; }
.sumflags { margin-top: 6px; }
.sumflags:empty { display: none; }
.sumflags .ic { width: 18px; height: 18px; vertical-align: -3px; }
.sumcamp h3 { margin: 4px 0 8px; font-size: 17px; line-height: 1.25; color: var(--ink); }
.sumcamp .night { display: flex; align-items: center; gap: 6px; min-height: 44px; margin: -6px 0 0; }  /* D1: tapped on the road */
.sumcamp .night .ic { width: 16px; height: 16px; flex: none; }
.sumcamp dl { margin: 0; }
.sumcamp dt { font-size: 13px; font-weight: 600; color: var(--muted); margin-top: 8px; }
.sumcamp dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.sumfuel .md p { margin: 6px 0; }

/* ---------------------------------------------------------------- start box and timeline */
.startbox { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 12px 0; }
.startbox .btn.start { flex: 1 1 100%; }
.startbox .whenrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.startbox .signal-note { flex: 1 1 100%; margin: 0; }
.startbox .btn.startwhen { font-variant-numeric: tabular-nums; }
.startwhen.plain { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; font-variant-numeric: tabular-nums; }
.startbox.started { background: var(--ok-soft); border-radius: var(--r-ctl); padding: 8px 8px 8px 12px; flex-wrap: nowrap; }
.startbox.started > div { flex: 1; }
.startbox.started .ic.ok { width: 24px; height: 24px; }
.startbox.quiet { margin: 6px 0; }
.tl { margin: 16px 0 6px; }
.tl-bar { position: relative; display: flex; gap: 2px; height: 28px; }
.tl-seg { border: 0; padding: 0 0 0 7px; min-width: 6px; border-radius: 4px; background: var(--ride); color: var(--on-fill);
  font: 700 13px/28px var(--font-display); text-align: left; cursor: pointer; position: relative; }
.tl-seg.brk { background: var(--brk); padding: 0; }
.tl-seg.on::after { content: ""; position: absolute; left: 2px; right: 2px; bottom: -7px; height: 3px; border-radius: 2px; background: var(--ink); }
.tl-seg:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.tl-now { position: absolute; top: -5px; bottom: -5px; width: 3px; margin-left: -1px; background: var(--ink); border-radius: 2px;
  box-shadow: 0 0 0 2px var(--surface); pointer-events: none; }
.tl-now[hidden] { display: none; }
.tl-axis { font-family: var(--font-display); font-weight: 600; display: flex; justify-content: space-between; align-items: center; margin-top: 10px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.tl-legend { color: var(--muted); font-size: 13px; }
.tl-legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 8px; vertical-align: -1px; }
.sw.ride { background: var(--ride); } .sw.brk { background: var(--brk); }

/* ---------------------------------------------------------------- the day */
.dayhead { padding-bottom: 4px; }
.cardnav { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 2px; }
.dots { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: center; }
.dot { width: 12px; height: 12px; border-radius: 50%; border: 0; padding: 0; background: var(--line); cursor: pointer; }
.dot.on { background: var(--accent); width: 26px; border-radius: 6px; }
.dot.end { width: auto; height: auto; background: none; color: var(--muted); display: inline-flex; padding: 2px; }
.dot.end .ic { width: 18px; height: 18px; }
.dot.end.on { color: var(--accent); }
.cards { display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; padding: 6px 14px 10px;
  margin: 0 -14px; scrollbar-width: none; align-items: flex-start; transition: height .25s ease; overscroll-behavior-x: contain;
  position: relative; }   /* the cards' offsetLeft (js/day.js, the carousel) counts from here, not the page edge */
.cards::-webkit-scrollbar { display: none; }
.lcard { flex: 0 0 calc(100% - 24px); scroll-snap-align: center; scroll-snap-stop: always; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; box-shadow: var(--shadow); min-width: 0; }
.lc-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.lc-no { font-family: var(--font-display); font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; display: inline-flex; gap: 4px; align-items: center; }
.lc-head .lc-style { margin-right: auto; }                   /* a leg that rides in its own style (ADR S7-18) */
.lc-when { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; display: inline-flex; gap: 4px; align-items: center; }
.lc-when .ic { width: 17px; height: 17px; color: var(--muted); }
.lc-title { font-family: var(--font-display); font-size: 23px; margin: 6px 0 4px; line-height: 1.2; }
.lc-title .arrow { color: var(--muted); font-weight: 400; }
.lc-figs { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 15px; color: var(--ink-2); }
.lc-figs b { font-family: var(--font-display); font-size: 19px; color: var(--ink); }
.lc-here { margin: 10px 0 0; padding: 8px 12px; border-radius: var(--r-ctl); background: var(--accent-soft); font-weight: 600; font-size: 15px;
  display: flex; gap: 8px; align-items: center; }
.lc-here[hidden] { display: none; }
.lc-sec { margin: 14px 0 0; }
.lc-sec.ask { border-top: 1px solid var(--line); padding-top: 12px; }
.wz { display: flex; flex-direction: column; gap: 6px; }
.wz-btn { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 6px 12px; border-radius: var(--r-ctl); background: var(--surface-2);
  color: var(--ink); text-decoration: none; font-family: var(--font-display); font-weight: 600; border: 1px solid var(--line); }
.wz-btn .n { display: inline-flex; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  align-items: center; justify-content: center; font-size: 15px; flex: none; }
.wz-btn.via .n { background: var(--muted); }
.wz-btn .ext { margin-left: auto; color: var(--muted); width: 17px; height: 17px; }
details.turns ol { list-style: none; padding: 0; margin: 4px 0; font-size: 15px; }
details.turns li { display: flex; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--line); }
details.turns .km { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 44px; text-align: right; }
.lc-brk { margin: 16px -16px -16px; padding: 14px 16px 12px; border-top: 4px solid var(--brk); background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius); }
.lc-brk .brk-head { display: flex; gap: 12px; align-items: center; }
.lc-brk .brk-ic { width: 44px; height: 44px; border-radius: var(--r-ctl); background: var(--hot); display: flex; align-items: center; justify-content: center; flex: none; }
.lc-brk .brk-ic .ic { width: 24px; height: 24px; }
.lc-brk .brk-title { font-family: var(--font-display); font-weight: 700; font-size: 19px; }
.lc-brk .offers li { font-size: 15px; }
.lc-brk .brk-move { display: inline-flex; align-items: center; min-height: 44px; margin-top: 2px; font-size: 15px; font-weight: 600; }   /* an editor moves the break the engine chose (ADR S7-18) */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 12px 0; font-size: 15px; }
.fact { display: contents; }
.fact dt { font-weight: 600; color: var(--ink-2); }
.fact dd { margin: 0; }
.fact.unknown dd { color: var(--warn); font-weight: 600; }
.lcard.end { border-top: 4px solid var(--ok); }
.titlerow { display: flex; align-items: center; gap: 2px; min-height: 44px; margin: 0 0 2px; }
.titlerow .rowend { display: flex; align-items: center; gap: 2px; margin-left: auto; }
.daycount { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: var(--muted); }
.more h2 { font-size: 17px; }
.more-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 4px 14px; margin: 8px 0; }

/* ---------------------------------------------------------------- composer, planner */
.about { margin: 0 0 4px; color: var(--ink-2); font-weight: 600; }
.cmp-box { border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 4px 8px 8px; background: var(--surface); }
.cmp-box textarea { border: 0; margin: 0; padding: 8px 4px; min-height: 120px; font-size: 17px; background: transparent; }
.cmp-box textarea:focus { outline: none; }
.cmp-box:focus-within { border-color: var(--accent); }
.cmp-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn.mic { min-height: 46px; border-radius: 99px; }
.btn.mic.live, #jobMic.live { background: var(--bad); border-color: var(--bad); color: var(--on-fill); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--bad) 15%, transparent); } }
.chip.loc .loc-text { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-voice { padding: 4px; font-style: italic; }
.cmp-voice .lvl { display: inline-block; width: 48px; height: 6px; margin-right: 8px; vertical-align: middle;
  border-radius: 3px; background: var(--line); overflow: hidden; }
.cmp-voice .lvl i { display: block; height: 100%; width: 0; background: var(--bad); transition: width .1s linear; }
.btn.mic:disabled, #jobMic:disabled { opacity: .7; }
.cmp-extra { display: flex; flex-direction: column; gap: 2px; }
.cmp-prompt { white-space: pre-wrap; font-size: 13px; background: var(--surface-2); padding: 10px; border-radius: var(--r-ctl); margin: 6px 0; }
.queued { border-left: 4px solid var(--warn); }
.job-title { font-family: var(--font-display); font-size: 21px; flex: 1; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.tool { font-size: 15px; font-family: var(--font-mono); margin: 3px 0; overflow-wrap: anywhere; display: flex; gap: 6px; flex-wrap: wrap; }
.tool .ic { width: 16px; height: 16px; }
.tool.failed { color: var(--bad); }
.note { color: var(--warn); margin: 6px 0; }
.turn-foot { margin: 10px 0 16px; }
.working::after { content: "…"; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------------------------------------------------------------- overlays */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabs-h) + 14px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: var(--radius); font-size: 15px; z-index: 70;
  box-shadow: var(--shadow-float); max-width: calc(100% - 24px); width: max-content; }
.toast a { color: inherit; font-weight: 700; margin-left: 8px; }
.toast[hidden] { display: none; }
.sheet-wrap { position: fixed; inset: 0; z-index: 50; }
.sheet-bg { position: absolute; inset: 0; background: var(--scrim); opacity: 0; transition: opacity .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; background: var(--surface);
  border-radius: var(--r-sheet) var(--r-sheet) 0 0; padding: 0 16px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%);
  transition: transform .22s ease; max-width: 760px; margin: 0 auto; overscroll-behavior: contain; }
.sheet-wrap.open .sheet { transform: none; }
.sheet-wrap.open .sheet-bg { opacity: 1; }
.sheet-head { position: sticky; top: 0; z-index: 2; background: var(--surface); display: flex; align-items: center; gap: 8px; padding: 18px 0 6px; }
.sheet-head h2 { margin: 0; flex: 1; font-family: var(--font-display); font-size: 21px; }
.sheet-head .grip { position: absolute; left: 50%; top: 7px; width: 42px; height: 5px; border-radius: 3px; background: var(--line); transform: translateX(-50%); }
.lightbox { position: fixed; inset: 0; z-index: 60; background: var(--photo-bg); opacity: 0; transition: opacity .15s; }
.lightbox.open { opacity: 1; }
.lb-scroll { position: absolute; inset: 0; overflow: auto; display: flex; align-items: center; justify-content: center; }
.lb-scroll img { max-width: 100%; max-height: 100%; display: block; }
.lb-scroll.zoomed { display: block; }
.lb-scroll.zoomed img { max-width: none; max-height: none; width: 260%; }
.lb-close { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; z-index: 2; background: var(--scrim-strong);
  color: var(--on-fill); border: 0; border-radius: 50%; width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.lb-hint { position: absolute; bottom: calc(18px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); color: var(--on-fill);
  background: var(--scrim-strong); padding: 6px 14px; border-radius: 99px; font-size: 15px; white-space: nowrap; }

/* ---------------------------------------------------------------- the map and the panel (ADR S7-06, D10, D13, D14)
   js/stage.js draws the map into #stage; js/panel.js sets body.mapmode, --head-h (the header) and --panel-h (the
   panel's height on a phone). Outside map mode (account, people, signed out) the panel is a plain block. */
.stage { position: fixed; left: 0; right: 0; top: var(--head-h, 52px); bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
  z-index: 1; background: var(--surface-2); }
.stage[hidden], body:not(.mapmode) .stage { display: none; }
.stage-map, .stage .stage-map.maplibregl-map { position: absolute; inset: 0; }   /* maplibre-gl.css sets relative */
.stage-note { position: absolute; top: 10px; left: 10px; right: 64px; z-index: 3; background: var(--surface); color: var(--ink);
  font-size: 15px; border-radius: var(--r-ctl); padding: 8px 12px; box-shadow: var(--shadow); }
.stage-note[hidden] { display: none; }
.stage .maplibregl-ctrl-group button { width: 44px; height: 44px; }
/* The map's credit (ODbL) stays in sight above the panel: stage.js keeps --cover-bottom at the px the panel covers. */
.stage .maplibregl-ctrl-bottom-right, .stage .maplibregl-ctrl-bottom-left { bottom: var(--cover-bottom, 0px); }
.stage .maplibregl-ctrl.maplibregl-ctrl-attrib { font-size: 12px; background: var(--attrib-bg); }
@media (min-width: 900px) { body.mapmode .stage-note { left: 450px; } }   /* beside the panel's column, not under it */
/* The router still working out the reach donut (ADR S7-11): a small chip at the top of the map, with a turning ring. */
.stage-busy { position: absolute; top: 10px; left: 10px; z-index: 3; display: flex; align-items: center; gap: 8px; background: var(--surface);
  color: var(--ink); font-size: 15px; border-radius: 99px; padding: 6px 12px; box-shadow: var(--shadow); pointer-events: none; }
.stage-busy::before { content: ""; width: 12px; height: 12px; border: 2px solid var(--accent); border-right-color: transparent;
  border-radius: 50%; animation: turn .8s linear infinite; }
.stage-busy[hidden] { display: none; }
@keyframes turn { to { rotate: 360deg; } }
@media (prefers-reduced-motion: reduce) { .stage-busy::before { animation: none; } }
@media (min-width: 900px) { body.mapmode .stage-busy { left: 450px; } }
.stage-locate, .stage-lock, .stage-whole { display: flex; align-items: center; justify-content: center; color: var(--ink-2); }
.stage-locate .ic, .stage-locate svg, .stage-lock .ic, .stage-whole .ic { width: 22px; height: 22px; }
.stage-locate.on, .stage-lock.on { color: var(--accent); }
@media (prefers-color-scheme: dark) {   /* the map stays light; its buttons and credit turn dark with the page */
  .stage .maplibregl-ctrl-group { background: var(--surface-2); box-shadow: 0 0 0 1px var(--line); }
  .stage .maplibregl-ctrl-group button + button { border-top-color: var(--line); }
  .stage .maplibregl-ctrl-group .maplibregl-ctrl-icon { filter: invert(1) brightness(1.6); }
  .stage-locate, .stage-lock, .stage-whole { color: var(--ink); }
  .stage .maplibregl-ctrl.maplibregl-ctrl-attrib, .stage .maplibregl-ctrl-attrib a { color: var(--muted); }
}
.me-dot { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); border: 3px solid var(--on-fill); box-sizing: border-box;
  box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 22%, transparent); pointer-events: none; }
/* The ring's element is a map marker, which MapLibre moves with transform: the ring that scales is its ::after. */
.pulse-ring { width: 30px; height: 30px; pointer-events: none; }
.pulse-ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 3px solid var(--accent); box-sizing: border-box;
  animation: pulse-ring 1.2s ease-out 2 both; }
@media (prefers-reduced-motion: reduce) { .pulse-ring::after { animation: none; } }
@keyframes pulse-ring { from { scale: .6; opacity: 1; } to { scale: 1.6; opacity: 0; } }

[data-pt] { cursor: pointer; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background-color: var(--accent-soft); } to { background-color: transparent; } }

body.mapmode { overflow: hidden; padding-bottom: 0; }
#grip { display: none; }
#panel main { min-height: 0; }

/* Phones: a panel along the bottom over the map, three heights (js/panel.js sets --panel-h). */
@media (max-width: 899.98px) {
  body.mapmode #panel { position: fixed; left: 0; right: 0; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
    height: var(--panel-h, 55dvh); z-index: 10; background: var(--bg); border-radius: var(--r-sheet) var(--r-sheet) 0 0;
    box-shadow: var(--shadow-up); display: flex; flex-direction: column; transition: height .25s ease; }
  body.mapmode #panel.dragging { transition: none; }
  body.mapmode #grip { display: flex; align-items: center; justify-content: center; flex: none; width: 100%; height: 44px; padding: 0;
    background: transparent; border: 0; cursor: grab; touch-action: none; }
  body.mapmode #grip[hidden] { display: none; }
  #grip span { display: block; width: 42px; height: 5px; border-radius: 3px; background: var(--muted); }
  #grip:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; border-radius: var(--r-sheet) var(--r-sheet) 0 0; }
  #panel.dragging #grip { cursor: grabbing; }
  body.mapmode #panel main { flex: 1; overflow-y: auto; overscroll-behavior: contain; max-width: none; margin: 0; padding: 0 14px 24px; }
}
@media (max-width: 899.98px) and (prefers-color-scheme: dark) {
  body.mapmode #panel { box-shadow: none; border-top: 1px solid var(--line); }
}

/* Wide screens: a 440px column down the left, from the header to the tabs. */
@media (min-width: 900px) {
  body.mapmode #panel { position: fixed; top: var(--head-h, 52px); bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom));
    left: 0; width: 440px; height: auto; z-index: 10; background: var(--bg); border-right: 1px solid var(--line);
    display: flex; flex-direction: column; }
  body.mapmode #grip { display: none; }
  body.mapmode #panel main { flex: 1; overflow-y: auto; overscroll-behavior: contain; max-width: none; margin: 0; padding: 12px 16px 24px; }
  body.mapmode .cards { margin: 0 -16px; padding: 6px 16px 10px; }
}
/* The day cards keep negative side margins equal to the panel's padding, so they stay centred and whole (D6, D7). */
@media (min-width: 700px) and (max-width: 899.98px) {
  body.mapmode .cards { margin: 0 -14px; padding: 6px 14px 10px; }
}

/* ---------------------------------------------------------------- rendered markdown */
.md { overflow-wrap: anywhere; }
.md h1 { font-size: 23px; } .md h2 { font-size: 19px; border-top: 1px solid var(--line); padding-top: 14px; } .md h3 { font-size: 17px; color: var(--ink); }
.md img { max-width: 100%; height: auto; border-radius: var(--r-ctl); cursor: zoom-in; }
.md .table { overflow-x: auto; }
.md table { border-collapse: collapse; font-size: 15px; min-width: 100%; }
.md th, .md td { border-bottom: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top;
  overflow-wrap: normal; }   /* words stay whole: a wide table scrolls in its own box (.md .table) */
.md pre { overflow-x: auto; background: var(--surface-2); padding: 10px; border-radius: var(--r-sm); }
.md pre code { background: none; padding: 0; }
.md li { margin: 3px 0; }
.md blockquote { margin: 8px 0; padding: 2px 12px; border-left: 4px solid var(--line); color: var(--muted); }
.md.reply { background: var(--surface); border-radius: var(--r-ctl); padding: 4px 14px; border: 1px solid var(--line); }
a.ext::after { content: " ↗"; font-size: .85em; }

/* The user guide (js/help.js): the topics down the left, the topic search above the article (D17). On a phone the
   menu is behind the Topics button; from 900px wide it stands beside the article. */
body.helpscreen main { max-width: 1000px; }
.helpwrap { display: grid; grid-template-columns: minmax(0, 1fr); }
.helptop { display: flex; gap: 10px; align-items: flex-start; margin: 0 0 12px; }
.helptopics { flex: none; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.helptopics[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.helpsearch { flex: 1; min-width: 0; }
.helpsearch input { width: 100%; font: inherit; font-size: 17px; padding: 11px 14px; min-height: 44px;
  border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.helpsearch input:disabled { color: var(--muted); }
.helpsearch input::placeholder { color: var(--muted); }
.helpfind { margin-top: 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface);
  overflow: hidden; box-shadow: var(--shadow); }
.helpfindrow { display: block; padding: 10px 12px; border-top: 1px solid var(--line); text-decoration: none; color: var(--ink); }
.helpfindrow:first-child { border-top: 0; }
.helpfindrow:hover, .helpfindrow:focus-visible { background: var(--surface-2); }
.helpfindt { display: block; font-weight: 700; font-size: 17px; color: var(--accent); }
.helpfinds { display: block; margin-top: 2px; color: var(--muted); font-size: 15px; line-height: 1.35; }
.helpnone { margin: 10px 12px; }
.helpside { display: none; }
.helpside.open { display: block; margin: 0 0 14px; }
.helpnav { list-style: none; margin: 0; padding: 0; }
.helpnav > li { margin: 2px 0; }
.helpnav a { display: flex; align-items: center; min-height: 44px; padding: 6px 10px; border-radius: 12px;
  color: var(--ink-2); text-decoration: none; font-weight: 600; }
.helpnav a:hover, .helpnav a:focus-visible { background: var(--surface-2); }
.helpnav a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.helpsubs { list-style: none; margin: 0 0 6px; padding: 0; }
.helpsubs a { min-height: 44px; padding: 4px 10px 4px 24px; font-size: 15px; font-weight: 400; }
.helpsubs a[aria-current] { background: none; color: var(--accent); font-weight: 600; }
@media (min-width: 900px) {
  .helpwrap { grid-template-columns: 250px minmax(0, 1fr); grid-template-areas: "side top" "side art"; column-gap: 32px; }
  .helptop { grid-area: top; }
  .helpside, .helpside.open { display: block; grid-area: side; margin: 0; position: sticky; top: calc(52px + 20px);
    align-self: start; max-height: calc(100vh - 96px); overflow-y: auto; padding-right: 4px; }
  .helptopics { display: none; }
  .helpwrap > .md.help { grid-area: art; }
}

/* Wide screens: one whole card at a time. Peeking neighbours (as on the phone) showed as cropped slices here, since
   the strip takes the current card's height; the arrows, dots, keys and swipes move between cards. */
@media (min-width: 700px) {
  .cards { margin: 0 -4px; padding: 6px 4px 10px; gap: 28px; }
  .lcard { flex-basis: 100%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }


/* ------------------------------------------------------------------ Twisty: sign-in, account, people */
.wrap { max-width: 600px; margin: 0 auto; padding: 16px 14px; }
body.signedout main { max-width: 600px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
body.signedout.helpscreen main { max-width: 1000px; }   /* the guide's two columns (D17) */
body.signedout { padding-bottom: 0; }
label { display: block; font-weight: 600; font-size: 15px; margin: 14px 0 6px; }
input[type="email"], input[type="text"], input[inputmode="numeric"] { width: 100%; font: inherit; font-size: 17px;
  padding: 12px 14px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
select { font: inherit; font-size: 17px; padding: 10px 12px; border-radius: var(--r-ctl); border: 1px solid var(--line);
  background: var(--surface-2); color: var(--ink); min-height: 48px; }
#inv-role { width: 100%; }
.pick { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-weight: 600; font-size: 15px; }
.pick select { min-height: 40px; padding: 6px 10px; font-size: 15px; }
select:focus-visible, input:focus-visible, .btn:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
input.code { letter-spacing: .3em; font-variant-numeric: tabular-nums; font-size: 26px; text-align: center; }
.check { display: flex; gap: 10px; align-items: center; font-weight: 400; margin-top: 14px; }
.check input { width: 22px; height: 22px; }

.btn.danger { color: var(--bad); }
.btn.danger:disabled { color: var(--muted); }

/* Trips: the folded Archived and Recently deleted lists (ADR S7-09) */
details.fold { margin: 22px 0 10px; }
details.fold > summary { font-family: var(--font-display); font-size: 19px; font-weight: 700; min-height: 44px; }
.deleted { list-style: none; margin: 0; padding: 0; }
.deleted li { display: flex; gap: 12px; align-items: center; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 10px 14px; margin: 10px 0; box-shadow: var(--shadow); min-height: 64px; }
.deleted .btn { flex: none; }
.deleted .restoring { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.btn.block { width: 100%; }
.actions.tight { margin-top: 10px; }

.msg { border-radius: var(--r-ctl); padding: 10px 14px; margin: 12px 0; font-size: 15px; }
.msg.bad { background: var(--bad-soft); color: var(--bad); }
.msg.ok { background: var(--ok-soft); color: var(--ok); }
.msg.info { background: var(--accent-soft); color: var(--ink); }

.people { list-style: none; margin: 0; padding: 0; }
.people li { border-top: 1px solid var(--line); padding: 14px 0; }
.people li:first-child { border-top: 0; padding-top: 0; }
.people .who { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.people .name { font-weight: 600; }
.people .email { color: var(--muted); font-size: 15px; word-break: break-all; }
.chip.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.chip.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.chip.role { background: transparent; }
.chip.role.admin { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.status { font-size: 15px; color: var(--ink-2); margin-top: 4px; }

/* The invite code card (ADR S7-20): always black on white, so it scans in dark mode too. */
.qrcard { text-align: center; }
.qrwrap { display: flex; justify-content: center; margin: 14px 0 12px; }
.qrwrap svg { width: min(260px, 70vw); height: auto; border-radius: 8px; }
.qrcard .actions { justify-content: center; }
.qrl { display: block; margin: 0 auto; max-width: 100%; padding: 8px 10px; border-radius: 8px; background: var(--surface-2);
  color: var(--muted); font-size: 13px; word-break: break-all; text-align: left; }

.keys { list-style: none; margin: 0; padding: 0; }
.keys li { display: flex; align-items: center; gap: 10px; justify-content: space-between; border-top: 1px solid var(--line);
  padding: 10px 0; }
.keys li:first-child { border-top: 0; }
h1[tabindex="-1"]:focus { outline: none; }

/* ------------------------------------------------------------------ route sketches and the map (ADR S7-03) */
.sketch { display: block; width: 100%; height: 100%; }
.sketch polyline { fill: none; stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.sketch circle { stroke: var(--surface); stroke-width: 1.5; }
.sketch circle.from { fill: var(--accent); }
.sketch circle.to { fill: var(--ok); }
.thumb .sketch { padding: 4px; }

/* maplibre-gl.css loads after this file, so these need the extra class to win */
.maplibregl-popup .maplibregl-popup-content { font: 15px var(--font-text); color: var(--ink); background: var(--surface); }
.maplibregl-popup[class*="anchor-top"] .maplibregl-popup-tip { border-bottom-color: var(--surface); }
.maplibregl-popup[class*="anchor-bottom"] .maplibregl-popup-tip { border-top-color: var(--surface); }
.maplibregl-popup[class*="anchor-left"] .maplibregl-popup-tip { border-right-color: var(--surface); }
.maplibregl-popup[class*="anchor-right"] .maplibregl-popup-tip { border-left-color: var(--surface); }

/* ------------------------------------------------------------------ sharing, history, editing (ADR S7-07) */
.role { display: flex; align-items: center; gap: 6px; margin: 2px 0 8px; color: var(--ink-2); font-weight: 600; }
.signal-note[hidden] { display: none; }
.share strong { font-size: 19px; }
.share .actions .btn { flex: 1 1 120px; }
.jobbar { position: sticky; top: 0; z-index: 3; }
.jobbar:empty { display: none; }
/* The route check's status line (ADR S7-13): a row only when there's something to say; info, warning or error */
.statusline { display: flex; align-items: center; gap: 8px; border-radius: var(--r-ctl); padding: 8px 12px; margin: 8px 0; font-size: 15px; }
.statusline .ic { flex: none; }
.statusline span { flex: 1; min-width: 0; }
.statusline .btn { flex: none; min-height: 44px; }
.statusline.info { background: var(--info-soft); }
.statusline.info .ic { color: var(--accent); }
.statusline.warn { background: var(--warn-soft); }
.statusline.warn .ic { color: var(--warn); }
.statusline.bad { background: var(--bad-soft); font-weight: 600; }
.statusline.bad .ic { color: var(--bad); }
/* The day's pen, opening its card in place on the trip's page (ADR S7-13): the same fields Edit trip had, without the points */
.dayedit { border-color: var(--accent); }
.dayedit .eyebrow { margin: 2px 0 4px; }
.dayedit h2 { margin: 2px 0 8px; }
.dayedit .actions { margin-top: 8px; }
/* The trip's name or description, edited in place (ADR S7-13): the form in the card, Save and Cancel under it */
.textedit { margin: 8px 0 12px; }
.textedit label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.textedit .actions { margin-top: 6px; }
.history { list-style: none; margin: 0; padding: 0; }
.history > li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-ctl); padding: 12px 14px; margin: 10px 0; }
.history .who { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.lines { list-style: none; margin: 6px 0 0; padding: 0; }
.lines li { padding: 2px 0; font-size: 15px; overflow-wrap: anywhere; }
.change.undone .lines { text-decoration: line-through; color: var(--muted); }
.editday { padding: 6px 16px; }
.editday summary { min-height: 44px; font-weight: 600; }
.editbody { padding-bottom: 8px; }
.fieldrow { display: flex; flex-wrap: wrap; gap: 0 10px; }
.fieldrow > div { flex: 1 1 150px; min-width: 0; }
input[type="date"], input[type="time"] { width: 100%; min-height: 48px; font: inherit; font-size: 17px; padding: 10px 14px; border-radius: var(--r-ctl);
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.pts { list-style: none; margin: 4px 0 0; padding: 0; }
.pts li { display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 5px 0; border-top: 1px solid var(--line); }
.pts .n { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-2); color: var(--ink-2); font-size: 13px; font-weight: 600; }
.pts .grow { overflow-wrap: anywhere; }
.pts .grow .chip { margin-left: 8px; }
.pts .ops { display: flex; flex: none; gap: 6px; }
.pts .ops .btn { min-width: 44px; padding: 4px 8px; }
.people .actions .btn.small, .history .actions .btn.small { flex: 0 0 auto; }
.jobbar:not(:empty) { background: var(--bg); }

/* ---------------------------------------------------------------- road surfaces (Account) */
.surface-row { margin: 12px 0; }
.surface-label { font-weight: 600; margin-bottom: 6px; }
.levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.btn.level { min-height: 48px; padding: 4px 4px; font-size: 15px; line-height: 1.2; overflow-wrap: anywhere; }

/* ---------------------------------------------------------------- Edit on map (ADR S7-08; js/draw.js, js/stage.js) */
button[data-edit-map]:disabled { display: none; }            /* hidden while offline: dom.js gateOnline disables data-online buttons */
.drawtop { display: flex; align-items: center; gap: 8px; margin: 4px 0; }
.drawtop h1 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 21px; }
.drawday { margin: 10px 0 4px; color: var(--ink-2); font-weight: 600; }
.drawnums { margin: 6px 0; font-family: var(--font-display); font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; min-height: 28px; }
.drawnums.changed { color: var(--accent); }
.drawnums .over { color: var(--warn); }                 /* a day over the riders' most hours (ADR S7-11) */
.drawhelp { margin: 8px 0; padding-left: 20px; color: var(--ink-2); font-size: 15px; }
.drawhelp li { margin: 3px 0; }
.drawmsg:empty { display: none; }
.drawtop .drawactions { flex: 0 0 auto; flex-wrap: nowrap; margin: 0; }
.drawactions .btn { min-width: 76px; min-height: 48px; padding: 8px 12px; }
.drawcard .msg { margin: 6px 0; }
/* The map in edit mode: the browser leaves touches to the script, which picks things up on a hold. */
.stage.drawing .maplibregl-canvas-container, .stage.drawing .maplibregl-canvas { touch-action: none !important;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.draw-handle { position: absolute; left: 0; top: 0; width: 32px; height: 32px; margin: -16px 0 0 -16px; border-radius: 50%; background: var(--on-fill);
  border: 5px solid var(--accent); box-sizing: border-box; box-shadow: var(--shadow-float); pointer-events: none; z-index: 4; }
.draw-handle[hidden] { display: none; }
.draw-handle.dim { opacity: .55; border-color: var(--ctx); }
.drawmenu-bg { position: fixed; inset: 0; z-index: 29; }
.drawmenu { position: fixed; z-index: 30; width: min(260px, calc(100vw - 16px)); display: flex; flex-direction: column; gap: 6px; padding: 8px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-float); }
.drawmenu .btn { width: 100%; min-height: 48px; }
.drawmenu-title { font-weight: 600; font-size: 15px; padding: 2px 6px; color: var(--ink-2); overflow-wrap: anywhere; }
.drawmenu-note { margin: 0; padding: 2px 6px 4px; font-size: 15px; }
.drawmenu.asheet { width: auto; border-radius: var(--radius) var(--radius) 0 0; }
/* a leg's riding style (ADR S7-18): the section under the route menu's choices, four styles in two rows, the leg's own marked */
.drawmenu-sec { border-top: 1px solid var(--line); margin-top: 4px; padding-top: 6px; }
.drawmenu-styles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.drawmenu .drawmenu-styles .btn { padding: 8px 4px; }
.drawmenu .btn.on { background: var(--accent-soft); color: var(--accent); font-weight: 700; box-shadow: inset 0 0 0 2px var(--accent); }

/* ---------------------------------------------------------------- New trip, Add a day (ADR S7-09; js/newtrip.js) */
.newcard .fieldrow { margin: 0; }
.newcard .fieldrow label { margin: 4px 0 2px; font-size: 13px; }
.newcard .fieldrow input { min-height: 44px; padding: 8px 12px; font-size: 17px; margin: 0; }
.newcard .newfields { gap: 0 10px; }
.newcard .newopts > summary { min-height: 44px; display: flex; align-items: center; color: var(--muted); }
/* One card per place, in order (js/newtrip.js): the place in hand open, the places picked done, the one to come waiting. */
.picksteps { list-style: none; margin: 8px 0 12px; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.pickstep { display: flex; gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.pickstep[data-state="open"] { box-shadow: inset 0 0 0 2px var(--accent); }
.pickstep[data-state="pending"] { background: transparent; opacity: .55; }
.pickstep-no { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--surface-2); color: var(--ink-2); font-family: var(--font-display); font-size: 13px; font-weight: 600; }
.pickstep[data-state="open"] .pickstep-no { background: var(--accent-soft); color: var(--accent); }
.pickstep[data-state="done"] .pickstep-no { background: var(--ok-soft); color: var(--ok); }
.pickstep-body { flex: 1 1 auto; min-width: 0; }
.pickprompt { margin: 0; font-family: var(--font-display); font-size: 19px; font-weight: 700; }
.pickstep-hint { margin: 2px 0 0; font-size: 15px; color: var(--muted); }
.pickstep-title { margin: 0; font-family: var(--font-display); font-size: 17px; font-weight: 600; }
.pickstep-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pickstep-value { margin: 0; min-width: 0; flex: 1 1 auto; font-family: var(--font-display); font-size: 19px; font-weight: 700; overflow-wrap: anywhere; }
.pickstep-k { color: var(--muted); font-family: var(--font-text); font-size: 15px; font-weight: 400; }
.pickstep .btn { width: 100%; min-height: 48px; margin-top: 8px; }
.pickstep .btn.small { width: auto; min-height: 44px; margin: 0; flex: 0 0 auto; }
.pickstep .switch { margin-top: 8px; }
.pickstep.pickopts { display: block; padding: 0; }
.pickopts summary { padding: 0 12px; cursor: pointer; }
.pickopts .newfields { padding: 0 12px 12px; }
.switch { margin: 0; flex: 0 0 auto; }
.switch[hidden] { display: none; }
.pickextra { margin: 4px 0; }
.pickextra:empty { display: none; }
.pickextra .btn { width: 100%; min-height: 48px; }
.pickstart { margin: 0; }
.pickerr:empty { display: none; }
.newcard .pickerr .msg { margin: 6px 0; }
.newcard .drawtop h1 { font-size: 21px; }
.editlast { border-color: var(--ok); }
.editlast .lastline { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.editday .actions .btn.danger { flex: 0 1 auto; }
.newcard .btn[hidden], .newcard .actions[hidden] { display: none; }
.drawextra { margin: 4px 0; }
.drawextra .btn { min-height: 48px; }
.drawextra .btn[hidden] { display: none; }

/* ---------------------------------------------------------------- Routing for good roads (ADR S7-10) */
.drawways { margin: 6px 0; }
.drawways[hidden] { display: none; }
.drawways-title { font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 2px 0 4px; }
.drawways .btn.way { display: block; width: 100%; min-height: 48px; margin: 0 0 6px; text-align: left; overflow-wrap: anywhere; border-style: dashed; color: var(--accent); }
/* The riding style picker (ADR S9-01; scene.js stylePicker): four radios as one segmented control, equal widths, with the
   chosen style's hint under it. The radio itself is hidden but stays focusable; the label is the target (44 px high). */
.stylepick { margin: 8px 0; padding: 0; border: 0; min-width: 0; }
.stylepick legend { padding: 0; margin: 0 0 4px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.stylepick .segs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); border-radius: var(--r-ctl);
  background: var(--surface); overflow: hidden; }
.stylepick .seg { position: relative; margin: 0; display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 4px 2px;
  text-align: center; font-family: var(--font-display); font-size: 15px; font-weight: 600; line-height: 1.2; color: var(--ink-2); cursor: pointer; }
.stylepick .seg + .seg { border-left: 1px solid var(--line); }
.stylepick .seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: inherit; }
.stylepick .seg:has(input:checked) { background: var(--accent-soft); color: var(--accent); font-weight: 700; box-shadow: inset 0 0 0 2px var(--accent); }
.stylepick .seg:has(input:focus-visible) { outline: 2px dashed var(--ink); outline-offset: -6px; }   /* not the selection's look */
@media (max-width: 359px) {   /* narrow phones (320 px): two rows of two, so every name fits on one line */
  .stylepick .segs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stylepick .seg:nth-child(3) { border-left: 0; }
  .stylepick .seg:nth-child(n+3) { border-top: 1px solid var(--line); }
}
.stylepick:disabled .seg { opacity: .55; cursor: default; }
.stylepick .stylehint { margin: 4px 0 0; min-height: 1.45em; }
/* "2 legs have their own style" and Use the day's style everywhere, under the picker (ADR S7-18) */
.legsnote { margin: 4px 0 8px; padding: 0; border: 0; min-width: 0; }
.legsnote[hidden] { display: none; }
.legsnote p { margin: 0 0 6px; }
.legsnote .btn { min-height: 48px; }
.legsnote:disabled .btn { opacity: .55; }
.movednote { margin: 8px 0; }

/* Gravel on a day (ADR S9-01): the note with Take the sealed way, and the line for gravel routed round */
.gravelnote .actions { margin: 8px 0 0; }
.gravelnote .actions .btn { flex: 0 1 auto; }
.gravelnote .signal-note { margin: 6px 0 0; }
.gravelnote .msg { margin: 8px 0 0; }
.gravelrouted { margin: 6px 0; }
