/* Component styles — derived from design/wireframes/wireframes.css with
 * the AA-blocker fixes from design/accessibility-review.md already applied
 * (see design-system.md §10). */

* { box-sizing: border-box; }

/* Global UI scale: everything (type, chrome, graphics) renders at 90% of its
 * designed px size. Zoom on the root scales viewport units too, so the
 * viewport-height containers divide by the scale so they still fill the window. */
:root { --ui-scale: 0.9; }
html { zoom: var(--ui-scale); }
/* Password managers (Dashlane and friends) place their in-field icons from
 * the input's measured rect, which CSS zoom throws off so the icon lands
 * beside the box. The account pages are plain forms, so they run unzoomed. */
html:has(.auth) { --ui-scale: 1; }

/* The hidden attribute always wins, whatever display an element's class
 * sets. Without this, a `display: flex` rule silently un-hides things. */
[hidden] { display: none !important; }

/* Staging copy only (see staging_label() in app.py). Fixed and click-through,
 * so no page's layout moves. */
.staging-label {
  position: fixed; z-index: 1000; top: env(safe-area-inset-top); left: 50%; transform: translateX(-50%);
  padding: 2px 10px; border-radius: 0 0 var(--radius-2) var(--radius-2);
  background: var(--color-state-warning); color: #fff;
  font: 600 11px/1.6 var(--font-ui); letter-spacing: 0.02em; white-space: nowrap;
  pointer-events: none; opacity: 0.92;
}
.staging-label__short { display: none; }
/* Phones: a small corner tag, clear of the menu button and the centred title. */
@media (max-width: 600px) {
  .staging-label { left: 0; transform: none; padding: 0 6px; font-size: 9px; line-height: 13px; border-radius: 0 0 var(--radius-2) 0; }
  .staging-label__long { display: none; }
  .staging-label__short { display: inline; }
}

html, body {
  margin: 0; padding: 0;
  background: var(--color-bg-canvas);
  color: var(--color-fg-primary);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ============================================================
 * App shell — the 3-region layout from ui-brief §3
 * ============================================================ */

.app {
  display: grid;
  grid-template-columns: var(--layout-sidebar-width) 1fr;
  grid-template-rows: var(--layout-header-height) 1fr auto;
  grid-template-areas:
    "header  header"
    "roster  transcript"
    "roster  composer";
  height: calc(100vh / var(--ui-scale));
  min-height: 720px;
}

/* Resizer: a thin column on the right edge of the roster. Mousedown
 * captures the cursor and updates --layout-sidebar-width inline on .app;
 * mouseup commits the new width to localStorage. See wireRosterResize()
 * in app.js. */
.roster {
  position: relative;
}
.roster-resizer {
  position: absolute;
  top: 0;
  right: 0; /* was -3px, which forced 3px of horizontal overflow */
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 2;
}
.roster-resizer:hover,
.roster-resizer--active {
  background: var(--color-state-active);
  opacity: 0.5;
}
body.roster-resizing {
  cursor: col-resize;
  user-select: none;
}

/* Collapsed participants panel. The column goes to zero and a small tab on
 * the left edge brings it back. See wireRosterToggle() in app.js. */
.app--roster-hidden {
  grid-template-columns: 0 1fr;
}
.app--roster-hidden .roster {
  display: none;
}
.roster-toggle {
  grid-area: transcript;
  justify-self: start;
  align-self: start;
  z-index: 6;
  margin-top: var(--space-3);
  /* Straddle the divider: half over the panel, half over the transcript. */
  transform: translateX(-50%);
  width: 26px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  background: var(--color-bg-surface-elevated);
  color: var(--color-fg-secondary);
  font-family: var(--font-ui);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: color var(--motion-fast-duration) var(--ease-out);
}
.roster-toggle:hover { color: var(--color-fg-primary); }
.roster-toggle:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }
.roster-toggle__closed { display: none; }
/* Collapsed: the transcript cell now starts at the window edge, so the flag
 * sits flush against it and shows the "bring it back" glyph. */
.app--roster-hidden .roster-toggle { transform: none; border-left: none; border-radius: 0 8px 8px 0; }
.app--roster-hidden .roster-toggle__open { display: none; }
.app--roster-hidden .roster-toggle__closed { display: inline; }

.header     { grid-area: header; }
.roster     { grid-area: roster; }
.transcript { grid-area: transcript; }
.composer   { grid-area: composer; }

/* ============================================================
 * Header
 * ============================================================ */

.header {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  padding: 0 var(--space-5);
  border-bottom: 1px solid var(--color-border-subtle);
}

.header__home {
  display: flex;
  align-items: center;
  /* Tight gap between logo and brand; the header's default 24px gap was
   * too loose for a paired logo+wordmark. */
  gap: var(--space-2);
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  border-radius: var(--radius-2);
  transition: opacity var(--motion-fast-duration) var(--ease-out);
}
.header__home:hover { opacity: 0.85; }
.header__home:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

.header__logo {
  filter: var(--logo-filter);
  display: block;
  height: 56px;
  width: auto;
  flex: 0 0 auto;
  /* Nudge the logo down so the round part centers with the brand text;
   * the sword tip extends a few pixels above center. */
  position: relative;
  top: 5px;
}

.header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 18px;
  letter-spacing: -0.005em;
}
.header__session {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 15px;
  color: var(--color-fg-muted);
}
.header__session::before { content: '· '; }

.header__spacer { flex: 1; }

.header__cost {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--color-fg-muted);
}

.header__copy {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-2);
  background: transparent;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-fg-muted);
  cursor: pointer;
  transition: color var(--motion-fast-duration) var(--ease-out),
              border-color var(--motion-fast-duration) var(--ease-out);
}
.header__copy:hover {
  color: var(--color-fg-primary);
  border-color: var(--color-fg-muted);
}
.header__copy:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

/* ============================================================
 * Roster sidebar
 * ============================================================ */

.roster {
  background: var(--color-bg-surface);
  border-right: 1px solid var(--color-border-subtle);
  overflow-y: auto;
  overflow-x: hidden; /* rows ellipsize; the panel never scrolls sideways */
  padding: var(--space-4) 0;
}

.roster__label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-fg-faint);
  padding: 10px var(--space-4) 0;
  margin-bottom: var(--space-3);
}

.roster__list {
  list-style: none; padding: 0; margin: 0;
}

/* Compact two-line row: line1 spans both columns; the model id (left,
 * ellipsized) and the ctx/cost meter (right, never wraps) share the
 * second visual line via the grid. Nothing here may force horizontal
 * scroll — long content truncates, full detail lives in title tooltips. */
.roster-row {
  padding: var(--space-2) var(--space-4);
  position: relative;
  border-left: 2px solid transparent;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-2);
}
.roster-row--current {
  border-left-color: var(--color-state-active);
}
.roster-row--disabled { opacity: 0.5; }

.roster-row__line1 {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}
.roster-row__name {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.roster-row__line2 {
  grid-column: 1;
  margin-top: 2px;
  /* Lines up with the chip: the 30px grip slot plus line1's 8px gap. */
  padding-left: 38px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-fg-muted);
  line-height: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.roster-row__health--degraded {
  color: var(--color-state-warning);
}
.roster-row__health--degraded::before {
  content: '▲ ';
}
/* Tiny pill on the model line: this speaker is on a fallback model. */
.roster-row__tag {
  display: inline-block;
  padding: 0 4px;
  border: 1px solid var(--color-fg-faint);
  border-radius: var(--radius-1);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-fg-faint);
  vertical-align: 1px;
}
/* Manual model override: this seat is not on the model its persona file
 * names. Distinct from the "fallback" pill, which means the chain moved it. */
.roster-row__tag--custom {
  border-color: var(--color-state-active);
  color: var(--color-state-active);
}
/* Context/cost meter — filled by refreshUsage() from /api/usage. Its own
 * element (not part of line2) so the degraded rewrite can't wipe it.
 * Right-aligned on the same visual line as the model id. */
.roster-row__ctx {
  grid-column: 2;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-fg-muted);
  line-height: 15px;
  white-space: nowrap;
  text-align: right;
}
.roster-row__ctx--high {
  color: var(--color-state-warning);
}

/* ============================================================
 * SpeakerChip
 * ============================================================ */

.chip {
  display: inline-flex;
  align-items: center;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-2);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-bg-canvas);
  background: var(--color-persona-slate);
  white-space: nowrap;
}

.chip--roster {
  padding: 2px var(--space-2);
  font-size: 11px;
}

.chip--ink    { background: var(--color-persona-ink); }
.chip--forest { background: var(--color-persona-forest); }
.chip--plum   { background: var(--color-persona-plum); }
.chip--bronze { background: var(--color-persona-bronze); }
.chip--teal   { background: var(--color-persona-teal); }
.chip--slate  { background: var(--color-persona-slate); }

/* Active-turn ring — applies in the transcript only, not the roster
 * (per a11y review B6 — roster's left bar is the carrier there). */
.transcript .chip--current-turn {
  box-shadow:
    0 0 0 2px var(--color-bg-canvas),
    0 0 0 calc(2px + var(--ring-active-turn-width)) var(--color-state-active);
}

