/* carsoft UI: one stylesheet, mobile first, no framework. docs/ui.md lists the tokens and components.
   Tokens on :root (light), redefined for dark under prefers-color-scheme. Components next, then page sections. */
:root {
  color-scheme: light dark;
  /* spacing */ --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px;
  /* type */ --fs-title: 1.5rem; --fs-section: 1.125rem; --fs-body: 1rem; --fs-small: .875rem;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  /* shape */ --radius: 8px; --pill: 999px; --border: 1px solid var(--line); --control: 44px;
  /* colour: AA in both schemes */
  --bg: #f6f6f3; --surface: #ffffff; --surface-2: #f0f0ec; --text: #1d1f21; --muted: #5d6166;
  --line: #d6d6d0; --road: #cfcfc8; --accent: #1964d8; --accent-text: #ffffff; --focus: #1964d866;
  --ok: #1a7f37; --ok-bg: #dafbe1; --due: #855600; --due-bg: #fff1c2; --over: #b42318; --over-bg: #ffe2dd;
  --low: #b45309;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121416; --surface: #1b1e21; --surface-2: #262a2e; --text: #e6e7e8; --muted: #a2a8ae;
    --line: #3a3f45; --road: #3b4046; --accent: #5b98ff; --accent-text: #0b0d0f; --focus: #5b98ff77;
    --ok: #4ac26b; --ok-bg: #12301b; --due: #e3b341; --due-bg: #3a2e0b; --over: #ff7b72; --over-bg: #3d1512;
    --low: #f59e0b;
  }
}

/* == base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: var(--fs-body)/1.45 var(--font); overflow-wrap: break-word; }
a { color: var(--accent); }
h1 { font-size: var(--fs-title); margin: 0 0 var(--s1); }
h2, .section-title { font-size: var(--fs-section); margin: 0 0 var(--s3); }
h3 { font-size: var(--fs-body); margin: 0 0 var(--s1); }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small, small { font-size: var(--fs-small); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
ul.plain, .due-list, .entries, .dtcs, .cards, .recent, .choices, .menu-list, .uploads, .picked, .shots, .history-items, .share-links,
.receipt-picks, .job-picks, .pub-recalls, .location-list, .public-timeline, .pub-docs, .checklist, .plan-flags, .trip-cards {
  list-style: none; margin: 0; padding: 0; }

/* == top bar
   Phone: brand and sign-out on one row, the four sections as equal columns below. 720 px and up: one row. */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s4);
  padding: var(--s2) var(--s4) 0; background: var(--surface); border-bottom: var(--border); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; padding: var(--s2) 0; line-height: 0; }
/* The logo (templates/_logo.html): supplied files, sized by height. Phones show the symbol alone in the app. */
.brand-logo, .brand-lockup { display: inline-block; }
.brand-logo img { display: block; height: 28px; width: auto; }
.brand-symbol { display: none !important; }
.public-brand { display: inline-block; line-height: 0; margin-bottom: var(--s4); }
@media (max-width: 719px) {
  .symbol-on-phone .brand-symbol { display: block !important; }
  .symbol-on-phone .brand-lockup { display: none; }
}
.topbar nav { order: 3; flex: 1 0 100%; display: grid; grid-template-columns: repeat(4, 1fr); }
.topbar nav a { padding: var(--s2) var(--s1); color: var(--text); text-decoration: none; text-align: center; white-space: nowrap;
  border-bottom: 3px solid transparent; }
.topbar nav a[aria-current] { border-bottom-color: var(--accent); font-weight: 600; }
.count { display: inline-block; min-width: 1.4em; padding: 0 5px; border-radius: var(--pill); background: var(--accent);
  color: var(--accent-text); font-size: var(--fs-small); line-height: 1.3; text-align: center; }
