/* ScootHero Back Office — layout and colour only.
 * Every font size comes from typography.css tokens (CLAUDE.md). Nothing here sets px type.
 *
 * Brand colours (decided): navy #060F22, teal #00A99D, orange #F07B20.
 * Use them only through the variables below; test/brand.test.js fails the build on any other
 * brand colour. Navy is ink and primary buttons, teal is selection and focus, orange is the
 * accent (current module, the top edge of the sign-in card).
 *
 * Two shells:
 *   .signed-out  the sign-in, forgotten password, choose a password and message pages
 *   .shell       the back office itself: top bar, module menu, page
 */

:root {
  --navy: #060F22;
  --navy-1: #14203A;
  --navy-2: #22304D;
  --teal: #00A99D;
  --teal-wash: #E6F6F5;
  --orange: #F07B20;

  --page: #F4F6F6;
  --card: #FFFFFF;
  --line: #E1E6E6;
  --line-soft: #EDF1F1;
  --ink: var(--navy);
  --ink-soft: #5B6672;
  --ink-faint: #6E7984;     /* readable secondary text: 4.6:1 on white */
  --ink-disabled: #A3ACB5;  /* not built yet; deliberately faint, never used for real content */

  --danger: #B3261E;
  --danger-bg: #FCECEA;
  --ok: #17724A;
  --ok-bg: #E7F4ED;
  --warn: #7A4A00;          /* a notice or an estimate: 6.6:1 on --warn-bg */
  --warn-bg: #FDF0DC;
  --quiet-bg: #EEF1F1;      /* finished, or closed: nothing to do here */

  /* One colour per stage tone, used by badges, map pins and charts. Which tone a stage
     has is decided in src/property/stages.js; what the tone looks like is decided here.
     All six are distinct (test/brand.test.js), and red is only ever Stopped. */
  --stage-open: #0A6F68;
  --stage-waiting: #5B6672;   /* grey: 5.2:1 on --quiet-bg */
  --stage-warn: #8A5A00;      /* amber: 5.3:1 on --warn-bg */
  --stage-live: var(--ok);
  --stage-done: #2F3A45;      /* slate, darker than waiting: 10.2:1 on --quiet-bg */
  --stage-closed: var(--danger);
  /* The dashboard map's four levels (29 Sep 2026): how far a site has got. Four different
     colours; test/brand.test.js says so. */
  --map-seen: var(--stage-waiting);
  --map-proposal: var(--orange);
  --map-lease: var(--teal);
  --map-live: var(--ok);

  --radius: 8px;
  --radius-lg: 12px;
  --gap: 16px;
  --topbar-h: 56px;
  --shadow-card: 0 1px 2px rgba(6, 15, 34, 0.06), 0 1px 3px rgba(6, 15, 34, 0.04);
  --shadow-lift: 0 4px 16px rgba(6, 15, 34, 0.1), 0 1px 3px rgba(6, 15, 34, 0.06);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page); color: var(--ink); }
a { color: var(--ink); }

:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }

/* ---------- The wordmark, until a logo file is dropped in ---------- */
.brand-word { font-weight: var(--fw-bold); letter-spacing: -0.015em; white-space: nowrap; }
.brand-word span { color: var(--orange); }
.brand-logo { display: block; height: 26px; width: auto; }

/* ---------- Back-office shell ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; max-width: 100%; }

.topbar {
  display: flex; align-items: center; gap: var(--gap);
  padding: 0 var(--gap); background: var(--card); color: var(--ink);
  position: sticky; top: 0; z-index: 10; height: var(--topbar-h);
  border-bottom: 1px solid var(--line); box-shadow: var(--shadow-card);
}
.topbar a { color: var(--ink); text-decoration: none; }
.brand { display: flex; align-items: center; padding-right: 4px; }

.modules { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.modules::-webkit-scrollbar { display: none; }
.modules a, .modules span {
  display: inline-flex; align-items: center; padding: 0 12px; border-radius: var(--radius);
  white-space: nowrap;
}
.modules a { color: var(--ink-soft); }
.modules a:hover { background: var(--page); color: var(--ink); }
.modules a[aria-current="true"] {
  color: var(--ink); font-weight: var(--fw-semibold);
  box-shadow: inset 0 -3px 0 var(--orange);
  border-radius: var(--radius) var(--radius) 0 0;
}
.modules span { color: var(--ink-disabled); cursor: not-allowed; font-weight: var(--fw-regular); }

.whoami { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.whoami .name { font-weight: var(--fw-semibold); }
.whoami .roles { color: var(--ink-faint); }

/* Phones only: the menu sits below the page, so the bar offers a jump to it. */
.menu-jump {
  display: none; align-items: center; padding: 0 12px; border-radius: var(--radius);
  border: 1px solid var(--line); min-height: var(--tap); background: var(--page);
}

.body { display: flex; flex: 1; align-items: stretch; min-width: 0; }

