/*
 * The caller's pages (/s and /start on link.). Loaded after /brand/base.css, which brings the
 * shared tokens, the select caret, the mark's styles and the caller seal from packages/tokens
 * (W-084). Every color here is a token. The dark theme maps the same variables onto the dark scheme's
 * values in packages/tokens/dark.css (W-087, made official in W-078; docs/BRAND.md → Dark theme).
 */
:root {
  --bg: var(--color-surface-muted);
  --surface: var(--color-surface);
  --surface-muted: var(--color-surface-muted);
  --text: var(--color-text);
  --muted: var(--color-text-muted);
  --border: var(--color-border);
  --field-border: var(--color-border-field); /* an input's edge, darker than --border (WCAG 1.4.11) */
  --accent: var(--color-primary);
  --accent-hover: var(--color-primary-hover);
  --accent-text: var(--color-on-primary);
  --accent-soft: var(--color-primary-soft);
  --accent-halo: var(--color-primary-halo);
  --flash: var(--color-primary-soft); /* a field the agent just changed: a mint flash (W-087) */
  --danger: var(--color-danger);
  --focus: var(--color-focus);
  --radius: 10px;
  --control-pad-x: 0.7rem; /* the inputs' horizontal padding, for the shared select caret */
  --attribution: var(--color-attribution); /* "Google Maps" under Google's suggestions (W-102) */
  --tag-bg: var(--color-surface-hover); /* the neutral tag on Sam's side of the demo (W-110) */
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--color-dark-page);
    --surface: var(--color-dark-surface);
    --surface-muted: var(--color-dark-surface-muted);
    --text: var(--color-dark-text);
    --muted: var(--color-dark-text-muted);
    --border: var(--color-dark-border);
    --field-border: var(--color-dark-border-field);
    --accent: var(--color-dark-primary);
    --accent-hover: var(--color-dark-primary-hover);
    --accent-text: var(--color-dark-on-primary);
    --accent-soft: var(--color-dark-primary-soft);
    --accent-halo: var(--color-dark-primary-halo);
    --flash: var(--color-dark-primary-soft);
    --danger: var(--color-dark-danger);
    /* The seal on dark: the same pill, mint text on a deep pine wash. */
    --seal-bg: var(--color-dark-primary-soft);
    --seal-text: var(--color-dark-on-primary-soft);
    --control-caret: var(--control-caret-dark);
    --attribution: var(--color-dark-attribution);
    --tag-bg: var(--color-dark-surface-muted); /* muted text on it: 6.5:1 (W-134) */
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font-sans);
}

main {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
}

/* The header (W-091): the business's name gets the full width on its own row; the seal (or the
   lockup) and the connection pill share the row under it, and wrap as whole pills when they don't fit. */
header.brand {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
}

.logo {
  font-size: 1.15rem;
}

