/*
 * Serv's one stylesheet. Direction A, "Conversation": Serv speaks in Newsreader, everything you
 * touch is Instrument Sans, one blue for what you can do next.
 *
 * Every colour, size, space, radius and timing is a token on :root (light) and is redefined for
 * dark mode. Components below use only the tokens. The same classes style the owner's pages, the
 * public forms, and the enquiry form inside a chat app (the chat connector's panel), so nothing
 * here assumes a whole page except the page shell (.shell, .top, .main).
 *
 * The in-chat form uses the parts between "panel: from here" and "panel: to here" and nothing
 * else: scripts/build-panel.mjs copies exactly those into the panel when it is built, so the two
 * never drift apart. Keep everything the public form needs inside them.
 */

/* panel: from here */
/* ---------- Fonts (self-hosted, see scripts/copy-browser.mjs) ---------- */
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url(/fonts/instrument-sans-latin-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url(/fonts/instrument-sans-latin-ext-wght-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/newsreader-latin-opsz-normal.woff2) format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Newsreader";
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url(/fonts/newsreader-latin-ext-opsz-normal.woff2) format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;

  /* Colour */
  --bg: #fbfbfc;
  --surface: #ffffff;
  --line: #e3e5ea;
  --line-strong: #cfd3db;
  --fg: #14161b;
  --muted: #585e6c;
  --accent: #2346d4;
  --accent-hover: #1b39b5;
  --accent-fg: #ffffff;
  --soft: #eceffc;
  --warn: #b0301c;
  --warn-soft: #fbece8;
  --ok: #1d7a4c;
  --ok-soft: #e6f4ec;
  --ring: #ccd5f8;
  --scrim: rgb(20 22 27 / 0.32);
  --shadow-prompt: 0 1px 2px rgb(20 22 27 / 0.04), 0 6px 20px -8px rgb(20 22 27 / 0.12);
  --shadow-pop: 0 12px 32px -8px rgb(20 22 27 / 0.25);

  /* Type */
  --font-ui: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-voice: "Newsreader", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --text-2xs: 0.6875rem;  /* 11px: tags */
  --text-xs: 0.8125rem;   /* 13px */
  --text-sm: 0.875rem;    /* 14px */
  --text-md: 0.9375rem;   /* 15px */
  --text-base: 1rem;      /* 16px: inputs never go below this, so phones don't zoom */
  --text-lg: 1.1875rem;   /* 19px: questions and Serv's shorter lines */
  --text-xl: 1.4375rem;   /* 23px: Serv's voice */
  --text-2xl: 2rem;       /* 32px: a public page's title */
  --text-call: 1.25rem;   /* the phone number in the urgent banner */
  --leading-tight: 1.15;
  --leading-voice: 1.28;
  --leading: 1.5;
  --weight-regular: 400;
  --weight-medium: 500;
  --weight-strong: 600;
  --tracking-tight: -0.01em;
  --tracking-caps: 0.04em;

  /* Space */
  --space-half: 0.125rem;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --gutter: 1.25rem;

  /* Size */
  --tap: 2.75rem;          /* 44px: the smallest thing you can press */
  --choice-height: 3rem;
  --icon: 1.25rem;
  --icon-sm: 0.9375rem;
  --avatar: 2.5rem;
  --avatar-sm: 1.5rem;
  --mark: 1.125rem;
  --control: 1.25rem;      /* radio and checkbox */
  --border: 1px;
  --focus-width: 2px;
  --ring-width: 3px;
  --measure: 40rem;        /* the thread */
  --measure-wide: 76rem;   /* the owner's inbox on a wide screen: list and open enquiry side by side */
  --split: 56rem;          /* from about 900px the inbox is two panes */
  --list-col: 24rem;
  --label-col: 12.5rem;    /* answers: question column on a wide screen */
  --pop-width: 17.5rem;
  --textarea: 6.5rem;
  --textarea-short: 4.5rem;
  --step: 2.25rem;
  --pair-min: 12rem;
  --mark-ring: 0.3125rem;
  --mark-hole: 0.5625rem;

  /* Radius */
  --radius-xs: 0.375rem;
  --radius-sm: 0.625rem;
  --radius-md: 0.875rem;
  --radius-lg: 1.125rem;
  --radius-xl: 1.5rem;
  --radius-pill: 999px;
  --radius-me: 1.125rem 1.125rem 0.25rem 1.125rem;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur-fast: 0.15s;
  --dur: 0.25s;
  --dur-arrive: 0.45s;
  --dur-spin: 1s;
  --stagger: 0.07s;
  --rise: 0.375rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1014;
    --surface: #171a21;
    --line: #272b35;
    --line-strong: #3a3f4c;
    --fg: #eceef3;
    --muted: #9ea4b2;
    --accent: #8da5ff;
    --accent-hover: #a9bbff;
    --accent-fg: #0b0d12;
    --soft: #1a2245;
    --warn: #ff9c86;
    --warn-soft: #361c16;
    --ok: #6fd3a0;
    --ok-soft: #12291e;
    --ring: #2b3a7a;
    --scrim: rgb(0 0 0 / 0.5);
    --shadow-prompt: 0 1px 2px rgb(0 0 0 / 0.3), 0 6px 20px -8px rgb(0 0 0 / 0.5);
    --shadow-pop: 0 12px 32px -8px rgb(0 0 0 / 0.6);
  }
}

