/* ==========================================================================
   Design system stylesheet. Plain CSS, no framework, no build step needed.
   Order: fonts, tokens, base, shell, components, diary, timetable, public pages.
   Nothing in this file names the brand or a trade: those come from the brand
   config and the industry pack, as text in the HTML.
   ========================================================================== */

/* ---------- 1. Fonts (self-hosted; both SIL Open Font License 1.1) ---------- */
@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Martian Mono";
  src: url("fonts/martian-mono-latin-wdth-normal.woff2") format("woff2");
  font-weight: 100 800; font-stretch: 75% 112.5%; font-style: normal; font-display: swap;
}

/* ---------- 2. Tokens ---------- */
:root, [data-theme="light"] {
  color-scheme: light;

  /* type */
  --font-ui: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --font-plate: "Martian Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text-xs: 0.8125rem;   /* 13px: the smallest text anywhere */
  --text-sm: 0.9375rem;   /* 15px: secondary text */
  --text-md: 1.0625rem;   /* 17px: body, buttons, inputs */
  --text-lg: 1.25rem;     /* 20px: card titles on big screens, key facts */
  --text-xl: 1.5rem;      /* 24px: page titles on phones */
  --text-2xl: 1.875rem;   /* 30px: page titles, big numbers */
  --text-3xl: 2.375rem;   /* 38px: hero numbers, public page headline */

  /* space (4px grid) */
  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;

  /* shape */
  --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-xl: 24px; --radius-full: 999px;

  /* touch */
  --tap: 48px;        /* smallest size of anything you can press */
  --tap-lg: 56px;     /* the main action on a screen */
  --row: 64px;        /* list rows */

  /* layout */
  --rail: 88px; --sidebar: 256px; --tabbar: 64px;
  --nav-item: 62px;   /* height of one item on the tablet rail */
  --gutter: var(--space-4);

  /* neutrals: warm paper, soft ink */
  --bg: #F5F4F0;            /* the page */
  --surface: #FFFFFF;       /* cards, sheets, inputs */
  --surface-2: #FAF9F6;     /* quiet areas inside a card */
  --surface-3: #EFEDE8;     /* pressed and hover */
  --line: #E6E3DC;          /* dividers and card edges (decoration) */
  --line-2: #D5D1C9;        /* edges of secondary buttons */
  --line-strong: #8E8B85;   /* edges of inputs: 3:1 against surfaces */
  --ink: #1A1C20;           /* main text */
  --ink-2: #50555C;         /* secondary text */
  --ink-3: #676C73;         /* small labels and meta: still 4.5:1 */
  --inverse: #1A1C20; --on-inverse: #FFFFFF;

  /* status: fixed, never taken from the business's colour */
  --ok: #007F38;      --on-ok: #FFFFFF;     --ok-text: #00642B;     --ok-soft: #E0F7E4;     --ok-line: #B4E2BC;
  --warn: #F5AE39;    --on-warn: #1A1C20;   --warn-text: #704A00;   --warn-soft: #FEEDD7;   --warn-line: #F0CEA1;
  --danger: #B33832;  --on-danger: #FFFFFF; --danger-text: #902824; --danger-soft: #FFEBE8; --danger-line: #FFC3BC;
  --info: #006BB9;    --on-info: #FFFFFF;   --info-text: #005494;   --info-soft: #E5F2FF;   --info-line: #B4D8FF;

  /* tones: six fixed families for kinds of work (job types, class types) */
  --blue-bg: #E4F0FF;   --blue-bar: #4081D2;   --blue-text: #174276;
  --green-bg: #DEF6E3;  --green-bar: #2A9754;  --green-text: #005126;
  --amber-bg: #FCECD5;  --amber-bar: #A97500;  --amber-text: #593C00;
  --violet-bg: #F0EBFF; --violet-bar: #8B6BC8; --violet-text: #4A3470;
  --rose-bg: #FFE8EB;   --rose-bar: #C45770;   --rose-text: #6C2738;
  --teal-bg: #D4F6F7;   --teal-bar: #009296;   --teal-text: #004D4F;

  /* accent: placeholders. The real values are printed per business by the server
     (see accent.js); these make the stylesheet usable on its own. */
  --brand: #2F5D50; --on-brand: #FFFFFF;
  --accent: #2F5D50; --accent-hover: #244A40; --on-accent: #FFFFFF; --accent-edge: #2F5D50;
  --accent-text: #2B5A4D; --accent-soft: #E6F1EC; --accent-soft-line: #C5DDD3;

  /* UK number plate: physical object, same in light and dark */
  --plate-rear: #FFD21F; --plate-front: #FBFBF8; --plate-ink: #111111; --plate-band: #1B4AA0;

  /* elevation */
  --shadow-1: 0 1px 2px rgb(26 28 32 / 0.05), 0 1px 1px rgb(26 28 32 / 0.03);
  --shadow-2: 0 6px 16px rgb(26 28 32 / 0.08), 0 1px 3px rgb(26 28 32 / 0.06);
  --shadow-3: 0 18px 44px rgb(26 28 32 / 0.18), 0 4px 12px rgb(26 28 32 / 0.10);

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Dark tokens. Used when the device asks for dark, or when data-theme="dark" is set
   on <html> (a per-device setting) or on any element (the system page uses that). */
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101214; --surface: #181B1E; --surface-2: #1F2327; --surface-3: #282D32;
  --line: #2C3136; --line-2: #3A4046; --line-strong: #747A81;
  --ink: #F1F0EC; --ink-2: #B9BDC3; --ink-3: #989DA4;
  --inverse: #F1F0EC; --on-inverse: #101214;
  --ok: #4AC06C;     --on-ok: #101214;     --ok-text: #8FD89E;     --ok-soft: #122D19;     --ok-line: #244D2E;
  --warn: #DA950B;   --on-warn: #101214;   --warn-text: #EEBA70;   --warn-soft: #352206;   --warn-line: #583C10;
  --danger: #F9786C; --on-danger: #101214; --danger-text: #FFABA1; --danger-soft: #3B1C19; --danger-line: #62332E;
  --info: #51A9FF;   --on-info: #101214;   --info-text: #95C9FF;   --info-soft: #12283E;   --info-line: #234566;
  --blue-bg: #1A2C44;   --blue-bar: #5FA1F3;   --blue-text: #BEDAFF;
  --green-bg: #16321F;  --green-bar: #4FB772;  --green-text: #B6E5C1;
  --amber-bg: #39280A;  --amber-bar: #CD9219;  --amber-text: #F1D3A4;
  --violet-bg: #2E2641; --violet-bar: #A98AEA; --violet-text: #DCCFFF;
  --rose-bg: #402027;   --rose-bar: #E6768E;   --rose-text: #FFC6CF;
  --teal-bg: #003334;   --teal-bar: #00B4B9;   --teal-text: #A0E6E8;
  --accent: #6FA897; --accent-hover: #7BB4A3; --on-accent: #101214; --accent-edge: #6FA897;
  --accent-text: #9AD0C0; --accent-soft: #162B25; --accent-soft-line: #24463C;
  --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
  --shadow-2: 0 6px 16px rgb(0 0 0 / 0.45), 0 1px 3px rgb(0 0 0 / 0.4);
  --shadow-3: 0 18px 44px rgb(0 0 0 / 0.6), 0 4px 12px rgb(0 0 0 / 0.45);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #101214; --surface: #181B1E; --surface-2: #1F2327; --surface-3: #282D32;
    --line: #2C3136; --line-2: #3A4046; --line-strong: #747A81;
    --ink: #F1F0EC; --ink-2: #B9BDC3; --ink-3: #989DA4;
    --inverse: #F1F0EC; --on-inverse: #101214;
    --ok: #4AC06C;     --on-ok: #101214;     --ok-text: #8FD89E;     --ok-soft: #122D19;     --ok-line: #244D2E;
    --warn: #DA950B;   --on-warn: #101214;   --warn-text: #EEBA70;   --warn-soft: #352206;   --warn-line: #583C10;
    --danger: #F9786C; --on-danger: #101214; --danger-text: #FFABA1; --danger-soft: #3B1C19; --danger-line: #62332E;
    --info: #51A9FF;   --on-info: #101214;   --info-text: #95C9FF;   --info-soft: #12283E;   --info-line: #234566;
    --blue-bg: #1A2C44;   --blue-bar: #5FA1F3;   --blue-text: #BEDAFF;
    --green-bg: #16321F;  --green-bar: #4FB772;  --green-text: #B6E5C1;
    --amber-bg: #39280A;  --amber-bar: #CD9219;  --amber-text: #F1D3A4;
    --violet-bg: #2E2641; --violet-bar: #A98AEA; --violet-text: #DCCFFF;
    --rose-bg: #402027;   --rose-bar: #E6768E;   --rose-text: #FFC6CF;
    --teal-bg: #003334;   --teal-bar: #00B4B9;   --teal-text: #A0E6E8;
    --accent: #6FA897; --accent-hover: #7BB4A3; --on-accent: #101214; --accent-edge: #6FA897;
    --accent-text: #9AD0C0; --accent-soft: #162B25; --accent-soft-line: #24463C;
    --shadow-1: 0 1px 2px rgb(0 0 0 / 0.4);
    --shadow-2: 0 6px 16px rgb(0 0 0 / 0.45), 0 1px 3px rgb(0 0 0 / 0.4);
    --shadow-3: 0 18px 44px rgb(0 0 0 / 0.6), 0 4px 12px rgb(0 0 0 / 0.45);
  }
}

/* Workshop mode: a per-device setting for gloves and greasy hands. Everything
   pressable grows; nothing else changes. */
[data-touch="glove"] { --tap: 60px; --tap-lg: 68px; --row: 76px; --text-md: 1.125rem; --tabbar: 76px; --rail: 104px; --nav-item: 72px; }

@media (min-width: 700px)  { :root { --gutter: var(--space-6); } }
@media (min-width: 1280px) { :root { --gutter: var(--space-8); } }

/* ---------- 3. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 var(--text-md)/1.45 var(--font-ui);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
img, svg { display: block; max-width: 100%; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 3px solid var(--accent-text); outline-offset: 2px; border-radius: var(--radius-sm); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

h1, .h1 { font-size: var(--text-xl); line-height: 1.15; font-weight: 700; letter-spacing: -0.02em; }
h2, .h2 { font-size: var(--text-lg); line-height: 1.25; font-weight: 700; letter-spacing: -0.01em; }
h3, .h3 { font-size: var(--text-md); line-height: 1.3; font-weight: 700; }
@media (min-width: 700px) { h1, .h1 { font-size: var(--text-2xl); } }

.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-2); }
.meta { color: var(--ink-3); font-size: var(--text-xs); }
.small { font-size: var(--text-sm); }
.strong { font-weight: 600; }
.link { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
.label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); letter-spacing: 0.01em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

.icon { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon--sm { width: 18px; height: 18px; stroke-width: 2; }
.icon--lg { width: 32px; height: 32px; stroke-width: 1.5; }

.stack { display: flex; flex-direction: column; gap: var(--space-4); }
.stack--sm { gap: var(--space-2); } .stack--lg { gap: var(--space-6); }
.cluster { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }
.cluster--sm { gap: var(--space-2); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.grow { flex: 1; min-width: 0; }

/* ---------- 4. App shell ----------
   One <nav> in the HTML. Phone: a bar along the bottom (thumb reach).
   Tablet: a rail down the left. Desktop: the rail widens into a sidebar.
   The menu has a short list (.nav__list: the pack's first group, six items at most, then "More")
   and the rest (.nav__rest: the other groups, Settings, and who is signed in).
   Phone: four of the short list and More, which is a link to the More page.
   Rail, and any sidebar without the height for everything: the short list; More opens the rest beside it.
   Sidebar on a tall screen: everything, in its groups, and no More. */
.app { min-height: 100dvh; }
.app__main { min-width: 0; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); }

.skip { position: absolute; left: var(--space-4); top: -100px; z-index: 100; background: var(--inverse); color: var(--on-inverse); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); font-weight: 600; }
.skip:focus { top: var(--space-4); }

