/* ================================================================
   Transcriptor — Reader prototype
   Visual language: MAS_Trader (see tokens.css for var(--*) values).
   ================================================================ */

:root {
  /* Tweak-driven knobs. JS sets these on documentElement. */
  --accent: #5eead4;
  --density-pad: 32px;
  --density-gap: 26px;
  --density-body-size: 16px;
  --density-body-lh: 1.65;
  --body-font: var(--font-sans);

  /* Derived */
  --shell-max: 920px;
  --read-max: 740px;
}

/* ---------- base ---------- */
* { box-sizing: border-box; }
html, body, #root { height: 100%; }
html, body {
  margin: 0;
  background: var(--bg-base);
  background-image: radial-gradient(circle, rgba(30, 30, 46, 0.45) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
::selection { background: color-mix(in oklch, var(--accent) 35%, transparent); color: var(--text-primary); }

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 6px; border: 2px solid var(--bg-base); }
::-webkit-scrollbar-thumb:hover { background: var(--border-emphasis); }

input, button, textarea { font-family: inherit; }
button { cursor: pointer; }
input[type="checkbox"] { accent-color: var(--accent); cursor: pointer; }

.app {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ================================================================
   TOP BAR
   ================================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 60px;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding: 0 24px;
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-default);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 6px 8px 6px 4px;
  margin-left: -8px;
  border-radius: 8px;
  border: none;
  background: transparent;
  text-align: left;
}
.brand:hover { background: var(--bg-hover); }
.brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.brand-logo {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.brand-name {
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1.1;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 3px;
}

.topbar-status { display: flex; justify-content: center; }
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  font-size: 12px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.status-chip .status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted);
}
.status-chip--idle .status-dot    { background: var(--text-muted); }
.status-chip--running .status-dot { background: var(--status-active); box-shadow: 0 0 8px var(--status-active); animation: pulseDot 2s ease-in-out infinite; }
.status-chip--done .status-dot    { background: var(--status-healthy); }
.status-chip--error .status-dot   { background: var(--status-critical); }
.status-chip--running             { color: var(--status-active); }
.status-chip--done                { color: var(--status-healthy); }
.status-chip--error               { color: var(--status-critical); }

@keyframes pulseDot {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

.nav { display: flex; justify-content: flex-end; align-items: center; gap: 6px; }
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border-radius: 8px;
}
.nav-link:hover { background: var(--bg-hover); color: var(--text-primary); }
.nav-link.is-active {
  background: var(--bg-inset);
  border-color: var(--border-default);
  color: var(--text-primary);
}
.nav-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
}
.nav-icon:hover { background: var(--bg-hover); color: var(--accent); }

/* ================================================================
   PAGE LAYOUT
   ================================================================ */
.page {
  flex: 1;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--density-pad) 24px 120px;
  display: flex;
  flex-direction: column;
  gap: var(--density-gap);
}

.hero-wrap {
  /* hero content */
}

/* ================================================================
   IDLE HERO
   ================================================================ */
.hero-idle {
  position: relative;
  padding: 56px 8px 24px;
  text-align: center;
}
.hero-glow {
  position: absolute;
  inset: -10% -20% auto -20%;
  height: 280px;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 30% 30%, color-mix(in oklch, var(--accent) 18%, transparent), transparent 60%),
    radial-gradient(ellipse at 70% 50%, color-mix(in oklch, var(--agent-watchdog) 10%, transparent), transparent 65%);
  filter: blur(20px);
}
.hero-idle > *:not(.hero-glow) { position: relative; z-index: 1; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 12px;
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  color: var(--accent);
  border-radius: 16px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.hero-title {
  margin: 22px auto 0;
  max-width: 720px;
  font-size: 40px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  color: var(--text-primary);
  text-wrap: balance;
}
.hero-yt {
  color: var(--accent);
  background: linear-gradient(120deg, var(--accent), color-mix(in oklch, var(--accent) 55%, white));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-lede {
  margin: 14px auto 0;
  max-width: 540px;
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.55;
  text-wrap: pretty;
}

.hero-form {
  margin: 28px auto 0;
  max-width: 620px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 6px 6px 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 28px;
  transition: border-color 120ms, box-shadow 120ms;
}
.hero-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.hero-form-icon { display: flex; color: var(--text-muted); }
.hero-form input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  height: 40px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-primary);
}
.hero-form input::placeholder { color: var(--text-muted); }
.hero-submit {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 20px;
  background: var(--text-primary);
  color: var(--bg-base);
  border: none;
  border-radius: 22px;
  font-weight: 600;
  font-size: 14px;
  transition: opacity 120ms, transform 120ms;
}
.hero-submit:hover { opacity: 0.92; }
.hero-submit:active { transform: scale(0.985); }
.hero-upload {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
  border-radius: 22px;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  transition: color 120ms, border-color 120ms, transform 120ms;
}
.hero-upload:hover { color: var(--text-primary); border-color: var(--accent); }
.hero-upload:active { transform: scale(0.985); }