.chip--degraded { opacity: 0.6; }
.chip--degraded::before { content: '▲ '; }

.chip--disabled {
  background: var(--color-border-subtle);
  color: var(--color-fg-muted);
}
.chip--disabled::before { content: '— '; }

/* ============================================================
 * Transcript
 * ============================================================ */

.transcript {
  overflow-y: auto;
  padding: var(--space-6) var(--space-6) var(--space-7);
  position: relative;
  scrollbar-gutter: stable;
}

.transcript__inner {
  max-width: var(--layout-content-max);
  margin: 0 auto;
  min-width: 0;
  overflow-wrap: anywhere;
  zoom: var(--transcript-scale, 1);
}

/* Speed and font-size buttons. They live in the composer's settings popover
 * (restyled there, see "Conversation column and composer" below) and in the
 * phone's Meeting sheet, which keeps these rules. See
 * wireTranscriptFontButtons(). */
.transcript__tools {
  grid-area: transcript;
  align-self: end;
  justify-self: end;
  z-index: 5;
  /* Sit clear of the transcript's scrollbar; the gutter is always reserved
   * (see .transcript) so the buttons never jump when it appears. */
  margin: 0 calc(var(--space-4) + 14px) var(--space-3) 0;
  display: flex;
  gap: var(--space-2);
  pointer-events: none;
}
.transcript__tool {
  pointer-events: auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--color-border-subtle);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg-surface);
  color: var(--color-fg-muted);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}
.transcript__tool--speed {
  width: 44px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.transcript__tool:hover {
  color: var(--color-fg-primary);
  border-color: var(--color-fg-faint);
}
.transcript__tool:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

.msg {
  margin-bottom: var(--space-5);
}
.msg__head {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-2);
}
.msg__body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 26px;
  color: var(--color-fg-primary);
  margin: 0;
}
.msg__meta {
  margin-top: var(--space-2);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-fg-muted);
}
.msg__picked { color: var(--color-fg-faint); }

.msg--passed {
  margin-bottom: var(--space-4);
  padding-left: var(--space-7);
  font-family: var(--font-body);
  font-style: italic;
  font-size: 15px;
  color: var(--color-fg-muted);
}

/* Quiet note line — a model failure reported without a banner. The raw
 * reason hides in the <details>. */
.msg--note {
  margin-bottom: var(--space-4);
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 20px;
  color: var(--color-fg-muted);
  overflow-wrap: anywhere;
}
.msg__details {
  display: inline;
  margin-left: var(--space-2);
}
.msg__details summary {
  display: inline;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-fg-faint);
}
.msg__details pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  margin: var(--space-2) 0 0;
  max-height: 12em;
  overflow-y: auto;
  color: var(--color-fg-muted);
}

.msg__cursor {
  display: inline-block;
  width: 2px;
  height: 20px;
  background: var(--color-state-active);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: pulse 1.2s ease-in-out infinite;
}

.msg__tag {
  font-style: italic;
  color: var(--color-fg-muted);
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50%      { opacity: 1.0; }
}

/* ============================================================
 * Banner
 * ============================================================ */

.banner {
  padding: var(--space-3) var(--space-4);
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin: 0 calc(-1 * var(--space-6)) var(--space-6);
}
.banner--info { background: var(--color-bg-surface); }
.banner--warning {
  background: rgba(181, 58, 45, 0.08);
  border-top: 1px solid var(--color-state-warning);
  border-bottom: 1px solid var(--color-state-warning);
}
.banner--error {
  background: rgba(139, 36, 24, 0.08);
  border-top: 1px solid var(--color-state-error);
  border-bottom: 1px solid var(--color-state-error);
}
.banner__glyph {
  font-family: var(--font-ui);
  font-weight: 700;
  flex-shrink: 0;
  width: 18px;
  text-align: center;
}
.banner--info .banner__glyph    { color: var(--color-fg-muted); }
.banner--warning .banner__glyph { color: var(--color-state-warning); }
.banner--error .banner__glyph   { color: var(--color-state-error); }
.banner__body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 22px;
  color: var(--color-fg-primary);
  min-width: 0;
  overflow-wrap: anywhere;
}

/* ============================================================
 * ControlBar
 * ============================================================ */

.controlbar {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  border-top: 1px solid var(--color-border-subtle);
}

.btn-pause {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: 8px;
  background: var(--color-bg-inset);
  color: var(--color-bg-canvas);
  border: none;
  cursor: pointer;
  transition: background var(--motion-fast-duration) var(--ease-out),
              opacity var(--motion-fast-duration) var(--ease-out);
}
.btn-pause:hover:not(:disabled) {
  background: var(--color-state-active);
}
.btn-pause:disabled {
  opacity: 0.6;
  cursor: progress;
}
.btn-pause:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

/* "New" — appears left of Start once the meeting has ended; navigates
 * to a fresh session. Neutral outline so Start stays the primary action. */
.btn-new {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--color-border-subtle);
  color: var(--color-fg-primary);
  cursor: pointer;
  transition: background var(--motion-fast-duration) var(--ease-out);
}
.btn-new:hover {
  background: var(--color-bg-inset);
  color: var(--color-bg-canvas);
}
.btn-new:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

/* Popover for the New button: two stacked choices. */
.new-menu {
  position: fixed;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 250px;
  background: var(--color-bg-surface-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-2);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.new-menu__item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: none;
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--color-fg-primary);
  text-align: left;
}
.new-menu__item + .new-menu__item {
  border-top: 1px solid var(--color-border-subtle);
}
.new-menu__item span {
  font-size: 11px;
  color: var(--color-fg-muted);
}
.new-menu__item:hover,
.new-menu__item:focus-visible {
  background: var(--color-bg-inset);
  color: var(--color-bg-canvas);
  outline: none;
}
.new-menu__item:hover span,
.new-menu__item:focus-visible span {
  color: inherit;
}

.btn-force-end {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--color-state-warning);
  color: var(--color-state-warning);
  cursor: pointer;
  transition: background var(--motion-fast-duration) var(--ease-out);
}
.btn-force-end:hover:not(:disabled) {
  background: var(--color-state-warning);
  color: var(--color-bg-canvas);
}
.btn-force-end:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}
/* After the meeting ends, the same button becomes "Reset" — switch its
 * tone from warning-red to a calmer neutral. */
.btn-force-end[data-state="reset"] {
  border-color: var(--color-fg-muted);
  color: var(--color-fg-primary);
}
.btn-force-end[data-state="reset"]:hover:not(:disabled) {
  background: var(--color-fg-muted);
  color: var(--color-bg-canvas);
}

.badge-queue {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  background: rgba(167, 123, 31, 0.16);
  border: 1px solid var(--color-state-active);
  color: var(--color-fg-primary);
  cursor: pointer;
}
.badge-queue--hidden { display: none; }
.badge-queue:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

.verbosity {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: var(--space-5);
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--color-fg-muted);
}
.verbosity__label {
  font-family: var(--font-mono);
  font-size: 12px;
}
.verbosity__slider {
  width: 100px;
  accent-color: var(--color-state-active);
  cursor: pointer;
}
.verbosity__value {
  font-style: italic;
  min-width: 64px;
  text-align: left;
  color: var(--color-fg-primary);
}

.pacing {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-fg-muted);
}

.response-clock {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-fg-muted);
  min-width: 36px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.response-clock:empty { display: none; }
.response-clock--active { color: var(--color-state-active); }

/* Awaiting-human pulse: a gentle 2s color cycle to nudge the eye toward
 * the status line without being insistent. Stops as soon as setPacing
 * runs with any other text (turn_started, queued, etc.). */
@keyframes pacing-awaiting-pulse {
  0%, 100% { color: var(--color-fg-muted); }
  50%      { color: var(--color-state-active); }
}
.pacing--awaiting {
  animation: pacing-awaiting-pulse 2s ease-in-out infinite;
  font-weight: 600;
}
@media (prefers-reduced-motion: reduce) {
  .pacing--awaiting { animation: none; color: var(--color-state-active); }
}

/* ============================================================
 * Composer — base rules. The phone keeps these and restyles the
 * box in phone.css; desktop and iPad get the card below.
 * ============================================================ */

.composer {
  position: relative;
  min-height: var(--layout-composer-min);
  padding: var(--space-4) var(--space-6);
  box-shadow: var(--shadow-elevation-1);
  transition: background var(--motion-medium-duration) var(--ease-out);
}
.composer:focus-within {
  background: var(--color-bg-surface);
}
.composer::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--color-state-active);
  opacity: 0;
  transition: opacity var(--motion-medium-duration) var(--ease-out);
  pointer-events: none;
}
/* Draggable divider on the composer's top edge. Dragging pins the textarea
 * height through --composer-input-height on .app (min and max collapse to
 * one value, so auto-grow is clamped); double-click clears it and auto-grow
 * returns. See wireComposerResize() in app.js. */