.nav {
  position: fixed; inset: auto 0 0 0; z-index: 30;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav__biz, .nav__rest, .nav__you { display: none; }
.nav__list { display: flex; height: var(--tabbar); }
.nav__list > li { flex: 1; display: flex; }
.nav__list > li:not([data-bar]):not([data-more]) { display: none; }
.nav__item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); position: relative; min-width: 0;
}
.nav__item .icon { width: 26px; height: 26px; }
/* A long label has a short form for the bar and the rail ("Invoices" for "Invoices and estimates"). */
.nav__full { display: none; }
/* More is marked when the page you are on lives inside it: data-current="bar" (only hidden on a phone) or "all". */
.nav__item[aria-current="page"], .nav__item[data-current] { color: var(--accent-text); }
.nav__item[aria-current="page"]::before, .nav__item[data-current]::before {
  content: ""; position: absolute; top: calc(50% - 26px); width: 56px; height: 32px; border-radius: var(--radius-full);
  background: var(--accent-soft); z-index: -1;
}
.nav__count {
  position: absolute; top: calc(50% - 28px); left: calc(50% + 8px); min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: var(--radius-full); background: var(--danger); color: var(--on-danger);
  font-size: 12px; font-weight: 700; line-height: 20px; text-align: center; font-variant-numeric: tabular-nums;
}

/* Phone top bar: whose business this is, the page title, two actions at most. */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: var(--space-3);
  min-height: 60px; padding: var(--space-2) var(--space-2) var(--space-2) var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px);
  -webkit-backdrop-filter: saturate(1.4) blur(12px);
}
.topbar__title { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; }

.logo {
  width: 40px; height: 40px; flex: none; border-radius: 11px; background: var(--brand); color: var(--on-brand);
  display: grid; place-items: center; font-weight: 800; font-size: 18px; letter-spacing: -0.02em; overflow: hidden;
}
.logo svg { width: 62%; height: 62%; }
.logo--lg { width: 56px; height: 56px; border-radius: 15px; font-size: 24px; }
.logo--sm { width: 32px; height: 32px; border-radius: 9px; font-size: 14px; }
/* Our own mark is already a tile, so it is shown as it is, never inside a second tile.
   Only used on our own pages, where the theme is the umbrella's. */
.logo--mark { background: none; border-radius: 0; color: var(--brand); }
.logo--mark svg { width: 100%; height: 100%; }
[data-theme="dark"] .logo--mark { color: var(--accent-text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo--mark { color: var(--accent-text); } }

.page { padding: var(--space-2) var(--gutter) var(--space-10); max-width: 1480px; margin-inline: auto; }
.page-head { display: none; }
.page-head__title { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

@media (min-width: 700px) {
  .app { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); }
  .app__main { padding-bottom: 0; }
  .topbar { display: none; }
  .page { padding-top: var(--space-6); }
  .page-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); margin-bottom: var(--space-6); min-height: var(--tap-lg); }
  .nav {
    position: sticky; inset: 0 auto auto 0; height: 100dvh; border-top: 0; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; align-items: center; padding: var(--space-4) 0 var(--space-2);
  }
  .nav__biz { display: flex; flex-direction: column; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); flex: none; }
  .nav__biz-name, .nav__biz-sub { display: none; }
  /* The short list never needs to scroll on a tablet. It can as a last resort (a phone on its side),
     and then the logo above it and the person below it stay where they are. */
  .nav__list { flex-direction: column; height: auto; gap: 2px; width: 100%; padding: 0 var(--space-1); flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
  .nav__list::-webkit-scrollbar { display: none; }
  .nav__list > li, .nav__list > li:not([data-bar]):not([data-more]) { display: flex; flex: none; }
  .nav__item { min-height: var(--nav-item); border-radius: var(--radius-md); gap: 3px; }
  .nav__item:hover, .nav__item[aria-expanded="true"] { background: var(--surface-3); }
  .nav__item[data-current="bar"] { color: var(--ink-2); }
  .nav__item[aria-current="page"], .nav__item[data-current="all"] { background: var(--accent-soft); color: var(--accent-text); }
  .nav__item[aria-current="page"]::before, .nav__item[data-current]::before { display: none; }
  .nav__count { left: calc(50% + 10px); }
  [data-touch="glove"] .nav__item, [data-touch="glove"] .nav__you { font-size: var(--text-sm); }

  /* Who is signed in, at the foot of the rail. Goes to their account in Settings. */
  .nav__you {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; flex: none;
    width: calc(100% - var(--space-2)); min-height: var(--nav-item); margin-top: var(--space-2); border-radius: var(--radius-md);
    font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); text-align: center; min-width: 0;
  }
  .nav__you:hover { background: var(--surface-3); }
  .nav__you[aria-current="page"] { background: var(--accent-soft); color: var(--accent-text); }
  .nav__you .avatar { width: 32px; height: 32px; font-size: 12px; }
  .nav__you-text { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .nav__you-text small { display: none; }

  /* The rest of the menu, opened by More: a panel the full height of the screen, beside the rail. */
  .nav[data-more="open"] .nav__rest {
    display: flex; flex-direction: column; position: fixed; z-index: 2; top: 0; bottom: 0; left: var(--rail);
    width: min(360px, calc(100vw - var(--rail) - var(--space-6)));
    background: var(--surface); border-right: 1px solid var(--line); box-shadow: var(--shadow-3);
    padding: var(--space-3) var(--space-3) calc(var(--space-3) + env(safe-area-inset-bottom)); overflow-y: auto; overscroll-behavior: contain;
  }
  .nav[data-more="open"]::after { content: ""; position: fixed; z-index: 1; inset: 0 0 0 var(--rail); background: rgb(16 18 20 / 0.32); }
  .nav__rest-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); min-height: var(--tap); padding-left: var(--space-3); margin-bottom: var(--space-1); flex: none; }
  .nav__rest-title { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; }
  .nav__group { flex: none; }
  .nav__group + .nav__group { margin-top: var(--space-2); }
  .nav__group-label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); letter-spacing: 0.01em; padding: var(--space-2) var(--space-3) var(--space-1); }
  .nav__rest ul { display: flex; flex-direction: column; gap: 2px; }
  .nav__rest li { display: flex; }
  .nav__rest .nav__item { flex-direction: row; justify-content: flex-start; gap: var(--space-3); min-height: var(--tap-lg); padding: 0 var(--space-3); font-size: var(--text-md); color: var(--ink); }
  .nav__rest .nav__item .icon { width: 24px; height: 24px; color: var(--ink-2); }
  .nav__rest .nav__item[aria-current="page"], .nav__rest .nav__item[aria-current="page"] .icon { color: var(--accent-text); }
  .nav__rest .nav__count { position: static; margin-left: auto; }
  .nav__rest .nav__short { display: none; }
  .nav__rest .nav__full { display: inline; }
  .nav__end { margin-top: auto; padding-top: var(--space-4); flex: none; }
  .nav__person { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) 0 0 var(--space-3); margin-top: var(--space-2); border-top: 1px solid var(--line); }
  .nav__person-text { flex: 1; min-width: 0; font-size: var(--text-sm); font-weight: 600; line-height: 1.25; }
  .nav__person-text > span, .nav__person-text small { display: block; overflow-wrap: anywhere; }
  .nav__person-text small { font-size: var(--text-xs); font-weight: 400; color: var(--ink-3); }
  .nav__signout { flex: none; padding: 0 var(--space-4); }
  .nav__product { display: none; }
}

@media (min-width: 1280px) {
  .app { grid-template-columns: var(--sidebar) minmax(0, 1fr); }
  .nav { align-items: stretch; padding: var(--space-5) var(--space-3) var(--space-3); }
  .nav__biz { flex-direction: row; gap: var(--space-3); padding: 0 var(--space-2); margin-bottom: var(--space-6); }
  .nav__biz-name { display: block; font-weight: 700; line-height: 1.2; }
  .nav__biz-sub { display: block; font-size: var(--text-xs); color: var(--ink-3); }
  .nav__list { padding: 0; }
  .nav__item { flex-direction: row; justify-content: flex-start; gap: var(--space-3); min-height: var(--tap); padding: 2px var(--space-3); font-size: var(--text-sm); line-height: 1.25; }
  .nav__item .icon { width: 22px; height: 22px; }
  .nav__short { display: none; }
  .nav__full { display: inline; }
  .nav__count { position: static; margin-left: auto; }
  [data-touch="glove"] .nav__item { font-size: var(--text-md); }
  .nav__you { flex-direction: row; justify-content: flex-start; gap: var(--space-3); width: auto; padding: var(--space-2); text-align: left; font-size: var(--text-sm); color: var(--ink); line-height: 1.25; }
  .nav__you .avatar { width: 44px; height: 44px; font-size: var(--text-sm); }
  .nav__you-text small { display: block; font-size: var(--text-xs); font-weight: 400; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; }
  .nav[data-more="open"] .nav__rest { left: var(--sidebar); width: 360px; }
  .nav[data-more="open"]::after { left: var(--sidebar); }
}

/* A sidebar with the height for the whole menu shows all of it, in its groups, and needs no More.
   880px is the height the largest menu (12 items in 3 groups) needs; workshop mode always keeps the short list. */
@media (min-width: 1280px) and (min-height: 880px) {
  html:not([data-touch="glove"]) .nav__list { flex: none; overflow: visible; }
  html:not([data-touch="glove"]) .nav__list > li[data-more],
  html:not([data-touch="glove"]) .nav__you,
  html:not([data-touch="glove"]) .nav__rest-head { display: none; }
  html:not([data-touch="glove"]) .nav::after { display: none; }
  html:not([data-touch="glove"]) .nav .nav__rest {
    display: flex; flex-direction: column; position: static; flex: 1; min-height: 0; width: auto;
    padding: 0; border: 0; box-shadow: none; background: none; overflow: visible;
  }
  html:not([data-touch="glove"]) .nav__group, html:not([data-touch="glove"]) .nav__group + .nav__group { margin-top: var(--space-3); }
  html:not([data-touch="glove"]) .nav__group-label { padding-top: 0; }
  html:not([data-touch="glove"]) .nav__rest .nav__item { min-height: var(--tap); font-size: var(--text-sm); color: var(--ink-2); }
  html:not([data-touch="glove"]) .nav__rest .nav__item .icon { width: 22px; height: 22px; color: inherit; }
  html:not([data-touch="glove"]) .nav__rest .nav__item[aria-current="page"] { color: var(--accent-text); }
  html:not([data-touch="glove"]) .nav__person { padding-left: var(--space-2); }
  html:not([data-touch="glove"]) .nav__person-text > span, html:not([data-touch="glove"]) .nav__person-text small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Our own name, small, under theirs. */
  html:not([data-touch="glove"]) .nav__product { display: block; padding: var(--space-2) var(--space-2) 0; }
  /* No room for the words beside a name here: the button keeps its name for screen readers and as a tooltip. */
  html:not([data-touch="glove"]) .nav__signout { width: var(--tap); padding: 0; background: transparent; border-color: transparent; box-shadow: none; }
  html:not([data-touch="glove"]) .nav__signout:hover { background: var(--surface-3); }
  html:not([data-touch="glove"]) .nav__signout > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}

/* The main action on a phone sits under the thumb. */
.fab {
  position: fixed; right: var(--space-4); bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--space-4)); z-index: 25;
  min-height: var(--tap-lg); padding: 0 var(--space-5) 0 var(--space-4); border-radius: var(--radius-full);
  background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent-edge);
  display: inline-flex; align-items: center; gap: var(--space-2); font-weight: 700; box-shadow: var(--shadow-3);
}
@media (min-width: 700px) { .fab { display: none; } }
@media (min-width: 700px) { .only-phone { display: none !important; } }
@media (max-width: 699px) { .not-phone { display: none !important; } }

