:root {
  --accent-h: 60;
  --accent-c: 0.11;
  --accent-l: 0.72;
  --accent: oklch(var(--accent-l) var(--accent-c) var(--accent-h));
  --accent-dim: oklch(0.55 0.07 var(--accent-h));
  --accent-glow: oklch(0.72 0.12 var(--accent-h) / 0.22);

  --bg-0: oklch(0.14 0.008 260);
  --bg-1: oklch(0.17 0.01 260);
  --bg-2: oklch(0.21 0.012 260);
  --line: oklch(0.32 0.012 260 / 0.6);
  --line-soft: oklch(0.32 0.012 260 / 0.3);

  --fg-0: oklch(0.94 0.01 80);
  --fg-1: oklch(0.78 0.012 80);
  --fg-2: oklch(0.58 0.012 80);
  --fg-3: oklch(0.42 0.012 80);

  --serif: 'Spectral', Georgia, serif;
  --sans: 'Inter', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  --density: 1;
  --motion: 1;
  --transcript-font: var(--serif);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: var(--bg-0);
  color: var(--fg-1);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: -20%;
  background:
    radial-gradient(ellipse 50% 40% at 30% 20%, var(--accent-glow), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, oklch(0.4 0.08 250 / 0.18), transparent 60%),
    radial-gradient(ellipse 40% 30% at 20% 80%, oklch(0.5 0.05 320 / 0.12), transparent 60%);
  filter: blur(40px);
  z-index: -2;
  animation: breathe calc(14s / var(--motion, 1)) ease-in-out infinite alternate;
  animation-play-state: var(--motion-play, running);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  opacity: 0.035;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence baseFrequency='0.9' numOctaves='2'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

@keyframes breathe {
  0%   { transform: scale(1) translate(0, 0); opacity: 0.85; }
  100% { transform: scale(1.08) translate(-2%, 1%); opacity: 1; }
}

#root { min-height: 100vh; }

button, select, input, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.45; }
::selection { background: var(--accent); color: var(--bg-0); }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }

/* ----------- Layout ----------- */

.stage {
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: calc(32px * var(--density));
  max-width: 1320px;
  margin: 0 auto;
  padding: calc(28px * var(--density)) calc(36px * var(--density));
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

/* Mobile overrides live in the consolidated block at the END of this file —
   equal-specificity rules resolve by source order, so overrides here would be
   dead the moment a base rule below repeats the property. */

/* ----------- Rails ----------- */

.left-rail, .right-rail {
  overflow-y: auto;
  min-height: 0;
}
.rail-section { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.rail-section:last-child { border-bottom: none; }
.rail-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 10px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 8px;
}
.brand-mark {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent-glow);
}
.brand-title {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  letter-spacing: 0.01em;
  color: var(--fg-0);
}
.brand-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-left: auto;
}

/* Persona card */
.persona-card {
  position: relative;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, #fdf8f0 62%, transparent);
  backdrop-filter: blur(6px);
}
.persona-card:hover { border-color: var(--accent-dim); }
.persona-name {
  font-family: var(--serif);
  font-size: 17px;
  color: var(--fg-0);
  margin-bottom: 2px;
}
.persona-modalities {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--fg-2);
  margin-bottom: 10px;
}
.persona-desc {
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-2);
  font-style: italic;
}
.persona-swap {
  display: flex;
  gap: 6px;
  margin-top: 12px;
}
.persona-swap button {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--fg-2);
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  transition: all 0.2s;
}
.persona-swap button:hover { color: var(--fg-0); border-color: var(--accent-dim); }

/* Meters */
.meter {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-size: 13px;
  color: var(--fg-1);
}
.meter + .meter { border-top: 1px solid var(--line-soft); }
.meter-label { color: var(--fg-2); font-size: 12px; }
.meter-value {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg-0);
  font-variant-numeric: tabular-nums;
}
.meter-value.dim { color: var(--fg-3); }

/* Research indicator */
.research {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: color-mix(in srgb, #fdf8f0 52%, transparent);
  font-size: 12px;
  color: var(--fg-2);
  transition: border-color 0.3s, color 0.3s;
}
.research.active { border-color: var(--accent-dim); color: var(--fg-1); }
.research-led {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--fg-3);
  box-shadow: none;
}
.research.active .research-led {
  background: var(--accent);
  animation: pulse calc(1.8s / var(--motion, 1)) ease-in-out infinite;
  box-shadow: 0 0 10px var(--accent-glow);
}
@keyframes pulse {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}
.research-meta {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--fg-3);
  margin-top: 2px;
}

/* PDF drop */
.pdf-drop {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  text-align: center;
  font-size: 12px;
  color: var(--fg-2);
  transition: all 0.2s;
  cursor: pointer;
}
.pdf-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pdf-list-item {
  margin: 0;
}
.pdf-add-more {
  margin-top: 4px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed var(--line);
  background: transparent;
  color: var(--fg-2);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}
.pdf-add-more:disabled {
  opacity: 0.45;
  cursor: default;
}
.pdf-drop:hover { border-color: var(--accent-dim); color: var(--fg-1); }
.pdf-drop.has-file {
  border-style: solid;
  border-color: var(--accent-dim);
  color: var(--fg-0);
  text-align: left;
}
.pdf-file {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-0);
}
.pdf-size {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-3);
}

