/* The client portal. Tokens from the website (website/src/styles/tokens.css); keep them in step. */
@font-face { font-family: 'Space Grotesk'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/space-grotesk-700.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400 600; font-display: swap; src: url('/fonts/inter-variable.woff2') format('woff2'); }

:root {
  --ink: #0A0A0A;
  --paper: #FAF9F5;
  --paper-alt: #F0EEE7;
  --tint-soft: #F5F2EC;
  --field: #FFFFFF;
  --signal: #FF5A00;
  --signal-dark: #E04E00;
  --signal-text: #B83F00;
  --muted: #62665F;
  --line: #DCDDD4;
  --input-line: #858B80;
  --error: #C62828;
  --success: #2E7D32;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --measure: 680px;
  --radius: 6px;
  --transition: 150ms ease;
  /* Added 22 November 2026 (hub plan 2026-11-22-portal-redesign-and-needs-you.md). Not website tokens, so the brand test ignores them. */
  --signal-soft: #FFE9DC;
  --warn: #8A5A00;
  --warn-soft: #FFF3D6;
  --ok-soft: #E3F1E4;
  --error-soft: #FBE4E4;
  --text-xs: 0.8125rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --space-1: 0.25rem;
  --space-5: 1.25rem;
  --space-12: 3rem;
  --measure-wide: 76rem;
  --shell: #0A0A0A;
  --on-shell: #FAF9F5;
  --on-shell-muted: #A3A3A3;
  --success-text: #1E5E22; /* success as text on --ok-soft: 6.7:1; --success itself is 4.4:1 there */
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--text-base)/1.6 var(--font-body); }
a { color: var(--signal-text); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
h1, h2 { font-family: var(--font-display); font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; }
/* Type: the website's steps plus --text-xs and --text-2xl; Space Grotesk only for page titles, section titles and tile numbers. */
h1 { font-size: var(--text-2xl); margin: 0 0 var(--space-5); }
h2 { font-size: var(--text-lg); margin: var(--space-8) 0 var(--space-3); }
h3 { font-family: var(--font-body); font-size: var(--text-base); font-weight: 600; margin: var(--space-6) 0 var(--space-2); }
.wrap { max-width: var(--measure); margin: 0 auto; padding: 0 var(--space-4); }
main.wrap { padding-top: var(--space-8); padding-bottom: var(--space-12); }
.wrap.wide { max-width: var(--measure-wide); }
.skip { position: absolute; left: -999px; top: 0; padding: var(--space-3) var(--space-4); background: var(--signal); color: #0A0A0A; z-index: 3; }
.skip:focus { left: var(--space-4); }
html { scroll-padding-top: 10rem; } /* the sticky header is the brand row and up to two rows of menu, so a jump to #main or #accounts clears it */
header.bar { position: sticky; top: 0; z-index: 2; background: var(--shell); color: var(--on-shell); }
/* On the design editor the header scrolls away, so the sticky preview beside the choices can stick. */
body:has(.editor) header.bar { position: static; }
header.bar > .wrap:first-child { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 56px; }
.brand { display: inline-flex; align-items: center; min-height: 44px; text-decoration: none; }
.brand img { display: block; height: 22px; width: auto; } /* the drawn wordmark, bone on ink (brand kit, npm run sync in brand/) */
.signout { display: flex; align-items: center; gap: var(--space-3); font-size: var(--text-sm); }
header.bar .who { color: var(--on-shell-muted); overflow-wrap: anywhere; }
header.bar button.link { color: var(--on-shell); }
header.bar button.link:hover { color: var(--signal); }
.muted { color: var(--muted); }
.email-body { white-space: pre-wrap; overflow-wrap: anywhere; }
/* A follow-up draft: the fixed words a person texts from their own phone. */
.draft { background: var(--tint-soft); border-left: 3px solid var(--signal); padding: var(--space-2) var(--space-3); border-radius: var(--radius); overflow-wrap: anywhere; }
/* The deals board: one column a stage, side by side on a wide screen, two on a tablet and stacked on a phone. A card is a list row with its form beneath. */
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); align-items: start; }
.board .column h2 { font-size: var(--text-base); margin: 0 0 var(--space-2); }
.board .list li { display: block; }
.board select { max-width: 100%; }
@media (max-width: 899px) { .board { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 599px) { .board { grid-template-columns: minmax(0, 1fr); } }
/* The menu: links under the brand that wrap onto another row when they do not fit, at every width, so none hides past the edge. */
.menu ul { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0; padding: 0; list-style: none; }
.menu a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); color: var(--on-shell-muted); text-decoration: none; white-space: nowrap; border-bottom: 3px solid transparent; font-weight: 600; font-size: var(--text-sm); }
.menu a:hover { color: var(--on-shell); }
.menu a[aria-current="page"] { color: var(--on-shell); border-bottom-color: var(--signal); }
.menu a:focus-visible { outline: 3px solid var(--signal); outline-offset: -3px; }
/* Lists read as rows on a card, not loose lines on the page. */
.list { list-style: none; margin: 0; padding: 0; background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.list li { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-2); padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.list li:first-child { border-top: 0; }
.list li:last-child { border-bottom: 0; }
.list.turns li { display: block; } /* a transcript reads as speech: who, then what they said, left to right */
/* Notices keep the orange edge; the tint follows the theme. */
.notice { background: var(--tint-soft); border-left: 4px solid var(--signal); border-radius: 0 var(--radius) var(--radius) 0; padding: var(--space-3) var(--space-4); margin: 0 0 var(--space-4); }
.error { color: var(--error); font-weight: 600; }
.ok { color: var(--success); font-weight: 600; }
form.stack { display: grid; gap: var(--space-4); max-width: 28rem; }
form.stack.review { max-width: none; } /* the import review's tables use the page's width */
/* Forms on the wide layout sit in a readable column, never stretched across 76rem (the review and the editor keep their own widths). */
.wide form.stack:not(.review) { max-width: 32rem; }
.wide .editor-panel form.stack { max-width: none; }
label { display: grid; gap: var(--space-2); font-weight: 600; font-size: var(--text-sm); }
input, select { font: inherit; font-weight: 400; min-height: 44px; padding: var(--space-2) var(--space-3); border: 1px solid var(--input-line); border-radius: var(--radius); background: var(--field); color: var(--ink); width: 100%; }
button { font: inherit; font-weight: 600; min-height: 44px; padding: var(--space-2) var(--space-6); border: 0; border-radius: var(--radius); background: var(--ink); color: var(--paper); cursor: pointer; transition: background var(--transition); }
button:hover { background: var(--signal-dark); }
button.link { background: none; color: var(--signal-text); padding: 0; min-height: 44px; text-decoration: underline; font-weight: 400; }
button.link:hover { background: none; color: var(--ink); }
button.quiet { background: var(--field); color: var(--ink); border: 1px solid var(--input-line); } /* a passkey button beside the page's main one */
button.quiet:hover { background: var(--paper-alt); }
.inline { display: inline; }
/* Sign in with Google: light, with Google's "G", as its branding asks; the email form follows an "or" line. */
a.google { display: inline-flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: var(--space-2) var(--space-6); border: 1px solid var(--input-line); border-radius: var(--radius); background: var(--field); color: var(--ink); font-weight: 600; text-decoration: none; transition: background var(--transition); }
a.google:hover { background: var(--paper-alt); }
a.google svg { flex: none; }
.or { color: var(--muted); margin: var(--space-6) 0 var(--space-2); }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.actions a { display: inline-flex; align-items: center; min-height: 44px; }
@media (min-width: 1024px) { .wide h1 { font-size: 2rem; } }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
/* The knowledge pages. */
textarea { font: inherit; font-weight: 400; padding: var(--space-2) var(--space-3); border: 1px solid var(--input-line); border-radius: var(--radius); background: var(--field); color: var(--ink); width: 100%; resize: vertical; }
textarea:focus-visible, input[type="checkbox"]:focus-visible { outline: 3px solid var(--signal); outline-offset: 2px; }
label.check { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; font-weight: 400; font-size: var(--text-base); }
label.check input { width: 24px; height: 24px; min-height: 0; margin: 0; flex: none; }
fieldset { display: grid; gap: var(--space-4); margin: 0; padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
legend { font-weight: 600; padding: 0 var(--space-2); overflow-wrap: anywhere; }
/* The facts list gets the same card as lists. */
.fields { display: grid; grid-template-columns: minmax(8rem, max-content) 1fr; gap: var(--space-2) var(--space-4); margin: 0; padding: var(--space-4); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.wide .fields { max-width: 48rem; }
.fields dt { font-weight: 600; font-size: var(--text-sm); }
.fields dd { margin: 0; overflow-wrap: anywhere; }
.scroll { overflow-x: auto; }
table.changes { border-collapse: collapse; width: 100%; font-size: var(--text-sm); }
table.changes th, table.changes td { text-align: left; vertical-align: top; padding: var(--space-2); border-bottom: 1px solid var(--line); overflow-wrap: break-word; }
table.changes th[scope="row"] { white-space: nowrap; } /* a word breaks only when it cannot fit alone; a table wider than the screen scrolls in .scroll */
.history { list-style: none; margin: 0; padding: 0; }
.history > li { padding: var(--space-4) 0; border-bottom: 1px solid var(--line); }
.history p { margin: 0 0 var(--space-2); }
ul.error { padding-left: var(--space-6); }
/* The client's brief: a question whose answer we have confirmed. */
.answer .label { font-weight: 600; font-size: var(--text-sm); margin: 0; }
input[type="file"] { min-height: 44px; padding: var(--space-2); } /* the touch-target floor, as for every other control */
/* A form below a form or a list of facts gets room above it, so a button never touches the next label or button. */
form + form, .fields + form { margin-top: var(--space-4); }
form.stack + form.stack { margin-top: var(--space-6); }
/* A client's own words, kept as they wrote them. */
.words { white-space: pre-wrap; overflow-wrap: anywhere; }
label.check input[type="radio"] { width: 24px; height: 24px; min-height: 0; margin: 0; flex: none; }
/* The style form's text and colour boxes: the portal's usual form width (form.stack, 28rem). */
form[data-style-form] input[type="text"], form[data-style-form] input[type="color"] { max-inline-size: 448px; }
/* The request forms' Record button (voice.js): a quieter button than the form's own, with its status line beside it. */
.voice { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.voice p { margin: 0; font-size: var(--text-sm); }
.voice button { background: var(--field); color: var(--ink); border: 1px solid var(--input-line); }
.voice button:hover { background: var(--paper-alt); }
.voice button[aria-disabled="true"] { cursor: progress; color: var(--muted); }
/* The design editor (pages/design-editor.ts, design-editor.js): the owner's preview in a frame, the choices beside it. The page
   uses the screen's width; the frame takes about two thirds. Phone and Computer set data-size on the frame. */
main.wrap:has(.editor) { max-width: 96rem; }
.editor { display: grid; grid-template-columns: minmax(0, 2fr) minmax(18rem, 1fr); gap: var(--space-6); align-items: start; }
.editor [hidden] { display: none; }
.editor-view { display: grid; gap: var(--space-3); min-width: 0; position: sticky; top: var(--space-4); }
.editor-frame { display: block; width: 100%; height: 75vh; min-height: 24rem; margin: 0 auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); }
.editor-frame[data-size="phone"] { width: 390px; max-width: 100%; }
.editor-sizes button, .editor-toggle { background: var(--field); color: var(--ink); border: 1px solid var(--input-line); }
.editor-sizes button:hover, .editor-toggle:hover { background: var(--paper-alt); }
.editor-sizes button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.editor-panel form.stack { max-width: none; }
.editor-panel input[type="color"] { padding: var(--space-2); }
.editor-panel label.check img { display: block; width: 96px; height: 64px; object-fit: cover; border-radius: var(--radius); background: var(--paper-alt); }
.editor-toggle { display: none; }
/* On a phone the preview fills the width and the choices are a sheet fixed to the bottom of the screen, once the script runs
   (it sets data-sheet): closed it is one button high; open it takes the bottom half, and the script brings the preview to the top of the screen above it. */
@media (max-width: 767px) {
  .editor { display: block; }
  .editor-view { position: static; }
  .editor-sizes { display: none; }
  .editor-frame, .editor-frame[data-size="phone"] { width: 100%; height: 70vh; }
  .editor-panel { margin-top: var(--space-6); }
  .editor:has(.editor-panel[data-sheet]) { padding-bottom: 5rem; }
  .editor:has(.editor-panel[data-sheet="open"]) { padding-bottom: 55vh; } /* room to scroll the preview up above the open sheet */
  .editor-panel[data-sheet] { position: fixed; inset: auto 0 0 0; z-index: 1; margin: 0; max-height: 50vh; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-3) var(--space-4); background: var(--paper); border-top: 1px solid var(--line); }
  .editor-panel[data-sheet] .editor-toggle { display: block; width: 100%; }
  .editor-panel[data-sheet="open"] .editor-toggle { position: sticky; top: 0; margin-bottom: var(--space-4); }
  .editor-panel[data-sheet="closed"] form { display: none; }
}
/* Dark theme: follows the device. The shell stays ink in both themes; the page turns to warm charcoal. */
@media (prefers-color-scheme: dark) {
  :root {
    --ink: #F3F1EA;
    --paper: #121210;
    --paper-alt: #1B1B18;
    --tint-soft: #22221E;
    --field: #1B1B18;
    --signal-text: #FF8A47;
    --signal-soft: #3A2416;
    --muted: #A3A3A3;
    --line: #2E2E29;
    --input-line: #6B6F66;
    --error: #FF7A7A;
    --error-soft: #3A1C1C;
    --success: #6CCB78;
    --success-text: #6CCB78;
    --ok-soft: #1C3320;
    --warn: #F2C14E;
    --warn-soft: #3A3016;
  }
  button { color: #0A0A0A; background: #F3F1EA; }
  button:hover { background: var(--signal); }
}

/* Shared pieces (ui.ts). */
.tag { display: inline-flex; align-items: center; min-height: 24px; padding: 0 var(--space-2); border-radius: 999px; font-size: var(--text-xs); font-weight: 600; white-space: nowrap; }
.tag-needs { background: var(--signal-soft); color: var(--signal-text); }
.tag-waiting { background: var(--paper-alt); color: var(--ink); }
.tag-ok { background: var(--ok-soft); color: var(--success-text); }
.tag-problem { background: var(--error-soft); color: var(--error); }
.tag-quiet { background: transparent; color: var(--muted); border: 1px solid var(--line); }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: var(--space-3); margin: 0 0 var(--space-6); }
.tile { padding: var(--space-4); border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); }
.tile p { margin: 0; }
.tile-label { font-size: var(--text-xs); font-weight: 600; color: var(--muted); }
.tile-value { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tile-note { font-size: var(--text-xs); color: var(--muted); }
.tile .tile-value { margin-top: var(--space-2); }
.tile .tile-note { margin-top: var(--space-1); }
.empty { padding: var(--space-6) var(--space-4); border: 1px dashed var(--input-line); border-radius: var(--radius); color: var(--muted); }
.empty p { margin: 0; }
.empty p + p { margin-top: var(--space-2); }
.flash { padding: var(--space-3) var(--space-4); border-radius: var(--radius); margin: 0 0 var(--space-4); }
.ok.flash { background: var(--ok-soft); color: var(--success-text); }
.error.flash { background: var(--error-soft); }

/* The operator's queue (pages/operator.ts): a docket, oldest first; orange edge = waits on us, ink edge = waits on the client. */
.queue { list-style: none; margin: 0 0 var(--space-6); padding: 0; display: grid; gap: var(--space-2); }
.queue li { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-4); background: var(--field); border: 1px solid var(--line); border-left-width: 4px; border-radius: var(--radius); }
.queue li.queue-needs { border-left-color: var(--signal); }
.queue li.queue-waiting { border-left-color: var(--ink); }
.queue a { display: grid; gap: var(--space-1); min-height: 44px; align-content: center; text-decoration: none; color: var(--ink); flex: 1; min-width: 0; }
.queue a:hover .queue-name { color: var(--signal-text); }
.queue-name { font-weight: 600; overflow-wrap: anywhere; }
.queue-what { font-size: var(--text-sm); color: var(--muted); }
.queue-age { font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
form.filters { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3); margin: 0 0 var(--space-4); }
form.filters label { flex: 1 1 14rem; }
details.new-account { margin-top: var(--space-8); }
details > summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--signal-text); }