/* ---------- Module menu ---------- */
.sidebar {
  width: 232px; flex: 0 0 232px; background: var(--card);
  border-right: 1px solid var(--line); padding: var(--gap) 10px 24px;
  position: sticky; top: var(--topbar-h); align-self: flex-start;
  max-height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.sidebar .group { margin-bottom: 18px; }
.sidebar .group > p {
  color: var(--ink-faint); font-weight: var(--fw-semibold);
  margin: 0 0 6px 10px; text-transform: uppercase; letter-spacing: 0.06em;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar li a, .sidebar li span.soon {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: var(--tap); padding: 0 10px; border-radius: var(--radius); text-decoration: none;
}
.sidebar li a:hover { background: var(--page); }
.sidebar li a[aria-current="page"] {
  background: var(--teal-wash); font-weight: var(--fw-semibold);
  box-shadow: inset 3px 0 0 var(--teal);
}
.sidebar li span.soon { color: var(--ink-disabled); cursor: default; }
.sidebar .count { color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.sidebar .note {
  color: var(--ink-faint); margin: 2px 10px 0; padding-top: 12px;
  border-top: 1px solid var(--line-soft);
}

/* ---------- Page ---------- */
main { flex: 1; min-width: 0; max-width: 1120px; padding: 24px var(--gap) 56px; }
.page-head { margin-bottom: 20px; padding-bottom: var(--gap); border-bottom: 1px solid var(--line); }
.page-head p { color: var(--ink-soft); margin: 6px 0 0; max-width: 68ch; }

/* ---------- Cards, forms, messages ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; max-width: 640px; box-shadow: var(--shadow-card);
}
.card h2 { margin-bottom: 8px; }
.card p { margin: 0 0 10px; }
.card p:last-child { margin-bottom: 0; }

.field { display: block; margin-bottom: var(--gap); }
.field > label { display: block; color: var(--ink-soft); font-weight: var(--fw-semibold); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink);
}
.field textarea { padding: 10px 12px; resize: vertical; }
.field input[type="file"] { padding: 8px 12px; height: auto; }
.field input:hover, .field select:hover, .field textarea:hover { border-color: #CBD3D3; }
.hint { color: var(--ink-soft); display: block; margin-top: 6px; }

/* The hidden attribute has to win against any display rule below it. .btn sets
   display: inline-flex, which beat the browser's own [hidden] rule, so the marking
   screen showed "Undo the last mark" before a single mark had been made. */
[hidden] { display: none !important; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 18px; border: 1px solid transparent; border-radius: var(--radius);
  background: var(--navy); color: #fff; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--navy-1); }
.btn.wide { width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--page); }
/* The bar is light, so its buttons are the ordinary ghost buttons. */
.topbar .btn.ghost { background: #fff; }

.notice { padding: 10px 12px; border-radius: var(--radius); margin-bottom: var(--gap); }
.notice.bad { background: var(--danger-bg); color: var(--danger); box-shadow: inset 3px 0 0 var(--danger); }
.notice.good { background: var(--ok-bg); color: var(--ok); box-shadow: inset 3px 0 0 var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); box-shadow: inset 3px 0 0 var(--warn); }

/* ---------- Page sections: wider than a form card ---------- */
.panel {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 18px 20px; margin-bottom: var(--gap); box-shadow: var(--shadow-card);
}
.panel > h2 { margin-bottom: 12px; }
.panel > p { margin: 0 0 10px; }
.panel > p:last-child { margin-bottom: 0; }
.panel.review { border-color: var(--warn); background: var(--warn-bg); }
.panel.review h2, .panel.review li { color: var(--warn); }
.panel.review ul { margin: 0; padding-left: 20px; }
.panel.review li { margin-bottom: 4px; }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  padding: 2px 8px; border-radius: 999px; background: var(--quiet-bg); color: var(--ink-soft);
  font-weight: var(--fw-semibold);
}
.badge.stage-open { background: var(--teal-wash); color: #0A6F68; }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.stage-waiting { background: var(--quiet-bg); color: var(--stage-waiting); }
.badge.stage-warn { background: var(--warn-bg); color: var(--stage-warn); }
.badge.stage-live, .badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.stage-done { background: var(--quiet-bg); color: var(--stage-done); }
.badge.stage-closed, .badge.stop { background: var(--danger-bg); color: var(--danger); }
.badge.internal { background: var(--navy); color: #fff; }

/* ---------- Filters ---------- */
.filters {
  display: flex; flex-wrap: wrap; align-items: end; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px; margin-bottom: var(--gap); box-shadow: var(--shadow-card);
}
.filter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.filter > label { color: var(--ink-soft); font-weight: var(--fw-semibold); }
.filter input, .filter select {
  padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink); max-width: 100%;
}
.filter.search { flex: 1 1 260px; }
.filter.toggle {
  flex-direction: row; align-items: center; gap: 8px; min-height: var(--tap);
  color: var(--ink-soft); font-weight: var(--fw-semibold);
}
.filter.toggle input { width: 18px; height: 18px; min-height: 0; accent-color: var(--teal); }
.filter.actions { flex-direction: row; gap: 8px; }
.result-count { color: var(--ink-faint); margin: 0 0 8px; }

/* ---------- Data grid ---------- */
.data-grid { width: 100%; border-collapse: collapse; background: var(--card); }
.data-grid { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.data-grid thead th {
  text-align: left; color: var(--ink-faint); font-weight: var(--fw-semibold);
  text-transform: uppercase; letter-spacing: 0.05em;
  background: var(--page); border-bottom: 1px solid var(--line); padding-inline: 12px;
}
.data-grid tbody th, .data-grid td { border-bottom: 1px solid var(--line-soft); padding-inline: 12px; text-align: left; vertical-align: top; }
.data-grid tbody th { font-weight: var(--fw-semibold); }
.data-grid tbody tr:last-child th, .data-grid tbody tr:last-child td { border-bottom: 0; }
.data-grid tbody tr:hover { background: var(--page); }
.data-grid .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-grid a { font-weight: var(--fw-semibold); }
/* A sortable heading is a link across the whole cell, so it is an easy target, and the
   arrow only appears on the column the list is actually sorted by. */
.data-grid thead th a.sort {
  display: flex; align-items: center; gap: 6px; justify-content: inherit;
  color: inherit; text-decoration: none; padding: 10px 0; margin: -10px 0;
  min-height: var(--tap);
}
.data-grid thead th.num a.sort { justify-content: flex-end; }
.data-grid thead th a.sort:hover span:first-child { text-decoration: underline; }
.data-grid thead th a.sort:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.data-grid thead th .arrow { color: var(--teal); font-size: var(--fs-meta); line-height: 1; }
.data-grid thead th.sorted { background: var(--page); }

.sites-table tbody th a { text-decoration: none; }
.sites-table tbody th a:hover { text-decoration: underline; }
.sites-table tbody th .badge { margin-left: 6px; }
.sites-table td { white-space: nowrap; }
.sites-table tbody th { white-space: normal; }

/* The lease figures: label, amount, then the note or badge that qualifies it. */
.figures { max-width: 720px; }
.figures tbody th { width: 40%; color: var(--ink-soft); }
.figures td:first-of-type { width: 26%; font-weight: var(--fw-semibold); text-align: right; font-variant-numeric: tabular-nums; }
.figures td.bad { color: var(--danger); }
.figures td.good { color: var(--ok); }
.figures tr.total th, .figures tr.total td { background: var(--page); }
.figures td .badge { margin-right: 6px; }
/* Revise the offer: a label and two amounts, now and revised. Short enough to stay a table
   on a phone, so it keeps its columns instead of taking the .figures phone layout. */
.compare { max-width: 720px; }
.compare tbody th { color: var(--ink-soft); }
.compare thead th:first-child { width: 44%; }
.compare td.num { font-weight: var(--fw-semibold); }
.compare tr.total th, .compare tr.total td { background: var(--page); }
.compare .badge { white-space: nowrap; }

/* ---------- Site cards (phones) ---------- */
.site-cards, .record-cards { display: none; list-style: none; margin: 0; padding: 0; }
.site-cards li, .record-cards li { margin-bottom: 10px; }
.site-cards a, .record-cards a, .record-cards .as-card {
  display: flex; flex-direction: column; gap: 6px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 12px 14px; box-shadow: var(--shadow-card);
}
.site-cards .name, .record-cards .name { font-weight: var(--fw-semibold); }
.site-cards .where, .record-cards .where { color: var(--ink-soft); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }

/* ---------- Site page ---------- */
.site-head .badges { margin: 10px 0 0; }
.kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 20px; margin: 0; }
.kv dt { color: var(--ink-faint); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.05em; }
.kv dd { margin: 4px 0 0; }
.kv dd.num { font-variant-numeric: tabular-nums; }

.notes, .history, .photo-list { list-style: none; margin: 0; padding: 0; }
.notes li, .history li, .photo-list li {
  padding: 10px 0; border-bottom: 1px solid var(--line-soft);
}
.notes li:last-child, .history li:last-child, .photo-list li:last-child { border-bottom: 0; }
.notes p { margin: 0; }
.notes p + p, .history .t-meta, .photo-list .t-meta { color: var(--ink-faint); margin-top: 2px; }
.history li, .photo-list li { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

.pager { display: flex; align-items: center; gap: 12px; margin-top: var(--gap); }
.pager .t-meta { color: var(--ink-faint); }
.empty { margin-top: 4px; }

/* ---------- Setup: team and roles ---------- */
.team-form { max-width: 520px; }
.team-form .field select {
  width: 100%; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: #fff; color: var(--ink);
}
.role-choices {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px 12px;
  margin: 0 0 var(--gap); display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 2px 12px;
}
.role-choices legend { color: var(--ink-faint); font-weight: var(--fw-semibold); text-transform: uppercase; letter-spacing: 0.05em; padding: 0 4px; }
.role-choices .check { display: flex; align-items: center; gap: 8px; min-height: var(--tap); }
.role-choices .check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--teal); }
.people-table tbody th .badge { margin-left: 6px; }
.people-table td .badges { gap: 4px; }

/* The one-time password link, shown once to whoever made it. */
.panel.invite { border-color: var(--teal); background: var(--teal-wash); }
.link-box {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; overflow-wrap: anywhere; margin-bottom: 8px;
}
.link-box code { font-family: inherit; }

/* ---------- New site: a form filled in standing up, on a phone ---------- */
/* Inputs are 16px and tap targets 44px on touch screens through the typography tokens,
   so nothing here sets a size: iOS must not zoom when a PSAL taps a field. */
.capture { max-width: 640px; }
.capture .panel > .field:last-of-type { margin-bottom: 0; }
.capture .pin-state {
  background: var(--page); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 10px 12px; margin: 10px 0 var(--gap); font-variant-numeric: tabular-nums;
}
.capture [data-accuracy-warning] { color: var(--warn); margin: -8px 0 var(--gap); }
.capture .field-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.capture .new-contact {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 4px; margin: 0;
}
.capture .new-contact legend {
  color: var(--ink-faint); font-weight: var(--fw-semibold); text-transform: uppercase;
  letter-spacing: 0.05em; padding: 0 4px;
}
.capture .photo-picks { list-style: none; margin: 0; padding: 0; }
.capture .photo-picks li { margin-bottom: 12px; }
.capture .photo-picks li:last-child { margin-bottom: 0; }
.capture .check { display: flex; align-items: center; gap: 8px; min-height: var(--tap); }
.capture .check input { width: 18px; height: 18px; min-height: 0; accent-color: var(--teal); }
.capture-actions { display: flex; gap: 12px; margin-top: var(--gap); }
.capture-actions .btn { flex: 1; }

/* Photos on a site page: thumbnails through the role-checked route, never a direct file. */
.photo-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px;
}
.photo-grid img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--page);
}
.photo-grid p { margin: 6px 0 0; }
.photo-grid .t-meta { color: var(--ink-faint); }