.hero-options {
  margin: 16px auto 0;
  display: flex;
  justify-content: center;
}
.opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 14px;
  font-size: 13px;
  color: var(--text-secondary);
}
.opt input { margin: 0; }
.opt-sub {
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 11px;
  padding-left: 6px;
  border-left: 1px solid var(--border-default);
}

.hero-samples {
  margin: 24px auto 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}
.hero-samples-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-right: 4px;
}
.sample-chip {
  padding: 5px 11px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
  transition: all 120ms;
}
.sample-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* ================================================================
   IDLE STRIP (below hero)
   ================================================================ */
.idle-strip {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.idle-item {
  display: flex;
  gap: 12px;
  padding: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  align-items: flex-start;
}
.idle-item-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.idle-item-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.idle-item-body {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ================================================================
   RUNNING CARD
   ================================================================ */
.running-card {
  padding: 22px 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
}
.running-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
}
.running-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.dot-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--status-active);
  box-shadow: 0 0 8px var(--status-active);
  animation: pulseDot 2s ease-in-out infinite;
}
.running-elapsed {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.running-sep { color: var(--text-disabled); }
.running-url {
  font-family: var(--font-mono);
  color: var(--text-secondary);
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.running-title {
  margin: 8px 0 4px;
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.2;
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}
.running-step {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-inset);
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid var(--border-subtle);
  letter-spacing: 0.02em;
}
.running-sub {
  color: var(--text-secondary);
  font-size: 13px;
}
.running-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.gpu-stats {
  text-align: right;
  padding: 6px 10px;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: 6px;
}
.gpu-stats .mas-label { font-size: 9px; }
.gpu-stats .mas-data { font-size: 12px; color: var(--text-primary); }
.cancel-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--status-critical) 50%, transparent);
  color: var(--status-critical);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  transition: background 120ms;
}
.cancel-btn:hover {
  background: color-mix(in srgb, var(--status-critical) 12%, transparent);
}

/* Vertical stepper. The list grew from 6 phases to 9 once emotion and
   vision were added, and nine labels side by side either squash or scroll
   off. Stacked, each step gets a full line and reads at a glance. */
.phase-bar {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
}
.phase {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}
.phase-node {
  width: 24px; height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border-default);
  background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  transition: all 200ms;
}
.phase--done .phase-node {
  border-color: var(--status-healthy);
  background: color-mix(in srgb, var(--status-healthy) 14%, var(--bg-elevated));
  color: var(--status-healthy);
}
.phase--active .phase-node {
  border-color: var(--status-active);
  background: color-mix(in srgb, var(--status-active) 14%, var(--bg-elevated));
  color: var(--status-active);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-active) 18%, transparent);
}
.phase-pulse {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--status-active);
  animation: pulseDot 1.4s ease-in-out infinite;
}
.phase-label {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
}
.phase--done .phase-label   { color: var(--text-secondary); }
.phase--active .phase-label { color: var(--text-primary); font-weight: 600; }
.phase-mini-bar {
  width: 56px;
  height: 2px;
  background: var(--border-subtle);
  border-radius: 1px;
  overflow: hidden;
}
.phase-mini-fill {
  height: 100%;
  background: var(--status-active);
  animation: indeterminate 1.6s ease-in-out infinite;
  transform-origin: left;
}
@keyframes indeterminate {
  0%   { transform: scaleX(0.1); opacity: 0.7; }
  50%  { transform: scaleX(0.7); opacity: 1; }
  100% { transform: scaleX(0.1); opacity: 0.7; }
}
.phase-connector {
  flex: 0 0 auto;
  width: 1px;
  height: 14px;
  background: var(--border-default);
  /* 11.5px lines the 1px rule up with the centre of the 24px node above. */
  margin: 2px 0 2px 11.5px;
  align-self: flex-start;
  transition: background 200ms;
}
.phase-connector.is-done { background: var(--status-healthy); }