/* ---------- 5. Components ---------- */

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--tap); min-width: var(--tap); padding: 0 var(--space-5);
  border: 1px solid var(--line-2); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink); font-weight: 600; font-size: var(--text-md); line-height: 1.2;
  white-space: nowrap; box-shadow: var(--shadow-1); transition: background 0.15s var(--ease), transform 0.1s var(--ease);
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(0.98); background: var(--surface-3); }
.btn--primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent-edge); }
.btn--primary:hover, .btn--primary:active { background: var(--accent-hover); }
.btn--soft { background: var(--accent-soft); color: var(--accent-text); border-color: var(--accent-soft-line); box-shadow: none; }
.btn--soft:hover, .btn--soft:active { background: var(--accent-soft-line); }
.btn--quiet { background: transparent; border-color: transparent; box-shadow: none; }
.btn--quiet:hover, .btn--quiet:active { background: var(--surface-3); }
.btn--danger { background: var(--danger); color: var(--on-danger); border-color: var(--danger); }
.btn--danger:hover { background: var(--danger); filter: brightness(0.94); }
.btn--lg { min-height: var(--tap-lg); padding: 0 var(--space-6); font-size: 1.125rem; border-radius: 14px; }
.btn--block { display: flex; width: 100%; }
.btn--icon { padding: 0; width: var(--tap); flex: none; }
.btn--round { border-radius: var(--radius-full); }
.btn[disabled], .btn[aria-disabled="true"] { background: var(--surface-3); color: var(--ink-3); border-color: var(--line); box-shadow: none; cursor: not-allowed; }

/* Fields */
.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: var(--text-sm); font-weight: 600; }
.field__hint { font-size: var(--text-xs); color: var(--ink-3); }
.field__error { font-size: var(--text-sm); color: var(--danger-text); font-weight: 600; display: flex; align-items: center; gap: 6px; }
.input, .select, .textarea {
  width: 100%; min-height: 52px; padding: 0 var(--space-4); border: 1.5px solid var(--line-strong); border-radius: var(--radius-md);
  background: var(--surface); color: var(--ink); font-size: var(--text-md); appearance: none;
}
.textarea { padding: var(--space-3) var(--space-4); min-height: 104px; resize: vertical; line-height: 1.45; }
.input::placeholder, .textarea::placeholder { color: var(--ink-3); opacity: 1; }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline-offset: 0; border-color: var(--accent-text); border-radius: var(--radius-md); }
.input[aria-invalid="true"] { border-color: var(--danger); border-width: 2px; }
.select {
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23676C73' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; background-size: 22px;
}
.search { position: relative; display: block; }
.search .icon { position: absolute; left: 14px; top: 50%; translate: 0 -50%; color: var(--ink-3); pointer-events: none; }
.search .input { padding-left: 46px; border-color: var(--line-2); border-width: 1px; background: var(--surface); border-radius: var(--radius-full); min-height: var(--tap); }

.check { display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap); font-weight: 500; }
.check input { appearance: none; width: 28px; height: 28px; flex: none; margin: 0; border: 1.5px solid var(--line-strong); border-radius: 8px; background: var(--surface); display: grid; place-items: center; }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked { background: var(--accent); border-color: var(--accent-edge); }
.check input:checked::after { content: ""; width: 14px; height: 8px; border: solid var(--on-accent); border-width: 0 0 2.5px 2.5px; rotate: -45deg; translate: 0 -2px; }
.check input[type="radio"]:checked::after { width: 10px; height: 10px; border: 0; border-radius: 50%; background: var(--on-accent); rotate: none; translate: none; }

.switch { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); min-height: var(--tap); font-weight: 500; }
.switch input { appearance: none; margin: 0; width: 56px; height: 34px; flex: none; border-radius: var(--radius-full); background: var(--line-strong); position: relative; transition: background 0.15s var(--ease); }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-1); transition: translate 0.15s var(--ease); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { translate: 22px 0; }

/* Segmented control and chips */
.seg { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface-3); border-radius: var(--radius-md); max-width: 100%; }
.seg__item { min-height: 40px; padding: 0 var(--space-4); border-radius: 9px; font-weight: 600; font-size: var(--text-sm); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.seg__item[aria-pressed="true"], .seg__item[aria-selected="true"], .seg__item[aria-current="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-1); }
.seg--block { display: flex; } .seg--block .seg__item { flex: 1; }

.chips { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; padding: 2px; margin: -2px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 var(--space-4); flex: none;
  border: 1px solid var(--line-2); border-radius: var(--radius-full); background: var(--surface);
  font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); white-space: nowrap; position: relative;
}
/* a 40px chip still gets a 48px press area */
.chip::after, .seg__item::after { content: ""; position: absolute; inset: -4px 0; }
.seg__item { position: relative; }
.chip[aria-pressed="true"], .chip[aria-current="true"] { background: var(--inverse); border-color: var(--inverse); color: var(--on-inverse); }
.chip__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--tone-bar, var(--ink-3)); }

/* Cards */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-1); min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-4) var(--space-5) 0; min-height: 52px; }
.card__head h2, .card__head h3 { font-size: var(--text-md); font-weight: 700; letter-spacing: 0; display: flex; align-items: center; gap: var(--space-2); }
.card__body { padding: var(--space-4) var(--space-5) var(--space-5); }
.card__foot { padding: var(--space-3) var(--space-5); border-top: 1px solid var(--line); }
.card--flush .card__body { padding: var(--space-2) 0 var(--space-2); }
.card--quiet { background: var(--surface-2); box-shadow: none; }
.card--accent { background: var(--accent-soft); border-color: var(--accent-soft-line); box-shadow: none; }
.card__more { font-size: var(--text-sm); font-weight: 600; color: var(--accent-text); min-height: var(--tap); display: inline-flex; align-items: center; gap: 2px; margin-right: -6px; padding: 0 6px; }

/* Stat tiles */
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
@media (min-width: 900px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); } }
.stat { padding: var(--space-4); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
@media (min-width: 700px) { .stat { padding: var(--space-4) var(--space-5); } }
.stat__label { font-size: var(--text-sm); color: var(--ink-2); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.stat__value { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat__sub { font-size: var(--text-xs); color: var(--ink-3); }
.stat__sub b { font-weight: 600; color: var(--ok-text); }
.stat__sub b[data-tone="danger"] { color: var(--danger-text); }
.stat__sub b[data-tone="warn"] { color: var(--warn-text); }

/* Lists */
.list > li + li { border-top: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: var(--space-3); min-height: var(--row); padding: var(--space-3) var(--space-5); position: relative; }
a.row:hover, button.row:hover { background: var(--surface-2); }
a.row:active, button.row:active { background: var(--surface-3); }
button.row { width: 100%; text-align: left; }
.row__lead { flex: none; display: grid; place-items: center; }
.row__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row__title { font-weight: 600; line-height: 1.3; }
.row__sub { font-size: var(--text-sm); color: var(--ink-2); line-height: 1.35; }
.row__end { flex: none; display: flex; align-items: center; gap: var(--space-2); color: var(--ink-3); text-align: right; }
.row__time { font-weight: 700; font-variant-numeric: tabular-nums; width: 52px; flex: none; }
.row--tight { min-height: 52px; padding-block: var(--space-2); }

.tile { width: 44px; height: 44px; border-radius: var(--radius-md); display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); flex: none; }
.tile[data-tone="ok"] { background: var(--ok-soft); color: var(--ok-text); }
.tile[data-tone="warn"] { background: var(--warn-soft); color: var(--warn-text); }
.tile[data-tone="danger"] { background: var(--danger-soft); color: var(--danger-text); }
.tile[data-tone="info"] { background: var(--info-soft); color: var(--info-text); }
.tile[data-tone="accent"] { background: var(--accent-soft); color: var(--accent-text); }

.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--tone-bg, var(--surface-3)); color: var(--tone-text, var(--ink-2)); font-weight: 700; font-size: var(--text-sm); letter-spacing: 0.01em; }
.avatar--sm { width: 28px; height: 28px; font-size: 12px; }
.avatar--lg { width: 72px; height: 72px; font-size: var(--text-xl); }

/* Tones: set data-tone on a job block, class card, avatar or chip */
[data-tone="blue"]   { --tone-bg: var(--blue-bg);   --tone-bar: var(--blue-bar);   --tone-text: var(--blue-text); }
[data-tone="green"]  { --tone-bg: var(--green-bg);  --tone-bar: var(--green-bar);  --tone-text: var(--green-text); }
[data-tone="amber"]  { --tone-bg: var(--amber-bg);  --tone-bar: var(--amber-bar);  --tone-text: var(--amber-text); }
[data-tone="violet"] { --tone-bg: var(--violet-bg); --tone-bar: var(--violet-bar); --tone-text: var(--violet-text); }
[data-tone="rose"]   { --tone-bg: var(--rose-bg);   --tone-bar: var(--rose-bar);   --tone-text: var(--rose-text); }
[data-tone="teal"]   { --tone-bg: var(--teal-bg);   --tone-bar: var(--teal-bar);   --tone-text: var(--teal-text); }
[data-tone="slate"]  { --tone-bg: var(--surface-3); --tone-bar: var(--line-strong); --tone-text: var(--ink-2); }

/* Badges: always a word, never colour alone */
.badge {
  display: inline-flex; align-items: center; gap: 6px; min-height: 26px; padding: 2px 10px; border-radius: var(--radius-full);
  font-size: var(--text-xs); font-weight: 600; line-height: 1.2; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid transparent;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.badge--plain::before, .badge:has(> .icon)::before { display: none; }
.badge .icon { width: 15px; height: 15px; stroke-width: 2.2; margin-left: -2px; }
.badge[data-tone="ok"] { background: var(--ok-soft); color: var(--ok-text); }
.badge[data-tone="warn"] { background: var(--warn-soft); color: var(--warn-text); }
.badge[data-tone="danger"] { background: var(--danger-soft); color: var(--danger-text); }
.badge[data-tone="info"] { background: var(--info-soft); color: var(--info-text); }
.badge[data-tone="accent"] { background: var(--accent-soft); color: var(--accent-text); }
.badge--solid[data-tone="danger"] { background: var(--danger); color: var(--on-danger); }
.badge--solid[data-tone="ok"] { background: var(--ok); color: var(--on-ok); }
.badge--outline { background: transparent; border-color: var(--line-2); }

/* UK number plate. Text is the registration as typed; the font and colours do the rest. */
.plate {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: var(--plate-rear); color: var(--plate-ink); border-radius: 5px;
  font-family: var(--font-plate); font-weight: 700; font-stretch: 75%; font-size: 15px; line-height: 1;
  letter-spacing: 0.01em; padding: 5px 8px 4px; white-space: nowrap; text-transform: uppercase;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.22), 0 1px 1px rgb(0 0 0 / 0.08);
}
.plate--front { background: var(--plate-front); }
.plate--sm { font-size: 12.5px; padding: 4px 6px 3px; border-radius: 4px; }
.plate--lg { font-size: 26px; padding: 9px 14px 7px; border-radius: 8px; }
.plate--xl { font-size: 34px; padding: 12px 18px 9px; border-radius: 9px; }

/* Capacity meter */
.meter { height: 8px; border-radius: var(--radius-full); background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; width: calc(var(--v, 0) * 100%); border-radius: inherit; background: var(--tone-bar, var(--accent-edge)); }
.meter[data-full] > i { background: var(--ink-2); }

/* Steps: where a job has got to */
.steps { display: flex; gap: 6px; }
.steps > li { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); }
.steps > li::before { content: ""; height: 6px; border-radius: var(--radius-full); background: var(--surface-3); }
.steps > li[data-done]::before { background: var(--accent-edge); }
.steps > li[aria-current="step"] { color: var(--ink); }
.steps > li[aria-current="step"]::before { background: linear-gradient(90deg, var(--accent-edge) 55%, var(--accent-soft-line) 55%); }
.steps > li[data-done] { color: var(--ink-2); }

/* Key facts: label over value */
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4) var(--space-4); }
.facts > div { min-width: 0; }
.facts dt { font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; }
.facts dd { font-weight: 600; line-height: 1.3; }