.signout { margin-left: auto; min-width: 0; }
.signout .who { margin-right: var(--s2); }
.signout .org { display: inline-block; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
@media (max-width: 719px) { .signout .who { display: none; } }
@media (min-width: 720px) {
  .topbar { padding-top: 0; }
  .topbar nav { order: 0; flex: 0 1 auto; display: flex; gap: var(--s1); }
  .topbar nav a { padding: var(--s3) var(--s3) calc(var(--s3) - 3px); }
}

main { max-width: 1200px; margin: 0 auto; padding: var(--s4); }
main.wide { max-width: none; }

/* == page header, cards, stat tiles */
.page-head, .section-head, .card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: var(--s2) var(--s4); }
.page-head { align-items: flex-start; margin-bottom: var(--s4); }
.page-head p { margin: 0; }
.page-head .head-actions { margin-left: auto; }  /* menus open inward */
.section-head { margin: 0 0 var(--s3); }
.section-head h2 { margin: 0; }
.card-head h2 { margin: 0 auto var(--s2) 0; }
.head-actions, .actions, .pager-links { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); }
.card { background: var(--surface); border: var(--border); border-radius: var(--radius); padding: var(--s4); margin-bottom: var(--s4); }
.card.narrow { max-width: 640px; margin: var(--s6) auto; }
.card.narrow.auth { max-width: 420px; }
.card.warn, .card.danger { border-color: var(--over); }
.empty { text-align: center; color: var(--muted); }
.empty p { margin: var(--s2) 0; }
.cards { display: grid; gap: var(--s3); }
@media (min-width: 720px) { .cards { grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); } }
.card-link { display: flex; flex-direction: column; text-decoration: none; color: var(--text); margin-bottom: var(--s2); }
.card-link .title { font-weight: 600; font-size: var(--fs-section); color: var(--accent); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.stat { background: var(--surface); border: var(--border); border-radius: var(--radius); padding: var(--s3); display: flex; flex-direction: column; }
.stat .label, .facts dt { font-size: var(--fs-small); color: var(--muted); }
.stat .value { font-size: var(--fs-title); font-weight: 600; font-variant-numeric: tabular-nums; }
.stat .sub { font-size: var(--fs-small); color: var(--muted); }
.facts { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s5); margin: 0; }
.facts dd, .kv dd { margin: 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 2px var(--s3); }
.kv dt { color: var(--muted); }

/* == notice, error, warning box */
.notice, .error, .warning-box, .share-note { padding: 10px 14px; border-radius: var(--radius); margin: 0 0 var(--s4); }
.notice { background: var(--ok-bg); color: var(--ok); }
.error { background: var(--over-bg); color: var(--over); }
.warning-box { background: var(--due-bg); color: var(--due); }
.warning-box ul, .share-note ul { margin: var(--s1) 0 0; padding-left: 18px; }
.warn-text { color: var(--due); }
.error-text { color: var(--over); }
form.inline-form.notice, .deletion-banner { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s2); align-items: center; }

/* == badges */
.badge { display: inline-block; padding: 0 var(--s2); border-radius: var(--pill); font-size: var(--fs-small); font-weight: 600;
  line-height: 1.5; background: var(--surface-2); color: var(--muted); white-space: nowrap; vertical-align: 1px; }
.badge::first-letter { text-transform: uppercase; }  /* sentence case */
.badge.ok, .badge.upcoming, .badge.extracted, .badge.confirmed, .badge.auto, .badge.level-ok, .fit.ok { background: var(--ok-bg); color: var(--ok); }
.badge.due, .badge.pending, .badge.extracting, .badge.needs_review, .badge.level-watch, .fit.bad { background: var(--due-bg); color: var(--due); }
.badge.overdue, .badge.rejected, .badge.failed, .badge.level-alert { background: var(--over-bg); color: var(--over); }
.badge.performed-self, .badge.performed-other { color: var(--text); font-weight: 500; }
.badge.before-you { margin-left: 6px; }
.fit { padding: 0 6px; border-radius: var(--pill); }

/* == buttons */
button, .button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control);
  padding: var(--s2) var(--s4); font: 600 var(--fs-body) var(--font); border-radius: var(--radius); border: 1px solid var(--accent);
  background: var(--accent); color: var(--accent-text); text-decoration: none; cursor: pointer; }
button.secondary, .button.secondary { background: transparent; color: var(--accent); }
button.danger { background: transparent; color: var(--over); border-color: var(--over); }
button.link { min-height: 0; padding: 0; border: 0; background: none; color: var(--accent); font-weight: 400; text-decoration: underline; }
.topbar button.link { color: var(--muted); text-decoration: none; font-size: var(--fs-small); }
button.small, .button.small { min-height: 32px; padding: var(--s1) 10px; font-size: var(--fs-small); }
button.link.small { min-height: 0; padding: 0; }