/* ---------- 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(--fg);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
h1, h2, h3, p, dl, dd, figure { margin: 0; }
a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: var(--focus-width) solid var(--accent); outline-offset: var(--focus-width); }
[hidden] { display: none !important; }
code { font-family: var(--font-mono); font-size: var(--text-sm); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.i { width: var(--icon); height: var(--icon); fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* panel: to here */
/* ---------- Page shell ---------- */
.shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--tap);
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: calc(var(--space-4) + env(safe-area-inset-top, 0px)) var(--gutter) 0;
}
.top-start { display: flex; align-items: center; gap: var(--space-4); min-width: 0; }
.top-biz { font-weight: var(--weight-strong); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.top-end { display: flex; align-items: center; gap: var(--space-2); flex: none; }
.mark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: var(--weight-strong);
  letter-spacing: var(--tracking-tight);
  color: var(--fg);
  text-decoration: none;
  min-height: var(--tap);
  min-width: 0;
}
.mark::before {
  content: "";
  width: var(--mark);
  height: var(--mark);
  flex: none;
  border-radius: var(--radius-xs);
  background: var(--accent);
  box-shadow: inset 0 0 0 var(--mark-ring) var(--accent), inset 0 0 0 var(--mark-hole) var(--bg);
}
.mark-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mark-sub { color: var(--muted); font-weight: var(--weight-regular); }
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--space-6) var(--gutter) calc(var(--space-8) + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 56rem) {
  .shell--wide .top { max-width: none; padding-inline: var(--space-6); padding-bottom: var(--space-3); border-bottom: var(--border) solid var(--line); }
  .shell--wide .main { max-width: var(--measure-wide); padding-top: 0; padding-bottom: 0; }
}
.stack { display: grid; gap: var(--space-4); }
.stack--tight { gap: var(--space-2); }
.section-title { font-size: var(--text-md); font-weight: var(--weight-strong); }

/* ---------- Thread: Serv says, you say ---------- */
.thread { display: grid; gap: var(--space-5); align-content: start; }
.say { display: grid; gap: var(--space-3); min-width: 0; }
.thread > *, .say > *, .stack > * { min-width: 0; }
.voice { font-family: var(--font-voice); font-size: var(--text-xl); line-height: var(--leading-voice); letter-spacing: -0.005em; font-weight: var(--weight-regular); text-wrap: pretty; }
.voice--sm { font-size: var(--text-lg); }
/* panel: from here */
.aside { color: var(--muted); font-size: var(--text-md); }
/* panel: to here */
.me {
  justify-self: end;
  max-width: 85%;
  background: var(--soft);
  color: var(--fg);
  border-radius: var(--radius-me);
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-md);
  overflow-wrap: anywhere;
}
/* panel: from here */
.fine { font-size: var(--text-xs); color: var(--muted); }
.fine--end { text-align: right; }
.fine--warn { color: var(--warn); font-weight: var(--weight-medium); }
/* panel: to here */