.running-foot {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  flex-wrap: wrap;
}

/* ================================================================
   ERROR BANNER
   ================================================================ */
.error-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: color-mix(in srgb, var(--status-critical) 10%, var(--bg-elevated));
  border: 1px solid color-mix(in srgb, var(--status-critical) 35%, transparent);
  border-radius: 10px;
  margin-bottom: 24px;
}
.error-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--status-critical) 18%, transparent);
  color: var(--status-critical);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.error-body { flex: 1; }
.error-title { font-weight: 600; color: var(--text-primary); }
.error-message { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.error-retry {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 6px 12px;
  background: var(--status-critical);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}
.error-retry:hover { opacity: 0.9; }
.error-dismiss {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.error-dismiss:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ================================================================
   DONE HERO
   ================================================================ */
.done-hero {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 24px;
  padding: 0;
}
.done-thumb { /* outer just holds aspect */ }
.done-thumb-art {
  position: relative;
  aspect-ratio: 16 / 9;
  background: linear-gradient(135deg, var(--bg-inset), var(--bg-hover));
  border: 1px solid var(--border-default);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.done-thumb-glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.done-thumb-corner {
  position: absolute;
  top: 8px; left: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: var(--text-secondary);
  padding: 2px 6px;
  border-radius: 3px;
}
.done-thumb-duration {
  position: absolute;
  bottom: 8px; right: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  background: rgba(0, 0, 0, 0.75);
  color: var(--text-primary);
  padding: 3px 7px;
  border-radius: 3px;
}
.done-thumb-play {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(10, 14, 20, 0.7);
  border: 1px solid color-mix(in srgb, var(--text-primary) 70%, transparent);
  color: var(--text-primary);
  display: flex; align-items: center; justify-content: center;
  padding-left: 5px;
  backdrop-filter: blur(4px);
}

.done-body { display: flex; flex-direction: column; }
.done-status-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.done-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: color-mix(in srgb, var(--status-healthy) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--status-healthy) 35%, transparent);
  color: var(--status-healthy);
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.done-elapsed {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-muted);
}
.done-title {
  margin: 12px 0 8px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.22;
  color: var(--text-primary);
  text-wrap: balance;
}
.done-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
}
.done-meta-item { display: inline-flex; align-items: center; gap: 5px; }
.done-meta-sep { color: var(--text-disabled); }
.done-meta-channel { color: var(--text-muted); font-family: var(--font-mono); font-size: 12px; }

.speaker-chip-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}
.sp-chip-bar {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 6px 5px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  font-size: 13px;
}
.sp-chip-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--sp-color);
  box-shadow: 0 0 6px color-mix(in srgb, var(--sp-color) 50%, transparent);
}
.sp-chip-name { color: var(--text-primary); font-weight: 600; }
.sp-chip-meta { color: var(--text-muted); font-family: var(--font-mono); font-size: 11px; }
.sp-chip-match {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 11px;
  background: color-mix(in srgb, var(--status-healthy) 12%, transparent);
  color: var(--status-healthy);
  font-size: 11px;
  font-weight: 500;
}
.sp-chip-save {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 11px;
  background: transparent;
  border: 1px dashed var(--border-default);
  color: var(--text-muted);
  font-size: 11px;
}
.sp-chip-save:hover { color: var(--accent); border-color: var(--accent); }

/* ================================================================
   TRANSCRIPT TOOLBAR
   ================================================================ */
.t-toolbar {
  position: sticky;
  top: 60px;
  z-index: 10;
  margin-top: 12px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg-base) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--border-default);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.t-toolbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.t-toolbar-stats {
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.t-toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}
.t-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: 18px;
  color: var(--text-muted);
  transition: border-color 120ms;
}
.t-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 18%, transparent);
}
.t-search input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  min-width: 160px;
}
.t-search input::placeholder { color: var(--text-muted); }
.t-search-clear {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--border-default);
  color: var(--bg-base);
  border: none;
  display: flex; align-items: center; justify-content: center;
}
.t-search-clear:hover { background: var(--text-secondary); }

.t-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}

/* ================================================================
   TRANSCRIPT BODY
   ================================================================ */
