@font-face { font-family: "Plex"; src: url("fonts/plex-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/plex-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Plex"; src: url("fonts/plex-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

/* ---------- tokens ---------- */
:root {
  --bg: #f1f4f9;
  --surface: #ffffff;
  --sunken: #e7edf6;
  --ink: #12213a;
  --ink-2: #4a5b76;
  --line: #d2dbe9;
  --line-strong: #b4c2d8;
  --accent: #1c54ae;
  --accent-hover: #164590;
  --accent-ink: #ffffff;
  --rail: #0e2444;
  --rail-ink: #c9d8ef;
  --rail-ink-strong: #ffffff;
  --rail-active: #1b3d6f;
  --rail-line: #1f3a63;
  --listed: #14703f;
  --listed-bg: #e0f2e8;
  --removed: #b0362b;
  --removed-bg: #fbe6e3;
  --price: #1c54ae;
  --price-bg: #e1ebfb;
  --pending: #855a00;
  --pending-bg: #faefcd;
  --key: #e9a100;
  --key-ink: #2b1d00;
  --shadow: 0 1px 2px rgba(14, 36, 68, 0.06), 0 4px 16px rgba(14, 36, 68, 0.05);
  --font: "Plex", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1424;
    --surface: #111f35;
    --sunken: #0d192c;
    --ink: #e4ecf8;
    --ink-2: #9db0cc;
    --line: #22344e;
    --line-strong: #33496a;
    --accent: #7aaeff;
    --accent-hover: #9cc3ff;
    --accent-ink: #071a33;
    --rail: #0c1a2f;
    --rail-ink: #a9bddb;
    --rail-ink-strong: #ffffff;
    --rail-active: #1a3359;
    --rail-line: #1b2e4b;
    --listed: #6dd19d;
    --listed-bg: #11322a;
    --removed: #ff9d90;
    --removed-bg: #3a1e26;
    --price: #8db9ff;
    --price-bg: #152f58;
    --pending: #efc665;
    --pending-bg: #382e14;
    --key: #f0b429;
    --key-ink: #2b1d00;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
  }
}
:root[data-theme="dark"] {
  --bg: #0a1424;
  --surface: #111f35;
  --sunken: #0d192c;
  --ink: #e4ecf8;
  --ink-2: #9db0cc;
  --line: #22344e;
  --line-strong: #33496a;
  --accent: #7aaeff;
  --accent-hover: #9cc3ff;
  --accent-ink: #071a33;
  --rail: #0c1a2f;
  --rail-ink: #a9bddb;
  --rail-ink-strong: #ffffff;
  --rail-active: #1a3359;
  --rail-line: #1b2e4b;
  --listed: #6dd19d;
  --listed-bg: #11322a;
  --removed: #ff9d90;
  --removed-bg: #3a1e26;
  --price: #8db9ff;
  --price-bg: #152f58;
  --pending: #efc665;
  --pending-bg: #382e14;
  --key: #f0b429;
  --key-ink: #2b1d00;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { margin: 0; font-weight: 600; line-height: 1.2; text-wrap: balance; }
h1 { font-size: 1.7rem; letter-spacing: -0.02em; }
h2 { font-size: 1.1rem; letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; }
p { margin: 0.6rem 0; }
strong { font-weight: 600; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); color: var(--ink); padding: 8px 12px; border-radius: 6px; z-index: 10; }
.skip:focus { left: 8px; }

/* ---------- shell ---------- */
body.app { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--rail); color: var(--rail-ink); display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; border-right: 1px solid var(--rail-line); }
.side :focus-visible, .bare-head :focus-visible { outline-color: #ffffff; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--rail-ink-strong); text-decoration: none; font-weight: 600; font-size: 1.05rem; letter-spacing: -0.01em; padding: 4px 10px 20px; }
.brand:hover { color: var(--rail-ink-strong); }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; background: linear-gradient(135deg, #5d9bff 0 50%, #2a66d0 50% 100%); flex: none; }
.nav { display: grid; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; color: var(--rail-ink); text-decoration: none; padding: 10px; border-radius: 8px; font-weight: 500; }
.nav a:hover { color: var(--rail-ink-strong); background: color-mix(in srgb, var(--rail-active) 55%, transparent); }
.nav a[aria-current="page"] { color: var(--rail-ink-strong); background: var(--rail-active); }
.nav svg { flex: none; }
.nav-count { display: inline-block; margin-left: 4px; min-width: 20px; padding: 3px 6px; border-radius: 999px; background: var(--key); color: var(--key-ink); font-size: 0.72rem; font-weight: 600; line-height: 1; text-align: center; }
.nav-count[hidden] { display: none; }
.side-foot { margin-top: auto; display: grid; gap: 12px; padding: 16px 0 0; border-top: 1px solid var(--rail-line); }
.side-foot form { margin: 0; }
.signout { width: 100%; text-align: left; background: none; border: 0; color: var(--rail-ink); font: inherit; font-weight: 500; padding: 10px; border-radius: 8px; cursor: pointer; }
.signout:hover { color: var(--rail-ink-strong); background: color-mix(in srgb, var(--rail-active) 55%, transparent); }

.main { padding: 32px 36px 72px; max-width: 1180px; width: 100%; }

/* theme switcher */
.theme { display: grid; gap: 6px; padding: 0 10px; }
.theme-label { font-size: 0.8rem; color: var(--rail-ink); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: color-mix(in srgb, #000 25%, var(--rail)); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { font: inherit; font-size: 0.82rem; font-weight: 500; color: var(--rail-ink); background: none; border: 0; border-radius: 6px; padding: 6px 4px; cursor: pointer; min-height: 32px; }
.seg button:hover { color: var(--rail-ink-strong); }
.seg button[aria-pressed="true"] { background: var(--rail-active); color: var(--rail-ink-strong); box-shadow: inset 0 0 0 1px color-mix(in srgb, #fff 14%, transparent); }

/* signed-out pages */
body.bare { min-height: 100vh; display: flex; flex-direction: column; align-items: center; background: var(--rail); }
.bare-head { padding: 48px 16px 20px; }
.bare-head .brand { padding: 0; font-size: 1.2rem; }
body.bare .main { padding: 0 16px; max-width: 460px; }
.bare-foot { padding: 20px 16px 40px; width: 100%; max-width: 250px; }
.bare-foot .theme { padding: 0; text-align: center; }

/* ---------- page head ---------- */
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 20px; flex-wrap: wrap; margin-bottom: 20px; }
.lede { margin: 0; color: var(--ink-2); }
.crumb { margin: 0 0 10px; font-size: 0.9rem; }
.hint, .fig-note, .url { color: var(--ink-2); font-size: 0.85rem; }
.fig-note { font-weight: 400; }

/* ---------- notices ---------- */
.notice { margin: 0 0 16px; padding: 11px 14px; border-radius: 8px; border: 1px solid; }
.notice-ok { background: var(--listed-bg); border-color: color-mix(in srgb, var(--listed) 35%, transparent); }
.notice-err { background: var(--removed-bg); border-color: color-mix(in srgb, var(--removed) 35%, transparent); }

/* ---------- forms ---------- */
label { display: block; font-size: 0.86rem; font-weight: 500; color: var(--ink-2); }
input, select { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; min-height: 40px; max-width: 100%; }
label > input:not([type="checkbox"]), label > select { display: block; width: 100%; margin-top: 5px; }
input:hover, select:hover { border-color: var(--ink-2); }
input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
select, input[type="date"], input[type="time"] { height: 40px; }
/* Draw the dropdown ourselves: Safari's built-in one ignores the field colours and clips the text. */
select { -webkit-appearance: none; appearance: none; line-height: 22px; padding-right: 34px; text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: right 17px center, right 12px center; background-size: 5px 5px; background-repeat: no-repeat; }
@supports (-webkit-touch-callout: none) {
  /* iPhone and iPad zoom the page when a field with text smaller than 16px is tapped. */
  input, select { font-size: 16px; }
  /* iOS draws date fields at their own size and centres the value; make them match the other fields */
  input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; min-width: 0; line-height: 22px; }
  input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; min-height: 22px; }
}
.hint { display: block; margin-top: 5px; font-weight: 400; }
.stack { display: grid; gap: 14px; max-width: 440px; }
.row-fields { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 14px; align-items: end; }
.row-fields > * { min-width: 0; }
.grow { flex: 1 1 200px; }
.check { display: flex; align-items: center; gap: 9px; min-height: 40px; color: var(--ink); font-weight: 400; font-size: 0.93rem; }
.check input { min-height: 0; width: 18px; height: 18px; accent-color: var(--accent); }
.inline { margin-top: 12px; }
.btn { display: inline-flex; align-items: center; justify-content: center; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; background: var(--accent); color: var(--accent-ink); border: 1px solid var(--accent); border-radius: 8px; padding: 8px 16px; min-height: 40px; justify-self: start; }
.btn:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--sunken); color: var(--ink); border-color: var(--ink-2); }
.btn-wide { width: 100%; justify-self: stretch; }
.btn svg { flex: none; margin-left: 8px; }
.panel-action { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.toolbar { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.toolbar .check { align-self: flex-end; }

/* ---------- inventory filters ---------- */
/* A full-width row at the bottom of the search box: the Filters button, what is in use, and the panel it opens. */
.filters { flex: 1 1 100%; min-width: 0; padding-top: 12px; border-top: 1px solid var(--line); }
.filters[hidden], .filters-panel[hidden], .toolbar .btn[hidden] { display: none; }
.filters-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; }
.filters-bar .btn { gap: 8px; }
.filters-bar .btn svg { margin-left: 0; }
.filters-bar .btn[aria-expanded="true"] { background: var(--sunken); border-color: var(--ink-2); }
.linkish { font: inherit; font-size: 0.9rem; font-weight: 500; color: var(--accent); background: none; border: 0; padding: 8px 4px; cursor: pointer; text-decoration: underline; }
.linkish[hidden] { display: none; }
.filters-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 28px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.fgroup { min-width: 0; margin: 0; padding: 0; border: 0; }
.fgroup legend { padding: 0; margin-bottom: 7px; font-size: 0.86rem; font-weight: 600; color: var(--ink-2); }
.frange { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; color: var(--ink-2); font-size: 0.86rem; }
.frange label { flex: 1 1 0; min-width: 0; }
.frange input { width: 100%; margin: 0; }
.fgroup .check { margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; }
.chips:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 0.88rem; font-weight: 500; line-height: 1.2; min-height: 34px; padding: 6px 12px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--ink-2); background: var(--sunken); }
.chip-n { font-size: 0.8rem; font-weight: 400; color: var(--ink-2); }
.chip[aria-pressed="true"], .chip-on { color: var(--price); background: var(--price-bg); border-color: var(--price); font-weight: 600; }
.chip[aria-pressed="true"] .chip-n { color: inherit; }
.chip:disabled { opacity: 0.45; cursor: default; background: var(--surface); border-color: var(--line); }
#filters-n { margin-left: 2px; }
#filters-n[hidden] { display: none; }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 22px; margin-bottom: 16px; box-shadow: var(--shadow); }
.panel > h2:first-child, .panel > .panel-head:first-child { margin-top: 0; }
.panel h2 { margin-bottom: 8px; }
.panel h3 { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel-head h2 { margin: 0; }
/* Settings: a heading over each group of panels, and the panels' own titles one level down. */
.panel .panel-title { font-size: 1.1rem; letter-spacing: -0.01em; margin: 0 0 8px; }
.panel-head .panel-title { margin: 0; }
.panel h4 { margin: 18px 0 0; font-size: 0.95rem; font-weight: 600; }
.group-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px 20px; flex-wrap: wrap; margin: 0 0 12px; }
.group-head p { margin: 4px 0 0; }
.group-head form { display: flex; flex-wrap: wrap; justify-content: flex-end; }
.group-head .busy-note { text-align: right; }
.group-head + .empty { margin-bottom: 16px; }
/* Settings: tabs to its pages, under the page title. On a phone they scroll sideways instead of wrapping. */
.subnav { display: flex; gap: 4px; margin: -4px 0 24px; padding-bottom: 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a { flex: none; padding: 10px 14px; margin-bottom: -1px; color: var(--ink-2); font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; border-radius: 6px 6px 0 0; }
.subnav a:hover { color: var(--ink); background: var(--sunken); }
.subnav a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }
.subnav + h2 { margin-top: 0; }
@media (max-width: 480px) { .subnav { gap: 0; } .subnav a { padding: 10px 6px; font-size: 0.94rem; } }
/* Settings, Account: a second part of one panel, under a rule. */
.panel-part { border-top: 1px solid var(--line); margin-top: 22px; padding-top: 4px; }
.panel h3 + .stack { margin-top: 10px; }
/* Settings, Admin: the accounts other than the admin share one area, folded until opened; the arrow turns with it. */
.acct { margin-top: 0; }
.acct > summary { width: auto; padding: 0; color: var(--ink); list-style: none; }
.acct > summary::-webkit-details-marker { display: none; }
.acct > summary .panel-title { display: flex; align-items: center; gap: 10px; min-width: 0; overflow-wrap: anywhere; }
.acct > summary .panel-title::before { content: ""; flex: none; width: 8px; height: 8px; margin: 0 2px 0 3px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(-45deg); }
.acct[open] > summary .panel-title::before { transform: rotate(45deg); margin-top: -4px; }
.acct[open] > summary { margin-bottom: 0; }
.acct .panel-part { margin-top: 18px; padding-top: 16px; }
.acct .panel-part h4 { margin: 0; overflow-wrap: anywhere; min-width: 0; }
/* A dealership's panel glows from the inside with its website's own colours (set per dealership by /dealerships.css). */
.dealer { border-left: 3px solid var(--line-strong); }
.dealer-lit {
  border-color: color-mix(in srgb, var(--d1) 45%, var(--line));
  border-left-color: var(--d1);
  background:
    radial-gradient(90% 130% at 0% 0%, color-mix(in srgb, var(--d1) 30%, transparent), transparent 60%),
    radial-gradient(70% 120% at 100% 0%, color-mix(in srgb, var(--d2) 15%, transparent), transparent 62%),
    radial-gradient(80% 90% at 60% 120%, color-mix(in srgb, var(--d3) 22%, transparent), transparent 65%),
    var(--surface);
  box-shadow: var(--shadow), inset 0 0 28px -6px color-mix(in srgb, var(--d1) 45%, transparent), inset 0 -18px 30px -22px color-mix(in srgb, var(--d2) 35%, transparent);
}
.dealer-lit .btn-ghost { background: color-mix(in srgb, var(--surface) 80%, transparent); }
.panel-narrow { padding: 28px; border: 0; }
.panel-narrow h1 { font-size: 1.4rem; margin-bottom: 18px; }
.panel-narrow h2 { margin: 10px 0 0; font-size: 1rem; }
.url { overflow-wrap: anywhere; margin-top: 2px; }
details { margin-top: 12px; }
summary { cursor: pointer; color: var(--accent); padding: 6px 0; width: fit-content; font-weight: 500; }
details .stack { margin-top: 8px; }
.plain { margin: 6px 0 0; padding-left: 18px; color: var(--ink-2); font-size: 0.9rem; }

/* ---------- summary strip ---------- */
.summary { display: grid; grid-template-columns: repeat(4, 1fr); margin: 0 0 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.sum { padding: 14px 18px; border-left: 1px solid var(--line); display: flex; flex-direction: column-reverse; }
.sum:first-child { border-left: 0; }
.sum dt { font-size: 0.86rem; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.sum dt::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--k); flex: none; }
.sum dd { margin: 0; font-size: 1.9rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; }

.k-listed { --k: var(--listed); --k-bg: var(--listed-bg); }
.k-removed { --k: var(--removed); --k-bg: var(--removed-bg); }
.k-price { --k: var(--price); --k-bg: var(--price-bg); }
.k-pending { --k: var(--pending); --k-bg: var(--pending-bg); }

/* ---------- ledger ---------- */
/* Each day opens and closes. Today starts open; earlier days start closed, showing only their counts. */
.day { margin-top: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.day:hover { border-color: var(--line-strong); }
.day > summary:focus-visible { outline-offset: -3px; border-radius: 9px; }
.keep-note { margin: 0 0 4px; padding-left: 10px; }
.day > summary { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; width: auto; padding: 11px 14px; color: var(--ink); list-style: none; }
.day > summary::-webkit-details-marker { display: none; }
.day > summary::before { content: ""; flex: none; width: 8px; height: 8px; margin: 0 4px 0 3px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(-45deg); }
.day[open] > summary::before { transform: rotate(45deg); margin-top: -4px; }
/* The day is one box: the date bar on top, its changes directly underneath, inside the same border. */
.day > .ledger { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.day > summary h2 { display: flex; align-items: center; gap: 10px; font-size: 1.05rem; }
.day-counts { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.day-n { font-size: 0.78rem; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px; white-space: nowrap; color: var(--k); background: var(--k-bg); }
.ledger { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.ledger-head { display: flex; align-items: center; gap: 8px; padding: 9px 16px 9px 20px; background: var(--k-bg); color: var(--k); font-size: 0.86rem; font-weight: 600; border-top: 1px solid var(--line); }
.ledger-head:first-child { border-top: 0; }
.ledger-head .n { font-weight: 500; opacity: 0.85; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 11px 16px 11px 20px; border-top: 1px solid var(--line); position: relative; }
.rows:first-child > .row:first-child, .ledger-head + .rows > .row:first-child { border-top: 0; }
.row[class*="k-"]::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--k); }
.row-main { min-width: 0; overflow-wrap: anywhere; }
.row-main > a { font-weight: 500; color: var(--ink); text-decoration: none; }
.row-main > a:hover { color: var(--accent); text-decoration: underline; }
/* Click-to-copy values (the script adds role="button"; without it they are plain text). */
.copy[role="button"] { position: relative; cursor: copy; border-radius: 4px; text-decoration: underline dotted var(--line-strong); text-underline-offset: 3px; }
.copy[role="button"]:hover { color: var(--accent); text-decoration-color: currentColor; }
.copy[data-done]::after { content: attr(data-done); position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); z-index: 2; white-space: nowrap; background: var(--ink); color: var(--surface); font-size: 0.75rem; font-weight: 600; line-height: 1; padding: 5px 8px; border-radius: 6px; pointer-events: none; }
.copy-scratch { position: fixed; top: 0; left: -9999px; opacity: 0; }
.row-meta { margin: 2px 0 0; display: flex; flex-wrap: wrap; gap: 2px 14px; color: var(--ink-2); font-size: 0.85rem; }
.row-fig { text-align: right; white-space: nowrap; flex: none; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.row-fig strong { font-size: 1rem; }
.was { color: var(--ink-2); text-decoration: line-through; }
.delta { font-size: 0.82rem; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.delta-down { color: var(--listed); background: var(--listed-bg); }
.delta-up { color: var(--removed); background: var(--removed-bg); }

.tag { display: inline-block; font-size: 0.74rem; font-weight: 600; line-height: 1; padding: 4px 8px; border-radius: 999px; background: var(--price-bg); color: var(--price); vertical-align: middle; white-space: nowrap; letter-spacing: 0; }
.tag-live { background: var(--listed-bg); color: var(--listed); }
.tag-gone { background: var(--removed-bg); color: var(--removed); }
.tag-pending { background: var(--pending-bg); color: var(--pending); }

.empty { background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 10px; padding: 24px; max-width: 620px; }
.empty p { margin: 0 0 4px; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.grid { border-collapse: collapse; width: 100%; }
.grid th, .grid td { padding: 11px 16px; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid th { font-size: 0.84rem; font-weight: 600; color: var(--ink-2); white-space: nowrap; background: var(--sunken); }
.grid th a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; padding: 3px 0; }
.grid th a:hover { color: var(--ink); text-decoration: underline; }
.grid th[aria-sort] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); }
.grid th span[aria-hidden] { font-size: 0.65rem; }
.grid .num { text-align: right; white-space: nowrap; }
.grid td.veh { min-width: 230px; }
/* Only the vehicle cell wraps; dates and figures stay on one line. */
.grid.inv td:not(.veh) { white-space: nowrap; }
.grid td.price { font-weight: 600; }
.grid td.price .fig-note { font-weight: 400; }
/* Every cell sits on the same text line as the vehicle name, not centred against the two-line cell. */
.grid tbody td { vertical-align: baseline; }
/* The year reads as part of the vehicle's name: same size and weight. */
.grid.inv td.yr { font-size: 1.06rem; font-weight: 600; }
.grid td.veh > a { font-size: 1.06rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.grid td.veh > a:hover { color: var(--accent); text-decoration: underline; }
.grid tbody tr:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.grid tr.gone td { color: var(--ink-2); }
.grid tr.gone td.veh > a { color: var(--ink-2); }

/* ---------- key run ---------- */
/* The key under each year: grey until the vehicle is on the Key Run list. */
.keyrun-form { margin: 0; }
/* On the inventory table the button is as wide as the four digits above it, so the key sits centred under the year. */
.grid.inv .keyrun-form { margin-top: 4px; width: 4ch; }
.grid.inv .keyrun { width: 100%; }
.keyrun { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 30px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--line-strong); cursor: pointer; }
.keyrun:hover { color: var(--ink-2); background: var(--sunken); }
.keyrun[aria-pressed="true"] { color: var(--key-ink); background: var(--key); }
.keyrun[aria-pressed="true"]:hover { background: color-mix(in srgb, var(--key) 85%, var(--ink)); color: var(--key-ink); }
.keyrun[aria-pressed="true"] circle { fill: color-mix(in srgb, currentColor 35%, transparent); }
.keyrun[disabled] { opacity: 0.6; cursor: progress; }
/* Vehicle page: the same switch as a button with words on it. */
.head-side { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
.keyrun-wide { width: auto; height: auto; min-height: 40px; gap: 8px; padding: 8px 14px; font: inherit; font-weight: 600; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); white-space: nowrap; }
.keyrun-wide:hover { color: var(--ink); border-color: var(--ink-2); }
.keyrun-wide[aria-pressed="true"] { border-color: var(--key); }
.keyrun-wide[aria-pressed="true"] .when-off, .keyrun-wide[aria-pressed="false"] .when-on { display: none; }
.grid.keys td.stock { font-weight: 600; font-size: 1.06rem; white-space: nowrap; }
.grid.keys .keyrun-form { display: inline-block; }
/* The Key Run area on the Inventory page. */
.keypanel { padding: 14px 16px; margin-bottom: 20px; box-shadow: none; }
.keypanel h2 { display: flex; align-items: center; gap: 8px; }
.tag-key { background: var(--key); color: var(--key-ink); }
.keypanel .hint { margin: 8px 0 0; }
.keylist { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 8px; }
.keylist li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 7px 10px 7px 7px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.keylist .keyrun-form { flex: none; }
.keylist-main { min-width: 0; display: grid; gap: 1px; }
.keylist-main > a { font-weight: 600; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; line-height: 1.3; }
.keylist-main > a:hover { color: var(--accent); text-decoration: underline; }
.keylist-meta { color: var(--ink-2); font-size: 0.85rem; }
/* Taken off the list on this page: stays in place, faded, until the page is reloaded, so a slip can be undone. */
.grid.keys tr:has(.keyrun[aria-pressed="false"]) td:not(:last-child) { opacity: 0.45; }

/* ---------- vehicle ---------- */
.vehicle { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 400px); gap: 20px; align-items: start; margin-bottom: 8px; }
.vehicle .panel { margin: 0; }
.bigprice { font-size: 2.1rem; font-weight: 600; margin: 0 0 16px; letter-spacing: -0.02em; line-height: 1.1; }
.bigprice .fig-note { font-size: 0.85rem; letter-spacing: 0; }
.was-price { margin-left: 10px; font-size: 1.15rem; font-weight: 500; letter-spacing: 0; color: var(--ink-2); }
.ids { margin: 0 0 24px; display: grid; gap: 14px; }
.ids dt, .spec dt { font-size: 0.8rem; color: var(--ink-2); }
.ids dd, .spec dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.ids dd { font-size: 1.2rem; font-weight: 600; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.btn-sgi { display: inline-flex; align-items: center; white-space: nowrap; letter-spacing: 0.02em; font-size: 0.78rem; font-weight: 600; line-height: 1; text-decoration: none; padding: 10px 14px; border-radius: 6px; background: var(--listed); color: var(--surface); }
.btn-sgi:hover { background: color-mix(in srgb, var(--listed) 85%, var(--ink)); color: var(--surface); }
/* Two-column grid; the 1px gaps show the container colour, which draws the faint lines. */
.specs { margin: 0 0 16px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.spec { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; background: var(--surface); min-width: 0; }
.spec:last-child:nth-child(odd) { grid-column: 1 / -1; }
.spec svg { flex: none; margin-top: 3px; color: var(--ink-2); }
.spec > div { min-width: 0; }
.photo { width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--line); background: var(--sunken); }
.main > h2 { margin: 28px 0 10px; }

/* ---------- insights on the vehicle page ---------- */
/* One box in bands, like a day on the Changes page: a summary strip, three coloured cards, the VIN grid, a foot. */
.insights { padding: 0; overflow: hidden; }
.ins-pad { margin: 0; padding: 18px 20px; }
.ins-note { margin: 16px 20px 0; }
.ins-lede { display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: linear-gradient(100deg, var(--price-bg), var(--surface) 75%); }
.ins-lede p { flex: 1 1 auto; margin: 0; font-size: 1.02rem; font-weight: 500; line-height: 1.45; }
.ins-lede .tag { flex: none; align-self: flex-start; margin-top: 3px; }
.ins-mark { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; color: #fff; background: linear-gradient(135deg, #5d9bff 0 50%, #2a66d0 50% 100%); box-shadow: 0 2px 6px rgba(28, 84, 174, 0.3); }
.k-know { --k: var(--pending); --k-bg: var(--pending-bg); }
.ins-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); overflow: hidden; border-top: 1px solid var(--line); }
/* Each card draws its own top and left line and sits one pixel up and left, so only the lines between cards show. */
.ins-card { min-width: 0; margin: -1px 0 0 -1px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
.insights .ins-head { display: flex; align-items: center; gap: 8px; margin: 0; padding: 9px 16px 9px 20px; font-size: 0.86rem; font-weight: 600; color: var(--k); background: var(--k-bg); }
.ins-head svg { flex: none; }
.ins-head-plain { --k: var(--ink-2); --k-bg: var(--sunken); border-top: 1px solid var(--line); }
.ins-list { list-style: none; margin: 0; padding: 12px 18px 16px 20px; display: grid; gap: 9px; font-size: 0.93rem; line-height: 1.45; }
.ins-list li { position: relative; padding-left: 16px; }
.ins-list li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 6px; height: 6px; border-radius: 50%; background: var(--k); }
.ins-specs { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: hidden; border-top: 1px solid var(--line); }
.ins-specs .spec { margin: -1px 0 0 -1px; padding: 11px 16px 11px 20px; border-top: 1px solid var(--line); border-left: 1px solid var(--line); box-shadow: 1px 0 0 var(--line), 0 1px 0 var(--line); }
.ins-specs .spec:last-child:nth-child(odd) { grid-column: auto; }
.ins-specs dd { overflow-wrap: break-word; }
.ins-specs .spec-wide, .ins-specs .spec-wide:last-child:nth-child(odd) { grid-column: 1 / -1; }
.ins-foot { display: flex; align-items: center; justify-content: space-between; gap: 6px 20px; flex-wrap: wrap; padding: 10px 20px; border-top: 1px solid var(--line); background: var(--sunken); }
.ins-foot .hint { flex: 1 1 320px; margin: 0; }
.ins-foot .linkish { padding: 6px 0; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.insights-form .btn { gap: 9px; }
@media (max-width: 860px) {
  .ins-specs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ins-lede { align-items: flex-start; padding: 14px 16px; gap: 12px; }
  .ins-lede .tag { display: none; }
  .ins-head, .ins-specs .spec { padding-left: 16px; }
  .ins-list { padding-left: 16px; }
  .ins-foot, .ins-pad { padding-left: 16px; padding-right: 16px; }
}
/* ---------- small screens ---------- */
@media (max-width: 860px) {
  /* Behind the page, the colour of the top bar: a phone tints its own status bar from this, and pulling the page
     down past its top shows more of the bar rather than a different colour. */
  html { background: var(--rail); }
  /* A phone colours its own status bar from the body's background. So on a phone the body is the top bar's colour and
     the page colour sits on the content area, which stretches to fill the rest of the screen. */
  body.app { display: flex; flex-direction: column; background: var(--rail); }
  body.app > .main { flex: 1 0 auto; background: var(--bg); max-width: none; }
  .side { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 22px 12px 10px; border-right: 0; } /* room at the top: a phone blurs the page's top edge under its status bar */
  .brand { padding: 4px; }
  .nav { order: 3; width: 100%; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; }
  .nav a { flex-direction: column; gap: 4px; padding: 8px 4px; font-size: 0.78rem; text-align: center; }
  /* The count sits on the corner of the icon, so the menu stays one line tall. */
  .nav a.sub { position: relative; }
  .nav-count { position: absolute; top: 3px; left: calc(50% + 7px); margin: 0; min-width: 18px; padding: 3px 5px; }
  .side-foot { margin: 0 0 0 auto; padding: 0; border: 0; grid-auto-flow: column; align-items: center; gap: 6px; }
  .theme { padding: 0; }
  .theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .seg button { padding: 6px 9px; }
  .signout { padding: 8px; white-space: nowrap; }
  .main { padding: 20px 16px 56px; }
  h1 { font-size: 1.45rem; }
  .summary { grid-template-columns: repeat(2, 1fr); }
  .sum:nth-child(3) { border-left: 0; }
  .sum:nth-child(n+3) { border-top: 1px solid var(--line); }
  .vehicle { grid-template-columns: 1fr; }
  .photo { grid-row: 1; }
  .toolbar { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: end; }
  .row-fields { grid-template-columns: minmax(0, 1fr); }
  /* Inventory on a phone: tighter cells and a vehicle column sized so the price shows without scrolling. */
  .grid.inv th, .grid.inv td { padding-left: 8px; padding-right: 8px; }
  .grid.inv th:first-child, .grid.inv td:first-child { padding-left: 16px; padding-right: 4px; }
  .grid.inv td.veh { min-width: max(150px, calc(100vw - 185px)); }
  /* Key Run on a phone: the vehicle name wraps so the stock number and key stay on screen. */
  .grid.keys th, .grid.keys td { padding-left: 8px; padding-right: 8px; }
  .grid.keys th:first-child, .grid.keys td:first-child { padding-left: 16px; }
  .grid.keys th:last-child, .grid.keys td:last-child { padding-right: 12px; }
  .grid.keys td.veh { min-width: 0; }
  .grid.keys td.veh > a { font-size: 1rem; }
  .toolbar > * { grid-column: 1 / -1; min-width: 0; }
  .toolbar > .half { grid-column: auto; }
  .toolbar .btn { width: 100%; }
  .filters-panel { grid-template-columns: minmax(0, 1fr); }
  .filters-bar .btn { width: auto; }
  .chip { min-height: 38px; padding: 8px 13px; }
  .row { align-items: flex-start; }
  .row-fig { flex-direction: column; align-items: flex-end; gap: 4px; }
}
/* A fetch in progress: the pressed button shows a spinner and a note explains the wait. */
.btn.is-busy { cursor: progress; opacity: 0.85; gap: 9px; }
.spinner { flex: none; width: 15px; height: 15px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; }
.busy-note { flex-basis: 100%; margin: 8px 0 0; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: no-preference) {
  .spinner { animation: spin 0.8s linear infinite; }
  .btn, .nav a, .seg button, .signout, .keyrun { transition: background-color 0.12s, color 0.12s, border-color 0.12s; }
}

/* ---------- inventory as photo rows ---------- */
.vlist { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); overflow: hidden; }
.vlist[hidden] { display: none; }
.vlist > li { display: grid; grid-template-columns: 132px minmax(0, 1fr) auto; gap: 4px 14px; align-items: start; padding: 12px 14px; border-top: 1px solid var(--line); }
.vlist > li[hidden] { display: none; }
.vlist > li:first-child { border-top: 0; }
.vlist > li:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.vlist-plain > li { grid-template-columns: minmax(0, 1fr) auto; }
/* The frame keeps its shape while the photo loads, and stays as a quiet block when there is none. */
.vthumb { display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: var(--sunken); border: 1px solid var(--line); }
.vthumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.vmain { min-width: 0; overflow-wrap: anywhere; }
.vtitle { font-size: 1.06rem; font-weight: 600; line-height: 1.3; color: var(--ink); text-decoration: none; }
.vtitle:hover { color: var(--accent); text-decoration: underline; }
.vmain .tag { margin-left: 4px; }
.vprice { margin: 3px 0 0; font-size: 1.06rem; font-weight: 600; line-height: 1.3; }
.vprice .fig-note { font-weight: 400; }
.vlist > li.gone .vtitle, .vlist > li.gone .vprice { color: var(--ink-2); }
.vlist .keyrun-form { align-self: center; }
@media (max-width: 480px) {
  .vlist > li { grid-template-columns: 104px minmax(0, 1fr) auto; gap: 4px 10px; padding: 10px 10px 10px 12px; }
  .vlist-plain > li { grid-template-columns: minmax(0, 1fr) auto; }
  .vtitle, .vprice { font-size: 1rem; }
}
/* The Cards layout: the same list, each vehicle a card with a large photo. A grid on a wide screen; on a phone one
   card at a time, swiped sideways (the browser's own snapping, so it needs no script to move). */
.vcards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.vcards > li, .vcards > li:first-child { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 0 0 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; }
/* The rule above names the first card, which would outrank the list's own "hidden" rule and keep a filtered-out first card on screen. */
.vcards > li[hidden], .vcards > li:first-child[hidden] { display: none; }
.vcards > li:hover { background: var(--surface); border-color: var(--line-strong); }
.vcards .vthumb { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; }
.vcards .vmain { padding: 0 14px; }
.vcards.vlist-plain .vmain { padding: 14px 52px 0 14px; }
.vcards .keyrun-form, .vcards > li > .keyrun { position: absolute; top: 8px; right: 8px; align-self: auto; }
.vcards .keyrun[aria-pressed="false"], .vcards > li > .keyrun { color: var(--ink-2); background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }
.vcards.vlist-plain .keyrun[aria-pressed="false"] { background: none; box-shadow: none; }
.vcount { margin: 8px 0 0; text-align: center; color: var(--ink-2); font-size: 0.85rem; font-variant-numeric: tabular-nums; }
.vcount[hidden] { display: none; }
@media (max-width: 640px) {
  .vcards { display: flex; gap: 12px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; padding: 2px 2px 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .vcards::-webkit-scrollbar { display: none; }
  .vcards > li, .vcards > li:first-child { flex: 0 0 88%; scroll-snap-align: center; scroll-snap-stop: always; }
  .vcards .vtitle { font-size: 1.15rem; }
  .vcards .vprice { font-size: 1.15rem; margin-top: 6px; }
  .vcards .row-meta { margin-top: 6px; }
}
.inv-more { height: 1px; }
.inv-more[hidden] { display: none; }
/* Rows fade in as they are drawn, and each photo as it arrives. Nothing moves, and none of it for people who ask for less motion. */
@keyframes row-in { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: no-preference) {
  .vlist > li, .grid.inv tbody tr { animation: row-in 0.22s ease-out; }
  .vthumb img { transition: opacity 0.22s ease-out; }
  .vthumb img.loading { opacity: 0; }
  .vthumb img.instant { transition: none; }
  .no-fade .vlist > li, .no-fade .grid.inv tbody tr { animation: none; }
}

/* ---------- settings: how the inventory list looks ---------- */
.look h3, .parts h3 { margin: 18px 0 0; }
.look .panel-part, .parts .panel-part { margin-top: 20px; }
.look .panel-part > .hint, .parts h3 + .hint { margin: 4px 0 12px; }
.parts h3 + .stack, .parts h3 + form { margin-top: 10px; }
.parts > .hint:first-of-type { margin: 0; }
.parts .hint + form { margin-top: 12px; }
/* The two layouts as cards, each with a small drawing of itself. */
.picks { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 10px; max-width: 760px; }
.pick, .toggle, .switch { position: relative; }
/* The real radio buttons and tick boxes stay in place for keyboards and screen readers, unseen under their cards. */
.pick input.sr, .toggle input.sr, .switch input.sr { top: 0; left: 0; min-height: 0; padding: 0; border: 0; }
.pick { display: block; margin: 0; cursor: pointer; }
.pick-card { position: relative; display: flex; flex-direction: column; gap: 12px; height: 100%; padding: 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.pick:hover .pick-card { border-color: var(--ink-2); }
.pick input:checked + .pick-card { border-color: var(--accent); background: var(--price-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.pick input:focus-visible + .pick-card { outline: 2px solid var(--accent); outline-offset: 2px; }
.pick-text strong { display: block; color: var(--ink); }
.pick-text .hint { margin-top: 2px; }
.pick-tick { position: absolute; top: 10px; right: 10px; display: none; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.pick input:checked + .pick-card .pick-tick { display: flex; }
.pick-art { display: block; padding: 9px 10px; border-radius: 8px; background: var(--sunken); border: 1px solid var(--line); }
.pick input:checked + .pick-card .pick-art { background: var(--surface); }
.pick-art i { display: block; background-repeat: no-repeat; }
.pick-art-rows i { height: 16px; margin: 6px 0; background-image: linear-gradient(var(--line-strong), var(--line-strong)), linear-gradient(var(--ink-2), var(--ink-2)), linear-gradient(var(--line-strong), var(--line-strong)); background-size: 22px 16px, 46% 4px, 30% 3px; background-position: 0 0, 30px 2px, 30px 11px; }
.pick-art-cards { display: flex; gap: 6px; }
.pick-art-cards i { flex: 1; height: 50px; margin: 6px 0; border-radius: 3px; background-image: linear-gradient(var(--line-strong), var(--line-strong)), linear-gradient(var(--ink-2), var(--ink-2)), linear-gradient(var(--line-strong), var(--line-strong)); background-size: 100% 26px, 70% 4px, 45% 3px; background-position: 0 0, 0 33px, 0 42px; }
.pick-art-table i { height: 5px; margin: 9px 0; background-image: linear-gradient(var(--ink-2), var(--ink-2)), linear-gradient(var(--line-strong), var(--line-strong)), linear-gradient(var(--line-strong), var(--line-strong)); background-size: 38% 100%, 18% 100%, 22% 100%; background-position: 0 0, 56% 0, 100% 0; }
/* The details as switches that look like the filter chips: filled when on. */
.toggles { display: flex; flex-wrap: wrap; gap: 8px; }
.toggle { display: block; margin: 0; cursor: pointer; }
.toggle .chip { min-height: 38px; padding: 7px 14px 7px 11px; color: var(--ink-2); }
.toggle .chip svg { opacity: 0.25; }
.toggle input:checked + .chip { color: var(--price); background: var(--price-bg); border-color: var(--price); font-weight: 600; }
.toggle input:checked + .chip svg { opacity: 1; }
.toggle input:focus-visible + .chip { outline: 2px solid var(--accent); outline-offset: 2px; }
.look-save { margin-top: 22px; }
/* One thing that is on or off, as a card with a switch. */
.switch { display: block; margin: 14px 0 0; cursor: pointer; max-width: 620px; }
.switch-card { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.switch:hover .switch-card { border-color: var(--ink-2); }
.switch input:checked + .switch-card { border-color: var(--accent); background: var(--price-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.switch input:focus-visible + .switch-card { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { min-width: 0; }
.switch-text strong { display: block; color: var(--ink); font-size: 0.93rem; }
.switch-text .hint { margin-top: 2px; }
.switch-knob { flex: none; position: relative; width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); transition: background-color 0.15s; }
.switch-knob::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25); transition: transform 0.15s; }
.switch input:checked + .switch-card .switch-knob { background: var(--accent); }
.switch input:checked + .switch-card .switch-knob::after { transform: translateX(18px); }
/* An account: its initial in a circle, its address and a line about it, and a tag. */
.who { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar { flex: none; display: flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--price-bg); color: var(--price); font-weight: 700; font-size: 1.05rem; line-height: 1; }
.who-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.who-text strong { display: block; color: var(--ink); font-size: 0.95rem; }
.who-text .hint { margin-top: 1px; }
.who-card { margin-top: 12px; padding: 14px; max-width: 620px; border: 1px solid var(--line); border-radius: 10px; background: var(--sunken); }
.who-card .avatar { background: var(--accent); color: var(--accent-ink); }
.who-list { display: grid; gap: 14px; margin-top: 12px; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: end; max-width: 520px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions form { margin: 0; }
/* Settings, Dealerships. Each dealership's panel keeps its own colours; the pieces inside follow them. */
.group-head .panel-title { margin: 0; }
.parts > .group-head { margin: 0; }
.add-dealer { margin-top: 18px; padding-top: 16px; }
.add-dealer > .hint { margin: 14px 0 12px; }
.add-dealer > summary .btn svg { transition: transform 0.15s; }
.add-dealer[open] > summary .btn svg { transform: rotate(180deg); }
.dealer .who .panel-title { margin: 0; font-size: 1.05rem; overflow-wrap: anywhere; }
.dealer .url { margin: 10px 0 0; overflow-wrap: anywhere; }
/* The dealership's own website icon, where it has one, on white as its site shows it. */
.avatar.avatar-icon { border-radius: 10px; overflow: hidden; background: #fff; box-shadow: 0 0 0 1px var(--line-strong); }
.avatar-icon img { display: block; width: 32px; height: 32px; object-fit: contain; }
.avatar-icon-sm img { width: 24px; height: 24px; }
.who-tags { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 5px; }
.dealer-lit .avatar { background: color-mix(in srgb, var(--d1) 24%, var(--surface)); color: color-mix(in srgb, var(--d1) 55%, var(--ink)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--d1) 45%, transparent); }
.dealer-accept { margin-top: 14px; padding: 12px 14px; border: 1px solid var(--removed); border-radius: 10px; background: var(--removed-bg); }
.dealer-accept p { margin: 0 0 10px; }
/* Check again and Edit sit side by side; what Edit opens goes underneath both. */
.dealer-acts { display: flow-root; margin-top: 14px; }
.dealer-acts > form { float: left; margin: 0 8px 0 0; }
.dealer-acts > details { margin: 0; }
.add-dealer > summary, .dealer-acts > details > summary { display: inline-block; width: auto; padding: 0; list-style: none; }
.add-dealer > summary::-webkit-details-marker, .dealer-acts > details > summary::-webkit-details-marker { display: none; }
.add-dealer[open] > summary .btn, .dealer-acts > details[open] > summary .btn { background: var(--sunken); border-color: var(--ink-2); }
.add-dealer > summary:focus-visible, .dealer-acts > details > summary:focus-visible { outline: 0; }
.add-dealer > summary:focus-visible .btn, .dealer-acts > details > summary:focus-visible .btn { outline: 2px solid var(--accent); outline-offset: 2px; }
.dealer-edit { clear: both; padding-top: 16px; }
.dealer-edit .stack { margin-top: 0; }
.dealer-lit .switch-card { background: color-mix(in srgb, var(--surface) 80%, transparent); }
.dealer-lit .switch input:checked + .switch-card { border-color: color-mix(in srgb, var(--d1) 70%, var(--ink-2)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--d1) 70%, var(--ink-2)); background: color-mix(in srgb, var(--d1) 14%, var(--surface)); }
.dealer-lit .switch input:checked + .switch-card .switch-knob { background: color-mix(in srgb, var(--d1) 70%, var(--ink-2)); }
.runs { list-style: none; margin: 8px 0 0; padding: 0; max-width: 440px; font-size: 0.9rem; color: var(--ink-2); }
.runs li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-top: 1px solid color-mix(in srgb, var(--line-strong) 60%, transparent); }
.runs li:first-child { border-top: 0; }
.btn-danger { color: var(--removed); border-color: var(--removed); }
.btn-danger:hover { color: var(--removed); border-color: var(--removed); background: var(--removed-bg); }
/* The preview follows the choices as they are made. It needs :has(); a browser without it shows no preview. */
.look-preview { display: none; }
@supports selector(:has(a)) {
  .look-preview { display: block; }
  .look-preview .vlist, .look-preview .table-wrap { margin-top: 10px; box-shadow: none; }
  .look-preview .vlist { max-width: 620px; }
  .look-preview .table-wrap { max-width: 900px; }
  .look-preview .vlist > li, .look-preview .grid.inv tbody tr { animation: none; }
  .look-preview .vlist > li:hover, .look-preview .grid tbody tr:hover { background: none; }
  .look-preview .keyrun { align-self: center; cursor: default; }
  .look-preview .keyrun:hover { background: none; color: var(--line-strong); }
  .look-preview .grid td.veh > a:hover { color: var(--ink); text-decoration: none; }
  .look-preview .vcards { display: grid; grid-template-columns: minmax(0, 300px); padding: 0; overflow: visible; }
  .look-preview .vcards > li { flex: none; }
  .look-preview .vcards > li:hover { border-color: var(--line); }
  .look:has(input[value="rows"]:checked) :is(.pv-table, .pv-cards), .look:has(input[value="table"]:checked) :is(.pv-rows, .pv-cards),
  .look:has(input[value="cards"]:checked) :is(.pv-rows, .pv-table) { display: none; }
  .look:has(input[value="photo"]:not(:checked)) .pv-cards .vmain { padding: 14px 52px 0 14px; }
  .look:has(input[value="photo"]:not(:checked)) .pv-cards .keyrun { background: none; box-shadow: none; }
  .look:has(input[value="photo"]:not(:checked)) .pv-photo, .look:has(input[value="price"]:not(:checked)) .pv-price,
  .look:has(input[value="stock"]:not(:checked)) .pv-stock, .look:has(input[value="vin"]:not(:checked)) .pv-vin,
  .look:has(input[value="colour"]:not(:checked)) .pv-colour, .look:has(input[value="km"]:not(:checked)) .pv-km,
  .look:has(input[value="days"]:not(:checked)) .pv-days, .look:has(input[value="first_seen"]:not(:checked)) .pv-first_seen,
  .look:has(input[value="source"]:not(:checked)) .pv-source, .look-single .pv-source { display: none; }
  .look:has(input[value="photo"]:not(:checked)) .pv-rows > li { grid-template-columns: minmax(0, 1fr) auto; }
}
@media (max-width: 480px) {
  .picks { gap: 8px; }
  .pick-card { padding: 11px; }
}

/* ---------- customers ---------- */
textarea { font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px; padding: 8px 10px; width: 100%; max-width: 100%; resize: vertical; display: block; margin-top: 5px; }
textarea:hover { border-color: var(--ink-2); }
textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.cust-form { max-width: 520px; margin-top: 14px; }
.call { margin-bottom: 16px; }
.call-hint { margin: -4px 0 14px; max-width: 640px; }
.call-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); background: var(--sunken); }
.call-head .hint { margin: 0; }
.call-head form { margin: 0; flex: none; }
.who-text strong a { color: inherit; text-decoration: none; }
.who-text strong a:hover { color: var(--accent); text-decoration: underline; }
.who > form { flex: none; margin: 0; }
.row-fig form { margin: 0; }
.row-main > .tag { margin-left: 6px; }
.cust-panel > .who-list { margin-top: 0; }
.cust-panel > .hint { margin: 0; }
.cust-pick { margin-top: 18px; }
.cust-new { margin-top: 14px; }
.cust-details { margin-top: 24px; }
/* Each customer as a card, in the look of the layout cards in Settings. */
.cust-cards { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.cust-card { display: flex; align-items: center; gap: 12px; height: 100%; padding: 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); color: inherit; text-decoration: none; }
.cust-card:hover { border-color: var(--ink-2); }
.cust-card:hover strong { color: var(--accent); }
.cust-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cust-card-call { flex-wrap: wrap; border-color: var(--accent); background: var(--price-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.cust-card-call .avatar { background: var(--accent); color: var(--accent-ink); }
.cust-card-call .who-text { flex-basis: calc(100% - 52px); }
.cust-card .tag { flex: none; margin: -4px 0 0 52px; }
@media (max-width: 480px) { .cust-cards { grid-template-columns: 1fr; gap: 8px; } }
.watch-search { margin: -6px 0 18px; }
.watch-search > form { margin-top: 12px; }
.watch-search[hidden] { display: none; }
@media (max-width: 480px) {
  .pair { grid-template-columns: 1fr; }
  .nav a { font-size: 0.7rem; padding: 8px 2px; }
}

/* ---------- dashboard ---------- */
/* Two columns where there is room, each part directly under the one above it whatever their heights. */
.dash { columns: 2 380px; column-gap: 16px; margin-bottom: 4px; }
.dash-part { margin: 0 0 16px; padding: 18px 20px; break-inside: avoid; overflow: hidden; }
.dash-part .panel-head { margin-bottom: 12px; }
.dash-part .panel-head a { font-size: 0.9rem; white-space: nowrap; }
.dash-part > .hint { margin: 0; }
.dash-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.dash-phone { font-weight: 400; font-size: 0.85rem; margin-left: 6px; white-space: nowrap; }
.who-text strong a.dash-phone { color: var(--accent); text-decoration: underline; }
.dash-today { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0 0 6px; }
.dash-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.dash-today > div { display: flex; flex-direction: column-reverse; padding: 10px 12px; border-radius: 8px; background: var(--sunken); min-width: 0; }
.dash-today dt { font-size: 0.78rem; color: var(--ink-2); line-height: 1.25; }
.dash-today dd { margin: 0; font-size: 1.5rem; font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; color: var(--k, var(--ink)); }
.dash-rows { margin: 8px -20px 0; }
.dash-rows > .row { padding-left: 20px; padding-right: 20px; }
.dash-rows > .row:first-child { border-top: 1px solid var(--line); }
.dash-part > .dash-rows:last-child { margin-bottom: -18px; }
.dash-part > .dash-more { margin: 0 -20px -18px; padding: 10px 20px 14px; border-top: 1px solid var(--line); }
.dash-part > .dash-list + .dash-more { margin-top: 16px; }
.dash-choose > form { margin-top: 14px; }
.dash-choose .hint { margin: 0 0 12px; }
/* On a phone the app's name at the top is the way home, so the menu keeps its six places. */
@media (max-width: 560px) { .nav a.nav-home { display: none; } }

/* ---------- the page sent to a customer ---------- */
.share-set > .hint:first-child { margin: 0 0 4px; }
.share-link-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.share-link-row input { flex: 1 1 240px; min-width: 0; font-size: 0.85rem; color: var(--ink-2); background: var(--sunken); }
.share-link-row + .hint { margin: 8px 0 0; }
.share-opts h3 { margin-top: 20px; }
.share-opts h3:first-of-type { margin-top: 18px; }
.share-opts .hint { margin: 4px 0 12px; }
.share-rep-fields { max-width: 520px; }
body.share { min-height: 100vh; background: var(--bg); }
.share-head { background: var(--rail); color: var(--rail-ink); padding: 28px 16px 22px; display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px 24px; }
.share-head, .share-main { padding-left: max(16px, calc((100% - 760px) / 2)); padding-right: max(16px, calc((100% - 760px) / 2)); }
.share-kicker { margin: 0 0 2px; font-size: 0.85rem; opacity: 0.8; }
.share-head h1 { margin: 0; color: #fff; font-size: 1.6rem; letter-spacing: -0.02em; line-height: 1.2; }
.share-acts { margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.share-head .share-call { background: #fff; color: #0e2444; border-color: #fff; }
.share-head .share-write { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.share-main { padding-top: 20px; padding-bottom: 48px; }
.share-list { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 16px; }
.share-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; display: grid; grid-template-columns: minmax(0, 300px) minmax(0, 1fr); }
.share-card:not(:has(.share-photo)) { grid-template-columns: 1fr; }
.share-photo { aspect-ratio: 4 / 3; background: var(--sunken); }
.share-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.share-sold { display: flex; align-items: center; justify-content: center; }
.share-sold span { font-size: 1.5rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); opacity: 0.7; }
.share-body { padding: 16px 18px; min-width: 0; align-self: center; }
.share-body h2 { margin: 0; font-size: 1.2rem; line-height: 1.3; letter-spacing: -0.01em; }
.share-price { margin: 6px 0 4px; font-size: 1.6rem; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; }
.share-note { margin: 6px 0 0; color: var(--ink-2); }
.share-body .row-meta { margin-top: 6px; font-size: 0.92rem; }
.share-link { margin: 12px 0 0; font-weight: 500; }
.share-gone h2 { color: var(--ink-2); }
.share-form { scroll-margin-top: 16px; }
.share-until { margin: 0; }
@media (max-width: 620px) {
  .share-card { grid-template-columns: 1fr; }
  .share-head h1 { font-size: 1.4rem; }
}

.share-thanks { text-align: center; padding: 30px 22px; }
.share-thanks p { margin: 0 auto; max-width: 420px; color: var(--ink-2); }
.share-thanks .panel-title { font-size: 1.25rem; margin: 12px 0 8px; }
.share-thanks .share-again { margin-top: 16px; font-weight: 500; }
.share-tick { display: inline-flex; align-items: center; justify-content: center; width: 52px; height: 52px; border-radius: 50%; background: var(--listed-bg); color: var(--listed); }

/* ---------- a box that finds a choice as it is typed (customers) ---------- */
.combo-form { display: grid; gap: 12px; max-width: 520px; }
.combo-form > .btn { justify-self: start; }
.combo { display: block; margin-top: 6px; }
.combo > input { width: 100%; border-radius: 10px; padding: 10px 12px; min-height: 44px; }
.combo-set > input { border-color: var(--accent); background: var(--price-bg); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.combo-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.combo-list[hidden] { display: none; }
.combo-card { position: relative; display: flex; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 400; }
.combo-card:hover { border-color: var(--ink-2); }
.combo-card[aria-selected="true"] { border-color: var(--accent); background: var(--price-bg); box-shadow: inset 0 0 0 1px var(--accent); }
.combo-card .avatar { width: 34px; height: 34px; font-size: 0.95rem; }
.combo-card .pick-tick { position: static; flex: none; }
.combo-card[aria-selected="true"] .pick-tick { display: flex; }
.combo-note { margin: 8px 0 0; }
.watch-search > .combo-form { margin-top: 12px; }
select[hidden] { display: none; }