/* == forms */
.form fieldset { border: 0; padding: 0; margin: 0 0 var(--s4); }
.form legend, .kind-choice legend { font-weight: 600; margin-bottom: var(--s2); }
label { display: flex; flex-direction: column; gap: var(--s1); font-size: var(--fs-small); color: var(--muted); margin-bottom: var(--s3); }
label.check { flex-direction: row; align-items: center; gap: 6px; color: var(--text); margin: 0; }
label.inline { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; margin: 0; }
input, select, textarea { width: 100%; min-height: var(--control); padding: var(--s2) 10px; font: var(--fs-body) var(--font); color: var(--text);
  background: var(--surface); border: var(--border); border-radius: var(--radius); }
input[type=checkbox], input[type=radio], label.inline input { width: auto; min-height: 0; }
textarea { min-height: 80px; }
.grid-3, .grid-2 { display: grid; gap: 0 var(--s3); }
@media (min-width: 640px) { .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-2 { grid-template-columns: repeat(2, 1fr); } }
.row.inline, .filters, .trip-filter, .vehicle-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2) var(--s3); margin-bottom: var(--s3); }
.row.inline .grow, .vehicle-row label { flex: 1 1 220px; }
.row.inline button { margin-bottom: var(--s3); }
.filters label:not(.check) { flex: 1 1 140px; }
.filters label, .trip-filter label, .vehicle-row label { margin: 0; }
.trip-filter input { width: auto; }
form.inline { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin: var(--s1) 0 0; }
.inline-form { display: inline; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3); margin-top: var(--s2); }
.danger-zone .inline-form { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.with-unit { display: flex; gap: 6px; }
.with-unit select { width: auto; }
fieldset[disabled] { opacity: .7; }
details > summary { cursor: pointer; }

/* == tables */
.table-wrap { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; margin: var(--s2) 0; font-size: var(--fs-small); }
th, td { text-align: left; padding: 6px var(--s2); height: 2.25rem; border-bottom: var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; }
th.num, td.num { text-align: right; }
tfoot th, tfoot td, table.tco tr.total th { color: var(--text); font-weight: 700; border-top: 2px solid var(--line); }
table.compact th, table.compact td { height: auto; padding: var(--s1) 0; }
table.ledger tr.projected td { font-style: italic; color: var(--muted); }
table.ledger tr.actual + tr.projected td { border-top: 2px solid var(--line); }

/* == tabs: one component. Vehicle tabs, Health's second
   row (.sub), the Add entry kinds, Settings sections and Admin. Each scrolls within itself on a phone. */
.tabs { display: flex; gap: var(--s1); margin: 0 0 var(--s4); overflow-x: auto; scrollbar-width: thin; border-bottom: var(--border); }
.tabs a { padding: var(--s2) var(--s3) calc(var(--s2) - 3px); color: var(--text); text-decoration: none; white-space: nowrap;
  border-bottom: 3px solid transparent; }
.tabs a[aria-current] { border-bottom-color: var(--accent); font-weight: 600; }
@media (max-width: 479px) { .tabs a { padding-left: 6px; padding-right: 6px; } }
.tabs.sub, .range { border-bottom: 0; gap: var(--s2); margin-top: calc(-1 * var(--s2)); }
.tabs.sub a, .range a { padding: var(--s1) var(--s3); border: var(--border); border-radius: var(--pill); color: var(--text);
  text-decoration: none; font-size: var(--fs-small); background: var(--surface); }
.tabs.sub a[aria-current], .range a[aria-current] { background: var(--surface-2); border-color: var(--accent); }
.range { display: flex; flex-wrap: wrap; margin: 0 0 var(--s4); }

/* == header menus (Add, More): <details> */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: ""; width: .45em; height: .45em; margin-left: 2px; border: solid currentColor;
  border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.menu-list { position: absolute; right: 0; z-index: 20; min-width: 13rem; margin-top: var(--s1); padding: var(--s1) 0;
  background: var(--surface); border: var(--border); border-radius: var(--radius); box-shadow: 0 6px 20px rgb(0 0 0 / 18%); }
.menu-list a { display: block; padding: 10px var(--s4); color: var(--text); text-decoration: none; }
.menu-list a:hover, .menu-list a:focus-visible { background: var(--surface-2); }

/* == vehicle: overview, history, import */
.overview { display: grid; gap: var(--s4); align-items: start; }
.overview > .card { margin: 0; display: flex; flex-direction: column; }
.overview p { margin: 0 0 var(--s2); }
.overview .more { margin-top: auto; padding-top: var(--s2); align-self: flex-start; }
.overview .more::after { content: " →"; }
@media (min-width: 720px) { .overview { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .overview { grid-template-columns: repeat(3, 1fr); } }
.recent li { display: grid; grid-template-columns: 6.5em 1fr auto; gap: var(--s2); padding: 6px 0; border-top: var(--border); }
.recent li:first-child { border-top: 0; }
.split { display: grid; gap: var(--s4); }
@media (min-width: 960px) { .split { grid-template-columns: minmax(300px, 1fr) 2fr; align-items: start; } }
.due-list li, .location-list li, .codes li.code, .history-item, .uploads li, .parts-drawer .drawer li {
  padding: 10px 0; border-top: var(--border); }
.due-list li:first-child, .codes li.code:first-child, .uploads li:first-child, .parts-drawer .drawer li:first-child { border-top: 0; }
.due-body { display: flex; flex-direction: column; margin-top: 2px; }
.entry { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 10px 0; border-top: var(--border); }
@media (min-width: 640px) { .entry { grid-template-columns: 120px 1fr; } }
.entry .when { color: var(--muted); font-size: var(--fs-small); }
.entry summary, .row-line { display: flex; flex-wrap: wrap; gap: 0 var(--s3); }
.entry .what { font-weight: 600; }
.entry .amount { margin-left: auto; font-variant-numeric: tabular-nums; }
.entry .meta { width: 100%; }
.entry.fuel .what::before { content: "⛽ "; }
.entry.odometer .what::before { content: "◷ "; }
.entry.pre-ownership { opacity: .8; }
.ownership-divider { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s3); margin: var(--s3) 0 var(--s1);
  padding-top: var(--s2); border-top: 2px dashed var(--line); font-weight: 600; }
ul.event-docs { margin: 6px 0; padding-left: 18px; }
.event-docs form.detach { display: inline-flex; margin: 0 0 0 6px; }
.choices { display: grid; gap: var(--s3); margin-bottom: var(--s4); }
@media (min-width: 720px) { .choices { grid-template-columns: repeat(3, 1fr); } }
.choices .card { margin: 0; display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; }
.choices .card p { margin: 0; flex: 1; }
.choices .chosen { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }

/* == upload */
.dropzone { border: 2px dashed var(--line); border-radius: var(--radius); padding: 20px var(--s4); text-align: center; margin-bottom: var(--s4); }
.dropzone.over { border-color: var(--accent); background: var(--surface-2); }
.drop-hint { margin: 0 0 var(--s3); font-weight: 600; }
.file-button { position: relative; overflow: hidden; margin: var(--s1); flex-direction: row; color: var(--accent); }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
@media (hover: hover) and (pointer: fine) { .file-button.camera { display: none; } }
.picked { margin-top: var(--s2); }
.uploads li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s3); }
.uploads li.fresh { background: linear-gradient(90deg, var(--ok-bg), transparent 60%); }
.uploads .name { font-weight: 600; word-break: break-all; }
.uploads .status { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.shots { margin-top: var(--s2); display: flex; flex-wrap: wrap; gap: var(--s2); justify-content: center; }
.shots li { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.shots img { width: 72px; height: 96px; object-fit: cover; border-radius: var(--radius); border: var(--border); }

/* == review */
.review-layout { display: grid; gap: var(--s4); }
@media (min-width: 1000px) {
  .review-layout { grid-template-columns: minmax(360px, 1fr) minmax(420px, 1fr); align-items: start; }
  .viewer { position: sticky; top: 64px; }
}
.viewer { padding: var(--s2); }
.viewer-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: var(--s2); }
.viewer-tools .pager { margin-left: auto; }
.viewer-tools .pager a { padding: 0 var(--s2); font-size: var(--fs-section); text-decoration: none; }
.viewer-frame { overflow: auto; max-height: 75vh; background: var(--surface-2); border-radius: var(--radius); text-align: center; }
@media (max-width: 999px) { .viewer-frame { max-height: 45vh; } }
.viewer-frame img { max-width: 100%; display: inline-block; transition: transform .15s ease; }
.viewer-frame img.zoomed { max-width: none; width: 100%; }
.conf { font-size: var(--fs-small); margin-right: var(--s1); vertical-align: middle; }
.conf.low { color: var(--low); }
.conf.medium { color: var(--muted); }
[data-low], .line.low { border-color: var(--low); }
.lines-edit, .manual-lines { display: flex; flex-direction: column; gap: var(--s2); margin-bottom: var(--s2); }
.line, .manual-line { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s2); padding: 10px; border: var(--border); border-radius: var(--radius); }
.line .desc, .line .type, .line .remove, .manual-line .desc { grid-column: 1 / -1; }
.line label { margin-bottom: 6px; }
.line .remove { justify-content: flex-end; color: var(--muted); font-size: var(--fs-small); }
@media (min-width: 640px) {
  .line { grid-template-columns: 2fr 1.1fr .6fr .9fr .9fr; }
  .line .type { grid-column: auto; }
}
@media (min-width: 720px) {
  .manual-line { grid-template-columns: 2fr 1.4fr .9fr .6fr .8fr 1fr; }
  .manual-line .desc { grid-column: auto; }
}
.remember { margin-top: 2px; align-self: flex-start; color: var(--accent); text-decoration: underline; }
.remembered { font-size: var(--fs-small); color: var(--ok); }
.totals { margin-top: var(--s3); }
.sticky-actions { position: sticky; bottom: 0; background: var(--surface); padding: 10px 0; border-top: var(--border); margin-top: var(--s2); }
/* phone: confirm bar pinned */
@media (max-width: 999px) {
  .review-layout .sticky-actions { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; margin: 0;
    padding: 10px var(--s4) calc(10px + env(safe-area-inset-bottom)); box-shadow: 0 -4px 12px rgb(0 0 0 / 12%); }
  .review-layout .sticky-actions button { flex: 1 1 auto; }
  main.wide:has(.review-layout .sticky-actions) { padding-bottom: 96px; }
}
.shortcuts { margin: var(--s2) 0 0; }
@media (hover: none) { .shortcuts { display: none; } }
.history-items { margin: var(--s3) 0; }
.history-item .lines { margin: var(--s1) 0; padding-left: 18px; }
.history-item .actions { gap: var(--s2) 14px; }
.history-item.skipped, .history-item.confirmed { opacity: .65; }
.history-item.duplicate { border-left: 3px solid var(--due); padding-left: var(--s2); }