/* Obsidian links */
.vault-links { display: flex; flex-direction: column; gap: 6px; }
.vault-link {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-2);
  text-decoration: none;
  padding: 4px 0;
}
.vault-link:hover { color: var(--accent); }
.vault-link::before {
  content: "\2192";
  color: var(--fg-3);
  font-family: var(--mono);
}
.vault-link:hover::before { color: var(--accent); }

/* ----------- Center ----------- */

.center {
  display: flex;
  flex-direction: column;
  /* Mirrors .stage's vertical padding (28px top + 28px bottom, both density-scaled),
     so the column never outgrows the stage's content box and gets clipped. */
  height: calc(100vh - 56px * var(--density));
  min-height: 0;
}

.session-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 28px;
  flex: 0 0 auto;
}
.session-date {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.session-title {
  font-family: var(--serif);
  font-size: clamp(26px, 3.2vw, 38px);
  font-weight: 300;
  letter-spacing: -0.01em;
  color: var(--fg-0);
  margin-top: 8px;
  line-height: 1.15;
}
.session-title em { font-style: italic; color: var(--accent); font-weight: 400; }
.session-clock {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--fg-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.05em;
  text-align: right;
}
.session-clock-big {
  display: block;
  font-size: 22px;
  color: var(--fg-0);
}

/* Transcript */
.transcript {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 28px;
  /* Clears the top mask ramp below, so the first entry's head isn't faded out at scroll-top. */
  padding-top: 24px;
  padding-bottom: 200px;
  padding-right: 8px;
  scroll-behavior: smooth;
  mask-image: linear-gradient(to bottom, transparent 0, black 24px, black calc(100% - 220px), transparent calc(100% - 140px));
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, black 24px, black calc(100% - 220px), transparent calc(100% - 140px));
}

.entry { position: relative; }
.entry-head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 10px;
}
.entry-speaker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--fg-2);
  min-width: 100px;
}
.entry-speaker.you { color: var(--accent-dim); }
.entry-speaker.therapist { color: var(--fg-2); }
.entry-time {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--fg-3);
  font-variant-numeric: tabular-nums;
}
.entry-body {
  font-family: var(--transcript-font);
  font-size: calc(19px * var(--density));
  line-height: 1.65;
  color: var(--fg-0);
  font-weight: 300;
  text-wrap: pretty;
  padding-left: 114px;
  max-width: 62ch;
}
.entry-body p + p { margin-top: 0.8em; }
.entry-body em { font-style: italic; color: var(--fg-1); }
.spoken-word.done {
  color: var(--accent);
  text-shadow: 0 0 10px var(--accent-glow);
}

@media (max-width: 720px) {
  .entry-body { padding-left: 0; }
  .entry-head { flex-direction: column; gap: 2px; }
}

.entry.streaming .entry-body::after {
  content: "";
  display: inline-block;
  width: 0.5ch;
  height: 1.1em;
  background: var(--accent);
  margin-left: 2px;
  vertical-align: text-bottom;
  animation: caret 1s steps(2) infinite;
}
@keyframes caret { 50% { opacity: 0; } }

.entry.you .entry-body { color: var(--fg-1); font-style: italic; font-weight: 300; }

/* Session state marker */
.marker {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-left: 114px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.marker::before {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
  max-width: 40px;
}
@media (max-width: 720px) { .marker { padding-left: 0; } }

/* ----------- Floor dock ----------- */

.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  padding: 16px 36px calc(22px + env(safe-area-inset-bottom, 0px));
  background: linear-gradient(to top, var(--bg-0) 30%, transparent);
  z-index: 20;
  pointer-events: none;
}
.dock-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 280px 1fr 320px;
  gap: 32px;
  align-items: end;
  pointer-events: auto;
}

.dock-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

/* Text mode replaces the fixed voice controls with one visible composer band. */
.m-quiet-text {
  width: 100%;
}
.m-quiet-text-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  width: 100%;
}
.m-side-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: color-mix(in srgb, #fdf8f0 80%, transparent);
  color: var(--fg-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.m-side-btn:hover {
  color: var(--fg-0);
  border-color: var(--accent);
}
.m-quiet-composer {
  flex: 1;
  min-width: 0;
  min-height: 48px;
  border-radius: 18px;
  padding: 12px 16px;
}
.m-quiet-send {
  height: 48px;
  padding: 0 20px;
  border-radius: 999px;
  flex: none;
}

/* Waveform */
.wave {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  height: 56px;
  overflow: hidden;
}
.wave-bar {
  width: 2px;
  height: 6px;
  background: var(--fg-3);
  border-radius: 2px;
  transition: background 0.3s;
  transform-origin: center;
}
.wave.listening .wave-bar { background: var(--fg-1); }
.wave.speaking .wave-bar { background: var(--accent); }
.wave.thinking .wave-bar { background: var(--accent-dim); }

.state-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fg-2);
  min-height: 14px;
}
.state-label.active { color: var(--accent); }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, #fbf5ea 88%, transparent);
  backdrop-filter: blur(12px);
  border-radius: 999px;
}
.tool-btn {
  width: 38px; height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--fg-2);
  transition: all 0.2s;
}
.tool-btn:hover { color: var(--fg-0); background: oklch(0.22 0.01 260); }
.tool-btn.on { color: var(--accent); background: oklch(0.2 0.02 60 / 0.3); }
.tool-btn svg { width: 18px; height: 18px; }

