/* Solva Customers, in Lori's "Folio" design language (flow-pc-build design/claude-design-v1: FolioShell,
   FolioSidebar, FolioHome, GoldChips direction 1, gold A). Warm off-white canvas, a raised sheet, the
   Newsreader serif for titles, Hanken Grotesk for everything else, hairlines instead of boxes, and one
   gold accent. Colours are Folio's oklch values converted to hex (test/contrast.test.js checks them).
   Deviations from Folio, on purpose: controls are 44px (Folio's are 36px; Mark's rule is 44), inputs are
   16px (iPhones zoom below that), and every status says its words (never colour alone). */
:root {
  --serif: 'Newsreader', Georgia, 'Times New Roman', serif;
  --sans: 'Hanken Grotesk', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --ease: cubic-bezier(.32,.72,0,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
  --r-sheet: 18px;
  --r-card: 16px;
  --r-row: 12px;
  --r-ctl: 10px;
  --orange: #F9A01B;
  --on-orange: #16130C;
  --orange-hover: #FFAE33;

  color-scheme: light;
  --bg: #F3EEE8;
  --panel: #FEFCF9;
  --panel-2: #FAF6F1;
  --field: #F6F3EE;
  --col: #EFEAE4;
  --hov: #F7F2EA;
  --act: #E8E2DA;
  --line: #E5E0DB;
  --line-2: #D5D0CA;
  --edge: #E0DCD5;
  --ink: #221B16;
  --ink-2: #38312C;
  --ink-3: #5B544E;
  --accent-ink: #983E07;
  --focus: #983E07;
  --wash: #FFEFD8;
  --gold-line: #EBC79C;
  --st-us: #983E07;
  --err-bg: #FFECE9;
  --err-line: #F3C0B9;
  --err-ink: #A51F1E;
  --note-bg: #FFEFD8;
  --note-line: #EBC79C;
  --note-ink: #6E2E06;
  --ai-bg: #E8E2DA;
  --ai-line: #D5D0CA;
  --scrim: rgba(34,27,22,.28);
  --chrome: rgba(243,238,232,.86);
  --toast-bg: #221B16;
  --toast-ink: #FEFCF9;
  --shadow-sheet: 0 1px 2px rgba(92,64,34,.06), 0 16px 40px -20px rgba(92,62,30,.22);
  --pop-shadow: 0 0 0 1px rgba(40,25,10,.08), 0 24px 60px -24px rgba(40,25,10,.40);
  --shadow-1: 0 1px 2px rgba(40,25,10,.08);
  /* Paper for printing (reports, quotes), whichever theme is on screen. */
  --print-paper: #FFFFFF;
  --print-ink: #111111;
  --print-ink-3: #4A4A4A;
  --print-line: #CCCCCC;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0E0B08; --panel: #181511; --panel-2: #1D1815; --field: #120F0C; --col: #28231F; --hov: #211C18; --act: #201B17;
    --line: #2A2522; --line-2: #37322E; --edge: #26221E;
    --ink: #F1EEE9; --ink-2: #D5D0CA; --ink-3: #B6B0A9;
    --accent-ink: #F9A01B; --focus: #F9A01B; --wash: #342210; --gold-line: #674420; --st-us: #F9A01B;
    --err-bg: #301715; --err-line: #66302A; --err-ink: #FB9890;
    --note-bg: #342210; --note-line: #674420; --note-ink: #F6D7AE;
    --ai-bg: #201B17; --ai-line: #37322E;
    --scrim: rgba(0,0,0,.55); --chrome: rgba(14,11,8,.86); --toast-bg: #F1EEE9; --toast-ink: #181511;
    --shadow-sheet: 0 20px 60px -24px rgba(0,0,0,.6);
    --pop-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 28px 70px -24px rgba(0,0,0,.8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0E0B08; --panel: #181511; --panel-2: #1D1815; --field: #120F0C; --col: #28231F; --hov: #211C18; --act: #201B17;
  --line: #2A2522; --line-2: #37322E; --edge: #26221E;
  --ink: #F1EEE9; --ink-2: #D5D0CA; --ink-3: #B6B0A9;
  --accent-ink: #F9A01B; --focus: #F9A01B; --wash: #342210; --gold-line: #674420; --st-us: #F9A01B;
  --err-bg: #301715; --err-line: #66302A; --err-ink: #FB9890;
  --note-bg: #342210; --note-line: #674420; --note-ink: #F6D7AE;
  --ai-bg: #201B17; --ai-line: #37322E;
  --scrim: rgba(0,0,0,.55); --chrome: rgba(14,11,8,.86); --toast-bg: #F1EEE9; --toast-ink: #181511;
  --shadow-sheet: 0 20px 60px -24px rgba(0,0,0,.6);
  --pop-shadow: 0 0 0 1px rgba(255,255,255,.06), 0 28px 70px -24px rgba(0,0,0,.8);
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 var(--sans); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { font-size: 16px; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
.sprite { display: none; }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }

/* ---------- shell: Folio sidebar + raised sheet ---------- */
#page { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100dvh; }
.sidebar { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; padding: 18px 14px 16px; gap: 18px; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px; text-decoration: none; color: var(--ink); min-height: 44px; }
.brand svg { width: 30px; height: 30px; border-radius: 9px; flex: none; }
.brand b { display: block; font: 400 24px/1.05 var(--serif); letter-spacing: -.01em; }
.brand small { display: block; margin-top: 3px; color: var(--ink-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-group { margin: 16px 12px 4px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.nav-group:first-child { margin-top: 0; }
.tabbar { display: none; }
.nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: var(--r-ctl); color: var(--ink-2); text-decoration: none; font-size: 14.5px; }
.nav a .ico { color: var(--ink-3); }
.nav a:hover { background: var(--hov); }
.nav a[aria-current="page"] { background: var(--act); color: var(--ink); font-weight: 600; }
.nav a[aria-current="page"] .ico { color: var(--ink); }
.side-foot { margin-top: auto; position: relative; }
.me-btn { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 6px 10px; border: 0; border-radius: var(--r-ctl); background: none; text-align: left; }
.me-btn:hover { background: var(--hov); }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--ink); color: var(--panel); font-weight: 600; font-size: 12.5px; flex: none; }
.me-btn .who-line { min-width: 0; }
.me-btn .who-line b { display: block; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-btn .who-line small { display: block; font-size: 12px; color: var(--ink-3); }
.menu { position: absolute; left: 0; right: 0; bottom: 54px; padding: 6px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--pop-shadow); z-index: 30; }
.menu .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu .who small { display: block; color: var(--ink-3); }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 14px; }
.menu button:hover { background: var(--hov); }
.viewas-row { display: grid; gap: 4px; padding: 6px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.viewas-row select { min-height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line-2); background: var(--field); color: var(--ink); padding: 0 8px; text-transform: none; letter-spacing: 0; font-weight: 400; }

.work { min-width: 0; display: flex; flex-direction: column; padding: 0 12px 12px 0; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 0; background: var(--chrome);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.top .brand { display: none; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input { width: 100%; height: 44px; padding: 0 14px 0 40px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--field); color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search .ico { position: absolute; left: 13px; top: 13px; color: var(--ink-3); pointer-events: none; }
.top .spacer { flex: 1; }
.demo { margin: 0 0 10px; padding: 8px 14px; border-radius: var(--r-ctl); background: var(--wash); border: 1px solid var(--gold-line); color: var(--accent-ink); font-size: 13px; font-weight: 600; }
main#view { flex: 1; background: var(--panel); border: 1px solid var(--edge); border-radius: var(--r-sheet); box-shadow: var(--shadow-sheet); padding: 44px 52px 56px; min-width: 0; }

/* ---------- buttons, chips ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: var(--r-ctl);
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font-size: 14px; font-weight: 600; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--hov); }
.btn.primary { background: var(--orange); color: var(--on-orange); border-color: transparent; border-radius: 11px; padding: 0 20px; }
.btn.primary:hover { background: var(--orange-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hov); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: 13.5px; }
.btn.danger { background: var(--err-ink); color: var(--panel); border-color: transparent; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
a.btn { color: var(--ink); }
a.btn.primary { color: var(--on-orange); }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px; border-radius: 6px; background: var(--col); color: var(--ink-3); font-size: 12px; font-weight: 500; white-space: nowrap; }
.icon-btn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; border-radius: var(--r-ctl); color: var(--ink-2); }
.icon-btn:hover { background: var(--hov); }

/* ---------- page headings ---------- */
.bar { display: flex; align-items: flex-end; gap: 12px 16px; margin: 0 0 28px; flex-wrap: wrap; }
.bar .titles { margin-right: auto; min-width: 0; }
.bar h1 { margin: 0; font: 400 42px/1.05 var(--serif); letter-spacing: -.012em; }
.bar h1.hello { font-size: 48px; }
.bar.today { margin-bottom: 18px; align-items: center; }
.bar.today h1.hello { font-size: 36px; }
.bar.today .date { margin-top: 6px; }
.counts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
.count-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); color: var(--ink-2); font-size: 14px; font-weight: 500; }
.count-chip b { font: 400 22px/1 var(--serif); color: var(--ink); font-variant-numeric: tabular-nums; }
.count-chip:hover { background: var(--hov); }
.count-chip.zero { color: var(--ink-3); }
.count-chip.zero b { color: var(--ink-3); }
.group { scroll-margin-top: 84px; }
.bar h1 em { font-style: italic; }
.bar .date { display: block; margin-top: 10px; color: var(--ink-3); font-size: 15px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--col); }
.seg button { min-height: 44px; padding: 0 16px; border: 0; border-radius: 9px; background: none; color: var(--ink-3); font-weight: 600; font-size: 13.5px; }
.seg button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-1); }