/* == settings, sharing, DIY */
.key, .copy-row code { font-family: var(--mono); word-break: break-all; padding: 6px var(--s2); background: var(--surface-2); border-radius: var(--radius); }
.key { padding: 10px; user-select: all; }
.copy-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.pairing .qr { background: #fff; padding: var(--s2); border-radius: var(--radius); width: fit-content; max-width: 100%; margin: var(--s2) 0; }
.pairing .qr svg { display: block; max-width: 100%; height: auto; }
.alive { color: var(--ok); }
.stale { color: var(--muted); }
#members select[name=role] { min-width: 7.5em; }
.share-note { background: var(--surface-2); }
.share-note p { margin: 0; }
.share-links, .receipt-picks, .job-picks, .pub-recalls { margin-bottom: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.share-link, .receipt-picks li, .place-choice .choice, .plan-card { border: var(--border); border-radius: var(--radius); padding: 10px var(--s3); }
.share-link.new { border-color: var(--ok); }
.share-link.revoked, .share-link.expired { opacity: .7; }
.share-head, .parts-suggestion, .suggestions li { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.share-sections { border: 0; padding: 0; margin: 0 0 var(--s2); }
.kind-choice .check, .job-picks .check { display: block; margin: var(--s1) 0; }
.receipt-picks details { margin: var(--s1) 0 0 26px; }
.receipt-picks li > a { margin-left: 26px; }
.place-choice { display: grid; gap: var(--s3); }
@media (min-width: 900px) { .place-choice { grid-template-columns: 1.4fr 1fr 1fr; } }
.place-choice .choice { display: flex; flex-direction: column; gap: var(--s2); align-items: flex-start; }
.parts-drawer .drawer li { display: flex; flex-wrap: wrap; gap: var(--s1) 10px; align-items: baseline; padding: 6px 0; }
form.kind-switch { margin: 0 0 var(--s2); }
.location-list p { margin: 0 0 var(--s1); }

/* == public page and site */
.public-main, .site-main { max-width: 860px; margin: 0 auto; padding: var(--s4); }
.site-main { max-width: 960px; }
.public-head { display: flex; flex-wrap: wrap; gap: var(--s3); justify-content: space-between; align-items: flex-start; margin-bottom: var(--s4); }
.public-head h1 { margin: 2px 0 var(--s1); }
.public-head p { margin: 0; }
.odo.ok { color: var(--ok); }
.odo.flag { color: var(--over); font-weight: 600; }
.pub-event { display: grid; grid-template-columns: 1fr; gap: var(--s1); padding: var(--s3) 0; border-bottom: var(--border); }
.pub-event:last-child { border-bottom: 0; }
.pub-event.pre .pub-what h3, .pub-odo { color: var(--muted); }
.pub-when { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); align-items: baseline; }
.pub-what h3 { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.pub-total { margin-left: auto; font-weight: 600; }
.pub-lines { margin: 0 0 var(--s1); padding-left: 18px; }
.pub-docs { margin-top: var(--s2); display: flex; flex-wrap: wrap; gap: var(--s3); }
.pub-docs li { display: flex; flex-direction: column; width: 124px; }
.pub-docs img { width: 120px; height: 160px; object-fit: cover; border: var(--border); border-radius: var(--radius); background: var(--surface-2); }
.pub-docs .sha { cursor: help; text-decoration: underline dotted; }
.verified p, .verified ul { margin: 0 0 var(--s2); }
.verified ul { padding-left: 18px; }
@media (min-width: 640px) { .pub-event { grid-template-columns: 170px 1fr; gap: var(--s3); } .pub-when { flex-direction: column; gap: 2px; } }
dialog.lightbox { max-width: min(96vw, 1100px); max-height: 96vh; padding: var(--s3); border: var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); }
dialog.lightbox::backdrop { background: rgb(0 0 0 / 70%); }
dialog.lightbox img { display: block; max-width: 100%; max-height: 80vh; margin: var(--s2) auto; }
dialog.lightbox form { text-align: right; margin: 0; }
.site-top nav, .site-foot nav, .hero-actions { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.site-foot { max-width: 960px; margin: var(--s5) auto 0; padding: var(--s4); border-top: var(--border); }
.hero { padding: var(--s5) 0 var(--s2); }
.hero h1 { font-size: clamp(1.8rem, 6vw, 2.8rem); line-height: 1.1; margin: 0 0 var(--s3); }
.lead { font-size: var(--fs-section); max-width: 40em; }
.how { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); margin: var(--s5) 0; }
.how-step h2 { margin: 6px 0; }
.how-n, .check-mark { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: var(--pill); font-weight: 700; flex: none; }
.how-n { background: var(--accent); color: var(--accent-text); }
.cta { text-align: center; padding: var(--s5) 0; }
.feature { display: grid; gap: var(--s4); align-items: start; margin: var(--s4) 0 var(--s6); }
@media (min-width: 800px) { .feature { grid-template-columns: 2fr 3fr; } }
.feature h3 { font-size: var(--fs-section); margin: 0 0 var(--s2); }
.features > h2 { font-size: var(--fs-title); }
.shot img { display: block; width: 100%; height: auto; }
.needs ul, .privacy-pitch ul { padding-left: 18px; }
.prose { max-width: 46em; line-height: 1.55; }
.prose h2 { margin-top: 1.4em; }
.sample-banner { margin-bottom: var(--s4); }
.checklist-item { display: flex; gap: var(--s3); padding: var(--s3) 0; border-bottom: var(--border); }
.checklist-item h2 { font-size: var(--fs-body); margin: 2px 0 var(--s1); }
.checklist-item p { margin: var(--s1) 0; }
.check-mark { border: 2px solid var(--line); }
.checklist-item.done .check-mark { background: var(--ok-bg); color: var(--ok); border-color: var(--ok); }

/* == billing and admin */
.usage { margin: var(--s3) 0; }
.usage-head { display: flex; justify-content: space-between; gap: var(--s2); }
.meter { height: 8px; border-radius: var(--pill); background: var(--surface-2); overflow: hidden; margin-top: var(--s1); }
.meter span { display: block; height: 100%; background: var(--accent); }
.meter.near span { background: var(--due); }
.meter.full span { background: var(--over); }
.plan-flags { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
.plan-flags .yes::before { content: "✓ "; color: var(--ok); }
.plan-flags .no { color: var(--muted); }
.plan-flags .no::before { content: "– "; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--s4); }
.plan-card.current { border-color: var(--accent); box-shadow: inset 0 3px 0 var(--accent); }
.plan-card .price { font-size: var(--fs-title); font-weight: 700; margin: 0; }
.plan-card ul { padding-left: 18px; }
.plan-buy { display: flex; flex-wrap: wrap; gap: 6px; }
.staff-banner { position: sticky; top: 0; z-index: 5; }
.daybars { display: flex; align-items: flex-end; gap: 2px; height: 120px; }
.daybars span { flex: 1; min-height: 1px; background: var(--accent); border-radius: 2px 2px 0 0; }
.android-app .sha { word-break: break-all; }

/* == health */
.health-card.level-alert { border-color: var(--over); }
.health-card.level-watch { border-color: var(--due); }
.explain { border-left: 3px solid var(--due); padding: 2px 0 2px var(--s3); margin: var(--s2) 0 var(--s3); }
.explain.alert { border-left-color: var(--over); }
.explain p { margin: var(--s1) 0; }
.chart-controls { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: flex-start; }
.chart-controls label { margin-bottom: var(--s1); }
.chart-controls select { min-height: 36px; width: auto; max-width: 100%; }
.chart-controls .types { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); }
.chart-controls .types legend { font-size: var(--fs-small); color: var(--muted); margin-bottom: var(--s1); }
.trend { margin: var(--s2) 0; }
.trend figcaption { margin-bottom: var(--s1); }
.markers li { margin: 2px 0; }
.codes .fix-form { width: 100%; }
.codes .fix-form label { flex: 1 1 16em; min-width: 0; max-width: 100%; }
.codes .fix-form select { width: 100%; max-width: 100%; min-width: 0; text-overflow: ellipsis; }
.suggestions li { align-items: center; margin: var(--s1) 0; }
.legend { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); }
.legend .item, .legend .leg { display: inline-flex; align-items: center; gap: 6px; }