/* ---------- Sending a link again ---------- */
.resend { margin: var(--gap) 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--page); }
.inline-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 8px; }
.inline-form .t-meta { color: var(--ink-soft); }

/* ---------- Maps ---------- */
/* Leaflet is vendored; only the tiles come from openstreetmap.org (see the CSP in app.js). */
.map {
  height: 420px; border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: var(--gap); background: var(--page); overflow: hidden;
}
.map .map-fallback { padding: 16px; color: var(--ink-soft); max-width: 46ch; }
.place-form { max-width: 1200px; }
/* The map beside the boxes on a laptop, so moving one shows in the other (28 Oct 2026);
   stacked on a phone. The map keeps its own height (see below). */
.place-grid { display: grid; gap: var(--gap); }
.place-grid .map { margin-bottom: 0; }
.place-fields .find-it { margin-top: 0; }
@media (min-width: 1000px) {
  .place-grid { grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr); align-items: start; }
  .place-grid .map { height: 520px; position: sticky; top: 16px; }
}
.new-site-map { height: 300px; margin-top: 12px; margin-bottom: 4px; }
/* Leaflet needs its container to have a height of its own, which .map above gives it.
   Do not give .leaflet-container a percentage height: the form around it is auto-height,
   so height:100% resolves to auto, the box collapses to nothing and the map disappears —
   which is exactly what the first screenshot of this screen showed. */


/* ---------- The render: what a proposal needs, and marking it ---------- */
.readiness-list { list-style: none; margin: 0; padding: 0; }
.readiness-list li {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.readiness-list li:last-child { border-bottom: 0; }
.readiness-list .not-met span:first-child { color: var(--ink); }
.readiness-list .met span:first-child { color: var(--ink-faint); }

.render-image {
  display: block; max-width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--page);
}
.render-preview .t-meta { color: var(--ink-faint); }
.render-save { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 12px; }
/* The preview and the form are one column, so the eye goes straight down the screen. */
.render-preview, .render-form { max-width: 720px; }

/* Which photo to mark. A radio the size of a fingertip, with the photo as its label. */
/* The built proposal on the check screen. Tall enough that the front page is readable
   without scrolling the frame, which is the whole point of the screen. */
.proposal-pdf {
  width: 100%; height: 70vh; min-height: 420px; display: block;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}

.photo-choices {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px;
}
.photo-choice { display: block; cursor: pointer; }
.photo-choice img {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block;
  border: 2px solid var(--line); border-radius: var(--radius);
}
.photo-choice input { min-width: 24px; min-height: 24px; margin: 0 0 6px; }
.photo-choice input:checked + img { border-color: var(--teal); }
.photo-choice input:focus-visible + img { outline: 2px solid var(--teal); outline-offset: 2px; }
.photo-choice .t-meta { display: block; margin-top: 4px; color: var(--ink-faint); }

/* The photo being marked, with the marks drawn over it. */
.mark-stage { margin-bottom: var(--gap); }
.mark-stage .mark-fallback { color: var(--ink-soft); max-width: 46ch; }
.mark-wrap { position: relative; display: inline-block; max-width: 100%; touch-action: pinch-zoom; }
.mark-photo {
  display: block; max-width: 100%; height: auto;
  border: 1px solid var(--line); border-radius: var(--radius);
}
.mark-layer { position: absolute; inset: 0; pointer-events: none; }
.mark-handle {
  position: absolute; width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border-radius: 50%; border: 3px solid var(--card); background: var(--teal);
  box-shadow: 0 1px 4px rgba(6, 15, 34, 0.45);
}
.mark-handle.mark-base { background: var(--orange); }
.mark-line {
  position: absolute; height: 3px; background: var(--teal); transform-origin: 0 50%;
  opacity: 0.85;
}
.mark-actions { display: flex; gap: 12px; flex-wrap: wrap; }

@media (pointer: coarse) {
  /* A finger is not a mouse: bigger handles, and room to miss. */
  .mark-handle { width: 36px; height: 36px; margin: -18px 0 0 -18px; }
}