/* Line items (job card work lines, payments) */
.lines { width: 100%; border-collapse: collapse; }
.lines th { text-align: left; font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); padding: var(--space-2) var(--space-3); border-bottom: 1px solid var(--line); white-space: nowrap; }
.lines td { padding: var(--space-3); border-bottom: 1px solid var(--line); vertical-align: top; }
.lines th:first-child, .lines td:first-child { padding-left: var(--space-5); }
.lines th:last-child, .lines td:last-child { padding-right: var(--space-5); text-align: right; }
.lines .r { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.lines .lines__group td { background: var(--surface-2); font-size: var(--text-sm); font-weight: 700; padding-block: var(--space-2); text-align: left; }
.lines tbody tr:last-child td { border-bottom: 0; }
.totals { display: grid; grid-template-columns: 1fr auto; gap: 6px var(--space-6); font-variant-numeric: tabular-nums; }
.totals dt { color: var(--ink-2); } .totals dd { text-align: right; font-weight: 600; }
.totals .totals__grand { font-size: var(--text-lg); font-weight: 700; color: var(--ink); padding-top: var(--space-2); border-top: 1px solid var(--line); margin-top: 2px; }

/* Toasts: bottom of the screen, above the phone's tab bar; one at a time */
.toast {
  display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap-lg); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  background: var(--inverse); color: var(--on-inverse); border-radius: 14px; box-shadow: var(--shadow-3);
  font-weight: 500; max-width: min(480px, 100%); width: fit-content;
}
.toast > .icon { color: var(--ok-soft); }
.toast[data-tone="danger"] > .icon { color: var(--danger-line); }
.toast__text { flex: 1; padding: var(--space-2) var(--space-2) var(--space-2) 0; line-height: 1.3; }
.toast__action { min-height: 40px; padding: 0 var(--space-4); border-radius: 10px; font-weight: 700; color: var(--on-inverse); background: color-mix(in srgb, var(--on-inverse) 16%, transparent); flex: none; }
.toast-area { position: fixed; z-index: 60; left: 50%; translate: -50% 0; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom) + var(--space-4)); width: calc(100% - var(--space-8)); display: flex; justify-content: center; pointer-events: none; }
.toast-area > * { pointer-events: auto; width: auto; }
@media (min-width: 700px) { .toast-area { bottom: var(--space-6); } }

/* Banners: a strip across the top of the content. Offline is the important one. */
.banner { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--gutter); font-size: var(--text-sm); line-height: 1.35; background: var(--surface-3); color: var(--ink); }
.banner b { font-weight: 700; }
.banner--offline { background: var(--warn-soft); color: var(--warn-text); border-bottom: 1px solid var(--warn-line); }
.banner--info { background: var(--info-soft); color: var(--info-text); }
.banner__end { margin-left: auto; flex: none; font-weight: 600; white-space: nowrap; }
html:not([data-state~="offline"]) .app .banner--offline { display: none; }

/* Empty states */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-3); padding: var(--space-10) var(--space-6); }
.empty__art { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: var(--space-2); }
.empty__title { font-size: var(--text-lg); font-weight: 700; }
.empty__text { color: var(--ink-2); max-width: 36ch; }

/* Bottom sheet (phone) / dialog (bigger screens) */
.sheet { background: var(--surface); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-3); padding: var(--space-3) var(--space-5) var(--space-6); }
.sheet::before { content: ""; display: block; width: 44px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 0 auto var(--space-4); }

/* Notes and callouts */
.note { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line); font-size: var(--text-sm); line-height: 1.4; }
.note[data-tone="warn"] { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); }
.note[data-tone="info"] { background: var(--info-soft); border-color: var(--info-line); color: var(--info-text); }
.note[data-tone="ok"] { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-text); }
.note[data-tone="danger"] { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-text); }
.note .icon { margin-top: 1px; }

/* Sticky action bar: the one or two things you do next, always in reach */
.actionbar {
  position: sticky; bottom: calc(var(--tabbar) + env(safe-area-inset-bottom)); z-index: 15; display: flex; gap: var(--space-3); align-items: center;
  padding: var(--space-3) var(--gutter); margin: var(--space-6) calc(var(--gutter) * -1) calc(var(--space-10) * -1);
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.actionbar .btn--primary { flex: 1; }
@media (min-width: 700px) { .actionbar { bottom: 0; } .actionbar .btn--primary { flex: none; margin-left: auto; min-width: 260px; } }

/* Dashboard layout: one column on a phone, two from tablet landscape up */
.dash { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 700px) { .dash { gap: var(--space-5); } }
@media (min-width: 960px) { .dash { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); align-items: start; } .dash > .dash__wide { grid-column: 1 / -1; } }
.dash__col { display: grid; gap: inherit; min-width: 0; }
.greeting { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
@media (min-width: 700px) { .greeting { font-size: var(--text-2xl); } }

/* ---------- 6. Diary grid: time down the side, resources across the top ----------
   Server sets on .diary:  --cols (number of resources), --slots (15-minute rows)
   and on each .job:       --col (1-based), --at (first row, 0-based), --len (rows) */
.diary { --slot: 22px; --time-col: 52px; --col-min: 148px; display: flex; flex-direction: column; min-height: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; }
.diary__scroll { overflow: auto; flex: 1; min-height: 0; overscroll-behavior: contain; scroll-snap-type: none; position: relative; scrollbar-width: thin; }
.diary__head, .diary__body { display: grid; grid-template-columns: var(--time-col) repeat(var(--cols), minmax(var(--col-min), 1fr)); min-width: calc(var(--time-col) + var(--cols) * var(--col-min)); }
.diary__head { position: sticky; top: 0; z-index: 6; background: var(--surface); border-bottom: 1px solid var(--line); }
.diary__corner { position: sticky; left: 0; z-index: 2; background: var(--surface); }
.diary__col-head { padding: var(--space-3) var(--space-3); border-left: 1px solid var(--line); min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.diary__col-name { font-weight: 700; display: flex; align-items: center; gap: var(--space-2); }
.diary__col-sub { font-size: var(--text-xs); color: var(--ink-3); }
.diary__body {
  position: relative; grid-template-rows: repeat(var(--slots), var(--slot));
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(color-mix(in srgb, var(--line) 45%, transparent) 1px, transparent 1px);
  background-size: 100% calc(var(--slot) * 4), 100% calc(var(--slot) * 2);
  padding-top: 12px; background-origin: content-box;
}
.diary__time { grid-column: 1; grid-row: calc(var(--at) + 1) / span 4; position: sticky; left: 0; z-index: 4; background: var(--surface); padding: 0 var(--space-2) 0 0; text-align: right; font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); font-variant-numeric: tabular-nums; translate: 0 -0.6em; }
.diary__gutter { grid-column: 1; grid-row: 1 / -1; position: sticky; left: 0; z-index: 3; background: var(--surface); }
.diary__lane { grid-column: calc(var(--col) + 1); grid-row: 1 / -1; border-left: 1px solid var(--line); scroll-snap-align: start; }
.diary__closed { grid-column: 2 / -1; grid-row: calc(var(--at) + 1) / span var(--len); z-index: 0;
  background: repeating-linear-gradient(135deg, transparent 0 7px, color-mix(in srgb, var(--line) 70%, transparent) 7px 8px), var(--surface-2);
  display: flex; align-items: center; justify-content: center; font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); }
/* "Now": the time sits in the gutter, on top; the line runs behind the blocks so it never looks like crossed-out text. */
.diary__now { grid-column: 1 / -1; grid-row: 1; align-self: start; height: 0; margin-top: calc(var(--at) * var(--slot)); pointer-events: none; display: flex; align-items: center; }
.diary__now::before { content: attr(data-time); position: sticky; left: 3px; z-index: 5; flex: none; width: calc(var(--time-col) - 6px); text-align: center; background: var(--danger); color: var(--on-danger); font-size: 12px; font-weight: 700; line-height: 20px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.diary__now::after { content: ""; flex: 1; border-top: 2px solid var(--danger); margin-left: 3px; position: relative; z-index: 0; }

.job {
  grid-column: calc(var(--col) + 1); grid-row: calc(var(--at) + 1) / span var(--len); z-index: 1;
  margin: 1px 3px 2px 4px; padding: 6px 8px 6px 12px; border-radius: 10px; position: relative; overflow: hidden; min-width: 0;
  background: var(--tone-bg, var(--surface-3)); color: var(--tone-text, var(--ink));
  display: flex; flex-direction: column; gap: 3px; text-align: left; cursor: grab; user-select: none; -webkit-user-select: none;
  touch-action: pan-x pan-y; transition: box-shadow 0.15s var(--ease), scale 0.15s var(--ease);
}
.job::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--tone-bar, var(--line-strong)); }
.job__top { display: flex; align-items: center; gap: 6px; min-width: 0; }
.job__title { font-weight: 700; font-size: var(--text-sm); line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.job__sub { font-size: var(--text-xs); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: 0.92; }
.job__foot { margin-top: auto; display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 600; min-width: 0; white-space: nowrap; }
.job__foot .icon { width: 15px; height: 15px; stroke-width: 2.2; }
.job__time { font-variant-numeric: tabular-nums; }
.job--short { flex-direction: row; align-items: center; padding-block: 2px; }
.job--short .job__sub, .job--short .job__foot { display: none; }
/* Finished work steps back: outlined, not filled. Still readable (AA). */
.job[data-status="done"] { background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.job.is-lifted { z-index: 20; box-shadow: var(--shadow-3); scale: 1.03; cursor: grabbing; outline: 2px solid var(--tone-bar); }
.job.is-ghost { opacity: 0.35; outline: 2px dashed var(--tone-bar); outline-offset: -2px; background: transparent; }
.job.is-ghost::before { display: none; }
.diary__drop { grid-column: calc(var(--col) + 1); grid-row: calc(var(--at) + 1) / span var(--len); z-index: 2; margin: 1px 3px 2px 4px; border-radius: 10px; border: 2px dashed var(--accent-text); background: var(--accent-soft); pointer-events: none; }
.diary__drop[data-clash] { border-color: var(--danger); background: var(--danger-soft); }

.diary-page { display: flex; flex-direction: column; height: calc(100dvh - var(--tabbar) - env(safe-area-inset-bottom) - 60px); padding-bottom: var(--space-3); gap: var(--space-3); }
.diary-bar { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.datenav { display: inline-flex; align-items: center; gap: 2px; }
.datenav__label { font-weight: 700; font-size: var(--text-lg); letter-spacing: -0.01em; padding: 0 var(--space-2); white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: var(--text-xs); color: var(--ink-2); font-weight: 600; }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 4px; background: var(--tone-bar); }

@media (max-width: 699px) {
  /* Phone: one resource fills the screen; swipe sideways for the next. A sliver of the next one shows that you can. */
  .diary { --time-col: 46px; --col-min: calc(100vw - var(--time-col) - var(--gutter) * 2 - 30px); border-radius: var(--radius-md); }
  .diary__scroll { scroll-snap-type: x proximity; scroll-padding-left: var(--time-col); }
  .diary-page { padding-inline: var(--gutter); }
}
@media (min-width: 700px) {
  .diary-page { height: 100dvh; padding-block: var(--space-6) var(--space-5); gap: var(--space-4); }
  .diary-page .page-head { margin-bottom: 0; }
}
@media (min-width: 1280px) { .diary { --slot: 24px; --time-col: 60px; } }

/* Tray of jobs that still need a slot */
.tray { display: flex; gap: var(--space-3); align-items: center; overflow-x: auto; scrollbar-width: none; }
.tray__item { flex: none; display: flex; align-items: center; gap: var(--space-2); min-height: var(--tap); padding: 6px var(--space-3) 6px var(--space-2); border-radius: var(--radius-md); background: var(--surface); border: 1px dashed var(--line-strong); font-size: var(--text-sm); font-weight: 600; cursor: grab; }

/* ---------- 7. Week timetable: days across, classes stacked in time order ---------- */
.timetable { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2); align-items: start; }
.timetable__day { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.timetable__head { text-align: center; padding: var(--space-2) 0; border-radius: var(--radius-md); font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); display: flex; flex-direction: column; line-height: 1.25; }
.timetable__head b { font-size: var(--text-lg); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.timetable__day[data-today] .timetable__head { background: var(--accent-soft); color: var(--accent-text); }
.timetable__day[data-today] .timetable__head b { color: var(--accent-text); }
.timetable__band { font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); text-align: center; padding-top: var(--space-2); }

.class {
  display: flex; flex-direction: column; gap: 4px; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); border-radius: var(--radius-md); min-width: 0; min-height: 84px;
  background: var(--tone-bg, var(--surface)); color: var(--tone-text, var(--ink)); position: relative; overflow: hidden; text-align: left;
}
.class::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--tone-bar, var(--line-strong)); }
.class__time { font-size: var(--text-xs); font-weight: 700; font-variant-numeric: tabular-nums; }
.class__name { font-weight: 700; font-size: var(--text-sm); line-height: 1.2; }
.class__who { font-size: var(--text-xs); line-height: 1.25; opacity: 0.92; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.class__cap { margin-top: auto; display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.class__cap .meter { flex: 1; height: 6px; background: color-mix(in srgb, var(--tone-bar) 22%, transparent); }
/* Classes that have happened step back, the same way finished jobs do. */
.class[data-past] { background: var(--surface-2); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.class[data-past]::before { opacity: 0.45; }
.class[data-full] .class__cap { color: var(--tone-text); }

/* Day list of classes (phone, tablet portrait, public page) */
.days { display: flex; gap: var(--space-2); overflow-x: auto; scrollbar-width: none; padding: 2px var(--gutter); margin-inline: calc(var(--gutter) * -1); scroll-snap-type: x proximity; }
.days::-webkit-scrollbar { display: none; }
.day {
  flex: 1 0 56px; min-height: 68px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--surface);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; scroll-snap-align: start;
  font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); position: relative;
}
.day b { font-size: var(--text-lg); line-height: 1.1; color: var(--ink); font-variant-numeric: tabular-nums; }
.day[aria-pressed="true"], .day[aria-current="date"] { background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent); }
.day[aria-pressed="true"] b, .day[aria-current="date"] b { color: var(--on-accent); }
.day[disabled] { background: transparent; border-style: dashed; color: var(--ink-3); cursor: not-allowed; }
.day[disabled] b { color: var(--ink-3); font-weight: 500; }