/* ---------- Prompt box: one answer and a send arrow ---------- */
.prompt { display: grid; gap: var(--space-2); margin-top: auto; padding-top: var(--space-6); }
.prompt-label { font-size: var(--text-xs); color: var(--muted); font-weight: var(--weight-medium); padding-left: var(--space-2); }
.pbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: var(--radius-xl);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4);
  box-shadow: var(--shadow-prompt);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.pbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 var(--ring-width) var(--ring); }
.pbox[aria-invalid="true"], .pbox--error { border-color: var(--warn); }
.pbox-input {
  flex: 1;
  min-width: 0;
  min-height: var(--tap);
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-size: var(--text-base);
  padding: 0;
  outline: none;
}
.pbox-input::placeholder { color: var(--muted); opacity: 1; }
.send {
  width: var(--tap);
  height: var(--tap);
  flex: none;
  border-radius: 50%;
  border: 0;
  background: var(--accent);
  color: var(--accent-fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.send:hover { background: var(--accent-hover); }
.send:active { transform: scale(0.94); }
.prompt-foot { font-size: var(--text-sm); color: var(--muted); padding-left: var(--space-2); }
.prompt-foot .link { min-height: var(--tap); padding: 0; }
/* On a big screen a page that is only a question and its prompt sits in the middle, not at the bottom. */
@media (min-width: 64rem) and (min-height: 40rem) {
  .main:has(> .prompt) { justify-content: center; }
  .main:has(> .prompt) .prompt { margin-top: 0; }
}

/* panel: from here */
/* ---------- Field ---------- */
.field { display: grid; gap: var(--space-2); min-width: 0; }
.label, .choices legend { font-family: var(--font-voice); font-weight: var(--weight-medium); font-size: var(--text-lg); line-height: 1.3; padding: 0; }
.field--plain .label, .choices--plain legend { font-family: var(--font-ui); font-size: var(--text-md); font-weight: var(--weight-strong); }
.hint { display: block; font-family: var(--font-ui); font-size: var(--text-sm); font-weight: var(--weight-regular); color: var(--muted); }
.error-text { display: block; font-size: var(--text-sm); color: var(--warn); font-weight: var(--weight-medium); }
/* In the in-chat form: an answer the assistant filled in, for the person to check. */
.filled { color: var(--accent); font-weight: var(--weight-medium); }
.input {
  width: 100%;
  min-height: var(--tap);
  margin: 0;
  font: inherit;
  font-size: var(--text-base);
  color: inherit;
  background: var(--surface);
  border: var(--border) solid var(--line);
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-4);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.input:hover { border-color: var(--line-strong); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 var(--ring-width) var(--ring); }
.input[aria-invalid="true"] { border-color: var(--warn); }
.input[readonly] { background: var(--bg); }
.input:disabled { opacity: 0.6; }
textarea.input { min-height: var(--textarea); resize: vertical; padding-block: var(--space-3); line-height: var(--leading); }
textarea.input--short { min-height: var(--textarea-short); }
select.input { appearance: auto; padding-inline-end: var(--space-2); }
input[type="date"].input { appearance: auto; }

/* ---------- Choices: pick one, pick any ---------- */
.choices { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: var(--space-2); }
.choices legend { margin-bottom: var(--space-2); }
.choices legend .hint { margin-top: var(--space-1); }
.choice, .check {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--choice-height);
  padding: var(--space-2) var(--space-4);
  border: var(--border) solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  cursor: pointer;
  font-weight: var(--weight-regular);
  transition: border-color var(--dur-fast), background-color var(--dur-fast);
}
.choice:hover, .check:hover { border-color: var(--line-strong); }
.choice:has(input:checked), .check:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.choice:has(input:focus-visible), .check:has(input:focus-visible) { box-shadow: 0 0 0 var(--ring-width) var(--ring); border-color: var(--accent); }
.choice:has(input:disabled), .check:has(input:disabled) { cursor: default; opacity: 0.65; }
.choice input, .check input { width: var(--control); height: var(--control); margin: 0; flex: none; accent-color: var(--accent); cursor: inherit; }
.choice input:focus-visible, .check input:focus-visible { outline: none; }
.check-text { display: grid; gap: var(--space-1); }
.check:has(.hint) { align-items: flex-start; padding-block: var(--space-3); }
.check:has(.hint) input { margin-top: var(--space-half); }

/* ---------- Buttons and reply-style actions ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-5);
  border: var(--border) solid transparent;
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: var(--text-md);
  font-weight: var(--weight-strong);
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  color: inherit;
  background: none;
  cursor: pointer;
  transition: background-color var(--dur-fast), border-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: var(--accent-fg); }
.btn--primary:hover { background: var(--accent-hover); color: var(--accent-fg); }
.btn--quiet { background: var(--surface); border-color: var(--line); color: var(--fg); font-weight: var(--weight-medium); }
.btn--quiet:hover { border-color: var(--line-strong); color: var(--fg); }
.btn--danger { background: var(--surface); border-color: var(--line); color: var(--warn); font-weight: var(--weight-medium); }
.btn--danger:hover { border-color: var(--warn); color: var(--warn); }
.btn--block { width: 100%; }
.btn--sm { min-height: var(--tap); padding: 0 var(--space-4); font-size: var(--text-sm); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn .i { width: var(--icon-sm); height: var(--icon-sm); stroke-width: 2; }
.wide-only { display: none; }
@media (min-width: 40rem) { .wide-only { display: inline-flex; } }
.link {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap);
  padding: 0;
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
.link:hover { color: var(--accent-hover); }
.link--muted { color: var(--muted); }
.link--danger { color: var(--warn); }
.link--inline { display: inline; min-height: 0; padding: 0; }
.replies { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; }
.replies--start { justify-content: flex-start; }
.replies form { display: contents; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.actions form { display: contents; }

/* ---------- Card, facts, banner, tag ---------- */
.card { display: grid; gap: var(--space-3); align-content: start; background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-lg); padding: var(--space-4); min-width: 0; }
.card--flush { padding: 0; overflow: hidden; }
.card--item { padding: var(--space-3) var(--space-4); gap: var(--space-1); border-radius: var(--radius-lg); }
.card--item .fine { margin-top: var(--space-1); }
.card-title { font-size: var(--text-base); font-weight: var(--weight-strong); display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.card-text { font-size: var(--text-sm); color: var(--muted); }
a.card { display: grid; color: inherit; text-decoration: none; transition: border-color var(--dur-fast), background-color var(--dur-fast); }
a.card:hover { border-color: var(--accent); color: inherit; }
.card--link { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--space-1) var(--space-3); }
.card--link .i { color: var(--muted); grid-row: span 2; }
.facts { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-2) var(--space-4); font-size: var(--text-md); }
.facts dt { color: var(--muted); }
.banner { display: flex; gap: var(--space-3); align-items: flex-start; border-radius: var(--radius-lg); padding: var(--space-4); font-size: var(--text-md); background: var(--soft); color: var(--fg); }
.banner > .i { margin-top: var(--space-half); color: var(--accent); }
.banner-body { display: grid; gap: var(--space-1); min-width: 0; overflow-wrap: anywhere; }
.banner-body > * { margin: 0; }
.banner--urgent, .banner--error { background: var(--warn-soft); }
.banner--urgent > .i, .banner--error > .i { color: var(--warn); }
.banner--ok { background: var(--ok-soft); }
.banner--ok > .i { color: var(--ok); }
.banner--plain { background: var(--surface); border: var(--border) solid var(--line); }
.banner--plain > .i { color: var(--muted); }
.banner-call { font-size: var(--text-call); font-weight: var(--weight-strong); letter-spacing: 0.01em; color: var(--fg); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--tap); }
.banner-call:hover { color: var(--fg); text-decoration: underline; }
.tag {
  display: inline-flex;
  align-items: center;
  font-size: var(--text-2xs);
  font-weight: var(--weight-strong);
  letter-spacing: var(--tracking-caps);
  text-transform: uppercase;
  line-height: 1.6;
  border-radius: var(--radius-pill);
  padding: 0 var(--space-2);
  white-space: nowrap;
  background: var(--soft);
  color: var(--accent);
}
.tag--urgent { background: var(--warn-soft); color: var(--warn); }
.tag--done { background: var(--ok-soft); color: var(--ok); }
.tag--muted { background: var(--bg); color: var(--muted); box-shadow: inset 0 0 0 var(--border) var(--line); }