.document-list { list-style: none; margin: 0 0 12px; padding: 0; }
.document-list li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.document-list li:last-child { border-bottom: 0; }
.document-list .t-meta { color: var(--ink-faint); margin-left: 8px; }
.proposal form { margin-top: 12px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

/* ---------- Stage history ---------- */
.stage-history { list-style: none; margin: 0; padding: 0; }
.stage-history li {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.stage-history li:last-child { border-bottom: 0; }
.stage-history .t-meta { color: var(--ink-faint); }
.history-table td form { display: inline; }

/* ---------- Dashboard ---------- */
.tiles {
  list-style: none; margin: 0 0 var(--gap); padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px;
}
.tiles li {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 14px 16px; box-shadow: var(--shadow-card);
}
.tiles p { margin: 0; }
.tiles .t-meta { color: var(--ink-faint); }
.tiles .figure {
  font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums; margin: 4px 0 2px;
}
.tiles .change .up { color: var(--ok); font-weight: var(--fw-semibold); }
.tiles .change .down { color: var(--danger); font-weight: var(--fw-semibold); }
.period-quick { color: var(--ink-faint); margin: -8px 0 var(--gap); }
.period-quick a { margin-right: 10px; }
.period-quick a[aria-current="page"] { font-weight: var(--fw-semibold); color: var(--ink); }

/* Charts: the SVG scales to its panel, the numbers sit under it in a details block. */
.chart { margin: 0; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart figcaption { color: var(--ink-faint); margin-top: 4px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 8px; color: var(--ink-soft); }
.chart-legend .key, .map-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .swatch, .map-legend .swatch {
  width: 12px; height: 12px; border-radius: 3px; display: inline-block;
}
.chart-legend .swatch.line { height: 3px; border-radius: 2px; }
.chart-data { margin-top: 10px; }
.chart-data summary { color: var(--ink-faint); cursor: pointer; min-height: var(--tap); display: flex; align-items: center; }
.chart-data table { margin-top: 8px; }
.chart text { fill: var(--ink); }
.chart .num-text { font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); }

.map-legend {
  display: flex; flex-wrap: wrap; gap: 10px 14px; margin: 0 0 10px; color: var(--ink-soft);
  border: 0; padding: 0; min-width: 0;
}
.map-legend .num { color: var(--ink-faint); font-variant-numeric: tabular-nums; }
.map-legend label { min-height: var(--tap); }
.map-legend input { accent-color: var(--teal); }
/* The map's own filters sit flat inside the panel rather than as a second card. */
.filters.map-filters { background: transparent; border: 0; box-shadow: none; padding: 0; margin-bottom: 8px; }
.filters.map-filters[hidden] { display: none; }
.map-count { margin: 0 0 8px; min-height: 1.4em; }

.quality { list-style: none; margin: 0; padding: 0; }
.quality li {
  display: flex; align-items: baseline; gap: 10px; padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
}
.quality li:last-child { border-bottom: 0; }
.quality a {
  font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; min-width: 3ch;
}
.panel.soon-panel { background: var(--page); }
.panel.soon-panel ul { margin: 0; padding-left: 20px; color: var(--ink-soft); }
.data-grid td.bad, .data-grid th.bad { color: var(--danger); }

/* ---------- Setup screens ---------- */
.setup-nav {
  display: flex; flex-wrap: wrap; gap: 4px 6px; margin: -8px 0 var(--gap);
}
.setup-nav a {
  padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--card); color: var(--ink-soft); text-decoration: none; min-height: var(--tap);
  display: inline-flex; align-items: center;
}
.setup-nav a:hover { background: var(--page); color: var(--ink); }
.setup-nav a[aria-current="page"] {
  background: var(--teal-wash); color: var(--ink); border-color: var(--teal); font-weight: var(--fw-semibold);
}

/* A row you can edit in place: the fields sit in a line and wrap on a phone. */
.row-form {
  display: flex; flex-wrap: wrap; align-items: end; gap: 10px 12px;
  padding: 10px 0;
}
.row-form .field { margin-bottom: 0; flex: 1 1 160px; }
.row-form .field.wide { flex: 1 1 320px; }
.row-form .field.narrow { flex: 0 0 90px; }
.row-form .field > span { color: var(--ink-faint); }
.row-form .check { flex: 0 0 auto; }
.row-counts { color: var(--ink-faint); flex: 1 1 100%; }
.row-actions { flex: 0 0 auto; }
.row-form .code { font-weight: var(--fw-semibold); color: var(--ink-soft); flex: 0 0 100%; margin: 0; }

.contact-list, .area-list, .plain-list { list-style: none; margin: 0; padding: 0; }
.contact-list > li, .area-list > li {
  padding: 8px 0; border-bottom: 1px solid var(--line-soft);
}
.contact-list > li:last-child, .area-list > li:last-child { border-bottom: 0; }
.contact-list > li.retired { opacity: 0.6; }
.plain-list li { display: flex; align-items: center; gap: 8px; padding: 6px 0; }
.setup-table td { white-space: normal; }

/* Cost assumptions: a number with its unit, and the sentence that explains it. */
.assumptions { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.assumptions .field { margin-bottom: 0; }
.assumptions .with-unit { display: flex; align-items: center; gap: 8px; }
.assumptions .with-unit input { max-width: 160px; font-variant-numeric: tabular-nums; }
.assumptions .unit { color: var(--ink-faint); }
.assumptions li.has-problem input { border-color: var(--danger); }
.hint.problem { color: var(--danger); }

/* ---------- Needs review ---------- */
.review-site .review-head { margin-bottom: 10px; }
.review-site .review-head h2 { margin-bottom: 6px; }
.review-site .review-head .badges { margin: 0 0 4px; }
.review-site .review-head .t-meta { color: var(--ink-faint); margin: 0; }
.review-items { list-style: none; margin: 0; padding: 0; }
.review-items > li { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.review-items > li.settled { background: var(--ok-bg); border-radius: var(--radius); padding: 10px 12px; }
.review-items p { margin: 0 0 6px; }
.review-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0; }
.review-actions form { display: flex; flex-wrap: wrap; gap: 8px; flex: 1 1 260px; }
.review-actions input[type="text"] {
  flex: 1 1 160px; padding: 0 10px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff; color: var(--ink);
}

/* ---------- Signed-out pages ---------- */
/* Light page so the navy-and-orange logo reads, with the card lifted off it. */
.signed-out {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(70% 50% at 50% 0%, rgba(0, 169, 157, 0.12), transparent 70%),
    radial-gradient(50% 40% at 90% 100%, rgba(240, 123, 32, 0.07), transparent 70%),
    var(--page);
  color: var(--ink);
}
.signed-out .sheet { width: 100%; max-width: 392px; }
.signed-out .mark { display: flex; justify-content: center; margin-bottom: 22px; }
.signed-out .mark .brand-logo { height: 36px; }
.signed-out h1 { text-align: center; margin-bottom: 6px; }
.signed-out .lede { color: var(--ink-soft); text-align: center; margin: 0 0 20px; }
.signed-out .card {
  max-width: none; padding: 22px 20px; margin-top: 16px;
  border-color: var(--line); box-shadow: var(--shadow-lift);
  border-top: 3px solid var(--orange);
}
.signed-out .card .card-foot { margin: 18px 0 0; text-align: center; }
.signed-out .card .card-foot a {
  color: var(--ink-soft); text-decoration: none; border-bottom: 1px solid var(--line);
}
.signed-out .card .card-foot a:hover { color: var(--ink); border-bottom-color: var(--ink-soft); }
.signed-out footer { color: var(--ink-faint); margin-top: 18px; text-align: center; }

/* ---------- Phones and small tablets ---------- */
@media (max-width: 720px) {
  /* Content first, menu after it: a PSAL on a phone should not scroll past 25 menu
     items to reach the page. The Menu link in the bar jumps down to it. */
  .body { flex-direction: column; }
  main { order: 1; max-width: none; padding: var(--gap) var(--gap) 24px; }
  .sidebar {
    order: 2; width: auto; flex: none; align-self: stretch;
    border-right: 0; border-top: 1px solid var(--line);
    position: static; max-height: none; overflow: visible;
    display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 8px; align-items: start;
  }
  .sidebar .group { margin-bottom: 10px; }
  .sidebar .note { grid-column: 1 / -1; }
  .whoami .name, .whoami .roles { display: none; }
  /* The bar shows the module you are in; Menu opens every module and this module's menu
     (the nav drawer, below). */
  .modules span, .modules a:not([aria-current="true"]) { display: none; }
  .modules { flex: 0 0 auto; overflow: visible; }
  .modules a[aria-current="true"] { flex: none; padding: 0 8px; }
  .topbar { gap: 10px; padding: 0 10px; }
  .topbar .brand-logo { height: 22px; }
  .menu-jump { display: inline-flex; }
  .signed-out { padding: 20px 16px; place-items: start center; padding-top: 48px; }
}

.tight { margin-bottom: 0; }

/* ---------- Lists on phones ---------- */
/* A seven-column table cannot be read on a 390px screen, so below 720px the same rows
   become cards: site name, stage, then landlord and city. */
@media (max-width: 720px) {
  .sites-table, .people-table { display: none; }
  .site-cards, .record-cards { display: block; }
  .filters { padding: 12px; gap: 10px; }
  .filter, .filter.search { flex: 1 1 100%; }
  .filter.actions { flex: 1 1 100%; }
  .filter.actions .btn { flex: 1; }
  .panel { padding: 14px; }
  .map { height: 320px; }
  .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  /* One field at a time on a phone: an editable row is a small form, not a table row. */
  .row-form .field, .row-form .field.wide, .row-form .field.narrow { flex: 1 1 100%; }
  .assumptions { grid-template-columns: minmax(0, 1fr); }
  .tiles li { padding: 10px 12px; }
  /* Five columns of dates do not fit a phone: each row becomes a block. */
  .history-table, .history-table tbody, .history-table tr { display: block; }
  .history-table thead { display: none; }
  .history-table tr { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); }
  .history-table tbody th, .history-table td { display: block; border: 0; padding: 2px 0; text-align: left; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  /* Three columns do not fit a 390px screen, and a table that scrolls sideways hides the
     badge that qualifies the figure. Each row becomes a line: label and amount together,
     the badge or note beneath them. */
  .figures, .figures tbody { display: block; }
  .figures tr {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px;
    padding: 8px 12px; border-bottom: 1px solid var(--line-soft);
  }
  .figures tr:last-child { border-bottom: 0; }
  .figures tbody th, .figures td { border: 0; padding: 0; width: auto; }
  /* Two columns of fields do not fit; one thing at a time, thumb-sized. */
  .capture .field-pair { grid-template-columns: minmax(0, 1fr); }
  .capture-actions { flex-direction: column; }
  .figures tbody th { flex: 1 1 auto; min-width: 0; }
  /* "Not agreed yet" sits where an amount would, so it has to be allowed to wrap. */
  .figures td:first-of-type { margin-left: auto; text-align: right; white-space: normal; }
  .figures td:last-child { flex: 1 1 100%; }
  /* The row carries the tint, not its cells: a flex row would show gaps between them. */
  .figures tr.total { background: var(--page); }
  .figures tr.total th, .figures tr.total td { background: transparent; }
}

/* ---------- Quotes (Step 11) ---------- */
/* A compare table grows a column per contractor, so on a phone it scrolls sideways rather
   than squeezing every price onto three lines. */
.table-scroll { overflow-x: auto; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: var(--gap); }
.thumbs figure { margin: 0; }
.thumbs img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--line); }
.thumb-pick { flex-direction: column; align-items: flex-start; }