.session { display: flex; align-items: stretch; gap: var(--space-3); padding: var(--space-3) var(--space-4) var(--space-3) var(--space-3); position: relative; min-height: 84px; width: 100%; text-align: left; }
.session__time { width: 74px; flex: none; display: flex; flex-direction: column; align-items: flex-start; padding-left: var(--space-3); border-left: 5px solid var(--tone-bar, var(--line-strong)); border-radius: 3px; }
.session__time b { font-size: var(--text-md); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.25; }
.session__time span { font-size: var(--text-xs); color: var(--ink-3); }
.session__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.session__name { font-weight: 700; line-height: 1.25; }
.session__who { font-size: var(--text-sm); color: var(--ink-2); line-height: 1.3; }
.session__cap { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-xs); font-weight: 600; color: var(--ink-2); margin-top: 4px; }
.session__cap .meter { flex: 0 1 72px; min-width: 28px; }
.session__cap { white-space: nowrap; }
.session__end { flex: none; display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 4px; }
.session[data-past] .session__name, .session[data-past] .session__time b { color: var(--ink-3); font-weight: 600; }
.session[data-past] .session__time { border-left-color: color-mix(in srgb, var(--tone-bar) 40%, transparent); }
.session[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent-edge); border-radius: var(--radius-md); }
.session .option__mark { align-self: center; }
.session[aria-pressed="true"] .option__mark { background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent); }

/* Wallet card (the member's pass). Same colours in light and dark: it mirrors the real card on their phone. */
.pass { width: 100%; max-width: 320px; border-radius: 20px; background: var(--pass, var(--accent)); color: var(--on-pass, var(--on-accent)); padding: var(--space-4) var(--space-4) var(--space-5); box-shadow: var(--shadow-2); display: flex; flex-direction: column; gap: var(--space-4); }
.pass__top { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; }
.pass__top .logo { background: var(--on-pass, var(--on-accent)); color: var(--pass, var(--accent)); width: 32px; height: 32px; border-radius: 9px; font-size: 14px; }
.pass__label { font-size: 12px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.pass__value { font-size: var(--text-lg); font-weight: 700; line-height: 1.2; }
.pass__row { display: flex; justify-content: space-between; gap: var(--space-4); }
.pass__qr { align-self: center; background: #fff; border-radius: 12px; padding: 10px; width: 148px; height: 148px; }
.pass__qr svg { width: 100%; height: 100%; }

/* Visit strip: one square per day */
.visits { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; }
.visits i { width: 100%; aspect-ratio: 1; border-radius: 4px; background: var(--surface-3); min-width: 10px; }
.visits i[data-v="1"] { background: var(--accent-edge); }
.visits i[data-v="2"] { background: var(--accent-edge); box-shadow: inset 0 0 0 2px var(--surface), inset 0 0 0 4px var(--accent-edge); }

/* ---------- 8. Public pages (what the business's own customers see) ---------- */
.public { min-height: 100dvh; display: flex; flex-direction: column; }
.public__head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--gutter); max-width: 1080px; width: 100%; margin-inline: auto; }
.public__biz { font-weight: 700; font-size: var(--text-lg); line-height: 1.2; letter-spacing: -0.01em; }
.public__main { flex: 1; width: 100%; max-width: 560px; margin-inline: auto; padding: var(--space-2) var(--gutter) 150px; display: flex; flex-direction: column; gap: var(--space-5); }
.public__title { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; }
.public__aside { display: none; }
.public__foot { padding: var(--space-5) var(--gutter) var(--space-8); text-align: center; font-size: var(--text-xs); color: var(--ink-3); display: flex; flex-direction: column; gap: 6px; align-items: center; }
.powered { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; color: var(--ink-3); }
.powered svg { width: 18px; height: 18px; }
@media (min-width: 900px) {
  .public__wrap { display: grid; grid-template-columns: minmax(0, 560px) 340px; gap: var(--space-10); justify-content: center; align-items: start; max-width: 1080px; margin-inline: auto; padding-inline: var(--gutter); width: 100%; }
  .public__main { padding-inline: 0; margin: 0; padding-bottom: var(--space-10); }
  .public__aside { display: flex; flex-direction: column; gap: var(--space-4); position: sticky; top: var(--space-6); padding-top: var(--space-2); }
  .public__title { font-size: var(--text-3xl); }
}

.step { display: flex; flex-direction: column; gap: var(--space-3); }
.step__head { display: flex; align-items: center; gap: var(--space-3); }
.step__n { width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; background: var(--inverse); color: var(--on-inverse); font-weight: 700; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.step__n[data-done] { background: var(--ok); color: var(--on-ok); }
.step__title { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; }

/* Registration field shaped like a plate */
.reg { display: flex; align-items: stretch; height: 72px; border-radius: 12px; background: var(--plate-rear); overflow: hidden; box-shadow: inset 0 0 0 2px rgb(0 0 0 / 0.22), var(--shadow-1); }
.reg:focus-within { outline: 3px solid var(--accent-text); outline-offset: 3px; }
.reg__band { width: 44px; flex: none; background: var(--plate-band); color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding-bottom: 8px; font-weight: 700; font-size: 14px; letter-spacing: 0.02em; }
.reg__input { flex: 1; min-width: 0; border: 0; background: transparent; color: var(--plate-ink); text-align: center; font-family: var(--font-plate); font-weight: 700; font-stretch: 75%; font-size: 36px; letter-spacing: 0.02em; text-transform: uppercase; padding: 4px 8px 0; }
.reg__input::placeholder { color: rgb(17 17 17 / 0.35); }
.reg__input:focus-visible { outline: none; }

/* Choice cards: a big radio */
.option { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: 72px; padding: var(--space-3) var(--space-4); text-align: left; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; position: relative; }
.option__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.option__title { font-weight: 700; line-height: 1.3; }
.option__sub { font-size: var(--text-sm); color: var(--ink-2); line-height: 1.35; }
.option__price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.option__price small { display: block; font-size: var(--text-xs); font-weight: 500; color: var(--ink-3); }
.option__mark { width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--line-strong); flex: none; display: grid; place-items: center; color: transparent; }
.option__mark .icon { width: 16px; height: 16px; stroke-width: 3; }
.option[aria-checked="true"], .option[aria-pressed="true"] { border-color: var(--accent-edge); box-shadow: inset 0 0 0 1px var(--accent-edge); background: var(--accent-soft); }
.option[aria-checked="true"] .option__mark, .option[aria-pressed="true"] .option__mark { background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent); }

.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.slot { min-height: 52px; border-radius: var(--radius-md); border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; font-variant-numeric: tabular-nums; }
.slot[aria-pressed="true"] { background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent); }
.slot[disabled] { background: transparent; border-style: dashed; color: var(--ink-3); font-weight: 500; text-decoration: line-through; cursor: not-allowed; }

/* Summary bar pinned to the bottom of a public page */
.checkout { position: fixed; inset: auto 0 0 0; z-index: 30; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px rgb(26 28 32 / 0.08); padding: var(--space-3) var(--gutter) calc(var(--space-3) + env(safe-area-inset-bottom)); }
.checkout__in { max-width: 560px; margin-inline: auto; display: flex; align-items: center; gap: var(--space-4); }
.checkout__sum { flex: 1; min-width: 0; line-height: 1.3; }
.checkout__sum b { display: block; font-weight: 700; }
.checkout__sum span { font-size: var(--text-sm); color: var(--ink-2); }
@media (min-width: 900px) { .checkout { display: none; } }

/* ---------- 9. Resource tiles: what is on each ramp, chair or room right now ---------- */
.resources { display: grid; gap: var(--space-3); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .resources { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.resource { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4) var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; background: var(--surface); position: relative; }
a.resource:hover { background: var(--surface-2); }
.resource__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 28px; }
.resource__name { font-size: var(--text-sm); font-weight: 700; color: var(--ink-2); }
.resource__what { display: flex; align-items: center; flex-wrap: wrap; gap: 4px var(--space-2); min-width: 0; font-weight: 700; }
.resource__sub { font-size: var(--text-sm); color: var(--ink-2); line-height: 1.35; }
.resource__foot { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--ink-2); margin-top: 2px; padding-top: var(--space-2); border-top: 1px solid var(--line); }
.resource__foot .num { margin-left: auto; font-weight: 600; white-space: nowrap; }
.resource--free { background: var(--surface-2); border-style: dashed; }
.resource { container-type: inline-size; }
@container (max-width: 270px) { .resource__what { flex-direction: column; align-items: flex-start; } }

/* Big figure with a sentence (reminders, takings) */
.figure { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; }
.figure b { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.bars { display: grid; gap: var(--space-3); }
.bars__row { display: grid; grid-template-columns: 1fr auto; gap: 4px var(--space-3); font-size: var(--text-sm); }
.bars__row .meter { grid-column: 1 / -1; }

/* ---------- 10. Small helpers ---------- */
@media (max-width: 959px) { .wide-only { display: none !important; } }
@media (min-width: 960px) { .narrow-only { display: none !important; } }
@media (max-width: 1279px) { .desktop-only { display: none !important; } }
@media (max-width: 699px) { .page:has(> .fab) { padding-bottom: 104px; } }

/* ---------- 11. Diary extras ---------- */
.job--mid .job__foot { display: none; }
.job__flag { margin-left: auto; flex: none; display: grid; place-items: center; }
.job__flag .icon { width: 16px; height: 16px; stroke-width: 2.4; }
.job:not(.job--mid):not(.job--short) .job__flag { display: none; }
a.job:focus-visible { outline-offset: 1px; border-radius: 10px; }
/* Narrow columns (four ramps on a tablet held upright): the plate takes the first line, the work the second. */
.job { container-type: inline-size; }
@container (max-width: 215px) {
  .job__top { flex-wrap: wrap; row-gap: 3px; }
  .job__title { order: 3; flex-basis: 100%; }
  .job--mid .job__sub, .job--hour .job__sub { display: none; }
  .job--short .job__title { order: 0; flex-basis: auto; }
}
/* While a block is being moved: where it will land, said in words above it. */
.diary__tip { grid-column: calc(var(--col) + 1); grid-row: calc(var(--at) + 1); z-index: 30; justify-self: start; align-self: start; translate: 4px calc(-100% - 6px); background: var(--inverse); color: var(--on-inverse); padding: 5px 10px; border-radius: 8px; font-size: var(--text-xs); font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; box-shadow: var(--shadow-2); pointer-events: none; }
.diary__tip[data-clash] { background: var(--danger); color: var(--on-danger); }
/* The diary page fills the screen; the grid scrolls inside it so the times and headings stay put. */
.app__main:has(> .diary-page) { display: flex; flex-direction: column; height: 100dvh; }
.app__main > .diary-page { flex: 1; min-height: 0; height: auto; max-width: none; width: 100%; }
.diary { flex: 1; }
@media (max-width: 699px) { .app__main > .diary-page { padding-top: 0; padding-bottom: var(--space-3); } }

/* ---------- 12. Record pages (job card, customer or member record) ---------- */
.split { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 960px) { .split { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--space-5); } }
.split > * { display: grid; gap: inherit; min-width: 0; }
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-5); }
.hero > .grow { flex: 1 1 220px; }
.hero__name { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; line-height: 1.2; }
@media (min-width: 700px) { .hero__name { font-size: var(--text-xl); } .facts--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.rule { border: 0; border-top: 1px solid var(--line); margin: var(--space-4) 0; }
.thumbs { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.thumb { width: 64px; height: 64px; border-radius: 10px; background: var(--surface-3); display: grid; place-items: center; color: var(--ink-3); overflow: hidden; flex: none; }
.thumb svg:not(.icon) { width: 100%; height: 100%; }
.thumb--add { border: 1.5px dashed var(--line-strong); background: transparent; color: var(--ink-2); flex-direction: column; font-size: var(--text-xs); font-weight: 600; gap: 2px; display: flex; align-items: center; justify-content: center; }
.timeline > li { display: grid; grid-template-columns: var(--tw, 48px) minmax(0, 1fr); gap: var(--space-3); padding: 7px 0; font-size: var(--text-sm); line-height: 1.4; }
.timeline time { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.timeline > li > span > small { display: block; color: var(--ink-3); font-size: var(--text-xs); }
.quote { background: var(--surface-2); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); font-size: var(--text-sm); line-height: 1.45; }
.quote b { display: block; font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; margin-bottom: 2px; }
.line__sub { display: block; font-size: var(--text-sm); color: var(--ink-2); }
.card__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); padding: 0 var(--space-5) var(--space-5); }