/* charts: server SVG, token colours */
svg.chart { width: 100%; height: auto; overflow: visible; font: 13px var(--font); }
svg.chart-wide { display: block; }
svg.chart-narrow { display: none; }
@media (max-width: 700px) { svg.chart-wide { display: none; } svg.chart-narrow { display: block; } }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .tick, svg.route .tick { fill: var(--muted); }
svg.chart .band, svg.glyph .band { fill: var(--ok-bg); }
svg.chart .limit line, svg.glyph .limit line { stroke: var(--over); stroke-width: 1.5; stroke-dasharray: 6 4; }
svg.chart .marker line, svg.glyph .marker line { stroke: var(--muted); stroke-width: 1.5; }
svg.chart .marker path, svg.glyph .marker path, .legend .glyph-marker { fill: var(--muted); }
svg.chart .marker.reset line, svg.glyph .marker.reset line { stroke-dasharray: 3 3; }
svg.chart .marker.reset path, svg.glyph .marker.reset path { fill: none; stroke: var(--muted); }
svg.chart .hit { fill: transparent; }
svg.chart .series, svg.chart .line, .legend .leg svg .line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; }
svg.chart .dot, svg.glyph .dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
svg.glyph .dot { stroke: none; }
svg.chart .point:hover .dot, svg.chart a.point:focus .dot { r: 6; }
svg.chart .line.s2, .legend .leg svg .line.s2 { stroke: var(--due); stroke-dasharray: 7 4; }
svg.chart .line.s3, .legend .leg svg .line.s3 { stroke: var(--ok); stroke-dasharray: 2 3; }
svg.chart .line.s4, .legend .leg svg .line.s4 { stroke: var(--muted); stroke-dasharray: 9 3 2 3; }
svg.glyph { width: 16px; height: 16px; overflow: visible; }