/* ---------- Drivers ---------- */
/* Drivers → Collections: one table, a row per booking, the time spanning its rows. Its seven
   columns do not fit a phone, so it keeps them and scrolls sideways inside .table-scroll. */
.collections-table { min-width: 860px; }
/* Positioned, so the screen-reader-only Actions heading stays inside the scroll box: without
   it, that absolutely placed span sat at the table's far edge and made the whole page scroll. */
.collections-table { position: relative; }
.collections-table tbody + tbody { border-top: 2px solid var(--line); }
.collections-table th[scope="rowgroup"] { white-space: nowrap; vertical-align: top; }
.collections-table tbody.cancelled { color: var(--ink-faint); }
.collections-table td.actions .row-form { margin: 6px 0 0; }
.collections-table td.actions .btn { white-space: nowrap; }
/* Read by a screen reader, not shown: the heading of the Fix column on a statement. */
.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.reasons, .statement-list, .statement-files { margin: 0 0 12px; padding-left: 20px; }
.reasons li, .statement-list li, .statement-files li { margin-bottom: 6px; }
.data-grid.lines tr.corrected { background: var(--warn-bg); }
.line-fix { display: grid; gap: 8px; min-width: 240px; padding: 8px 0; }
.line-fix .field { margin-bottom: 0; }
.panel > h3 { margin: 18px 0 8px; }

/* ---------- The driver onboard (docs/drivers-onboard-plan.md) ---------- */
.room-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 0 0 var(--gap); }
.room-tiles div { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; }
.room-tiles dt { color: var(--ink-faint); }
.room-tiles dd { margin: 2px 0 0; font-variant-numeric: tabular-nums; }
.qr { display: block; margin: 12px 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); }
.whatsapp { width: 100%; }

/* The door poster: black on white, one thing per line, printable. */
.poster { background: var(--card); }
.poster main { max-width: 640px; margin: 24px auto; text-align: center; display: grid; gap: 12px; justify-items: center; }
.poster-brand { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: var(--fw-bold); margin: 0; }
.poster-brand span { color: var(--teal); }
.poster img { width: 100%; max-width: 420px; height: auto; }
@media print { .poster main { margin: 0 auto; } }

/* Drivers → Collections → Hand over the bike (src/views/drivers/handover.ejs). */
.hint.bad { color: var(--danger); }
.signature-pad { display: block; width: 100%; max-width: 600px; aspect-ratio: 600 / 220; height: auto;
  background: var(--card); border: 2px dashed var(--line); border-radius: var(--radius); touch-action: none; margin: 8px 0; }
.handover-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-top: var(--gap); }
.handover-photos figure { margin: 0; }
.handover-photos img { display: block; width: 100%; height: 120px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); background: var(--page); }
.handover-photos img.signature-image { object-fit: contain; background: var(--card); }

/* ---------- Drivers → Funnel: the stage strip, and how late each driver is ---------- */
/* Each stage is a link that filters the list; the one shown is underlined in teal. Late is
   amber past the target and red past twice it, the same meaning as the stage tones. */
.stage-strip { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.stage-strip li { padding: 0; }
.stage-strip a { display: block; padding: 12px 14px; color: inherit; text-decoration: none; border-radius: var(--radius-lg); }
.stage-strip a:hover, .stage-strip a:focus-visible { background: var(--teal-wash); }
.stage-strip li[aria-current="true"] { border-color: var(--teal); box-shadow: inset 0 -3px 0 var(--teal); }
.stage-strip .late { color: var(--danger); font-weight: var(--fw-semibold); }
.age { font-variant-numeric: tabular-nums; font-weight: var(--fw-semibold); white-space: nowrap; }
.age.ok { color: var(--ok); }
.age.late { color: var(--stage-warn); }
.age.very_late { color: var(--danger); }

/* ---- Updates and next steps, the weekly review, My actions (src/property/updates.js) ---- */
.updates .next-step { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--line); background: var(--line-soft); border-radius: var(--radius); }
.updates .next-step p { margin: 0; }
.updates form.inline { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 8px; max-width: none; }
.updates form.inline .field { flex: 1 1 220px; margin: 0; }
.review-table td { vertical-align: top; }
.review-table .review-comment { max-width: 42ch; overflow-wrap: anywhere; }
.review-table tr.is-overdue td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.review-table p.tight + p.tight { margin-top: 2px; }
/* What was said is the point of an update, so it reads in full ink, not as meta text. */
.updates li > p.t-body, .updates .next-step p.t-body { color: var(--ink); }

/* Collections: the weekly-times form folds away, so the times themselves come first. */
details.panel > summary { cursor: pointer; min-height: var(--tap); display: flex; align-items: center; list-style: none; }
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary h2 { display: inline; }
details.panel > summary::after { content: "Show"; margin-left: auto; color: var(--teal); font-weight: var(--fw-semibold); }
details.panel[open] > summary::after { content: "Hide"; }

