/* Heidi Vault Dictation — the interpreter app's design tokens (Heidi "newBrand"
   sand/bark on white), as plain CSS variables so this app needs no build step. */

:root {
  --sand-25: #FCFAF8;  --sand-50: #F9F4F1;  --sand-75: #F6EFEA;
  --sand-100: #F6ECE4; --sand-150: #F4E7DD; --sand-200: #F0DFD1;
  --sand-300: #ECD7C6; --sand-500: #DABFA9;
  --bark-100: #E9E2E3; --bark-200: #D4C4C9; --bark-400: #A98993;
  --bark-500: #876C74; --bark-600: #755760; --bark-700: #5B3E47;
  --bark-800: #4C2934; --bark-900: #28030F; --bark-950: #211217;
  --skies-25: #EBF2FF; --skies-100: #D1E0FF; --skies-700: #2255C3;

  --text-primary: var(--bark-950);
  --text-secondary: var(--bark-600);
  --text-tertiary: var(--bark-500);
  --text-invert: #FFFFFF;
  --bg-primary: var(--bark-800);
  --bg-primary-hover: var(--bark-900);
  --bg-secondary: var(--sand-150);
  --bg-secondary-hover: var(--sand-200);
  --surface: #FFFFFF;
  --surface-page: var(--sand-25);
  --surface-accent: var(--sand-50);
  --surface-hover: var(--sand-50);
  --border: var(--sand-150);
  --border-hover: var(--sand-300);
  --border-focus: var(--skies-700);
  --success: #16A34A;
  --success-hover: #15803D;
  --success-muted: #F0FDF4;
  --success-border: #DCFCE7;
  --destructive: #DC2626;
  --destructive-muted: #FEF2F2;
  --destructive-border: #FEE2E2;
  --warning: #EA580C;
  --warning-muted: #FFF7ED;
  --warning-border: #FFEDD5;
  --info: #5B8DF6;
  --info-muted: var(--skies-25);
  --info-border: var(--skies-100);

  --radius-sm: 6px;  --radius-md: 8px;  --radius-lg: 12px;
  --radius-xl: 16px; --radius-2xl: 24px; --radius-3xl: 36px;

  --shadow-sm: 0 1px 2px rgba(33, 18, 23, .05);
  --shadow-lg: 0 10px 15px -3px rgba(33, 18, 23, .08), 0 4px 6px -4px rgba(33, 18, 23, .06);
  --shadow-xl: 0 20px 25px -5px rgba(33, 18, 23, .10), 0 8px 10px -6px rgba(33, 18, 23, .06);
  --shadow-2xl: 0 25px 50px -12px rgba(33, 18, 23, .22);

  --font-sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-note: Georgia, "Iowan Old Style", "Palatino Linotype", "Noto Serif CJK SC", "Noto Serif", serif;
}

* { box-sizing: border-box; border-color: var(--border); }

html, body {
  margin: 0; height: 100%;
  background: var(--surface-page); color: var(--text-primary);
  font-family: var(--font-sans); -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
svg { display: block; }
.i, .chev, .logo-mark, .banner-icon { display: inline-flex; }
.i svg, .chev svg { width: 20px; height: 20px; }
kbd {
  display: inline-block; padding: 0 5px; border-radius: 4px;
  border: 1px solid var(--border-hover); border-bottom-width: 2px;
  background: var(--surface); font: 600 11px/18px var(--font-sans); color: var(--text-secondary);
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideInLeft { from { transform: translateX(-100%) } to { transform: translateX(0) } }
@keyframes bannerSlideIn { from { opacity: 0; transform: translate(-50%, -8px) } to { opacity: 1; transform: translate(-50%, 0) } }
@keyframes pillIn { from { opacity: 0; transform: translate(-50%, 16px) } to { opacity: 1; transform: translate(-50%, 0) } }
@keyframes modalIn { from { opacity: 0; transform: translate(-50%, -50%) scale(.96) } to { opacity: 1; transform: translate(-50%, -50%) scale(1) } }
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes recPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, .35) }
  50%      { box-shadow: 0 0 0 6px rgba(220, 38, 38, 0) }
}
@keyframes caretBlink { 50% { opacity: 0 } }
@keyframes turnIn { from { opacity: 0; transform: translateY(6px) } to { opacity: 1; transform: none } }
@keyframes settle { from { background-color: var(--success-border) } to { background-color: transparent } }

