/* Every value comes from tokens.css. Motion rules: transform/opacity only, custom curves,
   press feedback on everything pressable, hover gated to real pointers, reduced motion kept
   gentle (opacity) rather than removed. */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-width);
}

[hidden] {
  display: none !important;
}

/* Read by screen readers, not shown. */
.visually-hidden {
  position: absolute;
  width: var(--border-width);
  height: var(--border-width);
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Header ─────────────────────────────────────────────────────── */

.topbar {
  width: 100%;
  padding: var(--space-3) var(--space-6) 0;
  display: flex;
  align-items: center;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-logo);
  font-weight: var(--font-weight-semibold);
  letter-spacing: var(--tracking-tight);
}

.wordmark svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

/* ── Layout ─────────────────────────────────────────────────────── */

.stage {
  width: 100%;
  /* A grid item otherwise grows to fit the one-line topic row, widening the whole page. */
  min-width: 0;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--gutter) var(--space-2);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  /* Only on a very short screen, once Relay is at its smallest, does the stage scroll. */
  min-height: 0;
  overflow-y: auto;
}

/* Page entrance: seen once per visit, so a short stagger is allowed. Never blocks input. */
.enter {
  opacity: 0;
  transform: translateY(var(--enter-offset));
  animation: enter var(--duration-enter) var(--ease-out) forwards;
}
.enter:nth-child(2) { animation-delay: var(--stagger); }
.enter:nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
.enter:nth-child(4) { animation-delay: calc(var(--stagger) * 3); }
.enter:nth-child(5) { animation-delay: calc(var(--stagger) * 4); }
.enter:nth-child(6) { animation-delay: calc(var(--stagger) * 5); }
.enter:nth-child(7) { animation-delay: calc(var(--stagger) * 6); }

@keyframes enter {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ── Hero ───────────────────────────────────────────────────────── */

.hero {
  text-align: center;
}

.trust-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin: 0 0 var(--space-2);
  padding: var(--space-1) var(--space-3) var(--space-1) var(--space-2);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.trust-tag svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

.trust-badge {
  fill: var(--color-verified);
}

.trust-check {
  fill: none;
  stroke: var(--color-on-verified);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.title {
  margin: 0 0 var(--space-1);
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--tracking-tight);
}

.lede {
  margin: 0 auto;
  max-width: var(--lede-width);
  color: var(--color-text-muted);
  font-size: var(--font-size-lg);
}

/* ── Relay, the steel face ─────────────────────────────────────────────── */

/* Takes whatever height the stage has left; Relay is sized to fit it (container units). */
.mascot-stage {
  flex: 1 1 0;
  min-height: var(--size-mascot-min);
  container-type: size;
  display: grid;
  justify-items: center;
  align-content: center;
}

.mascot {
  position: relative;
  width: var(--size-mascot-fit);
  aspect-ratio: 1;
}

.mascot canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity var(--duration-mascot-reveal) var(--ease-out);
}

.mascot[data-ready='true'] canvas {
  opacity: 1;
}

/* Loading and fallback share one quiet shape: a still, solid circle in the brand colour.
   Loading fades it out when the 3D face is ready; the fallback simply keeps it. */
.mascot::before {
  content: '';
  position: absolute;
  inset: var(--mascot-placeholder-inset);
  border-radius: 50%;
  background: var(--mascot-fallback);
  opacity: var(--mascot-placeholder-opacity);
  transition: opacity var(--duration-mascot-reveal) var(--ease-out);
}

.mascot[data-ready='true']::before {
  opacity: 0;
}

.mascot[data-fallback='true']::before {
  opacity: 1;
}

.mascot-shadow {
  width: var(--mascot-shadow-width);
  height: var(--size-mascot-shadow-height);
  margin-top: calc(var(--space-4) * -1);
  border-radius: 50%;
  background: var(--mascot-shadow);
  filter: blur(var(--mascot-shadow-blur));
}

/* Topics Relay covers: labels, not buttons, so they look quieter than the question chips. */
/* What Relay can help with: an invitation before the call, not needed once talking. */
body[data-in-call='true'] .topics {
  display: none;
}

/* On a shorter screen the greeting gives its room to Relay during a call; the status line in
   the dock already says what is happening. */
@media (max-height: 44rem) {
  body[data-in-call='true'] .hero {
    display: none;
  }
}