.composer-resizer {
  position: absolute;
  top: -3px;
  left: 0;
  right: 0;
  height: 6px;
  cursor: row-resize;
  background: transparent;
  z-index: 2;
}
body.composer-resizing {
  cursor: row-resize;
  user-select: none;
}

.composer__input {
  width: 100%;
  min-height: var(--composer-input-height, 52px);
  /* About half the window for the whole card; the rest is the card's own
   * padding and button row. */
  max-height: var(--composer-input-height, calc(50vh / var(--ui-scale) - 88px));
  resize: none;
  background: transparent;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 26px;
  color: var(--color-fg-primary);
}
.composer__input::placeholder {
  font-style: italic;
  color: var(--color-fg-muted);
}

/* ---- Mode tab: tucked behind the card's top edge, every layout ------ */
/* It stops at the card's border, so the border runs unbroken across its
 * base, and takes a shade between the page and the card so it reads as
 * sitting behind. Prominent in the lobby, quiet once the meeting runs. */
.mode-tab {
  position: absolute;
  bottom: calc(100% + 1px);
  left: var(--space-5);
  z-index: 3;
}
.mode-tab__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding: 0 var(--space-3);
  border: 1px solid var(--color-border-subtle);
  border-bottom: none;
  border-radius: min(8px, var(--radius-composer)) min(8px, var(--radius-composer)) 0 0;
  background: color-mix(in srgb, var(--color-bg-surface) 50%, var(--color-bg-canvas));
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--color-fg-faint);
  cursor: pointer;
  transition: color var(--motion-fast-duration) var(--ease-out),
              border-color var(--motion-medium-duration) var(--ease-out);
}
.mode-tab__caret { font-size: 9px; }
.mode-tab__btn:hover,
.mode-tab__btn[aria-expanded="true"],
.composer--lobby .mode-tab__btn {
  color: var(--color-fg-secondary);
  border-color: var(--color-border-strong);
  background: color-mix(in srgb, var(--color-bg-surface) 75%, var(--color-bg-canvas));
}
.mode-tab__btn:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }

.mode-pop {
  position: absolute;
  bottom: calc(100% + var(--space-1));
  left: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: calc(100vw - 2 * var(--space-4));
  overflow: hidden;
  background: var(--color-bg-surface-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-pop);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
}
.mode-pop__opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: var(--space-3) var(--space-4) var(--space-3) calc(var(--space-4) + 14px);
  position: relative;
  border: none;
  background: transparent;
  color: var(--color-fg-primary);
  font-family: var(--font-ui);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.mode-pop__opt + .mode-pop__opt { border-top: 1px solid var(--color-border-subtle); }
.mode-pop__opt span { font-size: 11px; color: var(--color-fg-muted); }
/* A dot marks the mode in force. */
.mode-pop__opt[aria-checked="true"]::before {
  content: "";
  position: absolute;
  left: var(--space-4);
  top: calc(var(--space-3) + 6px);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-state-active);
}
.mode-pop__opt:hover,
.mode-pop__opt:focus-visible {
  outline: none;
  background: var(--color-bg-inset);
  color: var(--color-bg-canvas);
}
.mode-pop__opt:hover span,
.mode-pop__opt:focus-visible span { color: inherit; }

/* Desktop-only pieces; the media block below shows them. */
.column-grips,
.composer__tools { display: none; }

/* ============================================================
 * Conversation column and composer — desktop and iPad
 *
 * The transcript column and the composer card share one width,
 * --layout-content-max, which the grips on the column's edges drag.
 * The composer is a rounded card like the phone's: the text box grows
 * as you type, and one row under it holds the meeting status, the
 * settings and End popovers, New, and the round Start / Pause / Send
 * button. The hidden #btn-pause keeps the state machine.
 * ============================================================ */
@media not ((max-width: 600px) and (orientation: portrait)) {
  .app {
    /* The side margin that centres a --layout-content-max column in the
     * transcript cell the way .transcript__inner is centred: never under
     * the transcript's padding, with the scrollbar gutter (--sbw, measured
     * by wireColumnResize) taken off the right side only. */
    --col-side: max(var(--space-6), (100% - var(--sbw, 0px) - var(--layout-content-max)) / 2);
  }

  .controlbar { display: none; }

  /* The text-size buttons zoom the inner column; divide so its on-screen
   * width stays the chosen width at every text size. */
  .transcript__inner {
    max-width: calc(var(--layout-content-max) / var(--transcript-scale, 1));
  }

  /* ---- Width grips -------------------------------------------------- */
  .column-grips {
    display: block;
    grid-column: 2;
    grid-row: 2 / 4;
    position: relative;
    z-index: 4;
    margin: 0 calc(var(--col-side) + var(--sbw, 0px)) 0 var(--col-side);
    pointer-events: none;
    --grip-w: 16px;
    --grip-gap: 14px;  /* grip centre to column edge */
  }
  .column-grip {
    position: absolute;
    top: var(--space-3);
    bottom: var(--space-4);
    width: var(--grip-w);
    pointer-events: auto;
    cursor: col-resize;
    touch-action: none;
  }
  .column-grip[data-side="left"]  { right: calc(100% + var(--grip-gap) - var(--grip-w) / 2); }
  .column-grip[data-side="right"] { left:  calc(100% + var(--grip-gap) - var(--grip-w) / 2); }
  /* Invisible until reached for. A hairline marks the column edge and a
   * short bar marks the handle; both edges light together because they
   * move together. */
  .column-grip::before,
  .column-grip::after {
    content: "";
    position: absolute;
    left: 50%;
    background: var(--color-state-active);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--motion-medium-duration) var(--ease-out);
  }
  .column-grip::before {
    top: 0;
    bottom: 0;
    width: 1px;
    margin-left: -0.5px;
  }
  .column-grip::after {
    top: 50%;
    width: 4px;
    height: 44px;
    margin: -22px 0 0 -2px;
    border-radius: 2px;
  }
  .column-grips:has(.column-grip:hover) .column-grip::before,
  .column-grips:has(.column-grip--active) .column-grip::before { opacity: 0.45; }
  .column-grip:hover::after,
  .column-grip--active::after { opacity: 0.9; }
  body.column-resizing {
    cursor: col-resize;
    user-select: none;
  }

  /* ---- The card ------------------------------------------------------- */
  .composer {
    z-index: 5;
    min-height: 0;
    margin: var(--space-1) calc(var(--col-side) + var(--sbw, 0px)) var(--space-4) var(--col-side);
    padding: var(--space-3) var(--space-3) var(--space-3) var(--space-5);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-composer);
    background: var(--color-bg-surface);
    box-shadow: none;
    transition: border-color var(--motion-medium-duration) var(--ease-out),
                box-shadow var(--motion-medium-duration) var(--ease-out);
  }
  /* Focus lights the card's edge in the accent, with a soft halo that
   * breathes. Every colour is a token, so all themes follow. */
  .composer:focus-within {
    border-color: var(--color-state-active);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-state-active) 18%, transparent);
    animation: composer-breathe 4s ease-in-out infinite;
  }
  @keyframes composer-breathe {
    50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-state-active) 7%, transparent); }
  }
  /* The transcript fades into the card instead of stopping at a line. */
  .composer::before,
  .composer:focus-within::before {
    top: auto;
    bottom: calc(100% + var(--space-1) + 1px);
    height: var(--space-5);
    background: linear-gradient(to bottom, transparent, var(--color-bg-canvas));
    opacity: 1;
    animation: none;
  }

  .composer__input {
    display: block;
    padding: 0;
    overflow-y: auto;
  }

  /* The height grip rides the card's top edge, clear of the corners. */
  .composer-resizer {
    top: -6px;
    left: var(--space-6);
    right: var(--space-6);
    height: 11px;
    touch-action: none;
  }
  .composer-resizer::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 44px;
    height: 4px;
    margin: -2px 0 0 -22px;
    border-radius: 2px;
    background: var(--color-state-active);
    opacity: 0;
    transition: opacity var(--motion-medium-duration) var(--ease-out);
  }
  .composer-resizer:hover::after,
  .composer-resizer--active::after { opacity: 0.9; }

  @media (pointer: coarse) {
    .column-grips { --grip-w: 28px; }
    .composer-resizer { top: -12px; height: 24px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .composer:focus-within { animation: none; }
  }

  /* ---- The row under the text --------------------------------------- */
  .composer__bar {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    margin-top: var(--space-2);
  }
  .composer__status {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    overflow: hidden;
    white-space: nowrap;
  }
  .composer__status > * { margin-left: 0; flex: 0 0 auto; }
  .composer__status .pacing { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .composer__status .badge-queue { padding: 3px var(--space-3); }

  .composer__tools {
    display: flex;
    align-items: center;
    gap: var(--space-1);
  }
  /* Not a positioning box: popovers anchor to the card itself, so they
   * open above it rather than over the text. */
  .composer__pop-wrap { display: flex; }
  /* End is offered only while the meeting runs; once it has ended, New
   * and Start take over. */
  .composer__end:has(#btn-end[hidden]),
  .composer__end:has(#btn-end[data-ended]) { display: none; }

  .composer__tool {
    width: 34px;
    height: 34px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: var(--radius-control);
    background: transparent;
    color: var(--color-fg-muted);
    cursor: pointer;
    transition: background var(--motion-fast-duration) var(--ease-out),
                color var(--motion-fast-duration) var(--ease-out);
  }
  .composer__tool:hover,
  .composer__tool[aria-expanded="true"] {
    background: var(--color-bg-surface-elevated);
    color: var(--color-fg-primary);
  }
  .composer__tool:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }

  .composer .btn-new {
    height: 36px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-control);
    font-size: 14px;
  }

  .composer__action {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: var(--radius-control);
    background: var(--color-bg-inset);
    color: var(--color-bg-canvas);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--motion-fast-duration) var(--ease-out),
                opacity var(--motion-fast-duration) var(--ease-out);
  }
  .composer__action:hover:not(:disabled) { background: var(--color-state-active); }
  .composer__action:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }
  .composer__action:disabled { opacity: 0.4; cursor: default; }
  /* Start / Resume: a labeled pill, not a circle. */
  .composer__action[data-mode="start"] {
    width: auto;
    padding: 0 var(--space-4);
    font-family: var(--font-ui);
    font-size: 15px;
    font-weight: 600;
  }

  /* ---- Popovers (settings, End, New) ---------------------------------- */
  /* Each opens upward from the card's top-right corner. */
  .composer-pop,
  .composer .new-menu {
    position: absolute;
    bottom: calc(100% + var(--space-2));
    right: 0;
    left: auto;
    z-index: 30;
    background: var(--color-bg-surface-elevated);
    border: 1px solid var(--color-border-subtle);
    border-radius: var(--radius-pop);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  }
  .composer-pop {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .tune-pop {
    gap: var(--space-3);
    padding: var(--space-4);
    width: 340px;
  }
  .tune-pop .verbosity { margin-left: 0; gap: var(--space-3); }
  .tune-pop .verbosity__label,
  .tune-pop__label {
    flex: 0 0 88px;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--color-fg-muted);
  }
  .tune-pop .verbosity__slider { flex: 1 1 auto; width: auto; min-width: 0; }
  .tune-pop .verbosity__value { min-width: 58px; }
  .tune-pop__row {
    display: flex;
    align-items: center;
    gap: var(--space-3);
  }
  .tune-pop .transcript__tools {
    margin: 0;
    pointer-events: auto;
  }

  .end-pop { min-width: 250px; }
  .end-pop .btn-end,
  .end-pop .btn-force-end {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    padding: var(--space-3) var(--space-4);
    border: none;
    border-radius: 0;
    background: transparent;
    color: var(--color-fg-primary);
    font-size: 13px;
    text-align: left;
  }
  .end-pop .btn-force-end {
    border-top: 1px solid var(--color-border-subtle);
    color: var(--color-state-warning);
  }
  .end-pop .btn-end::after,
  .end-pop .btn-force-end::after {
    content: attr(data-hint);
    font-size: 11px;
    font-weight: 400;
    color: var(--color-fg-muted);
  }
  .end-pop .btn-end:hover:not(:disabled),
  .end-pop .btn-end:focus-visible,
  .end-pop .btn-force-end:hover:not(:disabled),
  .end-pop .btn-force-end:focus-visible {
    background: var(--color-bg-inset);
    color: var(--color-bg-canvas);
    box-shadow: none;
  }
  .end-pop .btn-end:hover::after,
  .end-pop .btn-end:focus-visible::after,
  .end-pop .btn-force-end:hover::after,
  .end-pop .btn-force-end:focus-visible::after { color: inherit; }
  .end-pop .btn-end--wrapping { color: var(--color-state-active); }
}