/* ---------- All drivers: the Area filter and changing a driver's area ---------- */
/* Several areas at once: a drop-down of tick boxes that needs no script. */
.multi-pick { position: relative; }
.multi-pick > summary {
  list-style: none; cursor: pointer; min-height: var(--tap); display: flex; align-items: center;
  padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.multi-pick > summary::-webkit-details-marker { display: none; }
.multi-pick > summary::after { content: "▾"; margin-left: auto; padding-left: 8px; color: var(--ink-faint); }
.multi-pick-list {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 100%; max-width: min(360px, 90vw);
  max-height: 320px; overflow-y: auto; padding: 6px 10px; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lift);
}
.multi-pick-list .check { display: flex; align-items: center; gap: 8px; min-height: var(--tap); white-space: nowrap; }
/* The lookup's suggestions, as on the drivers' own sign-up page. */
.suburb-pick { position: relative; }
.suburb-list {
  list-style: none; margin: 4px 0 0; padding: 0; background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); position: absolute; z-index: 20; left: 0; right: 0; max-height: 280px; overflow-y: auto;
  box-shadow: var(--shadow-lift);
}
.suburb-list button {
  display: block; width: 100%; min-height: var(--tap); padding: 8px 12px; border: 0;
  border-bottom: 1px solid var(--line-soft); background: transparent; color: var(--ink); text-align: left; cursor: pointer;
}
.suburb-list li:last-child button { border-bottom: 0; }
.suburb-list button:hover, .suburb-list button:focus-visible { background: var(--teal-wash); }
.area-cell { min-width: 12rem; }
.area-cell .area-editor { margin-top: 8px; min-width: 16rem; }
.new-area > summary { cursor: pointer; color: var(--teal); margin: 6px 0; }
/* The page's input sizing is for text boxes; a tick box in the Area filter stays a tick box. */
.multi-pick-list input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; min-width: 0; padding: 0; margin: 0; flex: 0 0 auto; }

/* ---------- Weekly review: the week, the focus and quick updates (3 Nov 2026) ---------- */
.week-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 16px; }
.week-head h2 { margin: 0; }
.week-nav { margin: 0; }
.week-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 10px; }
@media (min-width: 1000px) { .week-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.focus-list { list-style: none; margin: 0 0 10px; padding: 0; }
.focus-list li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.score-table meter { width: 110px; height: 12px; vertical-align: middle; margin-right: 6px; }
.multi-pick-group { margin: 8px 0 2px; color: var(--ink-faint); }
.warn-text { color: var(--warn); }

.quick-update { margin-top: 6px; }
.quick-update > summary { cursor: pointer; color: var(--teal); min-height: var(--tap); display: inline-flex; align-items: center; }
.quick-update[open] > summary { color: var(--ink-soft); }
.quick-form { display: flex; flex-direction: column; gap: 8px; padding: 10px; margin-top: 4px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--page); min-width: 260px; }
.quick-form textarea { padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius); width: 100%; }
.quick-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
@media (min-width: 1200px) { .quick-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.quick-next > summary { cursor: pointer; color: var(--ink-soft); min-height: var(--tap); display: inline-flex; align-items: center; }

/* The ring sizes on the map: plain text on the line, no box. */
.ring-label { background: transparent; border: 0; color: var(--navy); white-space: nowrap; transform: translate(-50%, -110%); }
.map-tick { margin-top: 6px; }

/* The focus page: candidates beside the map on a laptop. */
.focus-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--gap); }
.candidate-table td.flag { min-width: 180px; }
.give-bar { position: sticky; bottom: 0; z-index: 500; background: var(--card); border-top: 1px solid var(--line);
  padding: 10px 0; display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.allocation-person { margin-top: 14px; }
.inline-form { display: flex; flex-wrap: wrap; align-items: end; gap: 6px; margin: 4px 0; }
.inline-form .filter input, .inline-form .filter select { min-height: var(--tap); }
.score-met { color: var(--ok); font-weight: var(--fw-semibold); }
.score-missed { color: var(--warn); font-weight: var(--fw-semibold); }
.score-meter { width: 100%; max-width: 360px; height: 14px; }
/* My calls on a phone (3 Nov 2026): a table that scrolls sideways hid the site and the number
   to call, which is the whole point of the page. Each site becomes a card instead. */
.phone-only { display: none; }
@media (max-width: 720px) {
  .table-scroll:has(.calls-table) { overflow: visible; }
  .calls-table, .calls-table tbody, .calls-table tr, .calls-table td { display: block; width: 100%; }
  .calls-table thead { display: none; }
  .calls-table tr { padding: 12px; border-bottom: 1px solid var(--line); }
  .calls-table td { border: 0; padding: 2px 0; text-align: left; }
  .calls-table td.num { text-align: left; }
  .phone-only { display: inline; }
  .quick-form { min-width: 0; }
}

/* ---------- Bike sales (src/views/sales, src/views/dealer) ---------- */
.muted { color: var(--ink-faint); }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 var(--gap); }
.notes-text { white-space: pre-line; margin-top: 12px; }

/* Where the dealers are: one tile per status, each a filter. */
.pipeline { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0 0 var(--gap); padding: 0; }
.pipeline li { flex: 1 1 110px; }
.pipeline a { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; text-decoration: none; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); }
.pipeline a:hover { border-color: var(--teal); }
.pipeline .num { font-size: var(--fs-h2); line-height: var(--lh-h2); font-weight: var(--fw-bold); font-variant-numeric: tabular-nums; }
.pipeline .t-meta { color: var(--ink-soft); }
.pipeline li[aria-current="true"] a { border-color: var(--teal); background: var(--teal-wash); }

/* The steps of one dealer or one order, done and next. */
.steps-strip { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 var(--gap); padding: 0; }
.steps-strip li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 6px; border-radius: 999px;
  background: var(--quiet-bg); color: var(--ink-soft); }
.steps-strip li span { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--card); font-weight: var(--fw-semibold); font-size: var(--fs-meta); }
.steps-strip li.done { background: var(--ok-bg); color: var(--ok); }
.steps-strip li.done span { background: var(--ok); color: #fff; }
.steps-strip li.next { background: var(--teal-wash); color: var(--ink); font-weight: var(--fw-semibold); }
.steps-strip li.next span { background: var(--teal); color: #fff; }

.close-appointment { flex: 1 1 100%; }
.close-appointment > summary { list-style: none; display: inline-flex; min-height: var(--tap); }
.close-appointment > summary::-webkit-details-marker { display: none; }

/* The order builder: the bikes on the left, the deal on the right; stacked on a phone. */
.builder-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 380px); gap: var(--gap); align-items: start; }
.model-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--gap); margin-bottom: var(--gap); }
.model-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 12px; box-shadow: var(--shadow-card); }
.model-card img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: contain; background: var(--page); border-radius: var(--radius); }
.model-card p { margin: 6px 0 0; }
.stepper { display: flex; align-items: stretch; gap: 6px; margin-top: 10px; }
.stepper .btn { min-width: 52px; min-height: 52px; font-size: var(--fs-h1); line-height: 1; padding: 0; }
.stepper input { flex: 1; min-width: 0; min-height: 52px; text-align: center; font-size: var(--fs-h1); font-weight: var(--fw-bold);
  border: 1px solid var(--line); border-radius: var(--radius); font-variant-numeric: tabular-nums; }