/* ---------- 13. Person header (member or customer record) ---------- */
.person { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.person__name { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.person__actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
@media (min-width: 700px) { .person__name { font-size: var(--text-2xl); } .person__actions { margin-left: auto; } }
@media (max-width: 699px) { .person__actions { width: 100%; } .person__actions .btn { flex: 1; padding-inline: var(--space-3); } }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.mini-stats b { display: block; font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.mini-stats span { font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; }
.pass-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); }

/* ---------- 14. The More page (phone; also where More goes with no JavaScript) ---------- */
.more { display: grid; gap: var(--space-5); max-width: 640px; }
.more__group { display: grid; gap: var(--space-2); min-width: 0; }
.more__label { font-size: var(--text-sm); font-weight: 700; color: var(--ink-2); letter-spacing: 0; padding-left: var(--space-1); }
.row .nav__count { position: static; }
.more__person { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.more__person .btn { margin-left: auto; }
@media (max-width: 479px) { .more__person .btn { flex-basis: 100%; } }
.more__product { display: flex; justify-content: center; padding-top: var(--space-2); }

/* ---------- 15. Our own pages: sign in, sign up, two-step sign-in ----------
   These wear the umbrella's colour and logo, not a business's. The lock-up is the mark and the
   name as live text; its rules are in docs/design/brand/logo.html. */
.lockup { display: inline-flex; align-items: center; gap: 0.36em; font-size: 22px; line-height: 1; white-space: nowrap; color: var(--ink); }
.lockup > svg { width: 1.26em; height: 1.26em; flex: none; color: var(--brand); }
[data-theme="dark"] .lockup > svg { color: var(--accent-text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .lockup > svg { color: var(--accent-text); } }
.lockup__word { font-weight: 800; letter-spacing: -0.022em; }
.lockup__word b { font-weight: 500; letter-spacing: -0.012em; }
.lockup--stack { flex-direction: column; gap: 0.5em; text-align: center; font-size: 26px; }
.lockup--stack > svg { width: 2.6em; height: 2.6em; }
.lockup.lockup--mono, .lockup.lockup--mono > svg { color: inherit; }

.auth { min-height: 100dvh; display: flex; flex-direction: column; }
.auth__side { display: none; }
.auth__main { flex: 1; display: flex; flex-direction: column; align-items: center; gap: var(--space-6); padding: var(--space-8) var(--gutter) var(--space-10); padding-bottom: calc(var(--space-10) + env(safe-area-inset-bottom)); }
.auth__brand { display: flex; justify-content: center; }
.auth__body { width: 100%; max-width: 480px; display: flex; flex-direction: column; gap: var(--space-4); }
.auth--wide .auth__body { max-width: 600px; }
.auth__card > .card__body { padding: var(--space-6) var(--space-5); display: flex; flex-direction: column; gap: var(--space-5); }
.auth__title { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.auth__lead { color: var(--ink-2); margin-top: calc(var(--space-3) * -1); }
.auth__alt { text-align: center; color: var(--ink-2); padding: var(--space-1) 0; }
.auth__who { display: flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--ink-2); min-width: 0; }
.auth__quiet { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1) var(--space-4); }
.auth fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.auth legend { padding: 0; }
@media (min-width: 700px) {
  .auth__main { padding-top: clamp(var(--space-8), 9vh, 120px); }
  .auth__card > .card__body { padding: var(--space-8); }
  .auth__title { font-size: var(--text-2xl); }
}
@media (min-width: 960px) {
  .auth { display: grid; grid-template-columns: clamp(340px, 38%, 560px) minmax(0, 1fr); align-items: start; }
  .auth__side {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-5);
    position: sticky; top: 0; height: 100dvh; padding: var(--space-10) var(--space-8);
    background: var(--brand); color: var(--on-brand); text-align: center;
  }
  .auth__side .lockup--stack { font-size: 34px; }
  .auth__tagline { font-size: var(--text-lg); line-height: 1.35; max-width: 22ch; opacity: 0.92; }
  .auth__domain { position: absolute; bottom: var(--space-6); left: 0; right: 0; font-size: var(--text-sm); font-weight: 600; opacity: 0.8; }
  .auth__brand { display: none; }
  .auth__main { min-height: 100dvh; justify-content: center; padding-block: var(--space-10); }
  .auth--wide .auth__main { justify-content: flex-start; }
}

/* A field with a small button inside its right-hand end (Show a password, Copy a key). */
.field__with { position: relative; display: block; }
.field__with .input { padding-right: 88px; }
.field__with > button { position: absolute; right: 6px; top: 6px; bottom: 6px; min-width: 64px; padding: 0 var(--space-3); border-radius: 8px; font-size: var(--text-sm); font-weight: 600; color: var(--accent-text); }
.field__with > button::after { content: ""; position: absolute; inset: -6px; }
.field__with > button:hover { background: var(--surface-3); }

/* The six-digit code: one box, big digits, so a paste or the phone's own suggestion fills it in one go. */
.code-input { min-height: 68px; font-size: var(--text-2xl); font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.3em; text-align: center; padding: 0 0 0 0.3em; }
.code-input--recovery { font-family: var(--font-plate); font-stretch: 75%; font-size: var(--text-xl); letter-spacing: 0.08em; text-transform: uppercase; padding-left: 0.08em; }

/* Two-step set-up: the QR code, and the same key to type, in groups of four. */
.setup { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .setup { grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-5); } }
.qr { width: 176px; height: 176px; padding: 12px; border-radius: var(--radius-md); background: #fff; border: 1px solid var(--line-2); flex: none; }
.qr svg { width: 100%; height: 100%; }
.auth__key { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: var(--space-2) var(--space-4); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line-2);
  font-family: var(--font-plate); font-stretch: 75%; font-weight: 700; font-size: var(--text-lg); letter-spacing: 0.06em; line-height: 1.3; user-select: all; -webkit-user-select: all; }
.auth__steps { display: grid; gap: var(--space-5); }
.auth__steps .step { gap: var(--space-3); }
.auth__steps .step__title { font-size: var(--text-md); letter-spacing: 0; }
.auth__steps .step > :not(.step__head) { margin-left: calc(30px + var(--space-3)); }
@media (max-width: 559px) { .auth__steps .step > :not(.step__head) { margin-left: 0; } }

/* Recovery codes: shown once, numbered so they can be ticked off on paper. */
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-flow: column; grid-template-rows: repeat(5, auto); gap: var(--space-2) var(--space-5); padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line-2); counter-reset: code; }
.codes li { counter-increment: code; display: flex; align-items: baseline; gap: var(--space-2); font-family: var(--font-plate); font-stretch: 75%; font-weight: 700; font-size: var(--text-md); letter-spacing: 0.04em; white-space: nowrap; }
.codes li::before { content: counter(code); width: 1.4em; text-align: right; font-family: var(--font-ui); font-weight: 600; font-size: var(--text-xs); letter-spacing: 0; color: var(--ink-3); flex: none; }
@media (max-width: 479px) { .codes { gap: var(--space-2) var(--space-3); padding: var(--space-4) var(--space-3); } .codes li { font-size: var(--text-sm); gap: 6px; } .codes li::before { width: 1.2em; } }
@media print {
  .skip, .btn, .note, .check, .auth__side, .auth__alt, .nav, .topbar { display: none !important; }
  .auth__brand { display: flex !important; }
  .codes { border: 0; background: none; }
}

/* Product chooser: one big card per trade. */
.choice { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-4) var(--space-4) var(--space-5); min-height: 96px; }
a.choice:hover { background: var(--surface-2); }
.choice__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.choice__name { font-size: var(--text-lg); font-weight: 800; letter-spacing: -0.02em; line-height: 1.2; }
.choice__name b { font-weight: 500; letter-spacing: -0.01em; }
.choice__for { font-size: var(--text-sm); color: var(--ink-2); line-height: 1.35; }