/* ---------------------------------------------------------------- generic */

.btn {
  min-height: 48px; height: 48px; padding: 0 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--radius-xl);
  font-size: 16px; font-weight: 500; cursor: pointer;
  transition: background-color .2s, opacity .2s, transform .1s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-dark { background: var(--bg-primary); color: var(--text-invert); }
.btn-dark:hover:not(:disabled) { background: var(--bg-primary-hover); }
.btn-ghost { background: transparent; color: var(--destructive); }
.btn-ghost:hover:not(:disabled) { background: var(--destructive-muted); }

.icon-btn {
  padding: 8px; border: 0; border-radius: var(--radius-lg);
  background: transparent; color: var(--text-secondary); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background-color .2s, color .2s;
}
.icon-btn:hover { background: var(--bg-secondary); color: var(--text-primary); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.tiny { padding: 4px; }
.icon-btn.tiny svg { width: 14px; height: 14px; }
.icon-btn.on { background: var(--bg-secondary); color: var(--text-primary); }

.pill-btn {
  height: 36px; padding: 0 14px; gap: 6px;
  display: inline-flex; align-items: center;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); color: var(--text-primary);
  font-size: 14px; font-weight: 500; cursor: pointer;
  transition: background-color .2s, border-color .2s;
}
.pill-btn:hover { background: var(--surface-hover); border-color: var(--border-hover); }
.pill-btn svg { width: 16px; height: 16px; }

.strong { font-weight: 600; }
.muted { color: var(--text-secondary); }

.field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.field > label { font-size: 14px; font-weight: 600; }
.select-wrap { position: relative; }
.select-wrap select {
  width: 100%; height: 48px; padding: 0 44px 0 16px;
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface); font-size: 16px;
  appearance: none; cursor: pointer;
  transition: border-color .2s, box-shadow .2s;
}
.select-wrap select:hover { border-color: var(--border-hover); }
.select-wrap select:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(34, 85, 195, .2); }
.chev { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--text-secondary); pointer-events: none; }
.field-note { margin: 0; min-height: 18px; font-size: 12px; color: var(--text-tertiary); }
.field textarea {
  width: 100%; padding: 10px 14px; resize: vertical; min-height: 64px;
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface); font-size: 14px; line-height: 1.4;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea:hover { border-color: var(--border-hover); }
.field textarea:focus { outline: none; border-color: var(--border-focus); box-shadow: 0 0 0 3px rgba(34, 85, 195, .2); }
.guard-note { display: inline-flex; align-items: center; gap: 4px; color: var(--warning); }

/* engine status */
.engines { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.engine {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface-accent);
  font-size: 12px; font-weight: 500; color: var(--text-secondary);
}
.engine .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--bark-200); flex: none; }
.engine.on { background: var(--success-muted); border-color: var(--success-border); color: var(--success-hover); }
.engine.on .dot { background: var(--success); }
.engine.off { background: var(--destructive-muted); border-color: var(--destructive-border); color: var(--destructive); }
.engine.off .dot { background: var(--destructive); }
.engine b { font-weight: 600; }
.engines-compact .engine { padding: 4px 9px; font-size: 11px; }

/* ---------------------------------------------------------------- banner */