.mic-btn {
  width: 64px; height: 64px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg-0);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 0 var(--accent-glow), 0 8px 24px oklch(0 0 0 / 0.4);
  transition: transform 0.2s, box-shadow 0.3s;
  margin: 0 6px;
}
.mic-btn:hover { transform: scale(1.05); }
.mic-btn.active {
  animation: mic-pulse calc(2.4s / var(--motion, 1)) ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow), 0 8px 24px oklch(0 0 0 / 0.4); }
  50%      { box-shadow: 0 0 0 16px oklch(0.72 0.12 var(--accent-h) / 0), 0 8px 24px oklch(0 0 0 / 0.4); }
}
.mic-btn svg { width: 26px; height: 26px; }
.mic-btn.idle {
  background: transparent;
  color: var(--fg-1);
  border: 1px solid var(--line);
  box-shadow: none;
}
.mic-btn.recording {
  background: oklch(0.55 0.15 25);
  animation: mic-pulse calc(1.6s / var(--motion, 1)) ease-in-out infinite;
}

.divider {
  width: 1px; height: 24px; background: var(--line);
  margin: 0 2px;
}

/* Start pill */
.start-pill {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  padding: 14px 22px 14px 18px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg-0);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  box-shadow: 0 0 40px var(--accent-glow), 0 12px 30px oklch(0 0 0 / 0.4);
  transition: transform 0.2s;
}
.start-pill:hover { transform: translateY(-1px); }
.start-pill svg { width: 18px; height: 18px; }

.dock-hint {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-3);
  text-align: center;
  min-height: 12px;
}

/* dock side chips */
.dock-left, .dock-right {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 20px;
  color: var(--fg-2);
  font-size: 12px;
}
.dock-right { justify-content: flex-end; }
.dock-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, #fbf5ea 70%, transparent);
  backdrop-filter: blur(8px);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-2);
}
.dock-chip strong { color: var(--fg-0); font-weight: 500; }

/* ----------- Pre-session opening ----------- */

.opening {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
  padding: 40px 0 260px;
  max-width: 640px;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
}
.opening::-webkit-scrollbar { display: none; }
.opening-kicker {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-3);
}
.opening-title {
  font-family: var(--serif);
  font-size: clamp(32px, 4.5vw, 54px);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--fg-0);
  text-wrap: balance;
}
.opening-title em { font-style: italic; color: var(--accent); font-weight: 400; }
.opening-lead {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  color: var(--fg-1);
  font-weight: 300;
  font-style: italic;
  max-width: 46ch;
}
.opening-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
  letter-spacing: 0.1em;
  margin-top: 16px;
}

/* Mode chooser */
.mode-chooser {
  margin-top: 12px;
  width: 100%;
  max-width: 640px;
}
.mode-chooser-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 14px;
}
.mode-chooser-opts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 640px) {
  .mode-chooser-opts { grid-template-columns: 1fr; }
}
.mode-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, #fdf8f0 58%, transparent);
  text-align: left;
  transition: all 0.2s;
  position: relative;
  min-height: 0;
}
.mode-card:hover {
  border-color: var(--accent-dim);
  background: color-mix(in srgb, #f7efdf 72%, transparent);
}
.mode-card.selected {
  border-color: var(--accent);
  background: oklch(0.72 0.12 var(--accent-h) / 0.08);
  box-shadow: 0 0 0 1px var(--accent) inset, 0 10px 30px oklch(0 0 0 / 0.3);
}
.mode-card.selected::after {
  content: "";
  position: absolute;
  top: 10px; right: 10px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
.mode-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 8px;
  background: #f2e8d5;
  color: var(--fg-1);
  border: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.mode-card.selected .mode-card-icon {
  color: var(--accent);
  border-color: var(--accent-dim);
}
.mode-card-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.mode-card-name {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 400;
  color: var(--fg-0);
  line-height: 1.2;
}
.mode-card-desc {
  font-size: 11.5px;
  color: var(--fg-2);
  line-height: 1.35;
}

/* ----------- Text input (in-session) ----------- */

.text-input-area {
  display: flex;
  gap: 10px;
  align-items: flex-end;
  padding: 0 114px 0 114px;
  margin-top: auto;
}
.opening-text-input {
  margin-top: 8px;
  width: 100%;
  max-width: 640px;
  padding-left: 0;
  padding-right: 0;
}
@media (max-width: 720px) {
  .text-input-area { padding: 0; }
}
.text-input-field {
  flex: 1;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, #faf4e8 90%, transparent);
  color: var(--fg-0);
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  resize: none;
  min-height: 48px;
  max-height: 120px;
  transition: border-color 0.2s;
}
.text-input-field:focus { border-color: var(--accent-dim); }
.text-input-field::placeholder { color: var(--fg-3); }
.text-send-btn {
  padding: 12px 18px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--bg-0);
  font-weight: 500;
  font-size: 13px;
  transition: all 0.2s;
}
.text-send-btn:hover { filter: brightness(1.1); }

/* ----------- Dialog ----------- */

dialog {
  margin: auto;
  padding: 0;
  background: transparent;
  color: inherit;
  border: none;
}
dialog::backdrop {
  background: oklch(0.3 0.02 60 / 0.4);
  backdrop-filter: blur(8px);
}
.fit-dialog-panel {
  width: min(520px, 92vw);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  box-shadow: 0 40px 80px oklch(0.3 0.03 60 / 0.2);
}
.fit-dialog-kicker {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 8px;
}
.fit-dialog-title {
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 300;
  color: var(--fg-0);
  margin-bottom: 6px;
}
.fit-dialog-lead {
  font-family: var(--serif);
  font-style: italic;
  font-size: 15px;
  color: var(--fg-1);
  line-height: 1.5;
  margin-bottom: 22px;
}
.fit-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-2);
  margin: 14px 0 8px;
}
.fit-rating {
  display: flex;
  gap: 6px;
}
.fit-rating button {
  flex: 1;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--fg-1);
  background: color-mix(in srgb, #fdf8f0 62%, transparent);
  font-family: var(--mono);
  transition: all 0.2s;
}
.fit-rating button:hover { border-color: var(--accent-dim); }
.fit-rating button.selected {
  border-color: var(--accent);
  background: oklch(0.72 0.12 var(--accent-h) / 0.15);
  color: var(--accent);
}
.fit-comment {
  width: 100%;
  min-height: 96px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6efe0;
  color: var(--fg-0);
  font-family: var(--serif);
  font-size: 15px;
  line-height: 1.5;
  resize: vertical;
}
.fit-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 22px;
}
.btn {
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: all 0.2s;
}
.btn-ghost {
  color: var(--fg-1);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--fg-2); }