/* A radio shown as a chip ("What do you call your members?"). The real input sits on top, unseen. */
.picks { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.pick { position: relative; display: inline-flex; }
.pick input, .swatch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pick .chip { min-height: var(--tap); padding: 0 var(--space-5); font-size: var(--text-md); color: var(--ink); }
.pick input:checked + .chip { background: var(--inverse); border-color: var(--inverse); color: var(--on-inverse); }
.pick input:focus-visible + .chip, .swatch input:focus-visible + .swatch__dot { outline: 3px solid var(--accent-text); outline-offset: 2px; }

/* Colour picker: ready-made colours and "another colour". The chosen one gets a ring and a tick. */
.swatches { display: flex; flex-wrap: wrap; gap: var(--space-3); }
.swatch { position: relative; display: block; width: var(--tap); height: var(--tap); }
.swatch__dot { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: var(--swatch); color: var(--swatch-on, #fff); --swatch-edge: color-mix(in srgb, var(--ink) 28%, transparent); box-shadow: inset 0 0 0 1px var(--swatch-edge); }
.swatch__dot .icon { width: 22px; height: 22px; stroke-width: 3; opacity: 0; }
.swatch input:checked + .swatch__dot { box-shadow: inset 0 0 0 1px var(--swatch-edge), 0 0 0 3px var(--surface), 0 0 0 6px var(--ink); }
.swatch input:checked + .swatch__dot .icon { opacity: 1; }
.swatch--other { display: flex; align-items: center; gap: var(--space-2); width: auto; padding-right: var(--space-2); font-size: var(--text-sm); font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.swatch--other .swatch__dot { width: var(--tap); flex: none; }
.swatch--other .swatch__dot { background: var(--surface); color: var(--ink-2); box-shadow: none; border: 1.5px dashed var(--line-strong); }
.swatch--other .swatch__dot .icon { opacity: 1; stroke-width: 1.75; width: 24px; height: 24px; }
/* "Another colour" is a radio like the rest. Once it is chosen, the colour input over it wakes up,
   so the next press opens the device's own colour picker. Works with no JavaScript. */
.swatch--other input[type="color"] { pointer-events: none; }
.swatch--other input[type="radio"]:checked ~ input[type="color"] { pointer-events: auto; }
.swatch--other input:checked + .swatch__dot { background: var(--swatch); color: var(--swatch-on, #fff); border-color: transparent; }

/* How the business's own screens will look in the chosen colour. The server prints the accent
   values on this element (the same values it will later print for the whole business). */
.preview { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--bg); overflow: hidden; }
.preview__label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); padding: var(--space-2) var(--space-4); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.preview__biz { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) var(--space-4) 0; min-width: 0; }
.preview__biz b { display: block; font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview__biz small { display: block; font-size: var(--text-xs); color: var(--ink-3); }
.preview__parts { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); padding: var(--space-4); }
.preview__nav { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-md); background: var(--accent-soft); color: var(--accent-text); font-size: var(--text-sm); font-weight: 600; }
.preview .btn { pointer-events: none; }

/* ---------- 16. Settings and People ---------- */
.settings { display: grid; gap: var(--space-5); grid-template-columns: minmax(0, 1fr); max-width: 720px; align-items: start; }
.settings > * { display: grid; gap: var(--space-5); min-width: 0; }
@media (min-width: 960px) { .settings { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); max-width: 1180px; } }
.settings .card__body { display: flex; flex-direction: column; gap: var(--space-4); }
.settings .card--flush .card__body { gap: 0; }
.form-row { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
@media (min-width: 560px) { .form-row { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.switch__text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.switch__text small { font-size: var(--text-sm); font-weight: 400; color: var(--ink-2); line-height: 1.35; }
/* Something that opens in place when asked for (a confirmation, a password box). No JavaScript: <details>. */
.reveal > summary { list-style: none; cursor: pointer; display: inline-flex; }
.reveal > summary::-webkit-details-marker { display: none; }
.reveal[open] > summary { background: var(--surface-3); }
.reveal__body { display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; margin-top: var(--space-3); padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-2); border: 1px solid var(--line); }
.reveal__body[data-tone="danger"] { background: var(--danger-soft); border-color: var(--danger-line); }
.reveal__body > .field { width: 100%; max-width: 360px; }
.person-row { padding: var(--space-3) var(--space-5); }
.person-row .row { padding: 0; min-height: 56px; align-items: flex-start; }
.person-row .row__lead { padding-top: 2px; }
.person-row .reveal { margin: var(--space-2) 0 0 calc(44px + var(--space-3)); }
.person-row .reveal > summary { margin-left: calc(var(--space-3) * -1); padding: 0 var(--space-3); color: var(--ink-2); font-size: var(--text-sm); }
.person-row__facts { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-2); }
@media (max-width: 559px) { .person-row .reveal { margin-left: 0; } .person-row .reveal > summary { margin-left: 0; } }
/* A choice card with a real radio inside it ("What can they do?"). */
.pick-option { position: relative; display: block; }
.pick-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pick-option input:checked + .option { border-color: var(--accent-edge); box-shadow: inset 0 0 0 1px var(--accent-edge); background: var(--accent-soft); }
.pick-option input:checked + .option .option__mark { background: var(--accent); border-color: var(--accent-edge); color: var(--on-accent); }
.pick-option input:focus-visible + .option { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.seg--block .seg__item { padding-inline: var(--space-2); min-width: 0; }
.nav__product .powered { font-size: var(--text-xs); }
.more__product .powered { font-size: var(--text-sm); }

/* ---------- 17. Money, job cards, stock, vehicle lookup, memberships (phase 3) ---------- */

/* 17.1 Dialog: a sheet from the bottom on a phone, a centred card from 700px.
   Put the class on a real <dialog> and open it with showModal(); the form inside does the work.
   A dialog that is open without showModal() (no JavaScript) draws its own dimmed background. */
.dialog {
  position: fixed; inset: auto 0 0 0; z-index: 70; width: 100%; max-width: none; max-height: 92dvh; margin: 0; padding: 0; border: 0;
  background: var(--surface); color: var(--ink); border-radius: var(--radius-xl) var(--radius-xl) 0 0; box-shadow: var(--shadow-3); overflow: hidden;
}
.dialog[open] { display: flex; flex-direction: column; }
.dialog::backdrop { background: rgb(16 18 20 / 0.45); }
.dialog:not(:modal) { box-shadow: var(--shadow-3), 0 0 0 100vmax rgb(16 18 20 / 0.45); }
.dialog__in { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dialog__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-2) var(--space-5); flex: none; }
.dialog__head h2 { font-size: var(--text-lg); }
.dialog__body { display: flex; flex-direction: column; gap: var(--space-4); padding: var(--space-2) var(--space-5) var(--space-5); overflow-y: auto; overscroll-behavior: contain; }
.dialog__foot { display: flex; gap: var(--space-3); padding: var(--space-3) var(--space-5) calc(var(--space-3) + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); flex: none; }
.dialog__foot .btn { min-width: 0; }
.dialog__foot .btn--primary, .dialog__foot .btn--danger { flex: 1; }
@media (min-width: 700px) {
  .dialog { inset: 0; margin: auto; width: min(560px, calc(100vw - 48px)); height: fit-content; max-height: min(88dvh, 780px); border-radius: var(--radius-xl); }
  .dialog--wide { width: min(720px, calc(100vw - 48px)); }
  .dialog__head { padding-top: var(--space-4); }
  .dialog__foot { justify-content: flex-end; padding-bottom: var(--space-4); }
  .dialog__foot .btn--primary, .dialog__foot .btn--danger { flex: none; min-width: 200px; }
}

/* 17.2 Fields for money and amounts: a sign before the box or a unit after it, and a stepper for "how many". */
.affix { position: relative; display: flex; }
.affix > .input { flex: 1; min-width: 0; }
.affix__pre, .affix__post { position: absolute; top: 0; bottom: 0; display: grid; place-items: center; color: var(--ink-2); font-weight: 600; pointer-events: none; }
.affix__pre { left: var(--space-4); }
.affix__post { right: var(--space-4); font-size: var(--text-sm); }
.affix__pre + .input { padding-left: 34px; }
.affix:has(> .affix__post) > .input { padding-right: 72px; }
.input--num { font-variant-numeric: tabular-nums; }
.field--short { max-width: 200px; }
.qty { display: inline-flex; align-items: stretch; border: 1.5px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; width: fit-content; }
.qty__btn { width: var(--tap); min-height: 49px; display: grid; place-items: center; color: var(--ink-2); flex: none; }
.qty__btn:hover { background: var(--surface-2); }
.qty__btn:active { background: var(--surface-3); }
.qty__input { width: 76px; min-width: 0; border: 0; border-inline: 1px solid var(--line-2); background: transparent; text-align: center; font-weight: 700; font-size: var(--text-md); font-variant-numeric: tabular-nums; padding: 0; appearance: textfield; -moz-appearance: textfield; }
.qty__input::-webkit-outer-spin-button, .qty__input::-webkit-inner-spin-button { appearance: none; margin: 0; }
.qty__input:focus-visible { outline-offset: -3px; }
/* Radios in a row of chips (how they paid, which reason): real radios, styled from :checked. */
.chip:has(> input) { cursor: pointer; }
.chip > input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip:has(> input:checked) { background: var(--inverse); border-color: var(--inverse); color: var(--on-inverse); }
.chip:has(> input:focus-visible) { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.chips--wrap { flex-wrap: wrap; overflow: visible; }
.chip__n { font-variant-numeric: tabular-nums; font-weight: 700; opacity: 0.75; }

/* 17.3 Lines you can press, and their states. The first cell of a line is a link to its edit sheet. */
.lines td.lines__open { padding: 0; }
.lines__open > a { display: block; padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5); min-height: var(--tap); }
.lines__open > a:hover { background: var(--surface-2); }
.lines__open > a:active { background: var(--surface-3); }
.line__what { font-weight: 600; }
.line__sub .badge { vertical-align: 1px; }
.lines tr[data-state="waiting"] td.r { color: var(--ink-2); }
.lines tr[data-state="no"] .line__what, .lines tr[data-state="no"] td.r { color: var(--ink-3); text-decoration: line-through; }
.lines--plain th:first-child, .lines--plain td:first-child { padding-left: 0; }
.lines--plain th:last-child, .lines--plain td:last-child { padding-right: 0; }
.lines tfoot td { border-bottom: 0; border-top: 1px solid var(--line); font-weight: 700; }
.totals .totals__note { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--ink-3); text-align: left; font-weight: 400; }
.totals dt.totals__due, .totals dd.totals__due { font-size: var(--text-lg); font-weight: 700; color: var(--ink); padding-top: var(--space-2); border-top: 2px solid var(--ink); margin-top: 2px; }

/* 17.4 Extra work found during a job: one block per thing the customer is asked about. */
.extras { display: grid; gap: var(--space-3); padding: var(--space-3) var(--space-5) var(--space-4); border-top: 1px solid var(--line); }
.extras__title { font-size: var(--text-sm); font-weight: 700; }
.extra { border: 1px solid var(--line-2); border-left: 4px solid var(--line-strong); border-radius: var(--radius-md); background: var(--surface); min-width: 0; }
.extra[data-state="waiting"] { border-left-color: var(--warn); }
.extra[data-state="yes"] { border-left-color: var(--ok); }
.extra[data-state="no"] { background: var(--surface-2); }
.extra__head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-2) var(--space-3); padding: var(--space-3) var(--space-4) 0; }
.extra__title { font-weight: 700; line-height: 1.3; }
.extra__why { font-size: var(--text-sm); color: var(--ink-2); padding: 2px var(--space-4) 0; }
.extra__price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.extra__price small { font-size: var(--text-xs); font-weight: 500; color: var(--ink-3); }
.extra .lines { margin-top: var(--space-2); font-size: var(--text-sm); }
.extra .lines th:first-child, .extra .lines td:first-child { padding-left: var(--space-4); }
.extra .lines th:last-child, .extra .lines td:last-child { padding-right: var(--space-4); }
.extra .lines td { padding-block: var(--space-2); border-bottom: 0; border-top: 1px solid var(--line); }
.extra .lines__open > a { padding: var(--space-2) var(--space-3) var(--space-2) var(--space-4); min-height: var(--tap); display: flex; flex-direction: column; justify-content: center; }
.extra__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-top: 1px solid var(--line); }
.extra__said { font-size: var(--text-sm); color: var(--ink-2); flex: 1 1 180px; min-width: 0; }
.extra[data-state="no"] .extra__title, .extra[data-state="no"] .extra__price { color: var(--ink-3); text-decoration: line-through; }