.topics {
  margin: calc(var(--space-2) * -1) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: nowrap;
  justify-content: safe center;
  gap: var(--space-1);
  overflow-x: auto;
  scrollbar-width: none;
}

.topics li {
  flex: none;
  white-space: nowrap;
  padding: var(--space-1) var(--space-2);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  color: var(--color-text-muted);
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-medium);
}

/* ── Call controls ──────────────────────────────────────────────── */

.console {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

/* Before a call nothing in the row is shown; take no space in the dock rather than a gap. */
.console:not(:has(> :not([hidden]))) {
  display: none;
}

.console .pill {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
}

/* The caller's own "I'm finished": a solid teal pill, the one filled control in the row, so it
   reads as the next step. Fades up when it appears, like Mute. */
.console .done {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: var(--font-weight-semibold);
  box-shadow: var(--shadow-accent);
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-press) var(--ease-out),
    background-color var(--duration-fast) ease;
  @starting-style {
    opacity: 0;
    transform: translateY(var(--enter-offset));
  }
}

@media (hover: hover) and (pointer: fine) {
  .console .done:hover {
    background: var(--color-accent-hover);
  }
}

.console .hint {
  flex-basis: 100%;
}

/* A pill at the end of the chat bar: the one primary action on the page. */
.call-button {
  position: relative;
  flex: none;
  height: var(--size-call);
  padding: 0 var(--space-4) 0 var(--space-3);
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  border: 0;
  border-radius: var(--radius-pill);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  background: var(--color-primary);
  color: var(--color-on-primary);
  box-shadow: var(--shadow-call);
  cursor: pointer;
  transition:
    transform var(--duration-press) var(--ease-out),
    background-color var(--duration-base) ease,
    box-shadow var(--duration-base) ease;
}

.call-button:active:not(:disabled) {
  transform: scale(var(--press-scale));
}

.call-button:disabled {
  cursor: not-allowed;
  opacity: var(--opacity-disabled);
}

.call-button svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
  transition: transform var(--duration-base) var(--ease-in-out);
}

/* In a call the same button hangs up: it turns red and the handset tips over. */
.call-button[data-in-call='true'] {
  background: var(--color-danger);
  box-shadow: var(--shadow-call-danger);
}

.call-button[data-in-call='true'] svg {
  transform: rotate(135deg);
}

@media (hover: hover) and (pointer: fine) {
  .call-button:hover:not(:disabled) {
    background: var(--color-primary-hover);
  }
  .call-button[data-in-call='true']:hover {
    background: var(--color-danger-hover);
  }
}

/* Idle only: a ring spreads from the button and the handset rings, then a long rest. It says
   "you can talk to Relay" without moving anything else, and stops as soon as a call starts. */
.call-button[data-state='ready']::after {
  content: '';
  position: absolute;
  inset: 0;
  border: var(--focus-width) solid var(--color-primary);
  border-radius: inherit;
  opacity: 0;
  pointer-events: none;
  animation: call-ring var(--duration-call-ring) var(--ease-out) infinite;
}

.call-button[data-state='ready'] svg {
  animation: call-shake var(--duration-call-ring) var(--ease-in-out) infinite;
}

@keyframes call-ring {
  0% {
    opacity: 0.55;
    transform: scale(1);
  }
  45%,
  100% {
    opacity: 0;
    transform: scale(var(--call-ring-scale-x), var(--call-ring-scale-y));
  }
}

@keyframes call-shake {
  0%,
  24%,
  100% {
    transform: rotate(0);
  }
  4%,
  12% {
    transform: rotate(-14deg);
  }
  8%,
  16% {
    transform: rotate(14deg);
  }
  20% {
    transform: rotate(-6deg);
  }
}