.transcript {
  max-width: var(--read-max);
  width: 100%;
  margin: 12px auto 0;
  padding: 0 0 40px;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.turn {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.turn-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.turn-avatar {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--sp-color) 18%, transparent);
  border: 1.5px solid var(--sp-color);
  color: var(--sp-color);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.turn-speaker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.turn-speaker-name {
  color: var(--sp-color);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.turn-speaker-vp {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--sp-color) 18%, transparent);
  color: var(--sp-color);
  display: inline-flex; align-items: center; justify-content: center;
}
.turn-speaker-raw {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}
.turn-rename {
  width: 20px; height: 20px;
  border-radius: 4px;
  background: transparent;
  border: none;
  color: var(--text-disabled);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 120ms, color 120ms;
}
.turn:hover .turn-rename { opacity: 1; }
.turn-rename:hover { color: var(--accent); background: var(--bg-hover); }
.turn-ts {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}
.turn-text {
  margin: 0;
  font-family: var(--body-font);
  font-size: var(--density-body-size);
  line-height: var(--density-body-lh);
  color: var(--text-primary);
  text-wrap: pretty;
}

.scene {
  display: flex;
  gap: 12px;
  margin: 6px 0;
  padding-left: 12px;
}
.scene-rail {
  width: 2px;
  background: linear-gradient(to bottom, var(--agent-watchdog), color-mix(in srgb, var(--agent-watchdog) 30%, transparent));
  border-radius: 1px;
  flex-shrink: 0;
}
.scene-body { flex: 1; padding: 4px 0; }
.scene-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.scene-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  color: var(--agent-watchdog);
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.scene-ts {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-muted);
}
.scene-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text-secondary);
  font-style: italic;
  text-wrap: pretty;
}

.hl { border-radius: 3px; padding: 0 2px; }

/* ================================================================
   STICKY FOOTER
   ================================================================ */
.sticky-footer {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 14px;
  background: color-mix(in srgb, var(--bg-elevated) 95%, transparent);
  border: 1px solid var(--border-default);
  border-radius: 30px;
  box-shadow:
    0 12px 40px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.sf-group { display: flex; align-items: center; gap: 6px; }
.sf-label { font-size: 9px; color: var(--text-muted); margin-right: 4px; }
.sf-dl {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 7px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: 16px;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  transition: all 120ms;
}
.sf-dl:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.sf-spacer { width: 8px; }
.sf-copy {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 16px;
  background: var(--accent);
  color: var(--bg-base);
  border: none;
  border-radius: 18px;
  font-weight: 600;
  font-size: 13px;
  transition: opacity 120ms, transform 120ms;
}
.sf-copy:hover { opacity: 0.92; }
.sf-copy:active { transform: scale(0.98); }

/* ================================================================
   VOICEPRINTS VIEW
   ================================================================ */
.vp-view {
  flex: 1;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 32px 24px 80px;
}
.vp-head { margin-bottom: 28px; }
.vp-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px 5px 8px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 14px;
  color: var(--text-secondary);
  font-size: 12px;
  margin-bottom: 18px;
}
.vp-back:hover {
  color: var(--text-primary);
  border-color: var(--border-emphasis);
}
.vp-title {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}
.vp-sub {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}
.vp-empty {
  text-align: center;
  padding: 64px 24px;
  background: var(--bg-elevated);
  border: 1px dashed var(--border-default);
  border-radius: 12px;
  color: var(--text-secondary);
}
.vp-empty svg { color: var(--accent); margin-bottom: 12px; }
.vp-empty p { margin: 4px 0; }
.vp-empty-sub { font-size: 13px; color: var(--text-muted); }
.vp-empty em { color: var(--text-primary); font-style: normal; font-weight: 600; }