/* == trips, routes, maps */
.totals-card table { margin-bottom: var(--s3); }
.totals caption { text-align: left; font-weight: 600; padding: var(--s2) 0 var(--s1); }
.month-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s3); margin: var(--s5) 0 var(--s3); font-size: var(--fs-section); }
.month-totals { font-size: var(--fs-small); font-weight: 400; color: var(--muted); }
.trip-cards { display: grid; gap: var(--s3); align-items: start; grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr)); }
.trip-card { display: flex; gap: var(--s3); align-items: center; margin: 0; padding: 10px; }
.trip-card.plain { padding: 0; border: 0; margin-bottom: var(--s2); }
a.trip-card { color: inherit; text-decoration: none; }
a.trip-card .trip-when { color: var(--accent); }
a.trip-card:hover { border-color: var(--accent); }
a.trip-card:hover .trip-when { text-decoration: underline; }
a.trip-card:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.trip-thumb { flex: 0 0 104px; height: 78px; display: flex; background: var(--surface-2); border-radius: var(--radius); border: var(--border); }
.trip-thumb svg { width: 100%; height: 100%; }
@media (min-width: 600px) {
  .trip-cards .trip-card { flex-direction: column; align-items: stretch; }
  .trip-cards .trip-thumb { flex: none; height: auto; aspect-ratio: 16 / 9; } }