/* ============================================================
 * Phase 3.5 — roster row actions, end-meeting controls, dialog
 *
 * Tokens-only: no hard-coded colors, no inline pseudo-system. Roster
 * actions reuse the InterjectButton dormant/armed vocabulary so the
 * sidebar feels like one design.
 * ============================================================ */

/* --- Roster header "+" button (opens the add-participant dialog) --- */

.roster__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.roster__label-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.roster__add-btn {
  background: transparent;
  border: 1px solid var(--color-fg-faint);
  border-radius: var(--radius-1);
  color: var(--color-fg-faint);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
  width: 20px;
  height: 20px;
  padding: 0;
  cursor: pointer;
  transition: color var(--motion-fast-duration) var(--ease-out),
              border-color var(--motion-fast-duration) var(--ease-out);
}
.roster__add-btn:hover {
  color: var(--color-fg-primary);
  border-color: var(--color-fg-primary);
}
.roster__add-btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

/* --- Team tabs: which preset roster is seated --- */
.team-tabs {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-1);
  padding: 0 var(--space-4);
  margin-bottom: var(--space-3);
}
.team-tabs__list {
  display: flex;
  flex-wrap: wrap;
  flex: 1;
  gap: var(--space-1);
}
.team-tab {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-fg-secondary);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  padding: var(--space-2);
  white-space: nowrap;
  cursor: pointer;
  transition: color var(--motion-fast-duration) var(--ease-out),
              border-color var(--motion-fast-duration) var(--ease-out);
}
.team-tab:hover { color: var(--color-fg-primary); }
.team-tab--active {
  color: var(--color-fg-primary);
  border-bottom-color: var(--color-state-active);
}
.team-tab--modified::after {
  content: " •";
  color: var(--color-state-active);
}
.team-tab:focus-visible {
  outline: none;
  border-radius: var(--radius-2);
  box-shadow: var(--shadow-focus-ring);
}
.team-tabs .roster__add-btn {
  margin-bottom: var(--space-2);
}

/* --- Dialog extras for the team editor --- */
.dialog__input {
  display: block;
  width: 100%;
  box-sizing: border-box;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-fg-primary);
  background: var(--color-bg-canvas);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-2);
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
}
.dialog__input:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}
.dialog__check-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  padding-left: 5px;
  cursor: pointer;
}
.dialog__check-row input { accent-color: var(--color-state-active); }
.dialog__check-row .dialog__row-name { flex: 1 1 auto; min-width: 0; }
.dialog__check-row .dialog__row-model { flex: 0 1 auto; min-width: 0; text-align: right; padding-right: 8px; }
.dialog__btn--primary {
  background: var(--color-bg-inset);
  border: 1px solid var(--color-bg-inset);
  color: var(--color-bg-canvas);
}
.dialog__btn--primary:hover { opacity: 0.92; }

/* --- Roster row actions: leader toggle + remove --- */