.order-sums { position: sticky; top: 12px; }
.order-sums .figures { max-width: none; }
.order-sums .figures tbody th { width: 55%; }
.order-sums .figures td:first-of-type { width: auto; }
.dealer-gain { background: var(--teal-wash); border-radius: var(--radius); padding: 10px 12px; margin: 12px 0; }
.dealer-gain p { margin: 0; }
.dealer-gain .figure { font-size: var(--fs-h1); line-height: var(--lh-h1); font-weight: var(--fw-bold); color: var(--stage-open); }
.data-grid.tiers tr.current td { background: var(--teal-wash); font-weight: var(--fw-semibold); }
.confirm-line { display: flex; align-items: flex-start; gap: 8px; margin: 12px 0 4px; }
.confirm-line input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--teal); flex: 0 0 auto; }
.data-grid.order-lines tr.total th, .data-grid.order-lines tr.total td { background: var(--page); }
.vin-row { padding: 4px 0; align-items: end; }
.vin-row .vin-n { flex: 0 0 24px; padding-bottom: 10px; text-align: right; }
input.vin, th.vin { font-variant-numeric: tabular-nums; letter-spacing: 0.04em; text-transform: uppercase; }

@media (max-width: 900px) {
  .builder-grid { grid-template-columns: 1fr; }
  .order-sums { position: static; }
}
.dealer-main { max-width: 1100px; margin: 0 auto; width: 100%; }
.dealer-footer { margin-top: 32px; padding-top: 12px; border-top: 1px solid var(--line); }
.order-sums .figures { width: 100%; }
.order-sums .figures th { text-align: left; font-weight: var(--fw-regular); color: var(--ink-soft); padding: 6px 0; }
.order-sums .figures td { text-align: right; font-weight: var(--fw-semibold); padding: 6px 0; font-variant-numeric: tabular-nums; }
.order-sums .figures tr.total th, .order-sums .figures tr.total td { color: var(--ink); font-weight: var(--fw-bold); padding-inline: 6px; }
.history li > .badge { align-self: flex-start; }
/* The deal panel stays a two-column table on a phone; the generic .figures stacking is for long labels. */
@media (max-width: 720px) {
  .order-sums .figures, .order-sums .figures tbody { display: table; width: 100%; }
  .order-sums .figures tbody { display: table-row-group; }
  .order-sums .figures tr { display: table-row; }
  .order-sums .figures th, .order-sums .figures td { display: table-cell; width: auto; border-bottom: 1px solid var(--line-soft); }
}

/* ---------- Bike sales: the dashboard and the network map (6 Nov 2026) ---------- */
.dashboard-pair { display: grid; gap: var(--gap); }
@media (min-width: 1100px) { .dashboard-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.dashboard-pair > .panel { margin-bottom: 0; }
.dashboard-pair + .panel, .panel + .dashboard-pair { margin-top: var(--gap); }
.map-tall { height: 560px; }
@media (max-width: 720px) { .map-tall { height: 420px; } }
.map-layers { display: flex; flex-wrap: wrap; gap: 6px 16px; border: 0; padding: 0; margin: 0 0 10px; }
.map-layers legend { padding: 0; margin-right: 4px; float: left; line-height: var(--tap); }
.map-layers label { display: inline-flex; align-items: center; gap: 6px; min-height: var(--tap); }
.map-layers input { width: 18px; height: 18px; accent-color: var(--teal); }
.swatch-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; background: var(--teal); border: 1px solid var(--line); }
.swatch-square, .station-pin { width: 12px; height: 12px; display: inline-block; background: var(--orange); border: 2px solid var(--navy); border-radius: 2px; box-sizing: border-box; }
.station-pin.station-building { background: var(--card); }
.station-pin.station-talks { background: var(--card); border-color: var(--ink-soft); }
.swatch-ring { width: 14px; height: 14px; display: inline-block; border: 1px dashed var(--navy); border-radius: 50%; }
.see-next { list-style: none; padding: 0; margin: 0; }
.see-next li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.see-next li > a { font-weight: var(--fw-semibold); }
.see-next li > .badge { margin-left: auto; }
.nearest-list { list-style: none; padding: 0; margin: 0 0 12px; }
.nearest-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.nearest-list li label { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tap); flex: 1 1 260px; }
.nearest-list input[type=radio] { width: 18px; height: 18px; accent-color: var(--teal); }
.parts-grid td.qty input { width: 72px; text-align: right; }
.parts-grid tr.picked td, .parts-grid tr.picked th { background: var(--teal-wash); }
.parts-search { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: end; margin-bottom: 12px; }
.parts-totals { width: 100%; max-width: 420px; margin: 12px 0 8px auto; border-collapse: collapse; }
.parts-totals th { text-align: left; font-weight: var(--fw-regular); color: var(--ink-soft); padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.parts-totals td { text-align: right; font-weight: var(--fw-semibold); padding: 6px 0; border-bottom: 1px solid var(--line-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.parts-totals tr.total th, .parts-totals tr.total td { color: var(--ink); font-weight: var(--fw-bold); }
/* Parts pictures (6 Nov 2026): a thumbnail and a one-tap button at the start of each row, and the
   picture beside the form in the Change panel. */
.part-pic { min-width: 120px; }
.part-pic .part-thumb { width: 56px; height: 56px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); display: block; margin-bottom: 6px; background: var(--page); }
.photo-form { display: flex; gap: 6px; align-items: center; margin: 0; }
.photo-btn { cursor: pointer; white-space: nowrap; }
.photo-btn.is-busy { opacity: 0.6; pointer-events: none; }
.part-edit { display: grid; gap: var(--gap); align-items: start; }
@media (min-width: 900px) { .part-edit { grid-template-columns: minmax(0, 1fr) 260px; } }
.part-photo { margin: 0; }
.part-photo img { width: 100%; max-width: 260px; aspect-ratio: 1; object-fit: contain; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); display: block; }
.part-photo figcaption { margin: 6px 0; }
.part-photo-empty { width: 100%; max-width: 260px; aspect-ratio: 1; display: grid; place-items: center; text-align: center; padding: 16px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-soft); }
.parts-grid .part-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); vertical-align: middle; margin-right: 8px; float: left; }
.part-edit-row > td { background: var(--page); padding: 16px; }
.part-edit-row .row-form { margin: 0; }
/* The open panel takes the table's width and never sets it: without this, its form widened the
   whole table past the screen and pushed the Change buttons out of sight (seen 6 Nov 2026). */
.part-edit-row .part-edit { width: 0; min-width: 100%; box-sizing: border-box; }
.part-edit-row .row-form { flex-wrap: wrap; }

/* ---------- The phone menu (6 Nov 2026) ---------- */
/* On a laptop the drawer is nothing: its left menu sits in the layout as it always has. */
.nav-drawer { display: contents; }
.phone-modules { display: none; }
@media (max-width: 720px) {
  /* Without the script: every module, then this module's menu, at the foot of the page. */
  .nav-drawer { display: block; order: 2; border-top: 1px solid var(--line); background: var(--card); }
  .nav-drawer .sidebar { border-top: 0; }
  .phone-modules { display: block; padding: var(--gap) 10px 4px; border-bottom: 1px solid var(--line-soft); }
  .phone-modules > p { color: var(--ink-faint); font-weight: var(--fw-semibold); margin: 0 0 6px 10px; text-transform: uppercase; letter-spacing: 0.06em; }
  .phone-modules ul { list-style: none; margin: 0 0 8px; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 8px; }
  .phone-modules a, .phone-modules .soon { display: flex; align-items: center; min-height: var(--tap); padding: 0 10px; border-radius: var(--radius); text-decoration: none; color: var(--ink); }
  .phone-modules .soon { color: var(--ink-disabled); }
  .phone-modules a[aria-current="page"] { background: var(--teal-wash); font-weight: var(--fw-semibold); box-shadow: inset 3px 0 0 var(--teal); }
  /* With the script: the same list as a panel over the page, opened by Menu. */
  .has-nav-menu .nav-drawer { display: none; }
  .has-nav-menu.nav-open .nav-drawer {
    display: block; position: fixed; top: var(--topbar-h); left: 0; right: 0; bottom: 0; z-index: 9;
    overflow-y: auto; -webkit-overflow-scrolling: touch; box-shadow: var(--shadow-card); border-top: 1px solid var(--line);
  }
  .has-nav-menu.nav-open body { overflow: hidden; }
  .menu-jump[aria-expanded="true"] { background: var(--teal-wash); border-color: var(--teal); }
}