/* ---------- groups and rows (Folio: soft cards, hairlines, quiet hover) ---------- */
.groups { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.groups.one { grid-template-columns: minmax(0, 1fr); }
.group { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-card); padding: 6px 8px 8px; }
.group > header { display: flex; align-items: center; gap: 10px; padding: 14px 12px 10px; }
.group > header h2 { margin: 0; font: 400 21px/1.2 var(--serif); }
.group > header .n { min-width: 24px; height: 22px; padding: 0 7px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--col); color: var(--ink-3); font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.group > header p { margin: 0 0 0 auto; color: var(--ink-3); font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }
.group .empty { padding: 4px 12px 16px; color: var(--ink-3); font-size: 14px; }
.empty.roomy { padding: 22px 16px; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { position: relative; display: flex; gap: 14px; align-items: center; padding: 14px 12px; border-top: 1px solid var(--line); border-radius: 0; cursor: pointer; min-height: 64px; }
.rows > .row:first-child { border-top-color: transparent; }
.row:hover, .row:focus-visible { background: var(--hov); border-radius: var(--r-row); border-top-color: transparent; }
.row:hover + .row { border-top-color: transparent; }
.row .main { flex: 1; min-width: 0; }
a.main { display: block; color: inherit; text-decoration: none; border-radius: 8px; }
.row:focus-within { background: var(--hov); border-radius: var(--r-row); border-top-color: transparent; }
.row .name { font-weight: 600; font-size: 15px; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.row .name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--ink-3); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 1px; }
.row .said { margin-top: 4px; color: var(--ink-2); font: italic 15px/1.45 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .side { text-align: right; flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.row.static { cursor: default; }
.row.static:hover { background: none; }
.row.mini { padding: 10px 0; min-height: 0; cursor: default; border-top: 1px solid var(--line); }
.results > .row.mini:first-child { border-top: 0; }
.row.mini:hover { background: none; border-radius: 0; border-top-color: var(--line); }
.main.link { cursor: pointer; }
.clock { font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; display: inline-flex; align-items: center; gap: 5px; }
.clock svg { width: 13px; height: 13px; }
.clock.calm { color: var(--ink-3); }
.clock.warm { color: var(--st-us); }
.clock.hot { color: var(--err-ink); }
.owner { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

/* ---------- lists, filters, tables ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 12px; margin: -8px 0 22px; align-items: flex-end; }
.filter { display: grid; gap: 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.filter select, .filter input[type=search] { min-height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--field); color: var(--ink); padding: 0 12px; text-transform: none; letter-spacing: 0; font-weight: 400; }
.filter.grow { flex: 1 1 220px; }
.filter.check { display: flex; align-items: center; gap: 10px; min-height: 44px; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--ink-2); }
.filter.check input, .tick input { width: 20px; height: 20px; accent-color: var(--accent-ink); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 18px; }
.bulk { display: flex; gap: 8px; padding: 0 12px 12px; flex-wrap: wrap; }
.bulk select { min-height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--field); color: var(--ink); padding: 0 12px; }
.tick { display: flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.table th, .table td { text-align: left; padding: 13px 12px; border-top: 1px solid var(--line); }
.table th { font-size: 11.5px; color: var(--ink-3); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; border-top: 0; }
.table td.num, .table th.num { text-align: right; }
.table a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.table-wrap { overflow-x: auto; }
.table td:first-child { white-space: nowrap; }
tr.off td { color: var(--ink-3); }

/* ---------- customer sheet ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; justify-content: flex-end; }
.sheet .scrim { position: absolute; inset: 0; background: var(--scrim); }
.sheet .panel { position: relative; width: min(760px, 100%); height: 100%; background: var(--panel); border-left: 1px solid var(--edge); box-shadow: var(--pop-shadow); display: flex; flex-direction: column; }
@media (prefers-reduced-motion: no-preference) {
  .sheet.enter .panel { animation: slide .34s var(--ease); } .sheet.enter .scrim { animation: fade .3s var(--ease-out); }
  @keyframes slide { from { transform: translateX(40px); opacity: .4; } } @keyframes fade { from { opacity: 0; } }
}
.sheet .head { display: flex; align-items: center; gap: 8px; padding: 14px 20px 10px 12px; padding-top: max(14px, env(safe-area-inset-top)); }
.sheet .head h2 { margin: 0; font: 400 32px/1.1 var(--serif); letter-spacing: -.01em; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet .head h2:focus { outline: none; }
.sheet .body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 28px 28px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; }
.card { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-card); padding: 18px 20px; }
.card-title { margin: 0 0 10px; font: 400 21px/1.2 var(--serif); }
.contact-line { display: flex; gap: 6px; flex-wrap: wrap; }
.contact-line .btn { flex: 1 1 auto; padding: 0 12px; }
.facts-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px 12px; margin-top: 12px; }
.facts-row .facts { margin-top: 0; padding-top: 12px; }
.menu-wrap { position: relative; flex: none; }
.more-list { list-style: none; margin: 0; padding: 0; display: grid; }
.more-list a { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 16px; }
.more-list a[aria-current="page"] { background: var(--act); font-weight: 600; }
.more-list .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--ink); color: var(--panel); font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.pop-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 45; min-width: 220px; padding: 6px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--pop-shadow); display: grid; }
.pop-menu button { min-height: 44px; padding: 0 12px; border: 0; background: none; border-radius: 8px; text-align: left; font-size: 14px; color: var(--ink); }
.pop-menu button:hover, .pop-menu button:focus-visible { background: var(--hov); }
.dnc { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--r-ctl); background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err-ink); font-size: 14px; }
.col-main, .col-history { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; align-content: start; min-width: 0; }
@media (min-width: 1180px) {
  .sheet .panel { width: min(1180px, 100%); }
  .sheet .body { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); overflow: hidden; padding-bottom: 16px; }
  .col-main, .col-history { overflow-y: auto; min-height: 0; padding: 0 4px 16px; }
  .latest { display: none; }
}
.facts { color: var(--ink-3); font-size: 14px; display: flex; gap: 6px 16px; flex-wrap: wrap; margin-top: 12px; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.hint { color: var(--ink-3); font-size: 13px; margin: 8px 0 0; }
.enq-head { display: flex; align-items: flex-start; gap: 8px; justify-content: space-between; }
.enq-head h3 { min-width: 0; }
.enq-head .mini-actions { flex-wrap: nowrap; flex: none; }
.enq h3 { margin: 0 0 4px; font: 400 23px/1.2 var(--serif); }
.enq .meta { color: var(--ink-3); font-size: 13.5px; margin-top: 2px; }
.enq .resp { margin-top: 10px; font-size: 14px; font-weight: 600; }
.enq.closed { background: var(--panel); }
.steps { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.steps button { min-height: 44px; padding: 0 14px; border-radius: var(--r-ctl); border: 1px solid var(--line-2); background: var(--panel); font-weight: 600; font-size: 13.5px; color: var(--ink-2); }
.steps button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.steps .sep { flex: 1; }
.owner-line { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; font-size: 14px; }
.owner-line select { min-height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--field); padding: 0 10px; }
.next { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.next input { flex: 1 1 180px; min-width: 0; min-height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--field); padding: 0 12px; }
.next input::placeholder, .compose-row textarea::placeholder, label.f input::placeholder, label.f textarea::placeholder { color: var(--ink-3); }
.mini-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.results { list-style: none; margin: 0; padding: 0; }

.timeline { display: grid; gap: 8px; }
.day { text-align: center; color: var(--ink-3); font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; margin: 14px 0 4px; }
.bubble { max-width: 84%; padding: 10px 14px; border-radius: 14px; font-size: 14.5px; white-space: pre-wrap; word-wrap: break-word; }
.bubble .by { display: block; font-size: 12px; margin-top: 5px; color: var(--ink-3); }
.bubble.in { justify-self: start; background: var(--panel); border: 1px solid var(--line-2); border-bottom-left-radius: 4px; }
.bubble.out { justify-self: end; background: var(--ai-bg); border: 1px solid var(--ai-line); border-bottom-right-radius: 4px; }
.bubble.note { justify-self: stretch; max-width: none; background: var(--note-bg); border: 1px solid var(--note-line); color: var(--note-ink); border-radius: 12px; }
.bubble.note .by { color: var(--note-ink); }
.sys { justify-self: center; color: var(--ink-3); font-size: 13px; text-align: center; padding: 2px 10px; }
.tag { font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; margin-right: 8px; }
.older { justify-self: center; }

.composer { border-top: 1px solid var(--line); background: var(--panel); padding: 12px 20px; padding-bottom: max(12px, env(safe-area-inset-bottom)); }
.modes { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: var(--col); margin-bottom: 10px; max-width: 100%; overflow-x: auto; }
.modes button { min-height: 44px; padding: 0 14px; border-radius: 9px; border: 0; background: none; color: var(--ink-3); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.modes button[aria-pressed="true"] { background: var(--panel); color: var(--ink); box-shadow: var(--shadow-1); }
.opt-row { display: flex; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 10px; }
.outcomes { display: flex; gap: 6px; flex-wrap: wrap; }
.outcomes button { min-height: 44px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel); font-weight: 500; font-size: 13.5px; color: var(--ink-2); }
.outcomes button[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); font-weight: 600; }
.compose-row { display: flex; gap: 8px; align-items: flex-end; }
.compose-row textarea { flex: 1; min-height: 44px; max-height: 160px; resize: none; border-radius: 12px; border: 1px solid var(--line); background: var(--field); padding: 10px 14px; }
.about, .when { min-height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--field); color: var(--ink); padding: 0 12px; }
.about { width: 100%; margin-bottom: 10px; }
.when { flex: 0 0 auto; max-width: 220px; }

/* ---------- dialogs, forms, sign-in ---------- */
dialog { border: 1px solid var(--edge); padding: 0; border-radius: var(--r-sheet); background: var(--panel); color: var(--ink); box-shadow: var(--pop-shadow); width: min(480px, calc(100% - 24px)); }
dialog::backdrop { background: var(--scrim); }
dialog form { padding: 26px 26px 22px; display: grid; gap: 14px; }
dialog h2 { margin: 0 0 2px; font: 400 28px/1.15 var(--serif); letter-spacing: -.01em; }
dialog p { margin: 0; color: var(--ink-3); }
label.f { display: grid; gap: 6px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
label.f input, label.f select, label.f textarea { min-height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--field); padding: 0 12px; font-weight: 400; color: var(--ink); text-transform: none; letter-spacing: 0; }
label.f textarea { padding: 10px 12px; min-height: 80px; resize: vertical; }
label.f small { font-weight: 400; text-transform: none; letter-spacing: 0; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.err { background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err-ink); border-radius: var(--r-ctl); padding: 10px 14px; font-size: 14px; }
.signed-out { max-width: 460px; margin: 48px auto; background: var(--panel-2); }
.signed-out h1 { margin: 0 0 6px; font: 400 40px/1.1 var(--serif); letter-spacing: -.012em; }
.signed-out p { margin: 0; }
.signin { display: grid; gap: 14px; padding: 30px; }

.toast { position: fixed; left: 50%; bottom: max(22px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--toast-bg); color: var(--toast-ink);
  padding: 11px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--pop-shadow); max-width: calc(100% - 32px); }
.sheet:not([hidden]) ~ .toast { bottom: 180px; }

/* ---------- the dealership workflow: showroom, stock, deliveries, reports, settings, quotes ---------- */
.nav a .count { margin-left: auto; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--ink); color: var(--panel); font-size: 12px; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.recent { position: absolute; left: 0; right: 0; top: 50px; z-index: 35; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--pop-shadow); padding: 6px; }
.recent-title { margin: 6px 10px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.recent ul { list-style: none; margin: 0; padding: 0; }
.recent a { display: flex; align-items: center; min-height: 44px; padding: 0 10px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.recent a:hover, .recent a:focus-visible { background: var(--hov); }
.views { display: flex; flex-wrap: wrap; gap: 8px; margin: -8px 0 18px; align-items: center; }
.view-chip { display: inline-flex; align-items: center; border: 1px solid var(--line-2); border-radius: 999px; background: var(--panel); }
.view-chip.on { background: var(--ink); border-color: var(--ink); }
.view-chip a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px 0 16px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 13.5px; }
.view-chip.on a, .view-chip.on button { color: var(--panel); }
.view-chip button { width: 44px; height: 44px; border: 0; background: none; color: var(--ink-3); display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; }
.warn { margin: -10px 0 20px; padding: 12px 16px; border-radius: var(--r-ctl); background: var(--note-bg); border: 1px solid var(--note-line); color: var(--note-ink); font-size: 14px; }
.visit .main { display: grid; gap: 2px; }
.visit-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
label.inline select { min-height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--field); color: var(--ink); padding: 0 10px; }
.row .name a, .row.mini a, .results a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.link-btn { min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; font-family: var(--mono); font-size: 13.5px; }
.status-line { margin: 10px 0 0; }
.card-title.spaced { margin-top: 22px; }
dialog.wide { width: min(720px, calc(100% - 24px)); }
.panel-head { display: flex; align-items: center; gap: 8px; padding: 18px 14px 6px 26px; }
.panel-head h2 { flex: 1; }
.panel-body { padding: 4px 26px 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; max-height: min(78dvh, 760px); overflow-y: auto; }
.panel-body p { margin: 0; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--r-row); padding: 12px 14px; display: grid; gap: 2px; align-content: start; }
.tile-label { color: var(--ink-3); font-size: 11.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; }
.tile b { font: 400 30px/1.15 var(--serif); font-variant-numeric: tabular-nums; }
.tile small { color: var(--ink-3); font-size: 12.5px; }
.progress { display: flex; align-items: center; gap: 10px; margin-top: 8px; font-size: 13px; color: var(--ink-2); flex-wrap: wrap; }
.bar-track { width: 120px; height: 6px; border-radius: 999px; background: var(--col); overflow: hidden; flex: none; }
.bar-fill { display: block; height: 100%; background: var(--accent-ink); border-radius: 999px; }
.w0 { width: 0; } .w1 { width: 10%; } .w2 { width: 20%; } .w3 { width: 30%; } .w4 { width: 40%; } .w5 { width: 50%; }
.w6 { width: 60%; } .w7 { width: 70%; } .w8 { width: 80%; } .w9 { width: 90%; } .w10 { width: 100%; }
.report { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.section-title { margin: 22px 0 0; font: 400 25px/1.2 var(--serif); }
.report > .section-title:first-child { margin-top: 0; }
.report .hint { margin: -6px 0 4px; }
.report-cols { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.groups.spaced { margin-top: 20px; }
.groups.settings { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.settings-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.settings-card .card-title { margin: 0; }
.hint.lede { margin: 0; }
.stamp { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--accent-ink); }
fieldset.routine { border: 1px solid var(--line); border-radius: var(--r-row); padding: 8px 14px 14px; margin: 0; display: grid; gap: 8px; }
fieldset.routine legend { padding: 0 6px; font-weight: 600; }
.row.mini.off .main, li.off .main { color: var(--ink-3); }
.extras { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.extra-line { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; font-size: 14px; }
.sub-block { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.sub-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.stage-pick { display: inline-flex; align-items: center; gap: 8px; }
.stage-pick select { min-height: 44px; border-radius: var(--r-ctl); border: 1px solid var(--line); background: var(--field); color: var(--ink); padding: 0 10px; max-width: 220px; }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist label { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 14.5px; cursor: pointer; }
.checklist input { width: 22px; height: 22px; accent-color: var(--accent-ink); flex: none; }
.tpl-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.tpl-tools { display: inline-flex; gap: 6px; }
.quote-sheet { max-width: 760px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
.quote-sheet header { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-end; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.quote-sheet h2 { margin: 0; font: 400 34px/1.1 var(--serif); }
.quote-sheet h3 { margin: 10px 0 0; font: 400 24px/1.2 var(--serif); }
.quote-sheet p { margin: 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.quote-meta { display: grid; gap: 2px; text-align: right; color: var(--ink-3); font-size: 14px; }
.quote-table th { text-transform: none; letter-spacing: 0; font-size: 15px; color: var(--ink); font-weight: 400; border-top: 1px solid var(--line); }
.quote-table tr:last-child th, .quote-table tr:last-child td { font-weight: 600; }
.quote-notes { white-space: pre-wrap; }
.quote-sheet footer { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; color: var(--ink-3); font-size: 13.5px; border-top: 1px solid var(--line); padding-top: 12px; }
.draft-flag { padding: 10px 14px; border-radius: var(--r-ctl); background: var(--err-bg); border: 1px solid var(--err-line); color: var(--err-ink); font-weight: 600; }

@media print {
  :root, :root[data-theme="dark"] { color-scheme: light; --bg: var(--print-paper); --panel: var(--print-paper); --panel-2: var(--print-paper); --col: var(--print-line);
    --ink: var(--print-ink); --ink-2: var(--print-ink); --ink-3: var(--print-ink-3); --line: var(--print-line); --line-2: var(--print-line); --edge: var(--print-paper); --accent-ink: var(--print-ink);
    --err-bg: var(--print-paper); --err-line: var(--print-ink); --err-ink: var(--print-ink); }
  .sidebar, .top, .demo, .no-print, .toast, .sheet { display: none !important; }
  #page { display: block; }
  .work { padding: 0; }
  main#view { border: 0; box-shadow: none; padding: 0; border-radius: 0; }
  .tile, .group { break-inside: avoid; }
}

/* ---------- Today's one list, the rotation, the deal desk (27 Sep) ---------- */
/* Why a row is there, in words; the lead and late tags also carry a tint (never the only signal). */
.chip.lead { background: var(--wash); color: var(--note-ink); }
.chip.late { background: var(--err-bg); color: var(--err-ink); }
.count-chip[aria-pressed="true"], .count-chip[aria-pressed="true"]:hover { background: var(--ink); border-color: var(--ink); color: var(--panel); }
.count-chip[aria-pressed="true"] b { color: var(--panel); }
.row .side .mini-actions { margin-top: 2px; }
.dlg-tools { display: flex; flex-wrap: wrap; gap: 8px; }
.rot { list-style: none; margin: 0; padding: 0 4px 4px; }
.rot-item { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 8px; border-top: 1px solid var(--line); }
.rot-item:first-child { border-top-color: transparent; }
.rot-n { flex: none; width: 30px; height: 30px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center; background: var(--col); color: var(--ink-3); font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.rot-item.up .rot-n { background: var(--orange); color: var(--on-orange); }
.rot-name { flex: 1; min-width: 0; display: grid; font-weight: 600; font-size: 15px; }
.rot-state { color: var(--ink-3); font-size: 13px; font-weight: 500; }
.rot-item.up .rot-state { color: var(--accent-ink); font-weight: 600; }
.rot-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 12px 12px; }
.desk { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); margin-top: 12px; }
.desk-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; }
.desk-head .card-title { margin: 0; }
.desk-nums { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; margin: 14px 0; font-size: 14.5px; }
.desk-nums dt { color: var(--ink-3); }
.desk-nums dd { margin: 0; text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.desk-nums .total { border-top: 1px solid var(--line-2); padding-top: 8px; color: var(--ink); font-weight: 600; }

/* ---------- signed out: no sidebar ---------- */
body.out #page { grid-template-columns: minmax(0, 1fr); }
body.out .sidebar, body.out .top .search, body.out #walkin-btn { display: none; }
body.out .top .brand { display: flex; }
body.out .work { padding: 12px 24px 24px; }
body.out main#view { background: none; border: 0; box-shadow: none; }

/* ---------- tablet and phone: the sidebar becomes a top bar and a row of sections ---------- */
@media (max-width: 900px) {
  #page { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: sticky; top: 0; z-index: 25; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 8px 12px; background: var(--chrome);
    backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
  .sidebar .brand b { font-size: 20px; }
  .sidebar .brand small { display: none; }
  .nav { order: 3; flex-direction: row; flex-basis: 100%; overflow-x: auto; scrollbar-width: none; }
  .nav-group { display: none; }
  .nav a { flex: none; padding: 0 12px; }
  .nav a .ico { display: none; }
  .side-foot { margin: 0 0 0 auto; }
  .me-btn .who-line { display: none; }
  .me-btn { width: auto; min-height: 44px; padding: 6px; }
  .menu { left: auto; right: 0; bottom: auto; top: 52px; min-width: 240px; }
  .work { padding: 0 10px 10px; }
  .top { position: static; background: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
  .top .spacer { display: none; }
  .search { max-width: none; }
  main#view { padding: 28px 22px 40px; border-radius: 16px; }
  .groups, .groups.settings, .report-cols { grid-template-columns: minmax(0, 1fr); }
  .nav a .count { margin-left: 6px; }
}
@media (max-width: 640px) {
  .walkin-label { display: none; }
  .sidebar .nav { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 4px 4px max(4px, env(safe-area-inset-bottom));
    background: var(--chrome); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-top: 1px solid var(--line); }
  .tabbar a, .tabbar button { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 56px; border: 0; background: none; border-radius: 10px;
    color: var(--ink-3); text-decoration: none; font-size: 11.5px; font-weight: 600; }
  .tabbar .ico { width: 22px; height: 22px; }
  .tabbar a[aria-current="page"], .tabbar button.on { color: var(--ink); background: var(--act); }
  .tabbar .count { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--ink); color: var(--panel); font-size: 11px; display: inline-flex; align-items: center; justify-content: center; }
  .work { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }
  .bar.today h1.hello { font-size: 30px; }
  .count-chip { padding: 0 12px; }
  .bar h1 { font-size: 34px; }
  .bar h1.hello { font-size: 36px; }
  main#view { padding: 22px 14px 36px; }
  .group { padding: 4px 4px 6px; }
  .sheet .body { padding: 6px 12px 16px; }
  .sheet .head h2 { font-size: 26px; }
  .card { padding: 16px; }
  .contact-line .btn { flex-basis: calc(50% - 4px); }
  .contact-line .btn:last-child:nth-child(odd) { flex-basis: 100%; }
  .composer { padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .opt-row { flex-wrap: nowrap; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .opt-row .outcomes { flex-wrap: nowrap; }
  .opt-row .outcomes + .outcomes { padding-left: 6px; border-left: 1px solid var(--line); }
  .outcomes button { white-space: nowrap; }
  .compose-row { flex-wrap: wrap; }
  .compose-row textarea { flex: 1 1 120px; min-width: 0; }
  .compose-row .btn { flex: 0 0 auto; }
  .when { max-width: none; flex: 1 1 100%; order: -1; }
  .mini-actions { width: 100%; justify-content: flex-start; }
  .enq-head { flex-wrap: wrap; }
  .enq-head h3 { flex: 1 1 100%; }
  .enq-head .mini-actions { width: auto; }
  .row.mini { flex-wrap: wrap; }
  .row.visit { flex-direction: column; align-items: stretch; gap: 8px; }
  .rows > .row:has(.side .mini-actions) { flex-wrap: wrap; }
  .row .side:has(.mini-actions) { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-start; }
  .rot-item { flex-wrap: wrap; }
  .rot-item .mini-actions { width: auto; }
  .row.visit .side { order: -1; align-items: flex-start; }
  .quote-meta { text-align: left; }
}