.roster-row {
  /* Never let the row's content push the sidebar wider than its grid
   * track (which would cause a horizontal scrollbar on the whole app). */
  min-width: 0;
}
.roster-row__line1 {
  /* Single line: chip + name + actions. The name truncates with ellipsis
   * before anything wraps — predictable layout at every panel width. */
  flex-wrap: nowrap;
  min-width: 0;
}
.roster-row__name {
  min-width: 0;
  flex: 1 1 auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.roster-row__actions {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
  flex: 0 0 auto;
}
/* Quiet rows: per-row actions and the drag handle appear on hover or
 * keyboard focus. The ACTIVE leader badge stays visible always — that's
 * state, not an action. */
.roster-row .roster-row__actions .roster-action,
.roster-row .roster-row__handle {
  opacity: 0;
  transition: opacity var(--motion-fast-duration) var(--ease-out);
}
.roster-row:hover .roster-action,
.roster-row:focus-within .roster-action,
.roster-row:hover .roster-row__handle,
.roster-row:focus-within .roster-row__handle,
.roster-row .roster-action--leader-on {
  opacity: 1;
}

/* Drag handle: only the handle is grabbable; the row's draggable=true is
 * set on mousedown of the handle and cleared on dragend. Wrapping the
 * symbol in a non-text-selectable span keeps the cursor sane. */
.roster-row__handle {
  cursor: grab;
  color: var(--color-fg-faint);
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  user-select: none;
  flex: 0 0 auto;
}
.roster-row__handle:hover { color: var(--color-fg-muted); }
.roster-row__handle:active { cursor: grabbing; }
.roster-row--dragging { opacity: 0.4; }

/* Grip slot: the animated persona face lives here, with the drag handle
 * stacked on top. At rest you see the face; hovering the row fades the
 * handle in over it so the row stays draggable with zero extra width. */
.roster-row__grip {
  position: relative;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
}
.roster-row__face {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity var(--motion-fast-duration) var(--ease-out);
}
.roster-row__face svg {
  width: 100%;
  height: 100%;
  display: block;
}
.roster-row__grip .roster-row__handle {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.roster-row:hover .roster-row__grip .roster-row__face,
.roster-row:focus-within .roster-row__grip .roster-row__face {
  opacity: 0.15;
}
/* The human row has no face, so its bare handle takes the same 30px slot
 * and its chip lines up with the AI rows. */
.roster-row[data-role="human"] > .roster-row__line1 > .roster-row__handle {
  width: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.roster-action {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 8px;
  background: transparent;
  border: 1px solid var(--color-fg-faint);
  color: var(--color-fg-faint);
  border-radius: var(--radius-1);
  cursor: pointer;
  transition: color var(--motion-fast-duration) var(--ease-out),
              border-color var(--motion-fast-duration) var(--ease-out);
}
.roster-action:hover {
  color: var(--color-fg-primary);
  border-color: var(--color-fg-primary);
}
.roster-action:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

/* Leader toggle in "off" state (default) looks like the dormant Interject
 * button. In "on" state, it picks up the active state-token color — same
 * pattern QueueBadge uses to mean "actively happening". */
.roster-action--leader-on {
  border-color: var(--color-state-active);
  color: var(--color-state-active);
}
.roster-action--remove {
  font-size: 14px;
  padding: 0;
  width: 22px;
  text-align: center;
}

/* Active leader: subtle ring on the chip so the leader is visible even
 * when the row has scrolled or the actions column is offscreen. */
.roster-row--leader .chip {
  box-shadow: 0 0 0 2px var(--color-state-active);
}

/* --- End-meeting button in the ControlBar (matches Pause) --- */

.btn-end {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: 8px;
  background: transparent;
  border: 1px solid var(--color-fg-muted);
  color: var(--color-fg-muted);
  cursor: pointer;
  transition: color var(--motion-fast-duration) var(--ease-out),
              border-color var(--motion-fast-duration) var(--ease-out);
}
.btn-end:hover {
  color: var(--color-fg-primary);
  border-color: var(--color-fg-primary);
}
.btn-end:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}
.btn-end[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

/* --- End-of-meeting prompt: sticky overlay so the user can always see it
 *     regardless of transcript scroll position. --- */

.end-prompt-banner {
  position: fixed;
  left: 50%;
  bottom: calc(var(--layout-controlbar-height) + var(--layout-composer-min) + 12px);
  transform: translateX(-50%);
  z-index: 90;
  min-width: 420px;
  max-width: 720px;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-radius: var(--radius-2);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}
.end-prompt-banner__text {
  flex: 1;
}
.end-prompt-banner__btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: var(--radius-1);
  cursor: pointer;
  white-space: nowrap;
}
.end-prompt-banner__btn--confirm {
  background: var(--color-bg-inset);
  color: var(--color-bg-canvas);
  border: 1px solid var(--color-bg-inset);
}
.end-prompt-banner__btn--cancel {
  background: transparent;
  border: 1px solid var(--color-fg-muted);
  color: var(--color-fg-primary);
}
.end-prompt-banner__btn:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

/* --- Add-participant dialog --- */

.dialog {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2);
  background: var(--color-bg-surface);
  color: var(--color-fg-primary);
  padding: 0;
  width: min(484px, 92vw);
  /* The list scrolls vertically inside; the dialog itself never scrolls sideways. */
  overflow-x: hidden;
  box-shadow: var(--shadow-elevation-2, 0 12px 32px rgba(0,0,0,0.12));
}
.dialog--wide {
  width: min(680px, 94vw);
}
.dialog__list.dialog__list--tall {
  max-height: min(60vh, 640px);
}
.dialog__list li.dialog__group {
  display: block;
  padding: 0;
  background: var(--color-bg-surface);
  position: sticky;
  top: 0;
  z-index: 1;
}
.dialog__group-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-2) var(--space-2) 5px;
  background: none;
  border: none;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-fg-faint);
  cursor: pointer;
  text-align: left;
}
.dialog__group-toggle:hover { color: var(--color-fg-secondary); }
.dialog__group-toggle:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); border-radius: var(--radius-2); }
.dialog__group-chevron {
  display: inline-block;
  width: 0;
  height: 0;
  border-left: 5px solid currentColor;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transform: rotate(90deg);
  transition: transform var(--motion-fast-duration) var(--ease-out);
}
.dialog__group--collapsed .dialog__group-chevron { transform: rotate(0deg); }
.dialog::backdrop {
  background: rgba(0, 0, 0, 0.32);
}
.dialog__form {
  padding: var(--space-5);
  margin: 0;
}
.dialog__title {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 var(--space-2);
  color: var(--color-fg-primary);
}
.dialog__subtitle {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-fg-muted);
  margin: 0 0 var(--space-4);
}
.dialog__subtitle code {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 1px 4px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-1);
}
.dialog__list {
  /* Clicking around checkboxes and accordion headings must never start a
   * text selection; only the model id stays selectable (copy-paste). */
  user-select: none;
  list-style: none;
  padding: 0;
  margin: 0 0 var(--space-4);
  max-height: 280px;
  overflow-y: auto;
  border-top: 1px solid var(--color-border-subtle);
  border-bottom: 1px solid var(--color-border-subtle);
}
.dialog__list li {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--color-border-subtle);
}
.dialog__list li:last-child { border-bottom: none; }
.dialog__row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.dialog__row-name {
  font-family: var(--font-body);
  font-size: 14px;
}
.dialog__row-model {
  user-select: text;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-fg-muted);
  word-break: break-all;
}
.dialog__empty {
  text-align: center;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--color-fg-faint);
  padding: var(--space-5) 0;
}
.dialog__menu {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
}
.dialog__btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-2) var(--space-4);
  border-radius: 8px;
  cursor: pointer;
}
.dialog__btn--danger {
  background: var(--color-state-warning);
  border: 1px solid var(--color-state-warning);
  color: var(--color-bg-canvas);
}
.dialog__btn--danger:hover {
  opacity: 0.92;
}
.dialog__suppress {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-3) 0 var(--space-4);
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-fg-muted);
  cursor: pointer;
}
.dialog__suppress input { accent-color: var(--color-state-active); }

.meetings-drawer__item {
  position: relative;
}
.meetings-drawer__item-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  color: var(--color-fg-faint);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  border-radius: var(--radius-1);
  opacity: 0;
  transition: opacity var(--motion-fast-duration) var(--ease-out);
}
.meetings-drawer__item:hover .meetings-drawer__item-delete { opacity: 1; }
.meetings-drawer__item-delete:hover {
  color: var(--color-state-warning);
  border-color: var(--color-state-warning);
}

.dialog__btn--ghost {
  background: transparent;
  border: 1px solid var(--color-fg-muted);
  color: var(--color-fg-primary);
}
.dialog__btn--ghost:hover {
  border-color: var(--color-fg-primary);
}

/* Mock-mode banner — fixed top, visually loud, can't be missed. */
.mock-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  background: var(--color-state-warning);
  color: var(--color-bg-canvas);
  font-family: var(--font-ui);
  font-size: 13px;
  text-align: center;
  border-bottom: 1px solid var(--color-fg-primary);
}
.mock-banner strong {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* Disconnect banner — appears the moment the WS errors or closes.
 * .signed-out-banner is the same treatment for a 4401 close (the session
 * cookie went away), kept as its own class so it can appear even when a
 * disconnect banner is already on screen.
 * Distinct from .mock-banner: error semantics, not warning. */
.disconnected-banner,
.signed-out-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 110;
  padding: var(--space-3) var(--space-4);
  background: var(--color-state-error);
  color: var(--color-bg-canvas);
  font-family: var(--font-ui);
  font-size: 14px;
  text-align: center;
  border-bottom: 2px solid var(--color-fg-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}
.disconnected-banner strong,
.signed-out-banner strong {
  font-family: var(--font-mono);
  margin-right: var(--space-2);
}

/* --- Rendered-markdown inside .msg__body --------------------------------- */

.msg__body p {
  margin: 0 0 var(--space-3) 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 26px;
  color: var(--color-fg-primary);
}
.msg__body p:last-child { margin-bottom: 0; }

/* Lists indent like a document outline: the number or bullet itself sits
 * about a quarter inch in from the text, the item's text further, and a
 * nested list lines its bullets up under the item's text. */
.msg__body ul,
.msg__body ol {
  margin: 0 0 var(--space-3);
  padding: 0 0 0 3em;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 26px;
  color: var(--color-fg-primary);
}
.msg__body li { margin-bottom: var(--space-1); }
.msg__body li > ul,
.msg__body li > ol {
  margin: var(--space-1) 0 var(--space-2);
  padding-left: 1.5em;
}
.msg__body ol > li::marker { font-weight: 600; }
/* Room between numbered items, so each reads as its own section. */
.msg__body ol > li + li { margin-top: var(--space-2); }

.msg__body strong {
  font-weight: 600;
  color: var(--color-fg-primary);
}
.msg__body em { font-style: italic; }

.msg__body code {
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 1px 6px;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-1);
}

/* --- Rendered-markdown tables inside .msg__body -------------------------- */

.msg-table {
  border-collapse: collapse;
  margin: var(--space-3) 0;
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 22px;
  width: 100%;
  max-width: 100%;
  /* Tables are dense data; let them scroll horizontally rather than
   * blow out the message bubble on narrow viewports. */
  display: block;
  overflow-x: auto;
}
.msg-table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--color-fg-primary);
  background: var(--color-bg-elevated);
  border-bottom: 2px solid var(--color-border);
  padding: 8px 12px;
  white-space: nowrap;
}
.msg-table tbody td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-subtle);
  color: var(--color-fg-primary);
  vertical-align: top;
}
.msg-table tbody tr:last-child td {
  border-bottom: none;
}
.msg-table tbody tr:hover td {
  background: var(--color-bg-elevated);
}