/* 17.5 Checklist: one line per thing checked, three answers. Real radios; the icon and the hidden word say which. */
.checks__key { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); font-size: var(--text-xs); color: var(--ink-2); font-weight: 600; }
.checks__key span { display: inline-flex; align-items: center; gap: 4px; }
.checks { display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--space-8); align-items: start; }
@media (min-width: 1280px) { .checks--two { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.check-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px var(--space-3); padding: 6px 0; border-top: 1px solid var(--line); }
.check-row__label { font-weight: 500; line-height: 1.3; }
.check-row__note { grid-column: 1 / -1; }
.check-row__note .input { min-height: var(--tap); font-size: var(--text-sm); }
.check-row:has([data-result="ok"] input:checked) .check-row__note, .check-row:not(:has(input:checked)) .check-row__note { display: none; }
.tri { display: inline-flex; gap: 4px; }
.tri__opt { position: relative; width: var(--tap); height: var(--tap); border: 1px solid var(--line-2); border-radius: var(--radius-md); background: var(--surface); color: var(--ink-3); display: grid; place-items: center; cursor: pointer; }
.tri__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tri__opt .icon { width: 22px; height: 22px; stroke-width: 2.2; }
.tri__opt:has(input:focus-visible) { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.tri__opt[data-result="ok"]:has(input:checked) { background: var(--ok-soft); border-color: var(--ok-line); color: var(--ok-text); box-shadow: inset 0 0 0 1px var(--ok-text); }
.tri__opt[data-result="soon"]:has(input:checked) { background: var(--warn-soft); border-color: var(--warn-line); color: var(--warn-text); box-shadow: inset 0 0 0 1px var(--warn-text); }
.tri__opt[data-result="now"]:has(input:checked) { background: var(--danger-soft); border-color: var(--danger-line); color: var(--danger-text); box-shadow: inset 0 0 0 1px var(--danger-text); }
/* Five steps with long names do not fit across a phone: under 560px the names are left to screen readers
   and one line under the bar says where the job is and what comes next. */
.steps__now { display: none; font-size: var(--text-sm); color: var(--ink-2); margin-top: var(--space-2); }
.steps__now b { color: var(--ink); font-weight: 700; }
@media (max-width: 559px) { .steps--long > li { font-size: 0; gap: 0; } .steps--long + .steps__now { display: block; } }
/* A heading with words under it that can be changed in place (the job card's note headings). */
.jotter { display: grid; gap: var(--space-4); }
.jot { display: grid; gap: 6px; }
.jot__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.jot__label { font-size: var(--text-sm); font-weight: 700; }
.jot .textarea { min-height: 76px; }

/* 17.6 Yes or no, on the public page where a customer answers an estimate. Real radios. */
.ask { border: 1px solid var(--line-2); border-radius: var(--radius-lg); background: var(--surface); padding: var(--space-4); margin: 0; min-width: 0; display: flex; flex-direction: column; gap: var(--space-3); box-shadow: var(--shadow-1); }
.ask__head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); }
.ask__title { font-size: var(--text-lg); font-weight: 700; line-height: 1.25; letter-spacing: -0.01em; }
.ask__price { font-size: var(--text-lg); font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; line-height: 1.25; }
.ask__price small { display: block; font-size: var(--text-xs); font-weight: 500; color: var(--ink-3); }
.ask__more > summary { list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); color: var(--accent-text); font-weight: 600; font-size: var(--text-sm); }
.ask__more > summary::-webkit-details-marker { display: none; }
.ask__more[open] > summary .icon { rotate: 180deg; }
.yesno { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.yesno__opt { position: relative; min-height: var(--tap-lg); border: 1.5px solid var(--line-strong); border-radius: 14px; background: var(--surface); display: flex; align-items: center; justify-content: center; gap: var(--space-2); font-weight: 700; cursor: pointer; text-align: center; line-height: 1.2; padding: var(--space-2); }
.yesno__opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.yesno__opt:has(input:focus-visible) { outline: 3px solid var(--accent-text); outline-offset: 2px; }
.yesno__opt[data-answer="yes"]:has(input:checked) { background: var(--ok); border-color: var(--ok); color: var(--on-ok); }
.yesno__opt[data-answer="no"]:has(input:checked) { background: var(--inverse); border-color: var(--inverse); color: var(--on-inverse); }
.ask:has(.yesno__opt[data-answer="yes"] input:checked) { border-color: var(--ok-line); }
.ask:has(.yesno__opt[data-answer="no"] input:checked) .ask__title, .ask:has(.yesno__opt[data-answer="no"] input:checked) .ask__price { color: var(--ink-2); }

/* Sums whose labels are sentences ("Full service and MOT, already agreed"): the label wraps, the figure does not. */
.totals.totals--wrap, .public .totals.totals--wrap { grid-template-columns: minmax(0, 1fr) auto; }
.totals.totals--wrap dt, .public .totals.totals--wrap dt { white-space: normal; }
.totals.totals--wrap dd { white-space: nowrap; }
.thumbs--lg .thumb { width: 104px; height: 104px; border-radius: var(--radius-md); }
.public__done { display: flex; flex-direction: column; gap: var(--space-4); padding-top: var(--space-4); }
.public__done .empty__art { margin: 0; }
.empty__art[data-tone="ok"] { background: var(--ok-soft); color: var(--ok-text); }

/* 17.7 The document: an invoice, estimate or credit note as the customer sees it. One block, used on the owner's
   screen, on the customer's own page and on paper. It uses neutral colours and the business's untouched colour
   for one bar, so it prints the same from a dark screen. */
.paper { position: relative; overflow: hidden; display: flex; flex-direction: column; gap: var(--space-5); padding: calc(var(--space-5) + 6px) var(--space-5) var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); font-size: var(--text-sm); line-height: 1.45; min-width: 0; }
.paper::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; background: var(--brand); }
.paper__head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-4) var(--space-6); }
.paper__from { display: flex; gap: var(--space-3); align-items: flex-start; min-width: 0; flex: 1 1 240px; }
.paper__biz { font-size: var(--text-lg); font-weight: 700; line-height: 1.2; letter-spacing: -0.01em; }
.paper__what { display: flex; flex-direction: column; gap: var(--space-2); align-items: flex-start; }
.paper__title { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.paper__meta { display: grid; grid-template-columns: auto auto; gap: 2px var(--space-4); font-variant-numeric: tabular-nums; }
.paper__meta dt { color: var(--ink-2); }
.paper__meta dd { font-weight: 600; }
.paper__parties { display: grid; gap: var(--space-4); grid-template-columns: minmax(0, 1fr); }
.paper__label { font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); margin-bottom: 2px; }
.paper__sums { align-self: flex-end; width: min(100%, 340px); }
.paper__box { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-2); padding: var(--space-3) var(--space-4); display: grid; gap: var(--space-2); break-inside: avoid; }
.paper__box h3 { font-size: var(--text-sm); }
.paper__bank { display: grid; grid-template-columns: auto 1fr; gap: 2px var(--space-4); font-variant-numeric: tabular-nums; }
.paper__bank dt { color: var(--ink-2); }
.paper__bank dd { font-weight: 600; }
.paper__foot { border-top: 1px solid var(--line); padding-top: var(--space-3); color: var(--ink-3); font-size: var(--text-xs); }
.paper__stamp { display: inline-block; border: 2px solid currentColor; border-radius: 8px; padding: 3px 12px; font-size: var(--text-sm); font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; rotate: -3deg; color: var(--ink-2); }
.paper__stamp[data-tone="ok"] { color: var(--ok-text); }
.paper__stamp[data-tone="warn"] { color: var(--warn-text); }
.paper__stamp[data-tone="danger"] { color: var(--danger-text); }
.paper .lines { font-size: var(--text-sm); }
.paper .lines th, .paper .lines td { padding-inline: var(--space-2); }
.paper .lines th:first-child, .paper .lines td:first-child { padding-left: 0; }
.paper .lines th:last-child, .paper .lines td:last-child { padding-right: 0; }
.paper .lines .lines__group td { background: none; padding-top: var(--space-3); border-bottom-color: var(--line-2); }
.paper .lines tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.paper__col { display: none; }
@media (min-width: 560px) {
  .paper__parties { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .paper__col { display: table-cell; }
  .paper__narrow { display: none; }
  .paper__what { align-items: flex-end; text-align: right; }
}
@media (min-width: 700px) { .paper { padding: calc(var(--space-8) + 6px) var(--space-8) var(--space-8); gap: var(--space-6); } }
.public__main--paper { max-width: 900px; padding-bottom: var(--space-10); }
@media (min-width: 900px) { .public__main--paper { margin-inline: auto; padding-inline: var(--gutter); } }
.paper--void .lines, .paper--void .paper__sums { opacity: 0.55; }
.paper-wrap { display: grid; gap: var(--space-4); min-width: 0; }
/* A small copy of the top of the document, on the money settings page. */
.paper--sample { box-shadow: none; padding: calc(var(--space-4) + 6px) var(--space-4) var(--space-4); gap: var(--space-3); font-size: var(--text-xs); }
.paper--sample .paper__title { font-size: var(--text-lg); }
.paper--sample .paper__biz { font-size: var(--text-md); }

/* 17.8 Lists of money, stock and memberships: figures line up on the right, the state is a word under them. */
.row__figs { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; min-width: 84px; }
.row__amount { font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.row__amount[data-void] { color: var(--ink-3); text-decoration: line-through; font-weight: 500; }
.row__when { flex: none; width: 76px; font-size: var(--text-sm); color: var(--ink-2); font-variant-numeric: tabular-nums; }
.row__col { flex: none; width: 112px; text-align: right; font-variant-numeric: tabular-nums; font-size: var(--text-sm); color: var(--ink-2); }
.row__col b { display: block; color: var(--ink); font-size: var(--text-md); }
.row__col b small { font-size: var(--text-xs); font-weight: 500; color: var(--ink-2); }
.list__head { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-5); font-size: var(--text-xs); font-weight: 600; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.list__head > .grow { min-width: 0; }
.tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.tools > .search { flex: 1 1 240px; }
.tools > .chips { flex: 1 1 100%; }
@media (min-width: 960px) { .tools > .chips { flex: 0 1 auto; } }
.sumline { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-6); align-items: baseline; }
.sumline > div { display: flex; flex-direction: column; min-width: 0; }
.sumline b { font-size: var(--text-xl); font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.sumline span { font-size: var(--text-xs); color: var(--ink-3); font-weight: 600; }
.sumline b[data-tone="danger"] { color: var(--danger-text); }
/* A row with its own button (mark this payment paid): the button drops to its own line on a phone. */
.row--act { flex-wrap: wrap; }
.row--act > .row__body { flex: 1 1 120px; }
.row--act > .btn { flex: none; }
@media (max-width: 559px) { .row--act > .btn { flex: 1 1 100%; } }
/* The amount still to pay, large, on an invoice screen. */
.owed { display: flex; flex-direction: column; gap: 2px; }
.owed b { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
/* A count of stock, large, with its unit. */
.stockqty { display: inline-flex; align-items: baseline; gap: 6px; font-variant-numeric: tabular-nums; }
.stockqty b { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.stockqty[data-tone="warn"] b { color: var(--warn-text); }
.stockqty[data-tone="danger"] b { color: var(--danger-text); }
/* Something found by a search inside a dialog: press the row to choose it. */
.pick-row { display: flex; align-items: center; gap: var(--space-3); width: 100%; min-height: var(--row); padding: var(--space-2) var(--space-3); border: 1px solid var(--line-2); border-radius: var(--radius-md); background: var(--surface); text-align: left; }
.pick-row:hover { background: var(--surface-2); }
.pick-row[aria-pressed="true"] { border-color: var(--accent-edge); box-shadow: inset 0 0 0 1px var(--accent-edge); background: var(--accent-soft); }
/* Waiting for an answer from somewhere else (a lookup): a turning mark and grey bars where the words will be. */
@keyframes turn { to { rotate: 360deg; } }
.spin { animation: turn 0.9s linear infinite; }
.skeleton { display: block; height: 14px; border-radius: 7px; background: var(--surface-3); }
/* MOT history: one test per row; faults open underneath. */
.test { padding: var(--space-3) var(--space-5); }
.test__top { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.test__date { font-weight: 700; flex: 1 1 120px; }
.test__miles { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: var(--text-sm); }
.test__faults { margin-top: var(--space-2); display: grid; gap: 6px; font-size: var(--text-sm); }
.test__faults li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2); align-items: start; }
.test__faults .badge { margin-top: 1px; }

/* 17.9 Paper. Only the document prints: everything else on the page is marked .no-print or is part of the shell. */
@page { size: A4; margin: 14mm 14mm 16mm; }
@media print {
  :root:not([data-theme="light"]) {
    color-scheme: light;
    --bg: #FFFFFF; --surface: #FFFFFF; --surface-2: #FAF9F6; --surface-3: #EFEDE8; --line: #E6E3DC; --line-2: #D5D1C9; --line-strong: #8E8B85;
    --ink: #1A1C20; --ink-2: #50555C; --ink-3: #676C73;
    --ok-text: #00642B; --warn-text: #704A00; --danger-text: #902824;
  }
  html, body { background: #FFFFFF; }
  .app, .app__main, .page, .public, .public__wrap, .public__main, .split, .split > *, .paper-wrap { display: block !important; padding: 0 !important; margin: 0 !important; max-width: none !important; min-height: 0 !important; }
  /* After the rule above, and stronger than it, so a column marked .no-print stays off the paper. */
  .nav, .topbar, .banner, .actionbar, .fab, .page-head, .skip, .toast-area, .dialog, .public__head, .public__aside, .public__foot, .checkout, .no-print, .split > .no-print, .public__main > .no-print { display: none !important; }
  .paper { border: 0; border-radius: 0; box-shadow: none; padding: 0; gap: 6mm; font-size: 10.5pt; overflow: visible; }
  .paper::before { position: static; display: block; height: 3mm; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper .logo, .paper__box { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .paper .lines td { padding-block: 2mm; }
  .paper .lines tr, .paper__sums, .paper__box { break-inside: avoid; }
  .paper a { color: inherit; text-decoration: none; }
}