.btn-primary {
  background: var(--accent);
  color: var(--bg-0);
}
.btn-primary:hover { filter: brightness(1.1); }

/* ----------- Tweaks panel ----------- */

.tweaks {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 280px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, #faf4e8 94%, transparent);
  backdrop-filter: blur(16px);
  z-index: 100;
  font-size: 13px;
  box-shadow: 0 20px 40px oklch(0.3 0.03 60 / 0.18);
}
.tweaks-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.tweaks-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-1);
}
.tweaks-close {
  width: 20px; height: 20px;
  color: var(--fg-3);
}
.tweaks-close:hover { color: var(--fg-0); }
.tweak-row + .tweak-row { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.tweak-label {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  margin-bottom: 8px;
}
.tweak-opts { display: flex; gap: 4px; flex-wrap: wrap; }
.tweak-opt {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 11px;
  color: var(--fg-2);
  background: transparent;
}
.tweak-opt:hover { color: var(--fg-0); }
.tweak-opt.selected {
  border-color: var(--accent);
  color: var(--accent);
  background: oklch(0.72 0.12 var(--accent-h) / 0.1);
}
.swatch {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: -1px;
}

/* Tweaks range slider */
.tweak-range {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tweak-range input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  height: 4px;
}
.tweak-range-val {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-1);
  min-width: 32px;
  text-align: right;
}