/* panel: to here */
/* ---------- Reading your website ---------- */
.steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-1); }
.step { display: flex; gap: var(--space-3); align-items: center; min-height: var(--step); font-size: var(--text-base); }
.step-ico { width: var(--avatar-sm); height: var(--avatar-sm); border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--soft); color: var(--accent); }
.step-ico .i { width: var(--icon-sm); height: var(--icon-sm); stroke-width: 2.4; }
.step-detail { color: var(--muted); }
.step--now { font-weight: var(--weight-strong); }
.step--now .step-ico { background: none; border: var(--focus-width) solid var(--line); border-top-color: var(--accent); animation: spin var(--dur-spin) linear infinite; }
.step--now .step-ico .i { display: none; }
.step--miss .step-ico { background: var(--bg); color: var(--muted); box-shadow: inset 0 0 0 var(--border) var(--line); }
.step--todo { color: var(--muted); }
.step--todo .step-ico { background: none; border: var(--focus-width) dashed var(--line); }
.step--todo .step-ico .i { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Inbox ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: var(--space-1); }
.tab {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: var(--text-md);
  font-weight: var(--weight-medium);
  text-decoration: none;
}
.tab:hover { color: var(--fg); background: var(--soft); }
.tab[aria-current="page"] { background: var(--surface); color: var(--fg); box-shadow: inset 0 0 0 var(--border) var(--line); }
.tab-count { font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; }
.list { list-style: none; margin: 0; padding: 0; display: grid; }
.list > li { border-top: var(--border) solid var(--line); }
.list > li:last-child { border-bottom: var(--border) solid var(--line); }
.row-link {
  display: grid;
  grid-template-columns: var(--avatar) minmax(0, 1fr) auto;
  gap: var(--space-1) var(--space-3);
  align-items: start;
  padding: var(--space-3) var(--space-2);
  border-radius: var(--radius-md);
  min-height: var(--tap);
  color: inherit;
  text-decoration: none;
  transition: background-color var(--dur-fast);
}
.row-link:hover { background: var(--soft); color: inherit; }
.row--open .row-link { background: var(--soft); }
.av {
  grid-row: span 2;
  width: var(--avatar);
  height: var(--avatar);
  border-radius: 50%;
  background: var(--soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-weight: var(--weight-strong);
  font-size: var(--text-sm);
}
.row--open .av, .row-link:hover .av { background: var(--surface); }
.row--done .av { background: var(--bg); color: var(--muted); box-shadow: inset 0 0 0 var(--border) var(--line); }
.row--done .who-name { color: var(--muted); }
.who { font-weight: var(--weight-strong); display: flex; gap: var(--space-2); align-items: center; min-width: 0; flex-wrap: wrap; }
.who-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.when { font-size: var(--text-xs); color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: var(--space-half); }
.what { grid-column: 2 / span 2; font-size: var(--text-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.what b { color: var(--fg); font-weight: var(--weight-medium); }
.row-body { display: grid; gap: var(--space-4); padding: var(--space-3) 0 var(--space-5); }
.list > li.row { border-top-color: var(--line); }
.list > li.row--open + li, .list > li.row--open { border-top-color: transparent; }
/* Two panes from about 900px: the list on the left, the open enquiry on the right (as in direction A). */
.split { display: grid; gap: var(--space-6); }
.pane { display: none; }
@media (min-width: 56rem) {
  .split { grid-template-columns: var(--list-col) minmax(0, 1fr); gap: 0; flex: 1; }
  .split-list { padding: var(--space-6) var(--space-5) var(--space-8) 0; border-right: var(--border) solid var(--line); min-width: 0; display: grid; gap: var(--space-5); align-content: start; }
  .pane { display: grid; gap: var(--space-5); align-content: start; padding: var(--space-8) 0 var(--space-8) var(--space-10); min-width: 0; }
  .row-body { display: none; }
  .split .tabs { gap: 0; }
}
.pane-head { display: grid; gap: var(--space-1); }
.pane-head .section-title { font-size: var(--text-lg); display: flex; gap: var(--space-2); align-items: center; flex-wrap: wrap; }
.push-end { margin-left: auto; }
.link--danger.push-end { padding-inline: var(--space-2); }
.row-meta { font-size: var(--text-xs); color: var(--muted); }
.row-meta--warn { color: var(--warn); font-weight: var(--weight-medium); }
.answers { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-1) var(--space-5); font-size: var(--text-md); }
.answers dt { color: var(--muted); font-size: var(--text-sm); }
.answers dd { margin-bottom: var(--space-3); white-space: pre-wrap; overflow-wrap: anywhere; }
.answers dd:last-child { margin-bottom: 0; }
@media (min-width: 40rem) {
  .answers { grid-template-columns: var(--label-col) minmax(0, 1fr); gap: var(--space-3) var(--space-5); }
  .answers dt { font-size: var(--text-md); }
  .answers dd { margin-bottom: 0; }
}
.item { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; }
.item-text { display: grid; gap: var(--space-half); min-width: 0; }
.pager { display: flex; gap: var(--space-2); justify-content: space-between; }

/* ---------- Your link, and code to copy ---------- */
.linkbox { display: flex; align-items: center; gap: var(--space-2); background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-xl); padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4); min-width: 0; }
.linkbox .pbox-input { font-size: var(--text-md); text-overflow: ellipsis; }
.codebox { display: grid; gap: var(--space-2); }
.code {
  display: block;
  margin: 0;
  padding: var(--space-3) var(--space-4);
  background: var(--bg);
  border: var(--border) solid var(--line);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  white-space: pre;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.code code { user-select: all; font-size: inherit; }

/* ---------- Menu (Popover API; /menu without it) ---------- */
.menu-btn {
  width: var(--tap);
  height: var(--tap);
  flex: none;
  border-radius: 50%;
  border: var(--border) solid var(--line);
  background: var(--surface);
  color: var(--fg);
  display: grid;
  place-items: center;
  cursor: pointer;
  padding: 0;
}
.menu-btn:hover { border-color: var(--line-strong); color: var(--fg); }
.menu-btn--popover { display: none; }
@supports selector(:popover-open) {
  .menu-btn--popover { display: grid; }
  .menu-btn--page { display: none; }
}
.menu-pop {
  position: fixed;
  inset: auto;
  top: calc(var(--space-4) + var(--tap) + var(--space-2) + env(safe-area-inset-top, 0px));
  right: max(var(--gutter), env(safe-area-inset-right, 0px));
  margin: 0;
  width: min(var(--pop-width), calc(100vw - 2 * var(--gutter)));
  padding: var(--space-2);
  background: var(--surface);
  color: var(--fg);
  border: var(--border) solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
}
.menu-pop:popover-open { display: grid; }
.menu-list { list-style: none; margin: 0; padding: 0; display: grid; }
.menu-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: var(--tap);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: var(--text-md);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--soft); color: var(--fg); }
.menu-item .i { color: var(--muted); width: var(--icon-sm); height: var(--icon-sm); }
.menu-item--danger { color: var(--warn); }
.menu-item--danger:hover { color: var(--warn); }
.menu-sep { height: var(--border); background: var(--line); margin: var(--space-2) var(--space-3); }
.menu-list form { margin: 0; }
.card .menu-list { margin: calc(var(--space-2) * -1); }

