/* 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; }

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 var(--layout-controlbar-height) auto;
  grid-template-areas:
    "header  header"
    "roster  transcript"
    "roster  controlbar"
    "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; }
.controlbar { grid-area: controlbar; }
.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);
}

/* ============================================================
 * ModeToggle
 * ============================================================ */

.mode-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--color-bg-surface-elevated);
  border-radius: var(--radius-pill);
  padding: var(--space-1);
  gap: 2px;
}
.mode-toggle__seg {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-fg-secondary);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: transparent;
  border: none;
  cursor: pointer;
}
.mode-toggle__seg[aria-checked="true"] {
  background: var(--color-bg-inset);
  color: var(--color-bg-canvas);
}
.mode-toggle__seg: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);
}

/* Font-size buttons: a sibling of the transcript pinned to the lower-right
 * corner of the same grid area, so they stay in the corner whether the
 * transcript is short or overflowing. 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--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
 * ============================================================ */

.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);
}
/* Focus lights the whole panel rather than ringing the textarea: the
 * surface lifts and the hairline top edge turns to the accent and breathes.
 * Every colour is a token, so all four themes follow. */
.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;
}
.composer:focus-within::before {
  opacity: 1;
  animation: composer-breathe 4s ease-in-out infinite;
}
@keyframes composer-breathe {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .composer:focus-within::before { animation: none; }
}
/* Draggable divider on the composer's top edge: the participants-panel
 * resizer turned sideways. 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;
}
.composer-resizer:hover,
.composer-resizer--active {
  background: var(--color-state-active);
  opacity: 0.5;
}
body.composer-resizing {
  cursor: row-resize;
  user-select: none;
}

.composer__input {
  width: 100%;
  min-height: var(--composer-input-height, 64px);
  max-height: var(--composer-input-height, 156px);
  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);
}

/* ============================================================
 * 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; }

.msg__body ul,
.msg__body ol {
  margin: 0 0 var(--space-3) var(--space-5);
  padding: 0;
  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 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__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); }

.welcome { min-height: calc(100vh / var(--ui-scale)); display: flex; flex-direction: column; background: var(--color-bg-canvas); color: var(--color-fg-primary); }
.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; }
.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); 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); }

/* 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. Same pill
 * vocabulary as .mode-toggle in the header. */
.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); }