/* --- Rendered-markdown headings inside .msg__body ------------------------ */

.msg__body h1, .msg__body h2, .msg__body h3,
.msg__body h4, .msg__body h5, .msg__body h6 {
  font-family: var(--font-body);
  font-weight: 600;
  line-height: 1.3;
  margin: var(--space-4) 0 var(--space-2) 0;
  color: var(--color-fg-primary);
}
.msg__body h1:first-child, .msg__body h2:first-child,
.msg__body h3:first-child, .msg__body h4:first-child,
.msg__body h5:first-child, .msg__body h6:first-child {
  margin-top: 0;
}
.msg__body h1 { font-size: 22px; }
.msg__body h2 { font-size: 19px; }
.msg__body h3 { font-size: 17px; }
.msg__body h4 { font-size: 15px; }
.msg__body h5 { font-size: 14px; }
.msg__body h6 { font-size: 13px; color: var(--color-fg-muted); }

/* Visible "wrapping up" state for the End Meeting button. Stays disabled-
 * looking but with a subtle accent so the user knows the click landed. */
.btn-end--wrapping {
  border-color: var(--color-state-active);
  color: var(--color-state-active);
  opacity: 1;  /* override the default disabled fade */
}

/* --- Fenced code blocks inside .msg__body ------------------------------- */

.msg-code {
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-2);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-3) 0;
  overflow-x: auto;
  position: relative;
}
.msg-code code {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 20px;
  color: var(--color-fg-primary);
  white-space: pre;
  background: none;
  padding: 0;
  border: none;
}
/* Show the language tag in the corner if present. */
.msg-code[data-lang]:not([data-lang=""])::before {
  content: attr(data-lang);
  position: absolute;
  top: 4px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-fg-faint);
}

/* Editable human-name button in the roster — looks like the name text but
 * hints it's clickable. */
.roster-row__name--editable {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--color-fg-primary);
  cursor: pointer;
  text-align: left;
}
.roster-row__name--editable:hover {
  color: var(--color-state-active);
}
.roster-row__name--editable:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
  border-radius: var(--radius-1);
}

/* ============================================================
 * Saved-meetings drawer
 * ============================================================ */

.header__menu {
  background: transparent;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-2);
  color: var(--color-fg-muted);
  font-size: 16px;
  line-height: 1;
  width: 32px;
  height: 32px;
  cursor: pointer;
  padding: 0;
}
.header__menu:hover {
  color: var(--color-fg-primary);
  border-color: var(--color-fg-muted);
}
.header__menu:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}

.meetings-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--drawer-width, 300px);
  max-width: 86vw;
  background: var(--color-bg-surface);
  border-right: 1px solid var(--color-border);
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.28);
  z-index: 120;
  transform: translateX(-100%);
  transition: transform var(--motion-fast-duration, 160ms) var(--ease-out, ease);
  display: flex;
  flex-direction: column;
  padding: var(--space-4);
}
.meetings-drawer__resizer {
  position: absolute;
  top: 0;
  right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
  z-index: 1;
}
.meetings-drawer__resizer:hover,
.meetings-drawer__resizer--active {
  background: var(--color-state-active);
  opacity: 0.5;
}
.meetings-drawer--open {
  transform: translateX(0);
}
.meetings-drawer__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}
.meetings-drawer__title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-fg-faint);
}
.meetings-drawer__close {
  background: none;
  border: none;
  color: var(--color-fg-muted);
  font-size: 15px;
  cursor: pointer;
  padding: 2px 6px;
}
.meetings-drawer__close:hover { color: var(--color-fg-primary); }

.meetings-drawer__new {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: var(--space-2) var(--space-3);
  margin-bottom: var(--space-4);
  background: var(--color-bg-inset);
  color: var(--color-bg-canvas);
  border: none;
  border-radius: var(--radius-2);
  cursor: pointer;
}
.meetings-drawer__new:hover { opacity: 0.92; }

.meetings-drawer__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  flex: 1;
}
.meetings-drawer__item {
  padding: var(--space-3);
  border-radius: var(--radius-2);
  cursor: pointer;
  border: 1px solid transparent;
}
.meetings-drawer__item:hover {
  background: var(--color-bg-elevated);
  border-color: var(--color-border-subtle);
}
.meetings-drawer__item--current {
  border-color: var(--color-state-active);
}
.meetings-drawer__item-title {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--color-fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meetings-drawer__item-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--color-fg-faint);
  margin-top: 2px;
}
.meetings-drawer__empty {
  font-family: var(--font-body);
  font-style: italic;
  font-size: 13px;
  color: var(--color-fg-faint);
  padding: var(--space-3);
}

.meetings-scrim {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.28);
  z-index: 115;
}
.meetings-scrim[hidden] { display: none; }

/* ============================================================
 * Auth pages (login / signup / reset / profile) — centered card
 * ============================================================ */