.vp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 16px;
}
.vp-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.vp-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.vp-avatar {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: var(--bg-inset);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.vp-card-name {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.vp-card-sub {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.vp-rename {
  width: 28px; height: 28px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
}
.vp-rename:hover { color: var(--accent); border-color: var(--accent); }

.vp-samples {
  list-style: none;
  margin: 0;
  padding: 4px 0;
}
.vp-sample {
  display: grid;
  grid-template-columns: 130px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 8px 16px;
  border-top: 1px solid var(--border-subtle);
  font-size: 13px;
}
.vp-sample:first-child { border-top: none; }
.vp-sample:hover { background: var(--bg-hover); }
.vp-sample-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}
.vp-sample-src code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 3px;
}
.vp-sample-dur {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}
.vp-sample-del {
  width: 26px; height: 26px;
  border-radius: 5px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  display: flex; align-items: center; justify-content: center;
}
.vp-sample-del:hover {
  background: color-mix(in srgb, var(--status-critical) 14%, transparent);
  color: var(--status-critical);
}

/* ================================================================
   TWEAKS — extras inside the panel
   ================================================================ */
.tweak-help {
  font-size: 11px;
  color: var(--text-muted, #5e6b7e);
  margin: 2px 0 8px;
  line-height: 1.45;
}
.tweak-state-buttons {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

/* ================================================================
   RESPONSIVE FALLBACKS
   ================================================================ */

/* ---------- Tablet & down (≤ 880px) ---------- */
@media (max-width: 880px) {
  .page { padding: 24px 16px 140px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .brand-sub { display: none; }
  .done-hero { grid-template-columns: 1fr; gap: 18px; }
  .done-thumb-art { max-width: 360px; }
  .idle-strip { grid-template-columns: 1fr; }
  .vp-view { padding: 24px 16px 80px; }
  .vp-grid { grid-template-columns: 1fr; }
}

/* ---------- Phone (≤ 640px) ---------- */
@media (max-width: 640px) {
  :root {
    --shell-max: 100%;
    --density-pad: 20px;
    --density-gap: 18px;
  }

  /* Top bar collapses: hide the centered status chip; brand shrinks to logo + name */
  .topbar {
    grid-template-columns: 1fr auto;
    height: 54px;
    padding: 0 14px;
    gap: 8px;
  }
  .topbar-status { display: none; }
  .brand-logo { width: 30px; height: 30px; }
  .brand-name { font-size: 14px; }
  .nav { gap: 4px; }
  .nav-link { padding: 6px 10px; font-size: 12px; }
  .nav-link svg { display: none; }
  .nav-icon { width: 30px; height: 30px; }

  .page { padding: 18px 14px 140px; }

  /* Hero idle */
  .hero-idle { padding: 28px 0 12px; }
  .hero-glow { height: 200px; inset: -10% -10% auto -10%; }
  .hero-eyebrow { font-size: 10px; padding: 3px 10px; }
  .hero-title {
    margin-top: 16px;
    font-size: 26px;
    line-height: 1.15;
    letter-spacing: -0.02em;
  }
  .hero-lede { margin-top: 12px; font-size: 14px; padding: 0 4px; }

  /* Stack the URL form vertically — input row on top, big button below */
  .hero-form {
    margin-top: 20px;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 8px;
    border-radius: 14px;
  }
  .hero-form input { height: 38px; padding: 0 4px; }
  .hero-form-icon { padding-left: 4px; }
  .hero-submit { width: 100%; justify-content: center; height: 44px; border-radius: 10px; }
  .hero-upload { width: 100%; justify-content: center; height: 44px; border-radius: 10px; }

  .hero-options { margin-top: 14px; }
  .opt { font-size: 12px; padding: 6px 10px; }
  .opt-sub { display: none; }

  .hero-samples { margin-top: 18px; row-gap: 6px; }
  .hero-samples-label { width: 100%; text-align: center; margin-bottom: 2px; }

  .idle-item { padding: 14px; }
  .idle-item-title { font-size: 13px; }
  .idle-item-body { font-size: 12.5px; }

  /* Running card */
  .running-card { padding: 16px 14px; border-radius: 10px; }
  .running-head { flex-direction: column; gap: 12px; }
  .running-right { align-self: stretch; justify-content: space-between; }
  .running-title { font-size: 18px; gap: 8px; }
  .running-step { font-size: 10px; padding: 2px 6px; }
  .running-sub { font-size: 12px; }
  .running-url { max-width: 200px; font-size: 11px; }
  .running-foot { font-size: 11px; }

  /* The phase list stacks vertically, so it no longer needs the horizontal
     scroll track that kept six side-by-side labels from squashing. */
  .phase-bar { margin-top: 18px; }
  .phase-label { font-size: 10px; }
  .phase-mini-bar { width: 48px; }

  /* Done hero */
  .done-thumb-art { max-width: 100%; }
  .done-title { font-size: 22px; margin: 10px 0 6px; }
  .done-meta { font-size: 12px; gap: 6px; }
  .done-meta-channel { width: 100%; margin-top: 2px; }
  .speaker-chip-bar { margin-top: 12px; }
  .sp-chip-bar { font-size: 12px; padding: 4px 6px 4px 9px; }
  .sp-chip-meta { display: none; }

  /* Transcript toolbar: stack into two rows */
  .t-toolbar {
    top: 54px;
    padding: 10px 12px;
    gap: 8px;
    flex-direction: column;
    align-items: stretch;
  }
  .t-toolbar-left {
    justify-content: space-between;
    width: 100%;
  }
  .t-toolbar-right {
    width: 100%;
    gap: 8px;
    flex-wrap: wrap;
  }
  .t-search { flex: 1 1 100%; }
  .t-search input { min-width: 0; }

  /* Transcript body */
  .transcript { gap: 22px; padding-bottom: 24px; }
  .turn-head { gap: 8px; }
  .turn-avatar { width: 22px; height: 22px; font-size: 9px; }
  .turn-speaker-name { font-size: 12px; }
  .turn-speaker-raw { display: none; }
  .turn-rename { display: none; } /* hover-revealed control — no hover on mobile */
  .turn-ts { font-size: 10px; }
  .turn-text {
    font-size: 15px;
    line-height: 1.55;
  }
  .scene { padding-left: 6px; gap: 10px; }
  .scene-text { font-size: 13px; }

  /* Sticky footer: full-width bar at bottom with a wrap fallback */
  .sticky-footer {
    left: 8px;
    right: 8px;
    bottom: 8px;
    transform: none;
    border-radius: 14px;
    padding: 8px 10px;
    gap: 6px;
    flex-wrap: wrap;
  }
  .sf-group { flex: 1 1 auto; gap: 4px; justify-content: flex-start; }
  .sf-label { display: none; }
  .sf-dl { padding: 7px 10px; font-size: 11px; }
  .sf-spacer { display: none; }
  .sf-copy { flex-shrink: 0; padding: 8px 14px; font-size: 12px; }

  /* Error banner */
  .error-banner { flex-wrap: wrap; padding: 12px; }
  .error-body { flex: 1 1 100%; order: 2; }
  .error-icon { order: 1; }
  .error-retry, .error-dismiss { order: 3; }

  /* Voiceprints view */
  .vp-view { padding: 18px 14px 100px; }
  .vp-title { font-size: 24px; }
  .vp-card-head { padding: 12px; }
  .vp-card-name { font-size: 14px; }
  .vp-sample {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    row-gap: 4px;
    padding: 10px 12px;
  }
  .vp-sample-time { grid-column: 1; grid-row: 1; }
  .vp-sample-dur { grid-column: 2; grid-row: 1; }
  .vp-sample-src { grid-column: 1 / span 1; grid-row: 2; }
  .vp-sample-del { grid-column: 2; grid-row: 2; justify-self: end; }
}

/* ---------- Tiny phones (≤ 380px) ---------- */
@media (max-width: 380px) {
  .hero-title { font-size: 22px; }
  .hero-lede { font-size: 13px; }
  .nav-link span { display: none; } /* icon-only */
  .nav-link { width: 30px; padding: 0; justify-content: center; }
  .nav-link svg { display: block; }
  .running-url { display: none; }
  .sticky-footer { flex-direction: column; align-items: stretch; }
  .sf-copy { width: 100%; justify-content: center; }
}

/* ================================================================
   APPLICATION OVERRIDES (added after the design handoff)

   The middle ``.topbar-status`` slot now holds functional UI in
   done/error states (HistoryDropdown + InlineUrlForm) — not just a
   status chip. On phones the original mobile rule hides that slot
   entirely, so we instead make it wrap to a second row of the topbar
   so the URL form + history dropdown stay reachable.
   ================================================================ */
@media (max-width: 640px) {
  .topbar {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    height: auto;
    min-height: 54px;
    align-items: center;
    row-gap: 6px;
    padding: 8px 14px;
  }
  .brand { grid-row: 1; grid-column: 1; }
  .nav   { grid-row: 1; grid-column: 2; }
  /* Override the design's `display: none` for our active tools row. */
  .topbar-status {
    display: flex !important;
    grid-row: 2;
    grid-column: 1 / -1;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-start;
  }
  /* Hide the status chip itself on mobile — saves vertical space when
     idle/running. The dropdown + form only render in done/error,
     when there's something useful to put there. */
  .topbar-status .status-chip { display: none; }
}

/* ================================================================
   MEETING NOTES PANEL (0.17.0)

   Rendered above the transcript when /result carries `meeting`. Shares
   the transcript's reading width so the notes and the turns they cite
   line up. `.turn.is-jumped` is the flash a [mm:ss] link leaves on the
   turn it scrolled to (reader-app jumpToSegment).
   ================================================================ */
/* The Meetings entry is a real link (own route), not a view button. */
a.nav-link, a.brand { text-decoration: none; color: inherit; }

.notes {
  max-width: var(--read-max);
  width: 100%;
  margin: 12px auto 0;
  padding: 20px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.notes-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.notes-brain {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border-default);
  background: var(--bg-inset);
  color: var(--text-secondary);
}
.notes-brain--claude {
  color: var(--agent-analyst);
  border-color: color-mix(in srgb, var(--agent-analyst) 45%, transparent);
  background: color-mix(in srgb, var(--agent-analyst) 10%, transparent);
}
.notes-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--status-critical) 10%, var(--bg-elevated));
  border: 1px solid color-mix(in srgb, var(--status-critical) 35%, transparent);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.notes-error svg { color: var(--status-critical); flex-shrink: 0; margin-top: 2px; }
.notes-summary p {
  margin: 0 0 10px;
  font-family: var(--body-font);
  font-size: var(--density-body-size);
  line-height: var(--density-body-lh);
  color: var(--text-primary);
  text-wrap: pretty;
}
.notes-summary p:last-child { margin-bottom: 0; }
.notes-section-title {
  margin: 0 0 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text-primary);
}
.notes-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.notes-item {
  padding: 10px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}
.notes-item-main { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.notes-item-text {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}
.notes-item-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-secondary);
}
.notes-ts {
  padding: 1px 6px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  transition: border-color 120ms, background 120ms;
}
.notes-ts:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.notes-unverified {
  padding: 1px 6px;
  border: 1px solid color-mix(in srgb, var(--status-warning) 50%, transparent);
  border-radius: 3px;
  color: var(--status-warning);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.notes-quote {
  margin-top: 6px;
  font-size: 12.5px;
  line-height: 1.5;
  font-style: italic;
  color: var(--text-muted);
  word-break: break-word;
}

.turn.is-jumped { border-radius: 8px; animation: jumpFlash 1.6s ease-out; }
@keyframes jumpFlash {
  0% {
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--accent) 22%, transparent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
  }
  100% {
    box-shadow: 0 0 0 8px transparent;
    background: transparent;
  }
}