.banner {
  position: fixed; top: 24px; left: 50%; z-index: 60;
  width: calc(100% - 32px); max-width: 512px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: start;
  padding: 14px 16px; border-radius: var(--radius-xl);
  border: 1px solid var(--destructive-border); background: var(--destructive-muted);
  box-shadow: var(--shadow-lg);
  animation: bannerSlideIn .25s ease-out forwards;
}
.banner.warning { border-color: var(--warning-border); background: var(--warning-muted); }
.banner.success { border-color: var(--success-border); background: var(--success-muted); }
.banner-icon { color: var(--destructive); }
.banner.warning .banner-icon { color: var(--warning); }
.banner.success .banner-icon { color: var(--success); }
.banner-icon svg { width: 20px; height: 20px; }
.banner-body { min-width: 0; }
.banner-title { margin: 0; font-size: 14px; font-weight: 600; }
.banner-desc { margin: 2px 0 0; font-size: 13px; color: var(--text-secondary); white-space: pre-line; }
.banner-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.banner-actions .pill-btn { padding: 4px 10px; font-size: 12px; }
.field-row { display: flex; gap: 8px; align-items: stretch; }
.field-row .select-wrap { flex: 1; min-width: 0; }
.field-row .pill-btn { flex: none; height: 48px; padding: 0 16px; border-radius: var(--radius-xl); font-size: 15px; }
.banner-desc:empty { display: none; }
.banner-close { margin: -4px -4px 0 0; }

/* --------------------------------------------------------------- sidebar */

.backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(0, 0, 0, .2); animation: fadeIn .2s ease-out; }
.sidebar {
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 50;
  width: 288px; display: flex; flex-direction: column;
  background: var(--surface-accent); box-shadow: var(--shadow-xl);
  animation: slideInLeft .25s cubic-bezier(.32, .72, 0, 1);
}
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 12px 14px 8px; }
.sidebar-head-actions { display: flex; align-items: center; gap: 6px; }
.sidebar-search { padding: 0 12px 10px; }
.sidebar-search input {
  width: 100%; height: 40px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: var(--radius-lg);
  background: var(--surface); font-size: 14px;
}
.sidebar-search input:focus { outline: none; border-color: var(--border-focus); }
.sidebar-list { flex: 1; overflow-y: auto; padding: 0 8px 12px; }
.sidebar-group { padding: 14px 8px 6px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary); }
.note-item {
  position: relative; display: block; width: 100%; text-align: left;
  padding: 10px 12px; margin-bottom: 2px;
  border: 0; border-radius: var(--radius-lg); background: transparent; cursor: pointer;
  transition: background-color .15s;
}
.note-item:hover { background: var(--surface); }
.note-item.active { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.note-item .s-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 22px; }
.note-item .s-sub { margin-top: 2px; font-size: 12px; color: var(--text-tertiary); }
.note-item .s-del { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); opacity: 0; transition: opacity .15s; }
.note-item:hover .s-del { opacity: 1; }
.sidebar-empty { padding: 24px 12px; font-size: 13px; color: var(--text-tertiary); text-align: center; }
.sidebar-foot { display: flex; align-items: center; gap: 10px; padding: 12px; border-top: 1px solid var(--border); }
.sidebar-foot-text p { margin: 0; font-size: 12px; }
.sidebar-foot-text .strong { font-size: 13px; }
.avatar { width: 40px; height: 40px; border-radius: 999px; flex: none; display: flex; align-items: center; justify-content: center; }
.avatar svg { width: 20px; height: 20px; stroke-width: 1.5; }
.avatar-dark { background: var(--bg-primary); color: var(--text-invert); }

/* -------------------------------------------------------------- main view */

.app { max-width: 1240px; margin: 0 auto; height: 100vh; display: flex; flex-direction: column; animation: fadeIn .3s ease-out; }
.app-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 24px 12px; }
.app-brand { display: flex; align-items: center; gap: 9px; }
.logo-mark {
  width: 28px; height: 28px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--bg-primary); color: var(--text-invert);
}
.logo-mark svg { width: 16px; height: 16px; }
.wordmark { font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.app-header-right { display: flex; align-items: center; gap: 10px; }

.context-strip {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  flex-wrap: wrap; padding: 0 24px 14px; font-size: 12px; color: var(--text-secondary);
}
.ctx {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-page); color: var(--text-secondary);
  font-size: 12px; font-weight: 500; cursor: pointer; transition: background-color .15s, border-color .15s, color .15s;
}
.ctx:hover { background: var(--surface-accent); border-color: var(--border-hover); }
.ctx svg { width: 13px; height: 13px; color: var(--text-tertiary); }
.ctx.toggle[aria-pressed="true"] { background: var(--success-muted); border-color: var(--success-border); color: var(--success-hover); }
.ctx.toggle[aria-pressed="true"] svg { color: var(--success); }
.ctx.toggle[aria-pressed="false"] { text-decoration: line-through; opacity: .8; }