.trip-facts { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trip-when { font-weight: 600; }
.trip-figures, .trip-more { display: flex; flex-wrap: wrap; gap: 0 var(--s2); }
.trip-figures > span, .trip-more > span, .trip-when > span { white-space: nowrap; }
.pager { display: flex; gap: var(--s4); align-items: center; justify-content: center; margin: var(--s4) 0; }
svg.route { font: 13px var(--font); }
svg.route .route-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg.route-full .route-line { stroke-width: 4; }
svg.route .route-roads path { fill: none; stroke: var(--road); stroke-linecap: round; stroke-linejoin: round; }
svg.route .road-highway { stroke-width: 2.2; }
svg.route .road-major-road { stroke-width: 1.4; }
svg.route .road-minor-road { stroke-width: 0.7; }
svg.route .route-start { fill: var(--ok); stroke: var(--surface); stroke-width: 2; }
svg.route .route-end { fill: var(--over); stroke: var(--surface); stroke-width: 2; }
svg.route .scale path { fill: none; stroke: var(--text); stroke-width: 1.5; }
svg.route .north path { fill: var(--text); }
.route-svg svg { width: 100%; height: auto; max-height: 60vh; display: block; background: var(--surface-2); border-radius: var(--radius); }
.trip-map { display: none; width: 100%; height: 460px; border-radius: var(--radius); overflow: hidden; }
.trip-map.active { display: block; }
@media (max-width: 700px) { .trip-map { height: 62vh; } }
.route-svg.behind-map { display: none; }
.map-marker { width: 16px; height: 16px; border: 3px solid #fff; box-shadow: 0 0 0 1px #0006; }
.map-marker.map-start { background: var(--ok); border-radius: 50%; }
.map-marker.map-end { background: var(--over); border-radius: 2px; }
.map-credit { margin-top: var(--s1); }
.route-delete { margin-top: var(--s3); }

/* Phase 10: emissions pre-check, used-car checks, trip purposes and the mileage log */
.verdict { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: baseline; margin: 0 0 var(--s3); }
.verdict .badge { font-size: 1rem; }
ul.rules, ul.findings { display: grid; gap: var(--s3); margin: 0 0 var(--s3); }
.rule p, .finding .small { margin: var(--s1) 0 0; }
.finding { padding-left: var(--s3); border-left: 3px solid var(--line); }
.finding-look { border-left-color: var(--over); }
.finding-know { border-left-color: var(--due); }
.check-verdict h3 { margin: var(--s3) 0 var(--s2); }
.trip-cards li.pickable { position: relative; }
.trip-pick { position: absolute; top: 4px; right: 4px; z-index: 1; display: grid; place-items: center;
  width: var(--control); height: var(--control); }
.trip-pick input { width: 22px; height: 22px; }
.bulk-purpose { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: end; }
.mileage-totals td, .mileage-totals th { white-space: nowrap; }
.row-flag { color: var(--due); }

/* Phase 11: bulletins and recommendations */
ul.rec-list, ul.bulletin-list { display: grid; gap: var(--s3); margin: 0 0 var(--s3); }
.rec { padding-left: var(--s3); border-left: 3px solid var(--line); }
.rec-strong { border-left-color: var(--due); }
.rec p { margin: var(--s1) 0 0; }
.rec-head { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: baseline; }
.rec-actions { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s2); }
.rec-actions form, form.inline { display: inline; margin: 0; }
.bulletin p { margin: var(--s1) 0 0; }
#rec-evidence-table th { text-align: left; font-weight: normal; color: var(--muted); padding-right: var(--s3); }
.service-visit h1 { font-size: var(--fs-section, 1.25rem); }
.service-visit .sv-note { background: var(--surface-2); padding: var(--s2) var(--s3); border-radius: var(--radius); }
.service-visit dl.sv-facts { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s4); margin: var(--s2) 0; }
.service-visit dl.sv-facts div { display: flex; gap: var(--s2); }
.service-visit dl.sv-facts dt { color: var(--muted); }
.service-visit dl.sv-facts dd { margin: 0; }
.service-visit .sv-sec { margin-top: var(--s4); }
.service-visit .sv-sec h2 { font-size: 1rem; border-bottom: var(--border); padding-bottom: var(--s1); }
.service-visit .sv-kv th { text-align: left; font-weight: normal; color: var(--muted); padding-right: var(--s3); }
.service-visit .sv-table { width: 100%; }
.service-visit .sv-chart svg { width: 100%; height: auto; }
.service-visit .sv-chart svg.chart-narrow { display: none; }