/* ================================================================
   MEETINGS PAGE (0.17.0) — templates/meetings.html + meetings.jsx

   Reuses the topbar, hero-* and opt classes above; these are only the
   pieces the home page has no equivalent for: the recordings list, the
   brain toggle, and the two-column options layout.
   ================================================================ */
.mt-hero { padding-top: 32px; padding-bottom: 8px; }
.mt-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}
.mt-card {
  padding: 16px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.mt-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mt-dir {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-refresh {
  width: 26px; height: 26px;
  border-radius: 6px;
  background: transparent;
  border: 1px solid var(--border-default);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
}
.mt-refresh:hover { color: var(--accent); border-color: var(--accent); }
.mt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.mt-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text-primary);
  text-align: left;
  transition: background 120ms, border-color 120ms;
}
.mt-row:hover { background: var(--bg-hover); }
.mt-row.is-selected { background: var(--bg-inset); border-color: var(--accent); }
.mt-row-icon { display: flex; color: var(--text-muted); }
.mt-row.is-selected .mt-row-icon { color: var(--accent); }
.mt-row-name {
  font-size: 13.5px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-row-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}
.mt-empty {
  text-align: center;
  padding: 36px 16px;
  border: 1px dashed var(--border-default);
  border-radius: 10px;
  color: var(--text-secondary);
}
.mt-empty svg { color: var(--accent); margin-bottom: 10px; }
.mt-empty p { margin: 4px 0; }
.mt-empty-sub { font-size: 12.5px; color: var(--text-muted); line-height: 1.6; }
.mt-empty code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 3px;
  word-break: break-all;
}
.mt-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}
.mt-upload-row .hero-upload { height: 34px; font-size: 13px; }
.mt-upload-name {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mt-opts { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.mt-opts .opt { justify-content: flex-start; }
.mt-seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  width: fit-content;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: 10px;
}
.mt-seg-btn {
  padding: 5px 14px;
  background: transparent;
  border: none;
  border-radius: 7px;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
}
.mt-seg-btn:hover { color: var(--text-primary); }
.mt-seg-btn.is-active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-card);
}
.mt-note { font-size: 12px; line-height: 1.45; color: var(--status-warning); }
.mt-run { width: 100%; justify-content: center; }
.mt-run:disabled { opacity: 0.45; cursor: not-allowed; }
.mt-run-target {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 880px) {
  .mt-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   FACEBOOK POST PANEL (0.18.0)

   Rendered above the transcript when /result carries `post`, on the
   same card and reading width as the meeting-notes panel. Attachment
   link targets are plain text; notes are warning lines (a partial
   capture, a stop, a skipped step), never errors. The partial pill is
   the post-only DoneHero's "Partial capture".
   ================================================================ */
.post-panel {
  max-width: var(--read-max);
  width: 100%;
  margin: 12px auto 0;
  padding: 20px 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-default);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.post-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.post-author { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.post-time { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); }
.post-text {
  margin: 0;
  font-family: var(--body-font);
  font-size: var(--density-body-size);
  line-height: var(--density-body-lh);
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}
.post-attachments {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.post-attachment {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-word;
}
.post-attachment-url {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  word-break: break-all;
}
.post-tag {
  padding: 1px 6px;
  border: 1px solid var(--border-default);
  border-radius: 3px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.post-tag--complete {
  color: var(--status-healthy);
  border-color: color-mix(in srgb, var(--status-healthy) 50%, transparent);
}
.post-tag--partial {
  color: var(--status-warning);
  border-color: color-mix(in srgb, var(--status-warning) 50%, transparent);
}
.post-stats { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.post-stat { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.post-sort { color: var(--text-muted); }
.post-open {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--status-active);
  font-size: 12.5px;
  text-decoration: none;
}
.post-open:hover { text-decoration: underline; }
.post-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--status-warning) 10%, var(--bg-elevated));
  border: 1px solid color-mix(in srgb, var(--status-warning) 35%, transparent);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}
.post-note svg { color: var(--status-warning); flex-shrink: 0; margin-top: 2px; }
.done-status--partial {
  background: color-mix(in srgb, var(--status-warning) 12%, transparent);
  border-color: color-mix(in srgb, var(--status-warning) 35%, transparent);
  color: var(--status-warning);
}

@media (max-width: 640px) {
  .post-panel { padding: 16px 14px; }
}

/* ================================================================
   FACEBOOK MEDIA (0.19.0)

   Pictures a Facebook capture saved, loaded only from the owner-only
   /facebook/media route: the post's picture up to the panel's width,
   a comment's picture as a thumbnail beside its text. Facebook's alt
   text and the local model's description are labeled lines; the text
   read from a picture sits in a collapsed "Text in image". A shared
   link is a small card whose target is plain text. On phones a
   comment's picture goes above its text instead of beside it.
   ================================================================ */
.fb-media {
  flex: 1 1 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fb-media--comment {
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  margin-top: 8px;
}
.fb-media--link {
  padding: 10px 12px;
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: 8px;
}
.fb-media-pic {
  flex-shrink: 0;
  align-self: flex-start;
  display: block;
  max-width: 100%;
  overflow: hidden;
  background: var(--bg-inset);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}
.fb-media-pic img {
  display: block;
  max-width: 100%;
  max-height: 480px;
  width: auto;
  height: auto;
}
.fb-media--comment .fb-media-pic img { max-width: 160px; max-height: 160px; }
.fb-media--link .fb-media-pic img { max-width: 96px; max-height: 96px; }
.fb-media-text {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-secondary);
  word-break: break-word;
}
.fb-media--comment .fb-media-text { font-size: 12.5px; }
.fb-media-label {
  margin-right: 8px;
  color: var(--text-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fb-media-ocr summary {
  cursor: pointer;
  width: fit-content;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}
.fb-media-ocr summary:hover { color: var(--accent); }
.fb-media-ocr-text {
  margin-top: 6px;
  padding: 8px 10px;
  background: var(--bg-inset);
  border-left: 2px solid var(--border-default);
  border-radius: 4px;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}
.fb-media-error { color: var(--text-muted); font-size: 12px; }
.fb-link-title { color: var(--text-primary); font-weight: 600; }
.fb-link-source {
  color: var(--text-muted);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fb-link-url {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-muted);
  word-break: break-all;
}

@media (max-width: 640px) {
  .fb-media--comment:not(.fb-media--link) { flex-direction: column; }
  .fb-media-pic img { max-height: 360px; }
}