/* The language pill opens a listbox of our own underneath it, so the menu
   matches the rest of the page instead of the browser's native picker. */
.ctx-lang-wrap { position: relative; }
.ctx-lang {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); font: inherit; font-size: 13px; font-weight: 500; letter-spacing: -.01em;
  color: var(--text-primary); white-space: nowrap; cursor: pointer;
  box-shadow: 0 1px 2px rgba(33, 18, 23, .04); transition: background-color .15s, box-shadow .15s;
}
.ctx-lang:hover { background: var(--surface-accent); }
.ctx-lang:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--info-border); }
.ctx-lang[aria-expanded="true"] { background: var(--surface-accent); box-shadow: 0 0 0 2px var(--info-border); }
.ctx-lang > .i svg { width: 13px; height: 13px; color: var(--text-tertiary); }
.ctx-lang-chev { display: inline-flex; margin-left: -3px; color: var(--bark-200); transition: transform .15s; }
.ctx-lang-chev svg { width: 14px; height: 14px; }
.ctx-lang[aria-expanded="true"] .ctx-lang-chev { transform: rotate(180deg); }

.lang-menu {
  position: absolute; top: calc(100% + 6px); left: 50%; transform: translateX(-50%);
  z-index: 52; min-width: 268px; max-height: min(70vh, 520px); overflow-y: auto;
  padding: 6px; border: 1px solid var(--border); border-radius: var(--radius-xl);
  background: var(--surface); box-shadow: var(--shadow-xl); outline: none;
  animation: lang-menu-in .14s ease-out;
}
@keyframes lang-menu-in {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.lang-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 7px 10px; border: 0; border-radius: var(--radius-md); background: transparent;
  font: inherit; font-size: 13px; color: var(--text-primary); text-align: left; cursor: pointer;
  transition: background-color .1s;
}
.lang-item:hover, .lang-item.focused { background: var(--surface-accent); }
.lang-item[aria-selected="true"] { background: var(--success-muted); }
.lang-item[aria-selected="true"]:hover, .lang-item[aria-selected="true"].focused { background: var(--success-muted); filter: brightness(.98); }
.lang-item .l-icon { display: inline-flex; width: 16px; justify-content: center; color: var(--text-tertiary); }
.lang-item .l-icon svg { width: 14px; height: 14px; }
.lang-item .l-name { flex: 1; font-weight: 500; letter-spacing: -.01em; }
.lang-item .l-native { color: var(--text-tertiary); font-size: 12px; }
.lang-item .l-check { display: inline-flex; width: 16px; justify-content: center; color: var(--success); }
.lang-item .l-check svg { width: 14px; height: 14px; }
.lang-item[aria-selected="true"] .l-name { color: var(--success-hover); }
.lang-sep { height: 1px; margin: 5px 6px; background: var(--border); }
.ctx-stats { color: var(--text-tertiary); letter-spacing: -.01em; }

/* ------------------------------------------------------------ workspace */

.workspace {
  flex: 1; min-height: 0; display: flex; gap: 16px;
  padding: 0 24px 240px;
}
.note-wrap {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius-2xl);
  background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden;
}
.note-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px 12px 24px; border-bottom: 1px solid var(--border); background: var(--surface-accent);
}
.note-title {
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  cursor: text; border-radius: var(--radius-sm); padding: 3px 6px; margin: -3px -6px;
  transition: background .15s, color .15s; border: 1px solid transparent;
}
.note-title:hover { background: var(--surface); color: var(--text-primary); border-color: var(--border); }
.note-title:focus { outline: none; background: var(--surface); color: var(--text-primary); border-color: var(--border-hover); box-shadow: var(--shadow-sm); }
.note-count { flex: 1; font-size: 12px; color: var(--text-tertiary); white-space: nowrap; }
.note-count:empty { display: none; }
.note-actions { display: flex; gap: 8px; flex: none; align-items: center; }