.status {
  margin: 0;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.status-dot {
  width: var(--size-dot);
  height: var(--size-dot);
  flex: none;
  border-radius: 50%;
  background: var(--color-text-subtle);
  transition: background-color var(--duration-base) ease;
}

.console[data-state='listening'] .status-dot,
.console[data-state='connecting'] .status-dot { background: var(--color-accent); }
.console[data-state='thinking'] .status-dot,
.console[data-state='speaking'] .status-dot { background: var(--color-primary); }
.console[data-state='error'] .status-dot,
.console[data-state='unavailable'] .status-dot { background: var(--color-danger); }

.timer {
  font-variant-numeric: tabular-nums;
  color: var(--color-text-subtle);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  transition:
    transform var(--duration-press) var(--ease-out),
    background-color var(--duration-fast) ease,
    border-color var(--duration-fast) ease;
}

.pill svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

.pill:active {
  transform: scale(var(--press-scale));
}

@media (hover: hover) and (pointer: fine) {
  .pill:hover {
    background: var(--color-surface-muted);
  }
}

.pill[aria-pressed='true'] {
  border-color: var(--color-danger);
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

/* Shown only in a call; fades up when it appears. */
.mute {
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-press) var(--ease-out);
  @starting-style {
    opacity: 0;
    transform: translateY(var(--enter-offset));
  }
}

.hint {
  margin: 0;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
  font-size: var(--font-size-sm);
  text-align: center;
  transition: opacity var(--duration-fast) var(--ease-out);
  @starting-style {
    opacity: 0;
  }
}

/* ── Conversation dock ──────────────────────────────────────────── */

/* Pinned to the bottom, centred, from the first paint. A restrained treatment (brand: no
   chat-heavy look): a pill bar, and a compact thread above it once there are messages. */
/* A full-width strip in the page colour, so content scrolling underneath disappears cleanly
   behind it rather than peeking out around the pill. */
.dock {
  padding: var(--space-2) var(--gutter) var(--space-4);
  background: var(--color-bg);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.dock > * {
  width: 100%;
  max-width: var(--dock-width);
  margin: 0 auto;
}

.chat-bar {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  box-shadow: var(--shadow-dock);
}

.chat-input {
  flex: 1;
  min-width: 0;
  padding: var(--space-1) 0;
  border: 0;
  background: transparent;
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-sm);
}

.chat-input::placeholder {
  color: var(--color-text-subtle);
}

.chat-input:focus-visible {
  outline: none;
}

/* The focus ring moves to the whole bar, so the pill itself shows where you are typing. */
.chat-bar:focus-within {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--border-width);
}

.chat-input:disabled {
  cursor: not-allowed;
}

.chat-send {
  flex: none;
  width: var(--size-send);
  height: var(--size-send);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-subtle);
  cursor: pointer;
  transition:
    transform var(--duration-press) var(--ease-out),
    background-color var(--duration-fast) ease,
    color var(--duration-fast) ease;
}

.chat-send svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

.chat-send:active:not(:disabled) {
  transform: scale(var(--press-scale));
}

.chat-send:disabled {
  cursor: not-allowed;
  opacity: var(--opacity-disabled);
}

@media (hover: hover) and (pointer: fine) {
  .chat-send:hover:not(:disabled) {
    background: var(--color-surface-muted);
    color: var(--color-text);
  }
}

.thread {
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  box-shadow: var(--shadow-dock);
  overflow: hidden;
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  @starting-style {
    opacity: 0;
    transform: translateY(var(--enter-offset));
  }
}

.thread-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-2) var(--space-3) var(--space-2) var(--space-5);
  border-bottom: var(--border-width) solid var(--color-border);
}