.auth {
  min-height: calc(100vh / var(--ui-scale));
  display: grid;
  place-items: center;
  padding: var(--space-6) var(--space-4);
  background: var(--color-bg-canvas);
  font-family: var(--font-ui);
  color: var(--color-fg-primary);
}
.auth__card {
  width: 100%;
  max-width: 420px;
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-2);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.auth__brand {
  display: flex; align-items: center; gap: var(--space-2);
  font-family: var(--font-body); font-size: 18px; text-decoration: none; color: inherit;
}
.auth__logo { height: 40px; width: auto; filter: var(--logo-filter); }
.auth__title { font-family: var(--font-body); font-weight: 500; font-size: 24px; margin: 0; }
.auth__errors {
  margin: 0; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-state-error); color: var(--color-state-error);
  border-radius: var(--radius-2); list-style: none; font-size: 14px;
}
.auth__form { display: flex; flex-direction: column; gap: var(--space-3); }
.auth__field { display: flex; flex-direction: column; gap: var(--space-1); font-size: 13px; color: var(--color-fg-secondary); }
.auth__field input {
  font: inherit; font-size: 15px; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-2);
  background: var(--color-bg-canvas); color: var(--color-fg-primary);
}
.auth__field input:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }
.auth__check { display: flex; align-items: center; gap: var(--space-2); font-size: 14px; }
.auth__submit {
  font: inherit; font-weight: 600; padding: var(--space-2) var(--space-4);
  background: var(--color-bg-inset); color: var(--color-bg-canvas);
  border: none; border-radius: var(--radius-2); cursor: pointer;
}
.auth__submit:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }
.auth__link-btn { background: none; border: none; color: var(--color-fg-muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; padding: 0; }
.auth__or { display: flex; align-items: center; gap: var(--space-3); color: var(--color-fg-faint); font-size: 12px; }
.auth__or::before, .auth__or::after { content: ''; flex: 1; border-top: 1px solid var(--color-border-subtle); }
.auth__oauth { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.auth__oauth-btn {
  flex: 1; text-align: center; padding: var(--space-2) var(--space-3); font-size: 14px;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-2);
  color: var(--color-fg-primary); text-decoration: none;
}
.auth__links, .auth__text { font-size: 14px; color: var(--color-fg-muted); margin: 0; }
.auth__links a { color: var(--color-fg-secondary); }
.verify-banner {
  display: flex; align-items: center; gap: var(--space-3);
  padding: var(--space-2) var(--space-5); font-family: var(--font-ui); font-size: 13px;
  background: var(--color-bg-surface-elevated); border-bottom: 1px solid var(--color-border-subtle);
}
.verify-banner__form { display: inline; }
.verify-banner__resend, .verify-banner__dismiss {
  background: none; border: 1px solid var(--color-border-strong); border-radius: var(--radius-2);
  color: var(--color-fg-secondary); font: inherit; font-size: 12px; padding: 2px var(--space-2); cursor: pointer;
}
.verify-banner__dismiss { margin-left: auto; border: none; }

.auth__card--wide { max-width: 640px; }
.auth__form--row { flex-direction: row; align-items: center; }
.auth__input {
  flex: 1; font: inherit; font-size: 15px; padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-2);
  background: var(--color-bg-canvas); color: var(--color-fg-primary);
}
.auth__submit--danger { background: var(--color-state-error); color: var(--color-bg-canvas); }
.auth__toast { margin: 0; font-size: 14px; color: var(--color-state-active); }
.profile__section { display: flex; flex-direction: column; gap: var(--space-2); padding-top: var(--space-4); border-top: 1px solid var(--color-border-subtle); }
.profile__section h2 { margin: 0; font-family: var(--font-body); font-size: 17px; font-weight: 500; }
.profile__section--danger h2 { color: var(--color-state-error); }
.profile__row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; }
.badge { font-size: 11px; padding: 1px var(--space-2); border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); color: var(--color-fg-muted); margin-left: var(--space-2); }
.badge--ok { color: var(--color-state-active); border-color: var(--color-state-active); }
.theme-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: var(--space-2); }
.theme-tile { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: var(--space-2); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-2); cursor: pointer; font-size: 13px; }
.theme-tile:has(input:checked) { border-color: var(--color-state-active); box-shadow: var(--shadow-focus-ring); }
.theme-tile input { position: absolute; opacity: 0; width: 0; height: 0; }
.theme-tile__swatch { width: 100%; height: 28px; border-radius: var(--radius-2); border: 1px solid var(--color-border-subtle); }
.theme-tile--system .theme-tile__swatch { background: linear-gradient(90deg, #F6F2EA 50%, #15140F 50%); }
.theme-tile--light .theme-tile__swatch { background: #F6F2EA; }
.theme-tile--dark .theme-tile__swatch { background: #15140F; }
.theme-tile--retro .theme-tile__swatch { background: linear-gradient(90deg, #05182e 60%, #faa968 60%); }
.theme-tile--midnight .theme-tile__swatch { background: linear-gradient(90deg, #0b0c16 60%, #8b6dff 60%); }

/* ============================================================
 * Header avatar menu + welcome page
 * ============================================================ */
.header__link { font-family: var(--font-ui); font-size: 13px; color: var(--color-fg-secondary); text-decoration: none; padding: var(--space-1) var(--space-3); border: 1px solid transparent; border-radius: var(--radius-2); }
.header__link--primary { border-color: var(--color-border-strong); }
.avatar-menu { position: relative; }
.avatar-menu__btn {
  width: 32px; height: 32px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--color-persona-ink); color: var(--color-bg-canvas);
  font-family: var(--font-ui); font-size: 12px; font-weight: 700;
}
.avatar-menu__btn:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }
.avatar-menu__pop {
  position: absolute; right: 0; top: 40px; z-index: 30; min-width: 220px;
  background: var(--color-bg-surface); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-2);
  padding: var(--space-2); display: flex; flex-direction: column; gap: var(--space-1);
  font-family: var(--font-ui); font-size: 14px;
}
.avatar-menu__pop[hidden] { display: none; }
.avatar-menu__who { padding: var(--space-2); border-bottom: 1px solid var(--color-border-subtle); }
.avatar-menu__email { font-size: 12px; color: var(--color-fg-muted); }
.avatar-menu__item { display: block; width: 100%; text-align: left; padding: var(--space-2); color: var(--color-fg-primary); text-decoration: none; background: none; border: none; font: inherit; cursor: pointer; border-radius: var(--radius-2); }
.avatar-menu__item:hover { background: var(--color-bg-surface-elevated); }
.avatar-menu__item--investors::before { content: ""; display: inline-block; width: 6px; height: 6px; margin: 0 var(--space-2) 1px 1px; background: var(--color-state-active); transform: rotate(45deg); }
.avatar-menu__theme { display: flex; gap: var(--space-1); padding: var(--space-1) var(--space-2); }
.avatar-menu__theme-opt { flex: 1; font: inherit; font-size: 12px; padding: 2px var(--space-1); background: none; border: 1px solid var(--color-border-subtle); border-radius: var(--radius-2); color: var(--color-fg-secondary); cursor: pointer; }
.avatar-menu__theme-opt[aria-checked="true"] { border-color: var(--color-state-active); color: var(--color-fg-primary); }

/* dvh: the visible screen. iPad Safari's 100vh assumes its toolbar is
 * hidden, which pushed the footer's last line below the fold. */
.welcome { min-height: calc(100vh / var(--ui-scale)); min-height: calc(100dvh / var(--ui-scale)); display: flex; flex-direction: column; background: var(--color-bg-canvas); color: var(--color-fg-primary); isolation: isolate; overflow-x: clip; }
/* The living background (welcome-bg.js): fixed behind the content. isolation
 * above keeps its z-index -1 over the page background but under the copy. The
 * large viewport height stops iOS toolbar changes from resizing it. */
.welcome__bg { position: fixed; top: 0; left: 0; width: 100%; height: calc(100vh / var(--ui-scale)); height: calc(100lvh / var(--ui-scale)); z-index: -1; pointer-events: none; }
.welcome__header { display: flex; align-items: center; gap: var(--space-3); height: var(--layout-header-height); padding: 0 var(--space-5); border-bottom: 1px solid var(--color-border-subtle); }
.welcome__hero { max-width: 720px; margin: var(--space-8) auto var(--space-6); padding: 0 var(--space-4); text-align: center; display: flex; flex-direction: column; gap: var(--space-4); align-items: center; }
.welcome__title { font-family: var(--font-body); font-weight: 500; font-size: 34px; line-height: 1.2; margin: 0; }
.welcome__lede { font-family: var(--font-body); font-size: 18px; color: var(--color-fg-secondary); margin: 0; }
/* Three pitches share one grid cell, so the hero is as tall as the longest
 * and nothing below it jumps when they rotate (welcome-pitch.js). The waiting
 * ones sit off to the right; .welcome clips that so phones don't side-scroll. */
.welcome__slides { display: grid; }
.welcome__slide { grid-area: 1 / 1; display: flex; flex-direction: column; justify-content: center; gap: var(--space-4); opacity: 0; transform: translateX(48px); transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out); pointer-events: none; }
.welcome__slide.is-active { opacity: 1; transform: none; pointer-events: auto; transition-delay: 150ms; }
.welcome__slide.is-leaving { opacity: 0; transform: translateX(-48px); transition-delay: 0ms; }
.welcome__ticks { display: flex; gap: var(--space-2); }
.welcome__tick { position: relative; width: 28px; height: 16px; padding: 0; border: none; background: none; cursor: pointer; }
.welcome__tick::before, .welcome__tick::after { content: ''; position: absolute; left: 0; right: 0; top: 7px; height: 2px; background: var(--color-border-strong); }
.welcome__tick::after { background: var(--color-fg-secondary); transform: scaleX(0); transform-origin: left; }
.welcome__tick[aria-current="true"]::after { animation: welcome-tick 8s linear forwards; }
.welcome__hero.is-paused .welcome__tick::after { animation-play-state: paused; }
.welcome__tick:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }
@keyframes welcome-tick { to { transform: scaleX(1); } }
@media (prefers-reduced-motion: reduce) {
  .welcome__slide, .welcome__slide.is-leaving { transform: none; }
  .welcome__tick[aria-current="true"]::after { animation: none; transform: scaleX(1); }
}
.welcome__uses { font-family: var(--font-ui); font-size: 14px; color: var(--color-fg-muted); margin: 0; }
.welcome__cta { display: inline-block; padding: var(--space-3) var(--space-5); background: var(--color-bg-inset); color: var(--color-bg-canvas); font-family: var(--font-ui); font-weight: 600; text-decoration: none; border-radius: var(--radius-2); }
.welcome__features { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-4); max-width: 900px; margin: 0 auto; padding: 0 var(--space-4) var(--space-8); font-family: var(--font-ui); }
.welcome__feature { background: var(--color-bg-surface); background: color-mix(in srgb, var(--color-bg-surface) 84%, transparent); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); border: 1px solid var(--color-border-subtle); border-radius: var(--radius-2); padding: var(--space-4); }
.welcome__feature h2 { margin: 0 0 var(--space-2); font-family: var(--font-body); font-weight: 500; font-size: 18px; }
.welcome__feature p { margin: 0; font-size: 14px; color: var(--color-fg-secondary); }
.welcome__footer { margin-top: auto; padding: var(--space-4); text-align: center; font-family: var(--font-ui); font-size: 12px; color: var(--color-fg-faint); border-top: 1px solid var(--color-border-subtle); }
.welcome__footer a { color: var(--color-fg-muted); }
.welcome__powered { margin: 0 0 var(--space-1); }
/* Wherever the screen is taller than the page (desktop, iPad), share the
 * spare space evenly above the headline and below the cards, so the block
 * sits centred between header and footer. The phone keeps its layout. */
@media not ((max-width: 600px) and (orientation: portrait)) {
  .welcome__hero { margin-top: auto; padding-top: var(--space-7); }
  .welcome__features { margin-bottom: auto; padding-bottom: var(--space-7); }
  .welcome__footer { margin-top: 0; }
}

/* Privacy policy / terms: long-form text in the wide auth card. */
.legal { gap: var(--space-3); }
.legal h2 { font-family: var(--font-body); font-weight: 500; font-size: 17px; margin: var(--space-3) 0 0; }
.legal p, .legal ul { font-size: 14px; line-height: 1.6; color: var(--color-fg-secondary); margin: 0; }
.legal ul { padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.legal a { color: var(--color-fg-primary); }
.legal__meta { font-size: 13px; color: var(--color-fg-muted); }

/* --- Model menu: right-click a persona to pick its model ------------------
 * One popover for the whole page, positioned at the pointer. app.js moves it
 * inside whichever <dialog> is open, because a modal dialog paints in the
 * top layer and would otherwise cover it. */

.model-menu {
  position: fixed;
  z-index: 200;
  width: 400px;
  max-height: min(78vh, 560px);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-2);
  /* Same lift as the other popovers (.new-menu). */
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  font-family: var(--font-ui);
}
.model-menu__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-fg-primary);
}
.model-menu__default {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--color-fg-faint);
  word-break: break-all;
}
/* Segmented control: which axis the accordions group by. */
.model-menu__sort {
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-pill);
}
.model-menu__sort-seg {
  flex: 1 1 0;
  padding: 2px var(--space-2);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--color-fg-muted);
  background: transparent;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.model-menu__sort-seg[aria-pressed="true"] {
  background: var(--color-bg-inset);
  color: var(--color-bg-canvas);
}
.model-menu__sort-seg:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }
/* Accordion headings, the persona selector's vocabulary at menu scale. */
.model-menu__group {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  padding: var(--space-3) var(--space-2) 5px 5px;
  background: var(--color-bg-surface);
  border: none;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-fg-faint);
  cursor: pointer;
  text-align: left;
}
.model-menu__group:hover { color: var(--color-fg-secondary); }
.model-menu__group:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); border-radius: var(--radius-2); }
.model-menu__group .dialog__group-chevron { transform: rotate(90deg); }
.model-menu__group[aria-expanded="false"] .dialog__group-chevron { transform: rotate(0deg); }
.model-menu__group-count { margin-left: auto; font-weight: 400; letter-spacing: 0; }
.model-menu__filter {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-fg-primary);
  background: var(--color-bg-canvas);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-1);
  padding: 4px var(--space-2);
}
.model-menu__filter:focus-visible {
  outline: none;
  box-shadow: var(--shadow-focus-ring);
}
.model-menu__list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  /* Keep the price column off the scrollbar. */
  padding-right: var(--space-2);
}
.model-menu__item {
  position: relative;
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  width: 100%;
  text-align: left;
  /* Names start where the group heading's text starts (chevron + gap);
   * the check mark sits in that left padding rather than in its own column. */
  padding: 6px var(--space-2) 6px 18px;
  border: none;
  border-radius: var(--radius-1);
  background: transparent;
  color: var(--color-fg-primary);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
}
.model-menu__item[aria-current="true"] {
  color: var(--color-state-active);
}
/* Hover wins over the current-item tint, which would otherwise be unreadable
 * on the inverted background. */