.template-wrap { position: relative; display: inline-flex; }
.template-menu {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 40;
  width: 270px; padding: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg); display: flex; flex-direction: column; gap: 2px;
}
.template-item {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  width: 100%; padding: 8px 10px; border: none; background: transparent;
  border-radius: var(--radius-md); text-align: left; cursor: pointer;
  font-family: var(--font-sans); transition: background .15s;
}
.template-item:hover { background: var(--surface-accent); }
.template-item strong { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.template-item span { font-size: 11px; color: var(--text-tertiary); line-height: 1.3; }

.pill-btn.pill-danger { color: var(--destructive); }
.pill-btn.pill-danger:hover { background: var(--destructive-muted); border-color: var(--destructive-border, var(--border-hover)); }
.pill-btn.pill-danger svg { color: var(--destructive); }
.pill-btn:disabled { opacity: .45; cursor: default; }
.pill-btn:disabled:hover { background: var(--surface); }

.note {
  flex: 1; min-height: 0; overflow-y: auto; padding: 28px 36px 60px;
  font-family: var(--font-note); font-size: 18px; line-height: 1.65;
  white-space: pre-wrap; overflow-wrap: anywhere; outline: none; caret-color: var(--bark-700);
}
.note.is-empty::before,
.note:empty::before { content: attr(data-placeholder); color: var(--text-tertiary); font-family: var(--font-sans); font-size: 16px; pointer-events: none; }

/* The text of one turn as it moves through its three states. Live text is
   what the recogniser has so far; provisional is the instant result; final has
   been through the record pass and flashes briefly as it settles. */
.turn { border-radius: 3px; transition: color .25s, background-color .25s; }
.turn.live { color: var(--text-tertiary); background: var(--surface-accent); }
.turn.live::after {
  content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px;
  background: var(--bark-500); vertical-align: -3px; animation: caretBlink 1s steps(2) infinite;
}
.turn.provisional { color: var(--text-secondary); }
.turn.settled { animation: settle 1.2s ease-out; }
.turn.failed { text-decoration: underline wavy var(--warning); }
.turn.flash { animation: settle 1.4s ease-out; }
@keyframes turnOut { to { opacity: 0; } }
.turn.removing { animation: turnOut .25s ease-out forwards; text-decoration: line-through; }

/* --------------------------------------------------------------- turns */

.turns {
  width: 340px; flex: none; display: flex; flex-direction: column;
  border: 1px solid var(--border); border-radius: var(--radius-2xl);
  background: var(--surface-accent); overflow: hidden;
}
.turns-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--border); font-size: 13px; }
.turns-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.turns-empty { padding: 24px 12px; font-size: 13px; color: var(--text-tertiary); text-align: center; }
.turn-card {
  padding: 10px 12px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--surface);
  animation: turnIn .25s ease-out;
}
.turn-card .t-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; color: var(--text-tertiary); }
.turn-card .t-state { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.turn-card .t-state svg { width: 12px; height: 12px; }
.turn-card.pending .t-state svg { animation: spin 1s linear infinite; }
.turn-card.done .t-state { color: var(--success-hover); }
.turn-card.failed .t-state { color: var(--warning); }
.turn-card { cursor: pointer; transition: border-color .15s, box-shadow .15s; }
.turn-card:hover { border-color: var(--border-hover); box-shadow: var(--shadow-sm); }
.turn-card.removed { opacity: .55; }
.turn-card.removed .t-text { text-decoration: line-through; }
.turn-card .t-raw { margin: 6px 0 0; font-size: 12px; color: var(--text-tertiary); line-height: 1.45; }
.turn-card .t-raw b { font-weight: 600; color: var(--text-secondary); }
/* A command word inside the heard text, shown as the command it became. */
.turn-card .t-raw .cmd-chip { vertical-align: 1px; margin: 0 1px; }
.turn-card .t-text { margin: 6px 0 0; font-size: 13px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.turn-card .t-cmds { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.cmd-chip {
  padding: 1px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 600; letter-spacing: .01em;
  background: var(--info-muted); color: var(--skies-700); border: 1px solid var(--info-border);
}
.turn-card .t-meta { margin-top: 8px; font-size: 11px; color: var(--text-tertiary); display: flex; gap: 10px; flex-wrap: wrap; }
.turn-card .t-meta b { font-weight: 600; color: var(--text-secondary); }
.t-meta .fast { color: var(--success-hover); }

/* ---------------------------------------------------------- recording bar */

.listening-pill {
  position: fixed; left: 50%; bottom: 230px; z-index: 50;
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px 8px 14px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow-lg); font-size: 13px; font-weight: 500;
  animation: pillIn .25s ease-out forwards;
}
.listening-pill .i svg { width: 15px; height: 15px; color: var(--destructive); }
.listening-pill.working .i svg { color: var(--text-secondary); animation: spin 1s linear infinite; }

.bar-wrap {
  position: fixed; bottom: 32px; left: 0; right: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 0 16px; pointer-events: none;
}
.bar-wrap > * { pointer-events: auto; }

.segmented { display: inline-flex; gap: 2px; padding: 4px; border-radius: var(--radius-xl); background: var(--bg-secondary); }
.segmented .seg {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border: 0; border-radius: var(--radius-lg);
  background: transparent; color: var(--text-secondary);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: background-color .2s, color .2s, box-shadow .2s;
}
.segmented .seg:hover { color: var(--text-primary); }
.segmented .seg.active { background: var(--surface); color: var(--text-primary); box-shadow: var(--shadow-sm); }
.mode-swap { background: rgba(244, 231, 221, .85); backdrop-filter: blur(8px); box-shadow: var(--shadow-sm); }

.recording-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 16px; border-radius: var(--radius-3xl);
  border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-lg);
}
.mic-slot {
  display: inline-flex; align-items: center; justify-content: center;
  height: 48px; padding: 0 12px; border-radius: var(--radius-xl);
  border: 1px solid var(--border); background: var(--surface); cursor: pointer;
}
.mic-slot canvas { display: block; width: 72px; height: 28px; }