.thread-title {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.thread-toggle {
  padding: var(--space-1) var(--space-3);
  border: 0;
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  cursor: pointer;
  transition: background-color var(--duration-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .thread-toggle:hover {
    background: var(--color-surface-muted);
  }
}

.chat-log {
  max-height: var(--thread-height);
  margin: 0;
  padding: var(--space-3) var(--space-5);
  list-style: none;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.chat-message {
  /* Contains its screen-reader label ("You said:"), which would otherwise stretch the page. */
  position: relative;
  max-width: var(--bubble-max-width);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: var(--font-size-sm);
  transition:
    opacity var(--duration-fast) var(--ease-out),
    transform var(--duration-fast) var(--ease-out);
  @starting-style {
    opacity: 0;
    transform: translateY(var(--enter-offset));
  }
}

.chat-message--caller {
  align-self: flex-end;
  background: var(--color-bubble-caller);
  color: var(--color-bubble-caller-text);
  border-bottom-right-radius: var(--radius-sm);
}

.chat-message--relay {
  align-self: flex-start;
  background: var(--color-surface-muted);
  border-bottom-left-radius: var(--radius-sm);
}

/* The caller's words while they are still speaking. */
.chat-message.is-partial {
  opacity: var(--opacity-partial);
}

.chat-text {
  margin: 0;
}

.chat-tag {
  margin-left: var(--space-2);
  color: var(--color-text-subtle);
  font-size: var(--font-size-2xs);
}

/* A reference in Relay's words: highlighted, and copied on click. The hint word ("Copy",
   "Copied") says what happens, so the state is never colour alone. */
.ref-chip {
  display: inline-flex;
  align-items: baseline;
  gap: var(--space-1);
  margin: 0 var(--space-1);
  padding: 0 var(--space-2);
  border: var(--border-width) solid var(--color-accent);
  border-radius: var(--radius-sm);
  background: var(--color-accent-soft);
  color: var(--color-text);
  font: inherit;
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition:
    transform var(--duration-press) var(--ease-out),
    background-color var(--duration-fast) ease;
}

.ref-chip:active {
  transform: scale(var(--press-scale));
}

.ref-chip-hint {
  color: var(--color-accent);
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-medium);
}

.ref-chip[data-copied] {
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.ref-chip[data-copied] .ref-chip-hint {
  color: var(--color-on-accent);
}

.chat-divider {
  align-self: center;
  margin: var(--space-1) 0;
  color: var(--color-text-subtle);
  font-size: var(--font-size-2xs);
}

/* ── Suggestions ────────────────────────────────────────────────── */

.chips {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-2);
}

.chip {
  padding: var(--space-1) var(--space-3);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  text-align: left;
  cursor: pointer;
  transition:
    transform var(--duration-press) var(--ease-out),
    background-color var(--duration-fast) ease,
    border-color var(--duration-fast) ease;
}

.chip:active:not(:disabled) {
  transform: scale(var(--press-scale));
}

.chip:disabled {
  cursor: not-allowed;
  opacity: var(--opacity-disabled);
}

@media (hover: hover) and (pointer: fine) {
  .chip:hover:not(:disabled) {
    border-color: var(--color-accent);
    background: var(--color-accent-soft);
  }
}

/* ── Error ──────────────────────────────────────────────────────── */

.error {
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  background: var(--color-danger-soft);
  color: var(--color-danger);
  transition: opacity var(--duration-fast) var(--ease-out);
  @starting-style {
    opacity: 0;
  }
}

.error p {
  margin: 0;
}

.error details {
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
}

.error summary {
  cursor: pointer;
}

.error code {
  display: block;
  margin-top: var(--space-2);
  overflow-wrap: anywhere;
}

/* ── Account panel ──────────────────────────────────────────────── */

/* Narrow screens: a drawer that slides in from the left, over a dimmed page. Wide screens (below):
   a fixed column beside Relay, always visible. */
.account-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-3);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
}

.account-toggle svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--drawer-width);
  padding: calc(var(--space-4) + env(safe-area-inset-top, 0px)) var(--space-4) var(--space-6);
  overflow-y: auto;
  background: var(--color-bg);
  border-right: var(--border-width) solid var(--color-border);
  box-shadow: var(--shadow-drawer);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  transform: translateX(-105%);
  /* Closed means gone: no shadow at the screen's edge, and no fields reachable by Tab. The
     visibility change waits for the slide to finish. */
  visibility: hidden;
  transition:
    transform var(--duration-base) var(--ease-out),
    visibility 0s linear var(--duration-base);
}

.sidebar[data-open='true'] {
  transform: none;
  visibility: visible;
  transition: transform var(--duration-base) var(--ease-out);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  background: var(--color-backdrop);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-title {
  margin: 0;
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
}

.sidebar-close {
  width: var(--size-send);
  height: var(--size-send);
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
}

.sidebar-close svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

@media (min-width: 60rem) {
  body {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    grid-template-areas:
      'side top'
      'side stage'
      'side dock';
  }
  .topbar { grid-area: top; }
  .stage { grid-area: stage; }
  .dock { grid-area: dock; }
  .sidebar {
    grid-area: side;
    position: static;
    width: auto;
    transform: none;
    visibility: visible;
    box-shadow: none;
    transition: none;
  }
  .account-toggle,
  .sidebar-close,
  .sidebar-backdrop {
    display: none;
  }
}

.card {
  padding: var(--space-4);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  transition: border-color var(--duration-base) ease, box-shadow var(--duration-base) ease;
}

/* Relay just asked for this form: it is where to look next. */
.card[data-attention] {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-accent);
}

.card-quiet {
  background: transparent;
}

.card-title {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.card-note {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}

.fields {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-top: var(--space-1);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.field label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
}

.field-optional {
  color: var(--color-text-subtle);
  font-weight: normal;
}

.field input {
  height: var(--field-height);
  padding: 0 var(--space-3);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
  font-size: var(--font-size-sm);
}

.field input::placeholder {
  color: var(--color-text-subtle);
}

.field input:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--border-width);
}