.model-menu__item:hover,
.model-menu__item[aria-current="true"]:hover {
  background: var(--color-bg-inset);
  color: var(--color-bg-canvas);
}
.model-menu__check {
  position: absolute;
  left: 4px;
  top: 7px;
  font-size: 10px;
}
.model-menu__label {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Fixed columns so the dot clusters and prices line up down the list. */
.model-menu__tier {
  flex: 0 0 52px;
  font-size: 9px;
  letter-spacing: 2px;
  color: var(--color-fg-faint);
}
.model-menu__tier b { font-weight: 400; color: var(--color-fg-muted); }
.model-menu__price {
  flex: 0 0 96px;
  text-align: right;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--color-fg-faint);
}
.model-menu__item[aria-current="true"] .model-menu__tier b,
.model-menu__item[aria-current="true"] .model-menu__price { color: var(--color-state-active); }
.model-menu__item:hover .model-menu__tier,
.model-menu__item:hover .model-menu__tier b,
.model-menu__item:hover .model-menu__price { color: var(--color-bg-canvas); }
.model-menu__empty {
  font-size: 12px;
  color: var(--color-fg-faint);
  padding: var(--space-2);
}
.model-menu__scope {
  display: flex;
  gap: var(--space-3);
  border-top: 1px solid var(--color-border-subtle);
  padding-top: var(--space-2);
  font-size: 12px;
  color: var(--color-fg-muted);
}
.model-menu__scope-opt {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}
.model-menu__scope-opt input { accent-color: var(--color-state-active); }
.model-menu__foot {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}
.model-menu__btn {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 3px var(--space-3);
  border-radius: var(--radius-1);
  background: transparent;
  border: 1px solid var(--color-fg-muted);
  color: var(--color-fg-primary);
  cursor: pointer;
}
.model-menu__btn:hover { border-color: var(--color-fg-primary); }
.model-menu__btn--reset { margin-right: auto; }
/* A selector row whose persona carries an override. */
.dialog__row-model--custom { color: var(--color-state-active); }

/* ---- Bug reporter (backlog F1) -------------------------------------------- */
/* Corner icon. Fixed to the viewport so it stays put whether the
   participants panel is open or tucked away. Muted at rest. */
.bug-btn {
  position: fixed;
  left: 12px;
  bottom: 12px;
  z-index: 7;
  width: 32px;
  height: 32px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--color-border-strong);
  border-radius: 8px;
  background: var(--color-bg-surface-elevated);
  color: var(--color-fg-muted);
  cursor: pointer;
  transition: color var(--motion-fast-duration) var(--ease-out);
}
.bug-btn:hover,
.bug-btn:focus-visible { color: var(--color-fg-primary); }
.bug-btn:focus-visible { outline: none; box-shadow: var(--shadow-focus-ring); }
/* Visually hidden on desktop; phone.css shows it inside the Meeting sheet. */
.bug-btn__label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.bug-kind { display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0 0 var(--space-4); }
.bug-kind__pill { position: relative; }
.bug-kind__pill input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.bug-kind__pill span {
  display: inline-block;
  padding: var(--space-1) var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--color-fg-secondary);
  cursor: pointer;
}
.bug-kind__pill input:checked + span {
  background: var(--color-bg-inset);
  border-color: var(--color-bg-inset);
  color: var(--color-bg-canvas);
}
.bug-kind__pill input:focus-visible + span { box-shadow: var(--shadow-focus-ring); }

.bug-field { display: block; }
.bug-field__label {
  display: block;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--color-fg-secondary);
  margin-bottom: var(--space-1);
}
.bug-textarea { resize: vertical; min-height: 110px; }

.bug-shot { display: flex; align-items: center; gap: var(--space-2); margin: 0 0 var(--space-4); }
.bug-shot__name {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--color-fg-muted);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bug-shot__clear {
  border: none;
  background: none;
  color: var(--color-fg-muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 var(--space-1);
  cursor: pointer;
}
.bug-shot__clear:hover { color: var(--color-fg-primary); }

.dialog__error {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--color-state-error);
  margin: 0 0 var(--space-3);
}
.bug-sent {
  margin: 0;
  padding: var(--space-5);
}
.bug-sent__text {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  text-align: center;
  /* Same pulse as the "your turn" status line: the eye is drawn to the
     confirmation for the 3 s it is on screen. */
  animation: pacing-awaiting-pulse 2s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .bug-sent__text { animation: none; color: var(--color-state-active); }
}

/* ============================================================
 * Lobby: the meeting page before anyone has spoken (lobby.js).
 * A greeting, how to begin, a dock the composer is lifted onto,
 * and a rotating tip. On start the composer drops back down to
 * its slot with a small bounce.
 * ============================================================ */
.transcript__inner:has(> .lobby) {
  box-sizing: border-box;
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.lobby {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  text-align: center;
}
.lobby__greeting {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.2;
  color: var(--color-fg-primary);
}
.lobby__how {
  max-width: 480px;
  margin: 0;
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.5;
  color: var(--color-fg-secondary);
}
.lobby__how strong { color: var(--color-fg-primary); }
/* Room above the dock for the composer's mode tab. */
.lobby__dock { flex: none; width: 100%; margin-top: var(--space-5); }
.lobby__tip {
  max-width: 480px;
  min-height: 3em;
  margin: 0;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-fg-muted);
}
.lobby__tip-label {
  margin-right: var(--space-1);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-fg-faint);
}
.lobby__tip-text { transition: opacity 350ms var(--ease-out); }
.lobby__tip-text--out { opacity: 0; }
.lobby__how,
.lobby__tip { transition: opacity 400ms var(--ease-out); }
.lobby--leaving .lobby__how,
.lobby--leaving .lobby__tip { opacity: 0; }

.composer.composer--lobby {
  transform: translateY(var(--lobby-shift, 0px));
  transition: transform 700ms cubic-bezier(0.2, 0.9, 0.3, 1),
              border-color var(--motion-medium-duration) var(--ease-out),
              box-shadow var(--motion-medium-duration) var(--ease-out),
              background var(--motion-medium-duration) var(--ease-out);
}
/* The fade above the card has no transcript to fade out here. */
.composer.composer--lobby::before { display: none; }
/* Falls, lands, hops twice, settles. Beats the focus "breathe" animation. */
.composer.composer--landing,
.composer.composer--landing:focus-within { animation: composer-land 900ms both; }
@keyframes composer-land {
  0%   { transform: translateY(var(--land-from, 0px)); animation-timing-function: cubic-bezier(0.55, 0, 0.9, 0.55); }
  55%  { transform: translateY(0); animation-timing-function: cubic-bezier(0.2, 0.6, 0.4, 1); }
  72%  { transform: translateY(-14px); animation-timing-function: cubic-bezier(0.6, 0, 0.8, 0.4); }
  86%  { transform: translateY(0); animation-timing-function: ease-out; }
  93%  { transform: translateY(-4px); animation-timing-function: ease-in; }
  100% { transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .composer.composer--lobby { transition: none; }
}