/* panel: from here */
/* ---------- Public pages ---------- */
.pubhead { display: grid; gap: var(--space-2); }
.crumb { display: flex; gap: var(--space-2); align-items: center; font-size: var(--text-sm); color: var(--muted); min-height: var(--tap); text-decoration: none; justify-self: start; }
a.crumb:hover { color: var(--fg); }
.crumb-av { width: var(--avatar-sm); height: var(--avatar-sm); border-radius: var(--radius-xs); background: var(--fg); color: var(--bg); display: grid; place-items: center; font-size: var(--text-2xs); font-weight: var(--weight-strong); flex: none; }
.title { font-family: var(--font-voice); font-weight: var(--weight-medium); font-size: var(--text-2xl); line-height: var(--leading-tight); letter-spacing: var(--tracking-tight); text-wrap: balance; }
.lead { font-size: var(--text-md); color: var(--muted); }
.form { display: grid; gap: var(--space-6); }
.form-part { display: grid; gap: var(--space-5); }
.form-part-title { font-family: var(--font-ui); font-size: var(--text-xs); font-weight: var(--weight-strong); letter-spacing: var(--tracking-caps); text-transform: uppercase; color: var(--muted); padding-top: var(--space-2); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.footnote { display: grid; gap: var(--space-1); padding-top: var(--space-4); margin-top: auto; font-size: var(--text-xs); color: var(--muted); }

/* panel: to here */
/* ---------- The editor ---------- */
.fold { background: var(--surface); border: var(--border) solid var(--line); border-radius: var(--radius-lg); }
.fold > summary {
  list-style: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: calc(var(--tap) + var(--space-3));
  padding: var(--space-3) var(--space-4);
  font-weight: var(--weight-strong);
  cursor: pointer;
  border-radius: var(--radius-lg);
}
.fold > summary::-webkit-details-marker { display: none; }
.fold-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-1) var(--space-2); min-width: 0; }
.fold > summary::after { content: ""; width: var(--space-2); height: var(--space-2); border-right: var(--focus-width) solid var(--muted); border-bottom: var(--focus-width) solid var(--muted); transform: rotate(45deg); transition: transform var(--dur) var(--ease); }
.fold[open] > summary::after { transform: rotate(-135deg); }
.fold-sub { font-weight: var(--weight-regular); font-size: var(--text-sm); color: var(--muted); }
.fold-body { display: grid; gap: var(--space-5); padding: var(--space-1) var(--space-4) var(--space-5); }
.fold .fold { background: var(--bg); border-radius: var(--radius-md); }
.fold .fold > summary { font-weight: var(--weight-medium); border-radius: var(--radius-md); }
.pair { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--pair-min)), 1fr)); align-items: end; }
.bar {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
  margin: 0 calc(var(--gutter) * -1);
  padding: var(--space-3) var(--gutter) calc(var(--space-3) + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  border-top: var(--border) solid var(--line);
}

/* ---------- Motion ---------- */
/* The cross-fade between pages lives in /motion.css, switched on by /motion.js (owner pages only). */
@media (prefers-reduced-motion: no-preference) {
  .motion .thread > *, .motion .arrive { animation: arrive var(--dur-arrive) var(--ease) both; }
  .motion .thread > :nth-child(2) { animation-delay: calc(var(--stagger) * 1); }
  .motion .thread > :nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
  .motion .thread > :nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
  .motion .thread > :nth-child(5) { animation-delay: calc(var(--stagger) * 4); }
  .motion .thread > :nth-child(n + 6) { animation-delay: calc(var(--stagger) * 5); }
  .menu-pop:popover-open { animation: arrive var(--dur-fast) var(--ease) both; }
}
@keyframes arrive { from { opacity: 0; transform: translateY(var(--rise)); } to { opacity: 1; transform: none; } }
/* panel: from here */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
/* panel: to here */