.field input[aria-invalid='true'] {
  border-color: var(--color-danger);
}

.field input:disabled {
  opacity: var(--opacity-disabled);
  cursor: not-allowed;
}

.field-hint {
  margin: 0;
  color: var(--color-text-subtle);
  font-size: var(--font-size-2xs);
}

/* The words say what happened; the colour only supports them. */
.form-message {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius);
  font-size: var(--font-size-xs);
  background: var(--color-surface-muted);
  color: var(--color-text);
}

.form-message[data-tone='error'] {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.form-message[data-tone='success'] {
  background: var(--color-accent-soft);
  color: var(--color-text);
}

.form-button {
  height: var(--field-height);
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font: inherit;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  cursor: pointer;
  transition: transform var(--duration-press) var(--ease-out), background-color var(--duration-fast) ease;
}

.form-button:active:not(:disabled) {
  transform: scale(var(--press-scale));
}

.form-button:disabled {
  opacity: var(--opacity-disabled);
  cursor: not-allowed;
}

@media (hover: hover) and (pointer: fine) {
  .form-button:hover:not(:disabled) {
    background: var(--color-primary-hover);
  }
  .sidebar-close:hover {
    background: var(--color-surface-muted);
  }
}

.verified {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.verified-badge {
  flex: none;
  width: var(--size-send);
  height: var(--size-send);
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-on-accent);
}

.verified-badge svg {
  width: var(--size-icon-sm);
  height: var(--size-icon-sm);
}

.verified-name {
  margin: 0;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
}

.account-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.account-status {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-2);
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--color-accent);
  font: inherit;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.facts {
  margin: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
}

.facts dt {
  color: var(--color-text-muted);
}

.facts dd {
  margin: 0;
  font-weight: var(--font-weight-medium);
  min-width: 0;
}

.rows {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
}

.row {
  padding: var(--space-2) 0;
  border-top: var(--border-width) solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.row:first-child {
  border-top: 0;
  padding-top: 0;
}

.row-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-2);
  font-size: var(--font-size-xs);
}

.row-head .ref-chip {
  margin: 0;
}

.row-title {
  font-weight: var(--font-weight-medium);
}

.row-meta,
.row-detail {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-2xs);
  overflow-wrap: anywhere;
}

.row-amount {
  margin-left: auto;
  font-weight: var(--font-weight-semibold);
  font-variant-numeric: tabular-nums;
}

/* Status is a word on a tinted pill; the word carries the meaning, never the colour alone. */
.status-pill {
  padding: 0 var(--space-2);
  border-radius: var(--radius-pill);
  background: var(--color-surface-muted);
  color: var(--color-text-muted);
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.status-pill[data-tone='attention'] {
  background: var(--color-warning-soft);
  color: var(--color-warning-text);
}

.status-pill[data-tone='problem'] {
  background: var(--color-danger-soft);
  color: var(--color-danger);
}

.status-pill[data-tone='done'] {
  background: var(--color-accent-soft);
  color: var(--color-text);
}

.history summary {
  cursor: pointer;
  font-size: var(--font-size-xs);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.history summary:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-width);
  border-radius: var(--radius-sm);
}

.mini-log {
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  font-size: var(--font-size-2xs);
}

.mini-log b {
  display: block;
  color: var(--color-text-muted);
  font-weight: var(--font-weight-semibold);
}

.mini-log p {
  margin: 0;
  overflow-wrap: anywhere;
}

.help-list {
  margin: 0;
  padding-left: var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
}

/* ── Reduced motion: fewer and gentler, not none. Keep opacity, drop movement. ── */

@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none;
  }
  .enter {
    transform: none;
    animation: fade var(--duration-enter) ease forwards;
  }
  @keyframes fade {
    to {
      opacity: 1;
    }
  }
  .call-button,
  .call-button svg,
  .pill,
  .chip,
  .mute,
  .console .done {
    transition-property: background-color, border-color, opacity;
  }
  .call-button:active:not(:disabled),
  .pill:active,
  .chip:active:not(:disabled) {
    transform: none;
  }
  .call-button[data-in-call='true'] svg {
    transform: none;
  }
  .call-button[data-state='ready']::after,
  .call-button[data-state='ready'] svg {
    animation: none;
  }
  .chat-message,
  .thread {
    transition-property: opacity;
  }
}