/* The dealer portal's tabs on a phone: all of them, as a strip under the brand that scrolls
   sideways, rather than only the one you are on. */
@media (max-width: 720px) {
  .topbar.portal-bar { height: auto; flex-wrap: wrap; row-gap: 0; padding-top: 6px; }
  .portal-bar .modules.portal-tabs { order: 3; flex: 1 1 100%; overflow-x: auto; }
  .portal-bar .modules.portal-tabs a:not([aria-current="true"]), .portal-bar .modules.portal-tabs span { display: inline-flex; }
  .portal-bar .modules.portal-tabs a { min-height: var(--tap); }
  .portal-bar .whoami { margin-left: auto; }
}
/* The count on the walk (6 Nov 2026): the number on the shelf and Save count, above Add picture. */
.photo-form { flex-wrap: wrap; }
.count-row { display: flex; gap: 6px; align-items: center; flex: 1 1 100%; }
.count-box { width: 76px; text-align: right; font-variant-numeric: tabular-nums; }
.count-save { white-space: nowrap; }
.count-note { margin: 4px 0 0; }
.stock-history { grid-column: 1 / -1; }
.stock-history h3 { margin: 0 0 4px; }
/* The catalogue on a phone (6 Nov 2026): each part a card, its number and name in full first
   (the person on the warehouse walk has to know which part is in their hand), then the count
   and the picture, then prices and state. No sideways scrolling. */
@media (max-width: 720px) {
  .parts-table, .parts-table tbody { display: block; width: 100%; }
  .parts-table thead { display: none; }
  .parts-table tbody tr:not(.part-edit-row) {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px;
    padding: 12px 14px; border-bottom: 1px solid var(--line);
  }
  .parts-table tbody tr:not(.part-edit-row) > * { display: block; border: 0; padding: 0; }
  .parts-table tbody tr > th[scope="row"] { order: 1; font-weight: var(--fw-bold); }
  .parts-table tbody tr > td:nth-child(3) { order: 2; flex: 1 1 100%; }
  .parts-table tbody tr > td.part-pic { order: 3; flex: 1 1 100%; min-width: 0; margin: 6px 0; }
  .parts-table tbody tr > td { order: 4; }
  .parts-table tbody tr > td.num::before { content: attr(data-label) " "; color: var(--ink-faint); }
  .parts-table .part-pic .part-thumb { width: 72px; height: 72px; }
  .parts-table .part-edit-row, .parts-table .part-edit-row > td { display: block; }
  .parts-table .count-box { width: 96px; }
}
/* On a laptop the walk column stays narrow: the count box above its button, not beside it. */
@media (min-width: 721px) {
  .part-pic { width: 136px; }
  .count-row { flex-wrap: wrap; }
  .count-box { width: 100%; max-width: 120px; }
}

/* ---------- Settings (6 Nov 2026) ---------- */
/* The gear in the top bar: setup that is not one module's lists. A full tap target on a phone. */
.settings-gear {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: var(--tap); min-height: var(--tap); border-radius: var(--radius);
  color: var(--ink-soft);
}
.topbar a.settings-gear { color: var(--ink-soft); }
.topbar a.settings-gear:hover, .topbar a.settings-gear[aria-current="page"] { background: var(--page); color: var(--ink); }
.topbar a.settings-gear[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--orange); }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--gap); }
.settings-list { list-style: none; margin: 0; padding: 0; }
.settings-list li { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.settings-list li:first-child { border-top: 0; }
.settings-list a { display: inline-flex; min-height: var(--tap); align-items: center; }
.settings-list .soon { color: var(--ink-disabled); }
.settings-list .t-meta { color: var(--ink-faint); }

/* ---------- Deals (8 Nov 2026) ---------- */
.data-grid caption { text-align: left; padding: 8px 0; font-weight: 600; }
.deal-stages { margin-bottom: var(--gap); }
.deal-stages .badge { margin-left: 6px; }
.deals-table th[scope="row"] { min-width: 180px; }
.deal-history { list-style: none; margin: 0; padding: 0; }
.deal-history > li { padding: 10px 0; border-top: 1px solid var(--line-soft); }
.deal-history > li:first-child { border-top: 0; }
.deal-history ul { margin: 4px 0 0; padding-left: 18px; }
.actions-row form.inline { display: inline-flex; margin: 0; }
.actions-row .promo-pick { display: inline-flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.actions-row .promo-pick select { max-width: 100%; }
section.panel form.inline { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* Driver page: Change email, folded under their contact line. */
.change-email { margin-top: var(--space-2, 8px); }
.change-email summary { cursor: pointer; color: var(--teal); min-height: var(--tap); display: inline-flex; align-items: center; }
.change-email .capture { max-width: 32rem; }

/* Promotions (10 Nov 2026): the email as a dealer reads it, and the small forms in each row. */
.email-text { white-space: pre-wrap; overflow-wrap: anywhere; font-family: inherit; margin: 0; padding: 12px; background: var(--line-soft); border: 1px solid var(--line); border-radius: 6px; }
td form.inline { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; }
td form.inline input[inputmode="decimal"] { width: 5em; }

/* ---- Stage track and next step (src/property/nextStep.js, 16 Nov 2026) ----
   Previous stage, muted → current stage → the next step as a green pill. The pill is --ok with
   white text (6.4:1), so it reads as "go" without a new colour. */
.stage-track { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 12px 0 0; }
.stage-track-prev { color: var(--ink-faint); }
.stage-track-now { font-weight: var(--fw-semibold); }
.stage-track-arrow { color: var(--ink-faint); }
.stage-track-done { color: var(--ok); font-weight: var(--fw-semibold); }
.next-step {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px;
  border-radius: 999px; background: var(--ok); color: #fff; font-weight: var(--fw-semibold);
  text-decoration: none; box-shadow: 0 0 0 3px var(--ok-bg);
}
a.next-step:hover, a.next-step:focus-visible { filter: brightness(1.12); color: #fff; }
a.next-step:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.next-step.blocker { background: var(--stage-warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.next-step.waiting { background: var(--ok-bg); color: var(--ok); box-shadow: none; }
.next-step.compact { min-height: 0; padding: 3px 10px; box-shadow: none; }
@media (max-width: 640px) {
  .stage-track .next-step { flex: 1 1 100%; justify-content: center; min-height: 44px; }
}
/* A panel the pill jumps to says so for a moment. */
h2:target { animation: next-step-flash 2s ease-out 1; scroll-margin-top: 80px; }
@keyframes next-step-flash { 0% { background: var(--ok-bg); } 100% { background: transparent; } }
.invoice-list { list-style: none; margin: 0 0 12px; padding: 0; }
.invoice-list > li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.invoice-list > li:last-child { border-bottom: 0; }