/* An account's tabs (shell.ts accountTabs): the same underline as the menu, on paper. */
.tabs ul { display: flex; flex-wrap: wrap; gap: var(--space-1); margin: 0 0 var(--space-6); padding: 0; list-style: none; border-bottom: 1px solid var(--line); }
.tabs a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--space-3); color: var(--muted); text-decoration: none; font-weight: 600; font-size: var(--text-sm); white-space: nowrap; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--ink); }
.tabs a:focus-visible { outline: 3px solid var(--signal); outline-offset: -3px; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--signal); }

/* On a phone the menu takes more rows (every item shows, rather than hiding behind a sideways scroll nobody is told about). */
@media (max-width: 599px) {
  html { scroll-padding-top: 16rem; } /* the brand row and up to four rows of menu: 244px tall at 360px wide */
}
@media (max-width: 359px) {
  html { scroll-padding-top: 19rem; } /* five rows of menu: 292px tall at 320px wide */
}
@media (max-width: 479px) {
  header.bar .who { display: none; }
}
/* An alert paragraph is a panel like the message line, not a block of bold red. Text on --error-soft: 4.64:1 light, 6.10:1 dark. */
p.error[role="alert"], div.error[role="alert"] { background: var(--error-soft); padding: var(--space-3) var(--space-4); border-radius: var(--radius); font-weight: 400; }
/* An alert paragraph still empty (pay.js fills it later) shows nothing, but stays in the page so the fill is announced. */
p.error[role="alert"]:empty, div.error[role="alert"]:empty { padding: 0; background: none; }
/* The operator's People list: each person's forms take the full row under their name. */
ul.list.people > li > .actions { flex-basis: 100%; }

.checklist { list-style: none; margin: 0 0 var(--space-6); padding: 0; display: grid; gap: var(--space-2); counter-reset: step; }
.checklist li { counter-increment: step; display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-4); background: var(--field); border: 1px solid var(--line); border-radius: var(--radius); }
.checklist li:has(a) { padding: 0; }
.checklist li a { display: flex; align-items: center; gap: var(--space-3); min-height: 44px; padding: 0 var(--space-4); flex: 1; }
.checklist li:has(a)::before { margin-left: var(--space-4); }
.checklist li::before { content: counter(step); display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--input-line); font-size: var(--text-xs); font-weight: 600; flex: none; }
.checklist li.check-done { color: var(--muted); text-decoration: line-through; }
.checklist li.check-done::before { content: "✓"; background: var(--success); border-color: var(--success); color: var(--paper); }