/* Co-branding (W-044, W-087): the business's name leads, with TrustFill's seal under it. */
.biz-name {
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.secured {
  display: inline-flex;
  white-space: nowrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.secured .tf-mark {
  width: 14px;
  height: 14px;
}
/* A verified business (W-047): the seal opens its phone and website, as plain text. */
button.tf-seal {
  cursor: pointer;
}
button.tf-seal:hover:not(:disabled) {
  background: var(--seal-bg, var(--color-primary-soft));
}
.seal-more {
  font-size: 0.7em;
  transition: transform 0.15s;
}
.tf-seal[aria-expanded="true"] .seal-more {
  transform: rotate(180deg);
}
.verified-details {
  font-size: 0.8rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.pill {
  font-size: 0.8rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.pill.on {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

h1 {
  font-size: 1.35rem;
  margin: 0 0 0.25rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}
h2 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}
p {
  margin: 0 0 0.75rem;
}
.muted {
  color: var(--muted);
  font-size: 0.92rem;
}
.error {
  color: var(--danger);
  font-size: 0.92rem;
  min-height: 1.4em;
  margin: 0.5rem 0 0;
}

label {
  display: block;
  font-weight: 600;
  font-size: 0.92rem;
  margin-bottom: 0.3rem;
}
.field {
  margin-bottom: 0.9rem;
}

input,
select,
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background-color: var(--surface); /* not the shorthand, which would remove the select's caret */
  border: 1px solid var(--field-border);
  border-radius: 8px;
  /* A select's right padding is the shared caret rule's (packages/tokens/controls.css). */
  padding-block: 0.6rem;
  padding-left: var(--control-pad-x);
}
input,
textarea {
  padding-right: var(--control-pad-x);
}
/* Pine focus on fields (the brief: marigold stays the operator's). Keyboard focus elsewhere is the blue ring. */
input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 0 4px var(--accent-halo);
}
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
input[type="checkbox"]:focus,
input[type="radio"]:focus {
  box-shadow: none;
}
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
input:disabled,
select:disabled,
textarea:disabled {
  opacity: 0.75;
}

/* A value the agent typed (W-087): a quiet grey field and a "From your agent" tag to check. */
.by-agent input:not([type="checkbox"]):not([type="radio"]),
.by-agent select,
.by-agent textarea,
.by-agent .choice {
  background-color: var(--surface-muted);
}
.label-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.label-row > label,
.label-row > legend {
  min-width: 0;
}
.from-agent {
  flex: none;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 0.45rem;
  white-space: nowrap;
}

/* The agent just changed it: mint, fading out. */
input,
select,
textarea,
.choice {
  transition: background-color 0.6s;
}
.flash,
.choice.flash {
  background-color: var(--flash);
  transition: none;
}
@media (prefers-reduced-motion: reduce) {
  input,
  select,
  textarea,
  .choice {
    transition: none;
  }
}

.row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.row > * {
  flex: 1 1 8rem;
}

button {
  font: inherit;
  font-weight: 600;
  min-height: 44px;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button.secondary {
  background: transparent;
  color: var(--accent);
  border-color: var(--field-border);
}
button.secondary:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
/* Delete and start fresh (W-160): an action that can't be undone, styled like the side panel's
   destructive "Yes, end it" (a danger wash, danger text), never pine. */
button.danger {
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  border-color: transparent;
  color: var(--danger);
}
button.danger:hover:not(:disabled) {
  background: color-mix(in srgb, var(--danger) 20%, transparent);
  border-color: transparent;
}
@media (prefers-color-scheme: dark) {
  button.danger {
    background: color-mix(in srgb, var(--danger) 20%, transparent);
  }
  button.danger:hover:not(:disabled) {
    background: color-mix(in srgb, var(--danger) 30%, transparent);
  }
}
/* "Forgot your PIN? Start fresh" (W-160), right under the PIN field. */
.forgot-pin {
  margin: 0.4rem 0 0;
  font-size: 0.92rem;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button.block {
  width: 100%;
}

[hidden] {
  display: none !important;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Template fields (W-022): help text, required tags, pick-several and yes/no groups. */
.help {
  color: var(--muted);
  font-size: 0.85rem;
  margin: -0.15rem 0 0.35rem;
}
.req {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0 0.45rem;
  margin-left: 0.4rem;
  vertical-align: 0.1em;
}
fieldset.field {
  border: 0;
  padding: 0;
  margin: 0 0 0.9rem;
  min-width: 0;
}
fieldset.field legend {
  font-weight: 600;
  font-size: 0.92rem;
  padding: 0;
  margin-bottom: 0.3rem;
}
fieldset.field {
  position: relative;
}
fieldset.field > .from-agent {
  position: absolute;
  top: 0.1rem;
  right: 0;
}
.choices {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.choices.inline {
  flex-direction: row;
  gap: 0.5rem;
}
.choice {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 500;
  margin: 0;
  padding: 0.5rem 0.7rem;
  min-height: 44px;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background-color: var(--surface);
}
.choices.inline .choice {
  flex: 1 1 0;
}
.choice input {
  width: auto;
  margin: 0;
  accent-color: var(--accent);
}
.choice:has(input:checked) {
  border-color: var(--accent);
  background-color: var(--accent-soft);
}
.choice:has(input:disabled) {
  opacity: 0.75;
}

/*
 * Per-field confirm (W-094, docs/BRAND.md → Caller pages). A contact answer has a round check
 * inside its right edge: a 44px tap target round a 32px circle. Pressed, it's pine and the
 * answer locks, read-only with a pine edge. The text keeps clear of the check.
 */
.check-wrap {
  position: relative;
}
.check-wrap input,
.check-wrap textarea {
  padding-right: calc(44px + 0.25rem);
}
.check-wrap select {
  padding-right: calc(var(--control-pad-x) + 1.5rem + 44px);
  background-position: right calc(var(--control-pad-x) + 44px) center;
}
button.confirm-check {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
}
.check-wrap:has(textarea) button.confirm-check {
  top: 0;
  transform: none;
}
button.confirm-check::before {
  content: "";
  grid-area: 1 / 1;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--field-border);
  background: var(--surface);
  box-sizing: border-box;
}
button.confirm-check svg {
  grid-area: 1 / 1;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  position: relative;
}
button.confirm-check:hover:not(:disabled) {
  background: transparent;
}
button.confirm-check:hover:not(:disabled)::before {
  border-color: var(--accent);
}
button.confirm-check:hover:not(:disabled) svg {
  stroke: var(--accent);
}
button.confirm-check[aria-pressed="true"]::before {
  background: var(--accent);
  border-color: var(--accent);
}
button.confirm-check[aria-pressed="true"] svg,
button.confirm-check[aria-pressed="true"]:hover svg {
  stroke: var(--accent-text);
}
button.confirm-check:disabled {
  opacity: 0.4;
}
button.confirm-check:focus-visible {
  outline-offset: -4px;
}
.field.confirmed input,
.field.confirmed select,
.field.confirmed textarea,
.field.confirmed.by-agent input:not([type="checkbox"]):not([type="radio"]) {
  border-color: var(--accent);
  background-color: var(--surface);
  opacity: 1;
  cursor: default;
}
/* A tap on a locked answer shouldn't look like it can be typed in. */
.field.confirmed input:focus,
.field.confirmed textarea:focus {
  box-shadow: 0 0 0 1px var(--accent);
}
.confirm-note p {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0.3rem 0 0;
}
.confirm-note p.confirm-ask {
  color: var(--text);
  background: var(--surface-muted);
  border-radius: 6px;
  padding: 0 0.6rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 0.5rem;
}
/* A button that reads as a link, still 44px tall to tap. */
button.link-button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
button.link-button:hover:not(:disabled) {
  background: transparent;
  color: var(--accent-hover);
}
.confirm-all {
  margin-top: 0.25rem;
}

/*
 * Address suggestions (W-102): a list under the street address field while the caller types, and
 * a quiet "Did you mean …?" under it after they leave it. Both carry "Google Maps" in one of the
 * colors Google allows, at 12px or more, never translated or hidden.
 */
.addr-wrap {
  position: relative;
}
.addr-list {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 4px);
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--field-border);
  border-radius: 8px;
  box-shadow: var(--shadow-popover);
  overflow: hidden;
}
.addr-list ul {
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
}
.addr-list li {
  padding: 0.7rem var(--control-pad-x);
  min-height: 44px;
  cursor: pointer;
  line-height: 1.35;
}
.addr-list li:hover,
.addr-list li[aria-selected="true"] {
  background: var(--accent-soft);
}
.gmaps {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--attribution);
  white-space: nowrap;
}
.addr-list .gmaps {
  margin: 0;
  padding: 0.35rem var(--control-pad-x);
  border-top: 1px solid var(--border);
}
.addr-hint {
  margin-top: 0.4rem;
  padding: 0.5rem 0.7rem;
  background: var(--surface-muted);
  border-radius: 8px;
}
.addr-hint p {
  margin: 0;
  font-size: 0.92rem;
}
.addr-hint-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  column-gap: 1rem;
  margin-top: 0.35rem;
}
.addr-hint .gmaps {
  margin-left: 0.15em;
}

/* A required field still empty when the agent tried to finish. */
.field.missing input,
.field.missing select,
.field.missing textarea,
.field.missing .choice {
  border-color: var(--danger);
}
.missing-note {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 0.3rem 0 0;
}
.alert {
  border: 1px solid var(--danger);
  color: var(--danger);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  margin: 0 0 0.9rem;
  font-size: 0.92rem;
}

/* Choosing which saved details to fill or save. */
.picklist {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.picklist .choice {
  align-items: flex-start;
}
.picklist .what {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.picklist .value {
  display: block;
  overflow-wrap: anywhere;
}

/* After Mark complete (W-097): "All set" leads, with the mark; saving is a quiet, optional box
   inside the same card (the muted surface, no border of its own), so it never competes with it. */
.done > .tf-mark {
  display: block;
  width: 40px;
  height: 40px;
  margin-bottom: 0.6rem;
}
.done h1:focus {
  outline: none;
}
.done > .muted {
  margin-bottom: 1rem;
}
.save-box {
  background: var(--surface-muted);
  border-radius: 8px;
  padding: 0.9rem;
}
.save-box h2 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}
/* Each button keeps its words on one line; on a narrow phone the two stack instead. */
.save-box .row > button {
  flex-basis: auto;
  white-space: nowrap;
}
/*
 * Feedback after the form (W-158): the Single Ease Question's seven points in one row, labelled at
 * the ends only. Each point is 44px tall; on a 320px phone the box's side padding shrinks so each
 * stays over 24px wide (WCAG 2.5.8). A hidden radio inside each label, so the ring shows on the label.
 */
.save-box.feedback {
  margin-top: 1rem;
}
.feedback .fb-note {
  font-size: 0.85rem;
  margin-top: 0.4rem;
}
.feedback .fb-light {
  font-weight: 400;
}
.feedback fieldset.field + fieldset.field,
.feedback .fb-note + fieldset.field {
  margin-top: 0.9rem;
}
.ease-scale {
  display: flex;
  gap: 0.25rem;
}
.ease-scale .choice {
  flex: 1 1 0;
  min-width: 0;
  justify-content: center;
  padding: 0;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}
/* The picked score: pine with white text, so it's plain which one was chosen (owner, 2026-11-16). */
.ease-scale .choice:has(input:checked) {
  background-color: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
/* The reasons and the preference sit a little closer than the form's own choices (still 44px each), to keep the box short. */
.feedback .choices.tight {
  gap: 0.25rem;
}
/* The Privacy link, in the page's link color (as button.link-button), light and dark. */
.feedback .fb-note a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.feedback .fb-note a:hover {
  color: var(--accent-hover);
}
.ease-scale .choice:has(input:focus-visible) {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
.ease-ends {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.25rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.feedback .fb-status:empty {
  display: none;
}
@media (max-width: 359px) {
  .save-box.feedback {
    padding-inline: 0.5rem;
  }
  .ease-scale {
    gap: 0.2rem;
  }
}
.shared-title {
  margin-bottom: 0.9rem;
}

/* PINs are digits: tabular, and spaced so they're easy to check. */
input[inputmode="numeric"] {
  font-variant-numeric: tabular-nums;
}

/* The footer line on every caller page (W-087): what's true, in words. */
.caller-foot {
  margin: 1.5rem 0 0;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  text-wrap: balance;
}
.caller-foot .tf-mark {
  width: 14px;
  height: 14px;
  margin: -2px 0.35rem 0 0;
}

/* "I didn't expect this text" (W-152): quiet, under the footer line, and its question. */
.report-link {
  margin: 0;
  text-align: center;
}
.report-link button.link-button {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--muted);
}
.report-link button.link-button:hover:not(:disabled) {
  color: var(--text);
}
.card.report {
  margin-top: 1rem;
}
.card.report h2 {
  margin-top: 0;
}
.report-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

/* The code page (W-087): the mark, the heading, and the code as 3 + 3 boxes. */
.start-head {
  display: grid;
  justify-items: center;
  gap: 0.6rem;
  text-align: center;
  padding: 1.25rem 0 0.75rem;
}
.start-head .tf-mark {
  width: 48px;
  height: 48px;
}
.start-head p {
  max-width: 20rem;
  margin: 0;
}

/*
 * One real input (autocomplete="one-time-code", so SMS autofill and paste work) lies over six
 * boxes drawn from its value by start.js. Without the script it's a plain, visible input.
 */
.code-field {
  position: relative;
  margin: 0.5rem 0 1rem;
}
/* Turnstile's box (W-177): no room at all until Cloudflare asks for a click. */
.turnstile.shown {
  display: flex;
  justify-content: center;
  margin: 0 0 1rem;
  min-height: 65px;
}
.code-input {
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.code-boxes {
  display: none;
}
.code-field.boxed .code-boxes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  pointer-events: none;
}
.code-boxes span {
  width: 2.75rem;
  height: 3.4rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--field-border);
  border-radius: 9px;
  background: var(--surface);
  font: 600 1.5rem/1 var(--font-mono);
  font-variant-numeric: tabular-nums;
}
.code-boxes i {
  width: 0.6rem;
  height: 2px;
  background: var(--field-border);
  display: block;
}
/* The input covers the boxes and takes every tap, paste and autofill; only its text is hidden. */
.code-field.boxed .code-input {
  position: absolute;
  inset: 0;
  height: 100%;
  color: transparent;
  caret-color: transparent;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  outline: none;
  letter-spacing: 0;
}
.code-field.boxed .code-input::selection {
  background: transparent;
}
/* The box the next digit goes in, while the input has focus. */
.code-field.boxed:has(.code-input:focus) .code-boxes span.next {
  border-color: var(--accent);
  box-shadow:
    0 0 0 1px var(--accent),
    0 0 0 4px var(--accent-halo);
}
@media (max-width: 360px) {
  .code-boxes span {
    width: 2.4rem;
    height: 3rem;
    font-size: 1.3rem;
  }
}

/*
 * The demo on link./demo (W-110; docs/ARCHITECTURE.md, Customer form → The demo). Wide: Sam's side
 * panel beside a phone with the live form in it, the size trustfill.com's stage frames. Narrow:
 * the form fills the screen with "Northside Plumbing sees" pinned to the bottom. Marigold only on
 * Sam's side, for Live and what the caller typed (docs/BRAND.md → Who typed it).
 */
main.demo-root {
  max-width: none;
  padding: 0;
}
.demo-hint {
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
  font-weight: 600;
  text-align: center;
}
.demo-wide {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 24rem);
  gap: 1.5rem;
  align-items: start;
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem;
}
.demo-phone-screen {
  height: 40rem;
  max-height: calc(100vh - 5rem);
  overflow: auto;
  padding: 1.25rem 1rem 1.5rem;
  border: 10px solid var(--color-ink);
  border-radius: 2rem;
  background: var(--bg);
}
.demo-sam {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.demo-sam-title {
  margin: 0;
  padding: 0.6rem 0.9rem;
  font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.demo-narrow {
  max-width: 34rem;
  margin: 0 auto;
  padding: 1rem 1rem 7rem; /* room for the bar */
}

.sam p {
  margin: 0;
}
.sam-live {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  color: var(--color-text-inverse);
  background: var(--color-ink);
}
.sam-live .tf-mark {
  width: 14px;
  height: 14px;
}
.live-dot {
  display: inline-block;
  flex: none;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--color-live);
}
.sam .sam-said {
  min-height: 1.5rem;
  margin: 0.6rem 0.9rem 0;
  font-size: 0.9rem;
}
.sam-progress {
  padding: 0.4rem 0.9rem 0;
  font-size: 0.8rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
/* W-168: the real panel's list (W-156, docs/BRAND.md → Who typed it), grouped by step (W-162):
   the question in muted text with its one label on the right, the answer as plain text under it. */
.sam-steps {
  display: grid;
  gap: 0.75rem;
  padding: 0.6rem 0.9rem 0.9rem;
}
.sam-step-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.sam-step-head h3 {
  margin: 0;
  font-size: 0.85rem;
}
.sam-step-count {
  font-weight: 400;
  color: var(--muted);
}
.sam-step-state {
  flex: none;
  font-size: 0.75rem;
  color: var(--muted);
}
.sam-step-state.open {
  font-weight: 600;
  color: var(--accent);
}
/* A step the caller can't see yet: its answers on the muted surface, as in the real list. */
.hidden-step .sam-fields {
  border-radius: 6px;
  background: var(--surface-muted);
}
.sam-fields {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0.5rem;
  display: grid;
  gap: 0.45rem;
}
.sam-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--muted);
}
.sam-value {
  margin-top: 0.1rem;
  font-size: 0.9rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--tag-bg);
}
.tag.caller {
  color: var(--color-on-live-soft);
  background: var(--color-live-soft);
}
.tag.caller .live-dot {
  width: 0.4rem;
  height: 0.4rem;
}
/* Confirmed: a pine check on the soft wash, as the real label (W-156). */
.tag.confirmed {
  padding-left: 0.15rem;
  color: var(--accent);
  background: var(--accent-soft);
}
.tag-check {
  position: relative;
  flex: none;
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 50%;
  background: var(--accent);
}
.tag-check::after {
  content: "";
  position: absolute;
  left: 36%;
  top: 20%;
  width: 22%;
  height: 42%;
  border: solid var(--accent-text);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}

.sees-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  gap: 0.15rem;
  width: 100%;
  padding: 0.6rem 1rem calc(0.6rem + env(safe-area-inset-bottom));
  border: 0;
  border-top: 1px solid var(--border);
  border-radius: 0;
  text-align: left;
  font: inherit;
  color: var(--color-text-inverse);
  background: var(--color-ink);
  cursor: pointer;
}
.sees-bar:hover:not(:disabled) {
  background: var(--color-ink);
}
.sees-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
}
.sees-latest {
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
.sees-what {
  font-weight: 600;
}
.sees-sheet {
  width: 100%;
  max-width: 34rem;
  max-height: 85vh;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  border-radius: 1rem 1rem 0 0;
  color: var(--text);
  background: var(--surface);
}
.sees-sheet::backdrop {
  background: rgb(0 0 0 / 0.4);
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0.9rem;
}
.sheet-head h2 {
  margin: 0;
  font-size: 1rem;
}
.save-off {
  font-weight: 600;
}
.sees-said {
  font-size: 0.85rem;
}
.sees-said:empty {
  display: none;
}

/* The code step (W-122): a quiet text button to step back, and the consent line under it. */
button.link {
  background: transparent;
  border-color: transparent;
  color: var(--accent);
  padding: 0.4rem 0;
  min-height: 44px;
  font-weight: 500;
}
button.link:hover:not(:disabled) {
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
}
.small {
  font-size: 0.82rem;
}
/* "Saved your details before? Use them" in the intro (W-122, option A2): a text link that's a
   button. The padding and matching negative margin give it a taller tap area without moving the line. */
button.inline-link {
  display: inline;
  min-height: 0;
  padding: 0.6rem 0.2rem;
  margin: -0.6rem -0.2rem;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}
button.inline-link:hover:not(:disabled) {
  background: none;
  text-decoration-thickness: 2px;
}
/* As in the save box: each button keeps its words on one line, and on a narrow phone they stack. */
.code-step .row > button {
  flex-basis: auto;
  white-space: nowrap;
}

/* W-162 (pick H): a quiet line about the call under the questions, on every template. A pine dot
   while the caller fills in; a pine check once everything shown is done. */
.call-line {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.4;
}
.call-mark {
  flex: none;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: 0.45rem;
  border-radius: 50%;
  background: var(--accent);
}
.call-line.done .call-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: 0.1rem;
}
/* The check is a mask filled with the on-pine color, so it reads in both themes. */
.call-line.done .call-mark::after {
  content: "";
  width: 0.7rem;
  height: 0.7rem;
  background: var(--accent-text);
  mask: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
}
/* Questions staff just showed (W-162) fade and rise in once. */
.field.arrived {
  animation: arrive 0.35s ease-out;
}
@keyframes arrive {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .field.arrived {
    animation: none;
  }
}