.record-btn {
  min-width: 220px; height: 48px; padding: 0 20px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: var(--radius-xl);
  font-size: 16px; font-weight: 500; color: var(--text-invert); cursor: pointer;
  user-select: none; -webkit-user-select: none; touch-action: none;
  transition: background-color .2s, opacity .2s;
}
.record-btn svg { width: 20px; height: 20px; }
.record-btn.idle { background: var(--success); }
.record-btn.idle:hover { background: var(--success-hover); }
.record-btn.recording { background: var(--destructive); animation: recPulse 1.6s ease-in-out infinite; }
.record-btn.busy { background: var(--bg-primary); opacity: .85; }
.record-btn.busy svg { animation: spin 1s linear infinite; }
.record-btn:disabled { opacity: .5; cursor: not-allowed; }

.bar-hint { margin: 0; font-size: 12px; color: var(--text-tertiary); text-align: center; }

.demo-strip {
  display: flex; align-items: center; gap: 10px;
  max-width: min(920px, 100%);
  padding: 6px 10px 6px 14px;
  border-radius: var(--radius-2xl);
  background: rgba(244, 231, 221, .85);
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}
.demo-kicker {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-tertiary);
}
.demo-clips { display: flex; flex-wrap: wrap; gap: 6px; }
.demo-clip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px 0 10px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-primary);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background-color .15s, border-color .15s, color .15s;
}
.demo-clip:hover { background: var(--surface-hover); border-color: var(--border-hover); }
.demo-clip .i svg { width: 12px; height: 12px; color: var(--text-tertiary); }
.demo-clip .dur { color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.demo-clip.playing {
  background: var(--success-muted); border-color: var(--success-border); color: var(--success-hover);
}
.demo-clip.playing .i svg, .demo-clip.playing .dur { color: var(--success-hover); }
.demo-clip:disabled { opacity: .5; cursor: default; }

.demo-bar { min-width: min(560px, 100%); }
.demo-bar-text { display: flex; flex-direction: column; gap: 2px; min-width: 160px; }
.demo-bar-title { font-size: 14px; font-weight: 600; }
.demo-bar-progress { font-size: 12px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.demo-meter {
  width: 128px; height: 6px; border-radius: 999px; flex: none;
  background: var(--sand-150); overflow: hidden;
}
.demo-meter i {
  display: block; height: 100%; width: 0;
  background: var(--success); border-radius: inherit;
}
.demo-bar .record-btn { min-width: 160px; }

/* ----------------------------------------------------------------- modal */

.modal {
  position: fixed; left: 50%; top: 50%; z-index: 55; transform: translate(-50%, -50%);
  width: calc(100% - 32px); max-width: 460px; max-height: calc(100vh - 48px);
  display: flex; flex-direction: column;
  border-radius: var(--radius-2xl); background: var(--surface);
  box-shadow: var(--shadow-2xl); overflow: hidden; animation: modalIn .2s ease-out forwards;
}
.modal-wide { max-width: 720px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 600; }
.modal-body { display: flex; flex-direction: column; gap: 18px; padding: 20px; overflow-y: auto; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-top: 1px solid var(--border); background: var(--surface-page); }
.modal-foot-group { display: flex; gap: 4px; flex-wrap: wrap; }

.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.toggle-row > span:first-child { display: flex; flex-direction: column; gap: 2px; }
.toggle-row .strong { font-size: 14px; font-weight: 600; }
.toggle-row .muted { font-size: 12px; }
.toggle-row input { position: absolute; opacity: 0; pointer-events: none; }
/* The one setting people come for sits first, as a card of its own. */
.toggle-row-first {
  padding: 12px 14px; margin: -4px 0 2px; border-radius: var(--radius-lg);
  border: 1px solid var(--border); background: var(--surface-accent);
}
.toggle-row .muted a { color: var(--bark-700); text-decoration: underline; text-underline-offset: 2px; }
.toggle-row .muted a:hover { color: var(--text-primary); }
.switch { position: relative; flex: none; width: 44px; height: 26px; border-radius: 999px; background: var(--bg-secondary); transition: background-color .2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow-sm); transition: transform .2s; }
.toggle-row input:checked + .switch { background: var(--success); }
.toggle-row input:checked + .switch::after { transform: translateX(18px); }

/* command words table */
.cmd-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.cmd-table th { text-align: left; padding: 6px 8px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-tertiary); border-bottom: 1px solid var(--border); }
.cmd-table td { padding: 7px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.cmd-table td.c-out { font-family: var(--font-note); font-size: 15px; white-space: nowrap; color: var(--text-primary); }
.cmd-table td.c-say { color: var(--text-secondary); }
.cmd-table td.c-say span { display: inline-block; padding: 1px 7px; margin: 1px 3px 1px 0; border-radius: 999px; background: var(--surface-accent); border: 1px solid var(--border); }
.cmd-note { margin: 0; font-size: 12px; color: var(--text-tertiary); line-height: 1.5; }

/* --------------------------------------------------------------- responsive */

@media (max-width: 960px) {
  .turns { display: none; }
}
@media (max-width: 720px) {
  .workspace { padding: 0 12px 270px; }
  .demo-strip { max-width: 100%; }
  .demo-bar { width: 100%; min-width: 0; flex-wrap: wrap; justify-content: center; }
  .demo-meter { flex: 1; width: auto; min-width: 80px; }
  .note { padding: 20px 18px 40px; font-size: 17px; }
  .recording-bar { width: 100%; flex-wrap: wrap; justify-content: center; }
  .record-btn { min-width: 0; flex: 1; }
  .app-header-right .engines { display: none; }
  .bar-hint { display: none; }
}