/* Info/error toasts */
.toast-area {
  position: fixed;
  top: max(20px, calc(env(safe-area-inset-top, 0px) + 12px));
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: 500px;
  width: 90%;
}
.toast {
  padding: 10px 16px;
  border-radius: 10px;
  font-size: 12px;
  line-height: 1.45;
  backdrop-filter: blur(12px);
  pointer-events: auto;
  animation: toast-in 0.3s ease-out;
}
.toast-info {
  background: color-mix(in srgb, #fbf5ea 94%, transparent);
  border: 1px solid var(--line);
  color: var(--fg-1);
}
.toast-error {
  background: #ffe1d0;
  border: 1px solid color-mix(in srgb, #c67139 55%, transparent);
  color: #643312;
}
.toast-action {
  margin-top: 8px;
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--bg-0, #fff) 88%, transparent);
  color: inherit;
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.toast-action:hover {
  border-color: var(--fg-2, #666);
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Utility */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--fg-3); }


/* --- MFT shared space (P7) --- */
/* Fixed pool-identity axis: mine = moss (h150), ours = indigo (h265). */
.mft-edge-mine { border-left: 3px solid oklch(0.72 0.10 150); }
.mft-edge-ours { border-left: 3px solid oklch(0.72 0.10 265); }
.mft-panel { margin-top: 1.25rem; }
.mft-panel-title { font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.7; margin-bottom: 0.5rem; }
.mft-card { padding: 0.6rem 0.75rem; margin-bottom: 0.6rem; border-radius: 6px; background: color-mix(in oklab, currentColor 4%, transparent); }
.mft-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 0.5rem; }
.mft-card-title { font-weight: 500; }
.mft-chip { font-size: 0.7rem; opacity: 0.65; border: 1px solid currentColor; border-radius: 999px; padding: 0.05rem 0.5rem; }
.mft-chip-warn { display: block; margin: 0.35rem 0; cursor: pointer; background: none; }
.mft-excerpt { font-family: 'Spectral', serif; font-size: 0.85rem; opacity: 0.85; margin: 0.4rem 0; white-space: pre-wrap; }
.mft-card-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
/* Sharing now is the exception to staging — present, not competing. */
.mft-btn-quiet { border-color: transparent; opacity: 0.7; }
.mft-btn-quiet:hover:not(:disabled) { border-color: currentColor; opacity: 1; }
.mft-queue-progress { font-size: 0.7rem; letter-spacing: 0.06em; text-transform: uppercase; opacity: 0.55; margin: 0; }
.mft-btn { font-size: 0.75rem; padding: 0.25rem 0.7rem; border-radius: 999px; border: 1px solid currentColor; background: none; color: inherit; cursor: pointer; }
.mft-btn:disabled { opacity: 0.4; cursor: default; }
.mft-btn-primary { border-color: oklch(0.72 0.10 265); color: oklch(0.72 0.12 265); }
.mft-hint { font-size: 0.75rem; opacity: 0.6; font-style: italic; }
.mft-modal-backdrop { position: fixed; inset: 0; background: rgb(0 0 0 / 0.45); display: grid; place-items: center; z-index: 60; }
.mft-modal { background: var(--bg, #16161a); color: inherit; max-width: 34rem; width: 92vw; max-height: 84vh; overflow-y: auto; padding: 1.25rem 1.5rem; border-radius: 10px; border-top: 3px solid oklch(0.72 0.10 265); }
.mft-preview-text { width: 100%; font-family: 'Spectral', serif; font-size: 0.95rem; background: none; color: inherit; border: 1px dashed oklch(0.72 0.10 265 / 0.6); border-radius: 6px; padding: 0.6rem; margin: 0.5rem 0; }
.mft-mode-chip { font-size: 0.75rem; opacity: 0.8; }
.mft-modal-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 0.8rem; }
.mft-audit { font-size: 0.7rem; opacity: 0.65; list-style: none; padding: 0; }
.mft-pref-row { margin: 0.4rem 0; font-size: 0.85rem; }
.mft-modal select,
.mft-pref-row select {
  min-height: 2rem;
  padding: 0.28rem 2rem 0.28rem 0.65rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background-color: color-mix(in srgb, currentColor 5%, transparent);
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2355504b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.55rem center;
  background-size: 1rem;
  cursor: pointer;
  appearance: none;
}
.mft-modal select:hover,
.mft-pref-row select:hover {
  border-color: color-mix(in srgb, var(--accent) 58%, var(--line));
  background-color: color-mix(in srgb, var(--accent) 9%, transparent);
}
.mft-modal select:focus-visible,
.mft-pref-row select:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 16%, transparent);
}
.mft-ourspace-link { margin-top: 0.4rem; }
.mft-rail { display: flex; flex-direction: column; }


/* ── Organic theme (Dyad brand — matches dyad-web landing) ────────────────
   Token override only: components below inherit. Cream ground, ink text,
   terracotta accent, sage support. */
:root {
  --accent-h: 55;
  --accent-c: 0.115;
  --accent-l: 0.62;
  --accent: #c67139;
  --accent-dim: #8c491a;
  --accent-glow: color-mix(in srgb, #c67139 14%, transparent);

  --bg-0: #f5ead8;
  --bg-1: #ebddc5;
  --bg-2: #f9f4ed;
  --line: color-mix(in srgb, #201e1d 16%, transparent);
  --line-soft: color-mix(in srgb, #201e1d 8%, transparent);

  --fg-0: #201e1d;
  --fg-1: color-mix(in srgb, #201e1d 84%, transparent);
  --fg-2: color-mix(in srgb, #201e1d 60%, transparent);
  --fg-3: color-mix(in srgb, #201e1d 44%, transparent);

  --sans: 'Figtree', -apple-system, system-ui, sans-serif;
}

/* Ambient blobs: sage + terracotta wash instead of dark-room glow. */
body::before {
  background:
    radial-gradient(ellipse 50% 40% at 30% 20%, color-mix(in srgb, #7a8a5e 16%, transparent), transparent 60%),
    radial-gradient(ellipse 60% 50% at 80% 90%, color-mix(in srgb, #c67139 12%, transparent), transparent 60%);
}
body::after { opacity: 0.02; }

/* MFT pool-identity edges keep their fixed axis, tuned for the light ground. */
.mft-edge-mine { border-left-color: #7a8a5e; }
.mft-edge-ours { border-left-color: #c67139; }
.mft-btn-primary { border-color: #c67139; color: #8c491a; }
.mft-modal { background: var(--bg-2); border-top-color: #c67139; }
.mft-preview-text { border-color: color-mix(in srgb, #c67139 60%, transparent); }

/* Organic: dock tool buttons (light-theme states; text chips become pills) */
.tool-btn { width: auto; min-width: 38px; padding-inline: 10px; border-radius: 999px; }
.tool-btn:hover { color: var(--fg-0); background: color-mix(in srgb, #201e1d 8%, transparent); }
.tool-btn.on { color: var(--accent-dim); background: color-mix(in srgb, #c67139 14%, transparent); }

/* ── Mobile / narrow layout ──────────────────────────────────────────────
   MUST remain the LAST section of this file. These overrides share
   specificity with the base rules above, and CSS resolves ties by source
   order — moved earlier, every rule here silently dies (bitten twice). */
@media (max-width: 1100px) {
  .stage {
    grid-template-columns: 1fr;
    gap: 24px;
    /* Bottom padding clears the fixed dock so nothing is underlaid. */
    padding: 16px 16px 240px;
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    overflow: visible;
  }
  /* Session content first; meters/pairing second; brand/persona last.
     .mft-rail is the actual grid child — .right-rail sits inside it. */
  .center { order: 1; height: auto; }
  .mft-rail { order: 2; }
  .left-rail { order: 3; }
  .left-rail, .right-rail { overflow: visible; }

  /* Transcript flows with the page; the window is the scroll container. */
  .transcript {
    mask-image: none;
    -webkit-mask-image: none;
    overflow: visible;
    padding-top: 8px;
    padding-bottom: 24px;
    padding-right: 0;
  }
  /* Window-level auto-scroll target clearance above the fixed dock. */
  .entry, .marker { scroll-margin-bottom: 280px; }

  .opening {
    justify-content: flex-start;
    padding: 8px 0 24px;
    overflow: visible;
    max-width: none;
  }

  /* Narrow: clock row under the title instead of colliding with it. */
  .session-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .session-clock { text-align: left; }
  .session-clock-big { display: inline; margin-left: 10px; }

  .dock { padding: 12px 16px 18px; }
  .dock-inner { grid-template-columns: 1fr; }
  .dock-left, .dock-right { display: none; }

  .tweaks { width: auto; left: 16px; right: 16px; }
}

/* ============================================================
   Quiet floor (design 1b) — phone widths only.
   One bottom band (never two). Identity / clock / End live in a sticky
   header. Rails collapse into a "···" sheet. Share stages surface as a
   pill above the dock. Last block in the file so it wins by source order.
   ============================================================ */
@media (max-width: 720px) {
  :root {
    --m-safe: env(safe-area-inset-bottom, 0px);
    --m-header-h: 52px;
    /* One band: waveform + side/mic row + hint */
    --m-dock-h: 118px;
  }

  /* Sticky session chrome — sibling of .stage, full-bleed */
  .m-session-header {
    position: sticky;
    top: 0;
    z-index: 25;
    display: flex;
    align-items: center;
    gap: 10px;
    height: calc(var(--m-header-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0 16px;
    background: color-mix(in srgb, var(--bg-0) 92%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line-soft);
  }
  .m-session-header-mark {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
    flex: none;
  }
  .m-session-header-id {
    display: flex; flex-direction: column; min-width: 0; flex: 1;
  }
  .m-session-header-name {
    font-family: var(--serif);
    font-size: 15px;
    color: var(--fg-0);
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .m-session-header-meta {
    font-family: var(--mono);
    font-size: 9.5px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--fg-3);
  }
  .m-session-header-end {
    height: 34px;
    padding: 0 15px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, #fdf8f0 70%, transparent);
    color: var(--fg-1);
    font-size: 13px;
    font-weight: 600;
    flex: none;
  }
  .m-session-header-end:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent-dim);
  }
  .m-session-header-more {
    width: 34px; height: 34px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, #fdf8f0 70%, transparent);
    color: var(--fg-1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
  }
  .m-session-header-more:hover {
    border-color: var(--accent);
    color: var(--accent-dim);
  }

  /* Rails / journal head move into the more sheet on phone. */
  .quiet-floor .left-rail,
  .quiet-floor .mft-rail,
  .quiet-floor .session-head { display: none !important; }

  /* Single opaque dock band — composer swaps into this band in text mode. */
  .dock.dock-quiet,
  .dock {
    height: auto;
    min-height: var(--m-dock-h);
    padding: 10px 16px;
    padding-bottom: calc(14px + var(--m-safe));
    background: linear-gradient(to top, var(--bg-0) 62%, color-mix(in srgb, var(--bg-0) 0%, transparent));
    border-top: none;
    display: flex;
    align-items: flex-end;
  }
  .dock-inner { width: 100%; align-items: center; }
  .dock-center { gap: 8px; width: 100%; }
  .dock .wave { height: 22px; }
  .state-label {
    min-height: 0;
    padding: 2px 12px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--bg-0) 82%, var(--fg-0) 12%);
  }
  .state-label:empty { display: none; }
  .dock-hint { display: block; font-size: 10px; text-align: center; }

  .tool-btn, .mic-btn, .start-pill, .m-side-btn, .m-session-header-end, .m-session-header-more {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }

  /* Quiet voice row: keyboard | mic | speaker */
  .m-quiet-row {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
  }
  .m-quiet-mic-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
  }
  .m-side-btn {
    width: 52px; height: 52px;
    border-radius: 50%;
    border: 1px solid var(--line);
    background: color-mix(in srgb, #fdf8f0 80%, transparent);
    color: var(--fg-2);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
  }
  .m-side-btn:hover, .m-side-btn.on {
    color: var(--fg-0);
    border-color: var(--accent);
  }
  .m-side-btn.on { color: var(--accent-dim); background: color-mix(in srgb, #c67139 12%, transparent); }
  .mic-btn.m-mic-btn {
    width: 68px; height: 68px;
    margin: 0;
  }

  /* Quiet text row: mic-back | composer | send — replaces the voice band */
  .m-quiet-text-row {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    width: 100%;
  }
  .m-quiet-composer {
    flex: 1;
    min-height: 48px;
    border-radius: 22px;
    padding: 13px 16px;
  }
  .m-quiet-send {
    height: 48px;
    padding: 0 20px;
    border-radius: 999px;
    flex: none;
  }

  /* Desktop-style dual-band composer is gone on quiet floor. */
  .quiet-floor .text-input-area:not(.opening-text-input) { display: none !important; }

  .stage {
    padding-top: 16px;
    /* Extra clearance for the share pill that sits above the dock when staged. */
    padding-bottom: calc(var(--m-dock-h) + var(--m-safe) + 72px);
  }
  .entry, .marker {
    scroll-margin-bottom: calc(var(--m-dock-h) + 56px);
  }

  /* Share pill — staged topics above the dock */
  .m-share-pill {
    position: fixed;
    left: 16px; right: 16px;
    bottom: calc(var(--m-dock-h) + var(--m-safe) + 8px);
    z-index: 22;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, #7a8a5e 50%, transparent);
    background: color-mix(in srgb, #f9f4ed 96%, transparent);
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-md, 0 8px 24px color-mix(in srgb, #201e1d 12%, transparent));
    text-align: left;
    color: inherit;
  }
  .m-share-pill-count {
    width: 26px; height: 26px;
    border-radius: 8px;
    background: color-mix(in srgb, #7a8a5e 18%, transparent);
    color: #55613f;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    flex: none;
  }
  .m-share-pill-copy {
    display: flex; flex-direction: column; min-width: 0; flex: 1;
  }
  .m-share-pill-title {
    font-size: 13.5px; font-weight: 600; color: var(--fg-0);
  }
  .m-share-pill-sub {
    font-size: 12px; color: var(--fg-2);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  .m-share-pill-chevron { margin-left: auto; color: var(--fg-3); font-size: 18px; }

  /* Bottom sheets */
  .m-sheet-backdrop {
    position: fixed; inset: 0; z-index: 40;
    background: color-mix(in srgb, #201e1d 34%, transparent);
    backdrop-filter: blur(3px);
  }
  .m-sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
    max-height: min(86vh, 640px);
    overflow-y: auto;
    border-radius: 28px 28px 0 0;
    background: #f9f4ed;
    box-shadow: 0 -18px 50px color-mix(in srgb, #201e1d 25%, transparent);
    padding: 10px 20px calc(30px + env(safe-area-inset-bottom, 0px));
    animation: sheetUp 0.22s ease-out;
  }
  @keyframes sheetUp {
    from { transform: translateY(24px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
  }
  @media (prefers-reduced-motion: reduce) {
    .m-sheet { animation: none; }
  }
  .m-sheet-handle {
    width: 42px; height: 4px; border-radius: 2px;
    background: color-mix(in srgb, #201e1d 18%, transparent);
    margin: 0 auto 16px;
  }
  .m-sheet-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--fg-3);
    margin: 0 0 10px;
  }
  .m-mode-seg {
    display: flex; gap: 6px;
    padding: 5px;
    border-radius: 16px;
    background: color-mix(in srgb, #201e1d 5%, transparent);
    margin-bottom: 22px;
  }
  .m-mode-seg-opt {
    position: relative;
    flex: 1;
    min-height: 46px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    color: var(--fg-2);
  }
  .m-mode-seg-opt.on {
    background: #fdf8f0;
    color: var(--fg-0);
    box-shadow: 0 2px 6px color-mix(in srgb, #201e1d 10%, transparent);
  }
  .m-meter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 22px;
  }
  .m-meter-cell {
    padding: 13px 14px;
    border-radius: 14px;
    background: color-mix(in srgb, #201e1d 4%, transparent);
  }
  .m-meter-cell-research {
    background: color-mix(in srgb, #7a8a5e 12%, transparent);
  }
  .m-meter-cell-label { font-size: 11.5px; color: var(--fg-2); }
  .m-meter-cell-value {
    font-family: var(--mono);
    font-size: 17px;
    color: var(--fg-0);
    margin-top: 3px;
  }
  .m-meter-cell-value-sm { font-family: var(--sans); font-size: 13px; line-height: 1.3; }
  .m-persona-card {
    padding: 15px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: color-mix(in srgb, #fdf8f0 70%, transparent);
    margin-bottom: 16px;
  }
  .m-persona-name { font-family: var(--serif); font-size: 17px; color: var(--fg-0); }
  .m-persona-meta {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.08em;
    color: var(--fg-2);
    margin: 3px 0 8px;
  }
  .m-persona-blurb {
    font-size: 13.5px; line-height: 1.5; color: var(--fg-2); font-style: italic;
  }
  .m-persona-swap { margin-top: 12px; }
  .m-model-swap {
    margin-top: 10px;
    width: 100%;
    justify-content: flex-start;
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-2);
  }
  .m-sheet-rows { display: flex; flex-direction: column; gap: 2px; }
  .m-sheet-row-btn {
    display: flex;
    align-items: center;
    min-height: 50px;
    padding: 0 4px;
    font-size: 15px;
    color: var(--fg-1);
    text-align: left;
    border-bottom: 1px solid color-mix(in srgb, #201e1d 7%, transparent);
  }
  .m-sheet-row-btn span { margin-left: auto; color: var(--fg-3); }
  .m-sheet-row-end {
    border-bottom: none;
    color: var(--accent-dim);
    font-weight: 600;
  }
  .m-sheet-row-end span { color: color-mix(in srgb, #c67139 50%, transparent); }

  .m-share-sheet { border-top: 3px solid #7a8a5e; }
  .m-share-sheet-title {
    font-family: var(--serif);
    font-size: 23px;
    font-weight: 300;
    color: var(--fg-0);
    margin: 0;
  }
  .m-share-sheet-lead {
    font-size: 13px; line-height: 1.5; color: var(--fg-2); margin: 8px 0 0;
  }
  .m-share-sheet-excerpt {
    font-family: var(--serif);
    font-size: 16px; line-height: 1.6; color: var(--fg-0);
    margin: 16px 0;
    padding: 14px 16px;
    border-radius: 16px;
    border-left: 3px solid #7a8a5e;
    background: color-mix(in srgb, #7a8a5e 9%, transparent);
  }
  .m-share-sheet-count {
    font-size: 12.5px; color: var(--fg-2); margin: 0 0 8px;
  }
  .m-share-sheet-actions {
    display: flex; flex-direction: column; gap: 10px; margin-top: 20px;
  }
  .m-sheet-primary, .m-sheet-secondary, .m-sheet-ghost {
    min-height: 52px;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 600;
  }
  .m-sheet-primary {
    border: none;
    background: var(--accent);
    color: #f9f4ed;
  }
  .m-sheet-secondary {
    border: 1px solid var(--line);
    background: none;
    color: var(--fg-1);
  }
  .m-sheet-ghost {
    min-height: 44px;
    border: none;
    background: none;
    color: var(--fg-3);
    font-weight: 500;
  }

  /* Legacy dual-band composer path (if quiet-floor class missing): keep End tap-safe. */
  .toolbar {
    gap: 4px;
    padding: 6px;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .toolbar::-webkit-scrollbar { display: none; }
  .end-session-btn {
    color: var(--accent);
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    flex-shrink: 0;
  }

  .mft-modal-backdrop { z-index: 80; }
  .fit-dialog-panel {
    max-height: min(84vh, calc(100dvh - 32px));
    overflow-y: auto;
    padding: 24px 20px;
  }
}

/* --- Session closeout ---------------------------------------------------- */
/* Shown after End while the vault pipeline runs. The bar advances per settled
   step, not per elapsed second: the steps are LLM calls of wildly uneven
   duration, so a time-based percentage would lurch and mislead. */
.closing {
  max-width: 560px;
  margin: 0 auto;
  padding: 48px 20px 24px;
}
.closing-title {
  font-family: var(--font-display, inherit);
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 400;
  line-height: 1.15;
  margin: 8px 0 12px;
}
.closing-lead {
  color: var(--muted, #6b6b6b);
  margin: 0 0 28px;
  line-height: 1.5;
}
.closing-bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(128, 128, 128, 0.22);
  overflow: hidden;
  margin-bottom: 24px;
}
.closing-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: currentColor;
  opacity: 0.6;
  transition: width 320ms ease;
}
.closing-steps {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.closing-step {
  display: grid;
  grid-template-columns: 20px 1fr auto;
  align-items: baseline;
  gap: 10px;
  opacity: 0.45;
  transition: opacity 200ms ease;
}
.closing-step.is-running,
.closing-step.is-ok,
.closing-step.is-error { opacity: 1; }
.closing-step-mark { text-align: center; }
.closing-step-status {
  font-size: 13px;
  color: var(--muted, #6b6b6b);
}
.closing-step.is-error .closing-step-status { color: var(--warn, #b4553c); }
.closing-leave {
  display: inline-flex;
  align-items: center;
  background: none;
  border: 0;
  padding: 8px 0;
  min-height: 44px;
  font: inherit;
  font-size: 14px;
  color: var(--muted, #6b6b6b);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.closing-leave:hover { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  .closing-bar-fill { transition: none; }
}

/* Desktop: quiet-floor chrome stays out of the way */
@media (min-width: 721px) {
  .m-session-header,
  .m-share-pill,
  .m-sheet,
  .m-sheet-backdrop { display: none !important; }
}


/* Persistent transport status. Kept outside the waveform so reconnect state
   remains visible even when a session collapses back to its resume prompt. */
.connection-chip {
  position: absolute;
  right: 20px;
  top: 10px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 24px;
  padding: 3px 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg-0) 90%, transparent);
  color: var(--fg-3);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #a87948;
}
.connection-chip.is-connected .connection-dot {
  background: #667c4b;
  box-shadow: 0 0 8px color-mix(in srgb, #667c4b 45%, transparent);
}
.connection-chip.is-reconnecting .connection-dot {
  animation: connectionPulse 1.1s ease-in-out infinite;
}
.connection-chip.is-ended .connection-dot {
  background: var(--fg-3);
  box-shadow: none;
}
@keyframes connectionPulse {
  50% { opacity: 0.32; }
}
.session-ended {
  max-width: 46ch;
  margin: 0 auto;
  padding: 8vh 0;
  text-align: left;
}
.session-ended .closing-lead {
  margin-bottom: 26px;
}
.start-pill:disabled {
  cursor: wait;
  opacity: 0.52;
}
@media (max-width: 720px) {
  .connection-chip {
    right: 12px;
    top: 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .connection-chip.is-reconnecting .connection-dot { animation: none; }
}
