/* ==========================================================================
   FinPodcast Studio — Authentic Google Material 3 / Google AI Studio Aesthetic
   Matches video.5oar.com visual design system (Light + Dark modes)
   ========================================================================== */

:root,
[data-theme="light"] {
  --surface: #ffffff;
  --surface-dim: #f8fafd;
  --surface-container: #f0f4f9;
  --surface-container-high: #e8edf5;
  --surface-elevated: #ffffff;
  --outline: #e0e3e7;
  --outline-strong: #c4c7c5;
  --ink: #1f1f1f;
  --ink-secondary: #444746;
  --ink-muted: #747775;
  --primary: #0b57d0;
  --primary-hover: #0842a0;
  --primary-ink: #ffffff;
  --primary-container: #d3e3fd;
  --on-primary-container: #041e49;
  --success: #137333;
  --success-bg: #e6f4ea;
  --warning: #b06000;
  --warning-bg: #fef7e0;
  --danger: #b3261e;
  --danger-bg: #fce8e6;
  --shadow-composer: 0 2px 12px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-popover: 0 8px 28px rgba(0, 0, 0, 0.12), 0 1px 3px rgba(0, 0, 0, 0.08);
  --console-bg: #f8fafd;
  --console-ink: #3c4043;
  --hero-bg: linear-gradient(135deg, #101828 0%, #162447 55%, #0b2239 100%);
}

[data-theme="dark"] {
  --surface: #131314;
  --surface-dim: #18191b;
  --surface-container: #1e1f20;
  --surface-container-high: #282a2c;
  --surface-elevated: #1e1f20;
  --outline: #333537;
  --outline-strong: #494c4f;
  --ink: #e3e3e3;
  --ink-secondary: #c4c7c5;
  --ink-muted: #8e918f;
  --primary: #a8c7fa;
  --primary-hover: #c2d9ff;
  --primary-ink: #062e6f;
  --primary-container: #004a77;
  --on-primary-container: #d3e3fd;
  --success: #81c995;
  --success-bg: rgba(129, 201, 149, 0.14);
  --warning: #fdd663;
  --warning-bg: rgba(253, 214, 99, 0.14);
  --danger: #f28b82;
  --danger-bg: rgba(242, 139, 130, 0.14);
  --shadow-composer: 0 4px 20px rgba(0, 0, 0, 0.36);
  --shadow-popover: 0 12px 32px rgba(0, 0, 0, 0.52);
  --console-bg: #0e0e10;
  --console-ink: #b9bdc2;
  --hero-bg: linear-gradient(135deg, #0d1117 0%, #152238 55%, #0f1b2e 100%);
}

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

html, body {
  height: 100%;
  background: var(--surface);
  color: var(--ink);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC", "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.9em;
  background: var(--surface-container-high);
  padding: 1px 5px;
  border-radius: 5px;
}

.hidden { display: none !important; }

.ms {
  font-family: "Material Symbols Rounded";
  font-weight: 400;
  font-style: normal;
  font-size: 19px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 20;
}

/* --------------------------------------------------------------------------
   Top App Bar
   -------------------------------------------------------------------------- */
.appbar {
  height: 56px;
  padding: 0 16px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-bottom: 1px solid var(--outline);
  position: sticky;
  top: 0;
  z-index: 40;
}

.appbar-left, .appbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.brand-glyph {
  width: 22px;
  height: 22px;
  display: grid;
  grid-template-columns: repeat(2, 8px);
  gap: 4px;
  align-content: center;
  justify-content: center;
  flex-shrink: 0;
}

.g-dot { width: 8px; height: 8px; border-radius: 50%; }
.g-blue { background: #4285f4; }
.g-red { background: #ea4335; }
.g-yellow { background: #fbbc04; }
.g-green { background: #34a853; }

.brand-title {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.02em;
}

.mode-switcher {
  display: inline-flex;
  align-items: center;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-container);
  border: 1px solid var(--outline);
  margin-left: 4px;
}

.mode-tab {
  height: 30px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, box-shadow 0.15s;
}

.mode-tab .ms { font-size: 16px; }
.mode-tab:hover { color: var(--ink); }
.mode-tab.active {
  background: var(--surface);
  color: var(--primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.09);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface-container);
  font-size: 12px;
  border: 1px solid transparent;
}

.status-chip-btn {
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.status-chip-btn:hover {
  background: var(--surface-container-high);
  border-color: var(--outline-strong);
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-ok { background: #1e8e3e; }
.dot-pending { background: var(--ink-muted); }
.dot-err { background: var(--danger); }

.status-key { color: var(--ink-muted); }
.status-val { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.icon-btn:hover { background: var(--surface-container); color: var(--ink); }
.icon-btn.active { background: var(--primary-container); color: var(--on-primary-container); }
.icon-btn-sm { width: 32px; height: 32px; }

.icon-text-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.icon-text-btn:hover { background: var(--surface-container); color: var(--ink); }
.icon-text-btn:disabled { opacity: 0.55; cursor: wait; }

/* --------------------------------------------------------------------------
   Main Shell
   -------------------------------------------------------------------------- */
.shell {
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
  background: var(--surface);
}

.canvas-column {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
}

.canvas-scroll {
  flex: 1;
  overflow-y: auto;
  scrollbar-gutter: stable;
  padding: 20px 24px 28px;
}

.canvas-scroll::-webkit-scrollbar,
.inspector-scroll::-webkit-scrollbar,
.console-pre::-webkit-scrollbar,
.detail-code-pane::-webkit-scrollbar,
.nlm-list-body::-webkit-scrollbar {
  width: 6px;
}

.canvas-scroll::-webkit-scrollbar-thumb,
.inspector-scroll::-webkit-scrollbar-thumb,
.console-pre::-webkit-scrollbar-thumb,
.detail-code-pane::-webkit-scrollbar-thumb,
.nlm-list-body::-webkit-scrollbar-thumb {
  background: var(--outline-strong);
  border-radius: 999px;
}

.canvas-inner {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* --------------------------------------------------------------------------
   Welcome Stage
   -------------------------------------------------------------------------- */
.welcome-stage {
  padding: 4px 0 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.welcome-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 800px;
}

.welcome-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
}

.welcome-eyebrow .ms { font-size: 16px; }

.welcome-head h1 {
  font-size: 26px;
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.24;
}

.welcome-head p {
  font-size: 13.5px;
  color: var(--ink-secondary);
  line-height: 1.55;
}

.starter-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.starter-card {
  text-align: left;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid transparent;
  background: var(--surface-container);
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 7px;
  transition: background 0.16s, border-color 0.16s, transform 0.15s;
}

.starter-card:hover {
  background: var(--surface-container-high);
  border-color: var(--outline-strong);
  transform: translateY(-1px);
}

.starter-top { display: flex; align-items: center; justify-content: space-between; }

.starter-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--primary);
  font-size: 18px;
}

.starter-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-muted);
}

.starter-title { font-size: 14px; font-weight: 500; }

.starter-desc {
  font-size: 12px;
  color: var(--ink-secondary);
  line-height: 1.45;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Active Progress Monitor Card
   -------------------------------------------------------------------------- */
.monitor-card {
  border-radius: 24px;
  background: var(--surface-dim);
  border: 1px solid var(--outline);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.monitor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.monitor-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--primary);
  margin-bottom: 6px;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--primary);
  animation: pulseDot 1.5s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.75); }
}

.monitor-head h2 { font-size: 18px; font-weight: 500; letter-spacing: -0.015em; }
.monitor-prompt { margin-top: 5px; font-size: 13px; color: var(--ink-secondary); }
.monitor-right { text-align: right; flex-shrink: 0; }

.monitor-pct {
  display: block;
  font-family: "JetBrains Mono", monospace;
  font-size: 24px;
  font-weight: 500;
  line-height: 1.1;
}

.mono-sub {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  color: var(--ink-muted);
}

.m3-progress-track {
  height: 4px;
  border-radius: 999px;
  background: var(--primary-container);
  overflow: hidden;
}

.m3-progress-bar {
  height: 100%;
  border-radius: 999px;
  background: var(--primary);
  transition: width 0.4s cubic-bezier(0.2, 0, 0, 1);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--outline);
  font-size: 12px;
  color: var(--ink-muted);
}

.step-num {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--surface-container);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  flex-shrink: 0;
}

.step-item.active { border-color: var(--primary); color: var(--ink); font-weight: 500; }
.step-item.active .step-num { background: var(--primary); color: var(--primary-ink); }
.step-item.done { border-color: transparent; background: var(--success-bg); color: var(--success); }
.step-item.done .step-num { background: var(--success); color: #fff; }

.live-sources-wrap {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.live-sources-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.source-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.source-mini-chip {
  font-size: 11.5px;
  padding: 3px 9px;
  border-radius: 8px;
  background: var(--surface-container);
  color: var(--ink-secondary);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.console-details {
  border-radius: 14px;
  border: 1px solid var(--outline);
  background: var(--console-bg);
  overflow: hidden;
}

.console-summary {
  list-style: none;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  border-bottom: 1px solid var(--outline);
}

.console-summary::-webkit-details-marker { display: none; }

.console-title {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-secondary);
}

.console-pre {
  max-height: 200px;
  overflow-y: auto;
  padding: 12px 14px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--console-ink);
  white-space: pre-wrap;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   Google NotebookLM / Material 3 Audio Studio Stage
   -------------------------------------------------------------------------- */
.audio-studio-card {
  border-radius: 22px;
  border: 1px solid var(--outline);
  background: var(--surface);
  overflow: hidden;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.05);
}

.audio-hero {
  background: var(--hero-bg);
  color: #f1f3f4;
  padding: 18px 22px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.audio-hero-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hero-pill-btn {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f3f4;
  font-size: 12px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  transition: background 0.15s;
}

.hero-pill-btn .ms { font-size: 16px; }
.hero-pill-btn:hover { background: rgba(255, 255, 255, 0.16); }

.audio-hero-badges { display: flex; align-items: center; gap: 8px; }

.hero-tag {
  font-size: 11.5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(168, 199, 250, 0.16);
  color: #d3e3fd;
  border: 1px solid rgba(168, 199, 250, 0.22);
}

.mono-tag { font-family: "JetBrains Mono", monospace; }

.audio-hero-main {
  display: flex;
  align-items: center;
  gap: 18px;
}

.audio-art-box {
  width: 82px;
  height: 82px;
  border-radius: 20px;
  background: radial-gradient(circle at 30% 25%, #4285f4 0%, #1a56db 55%, #0b2239 100%);
  box-shadow: 0 8px 24px rgba(11, 87, 208, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.eq-bars {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 34px;
}

.eq-bars span {
  width: 4px;
  height: 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.9);
  transition: height 0.2s ease;
}

.eq-bars span:nth-child(2) { height: 22px; }
.eq-bars span:nth-child(3) { height: 16px; }
.eq-bars span:nth-child(4) { height: 28px; }
.eq-bars span:nth-child(5) { height: 18px; }
.eq-bars span:nth-child(6) { height: 24px; }
.eq-bars span:nth-child(7) { height: 12px; }

.audio-art-box.playing .eq-bars span {
  animation: eqBounce 0.95s ease-in-out infinite alternate;
}

.audio-art-box.playing .eq-bars span:nth-child(2) { animation-delay: 0.12s; }
.audio-art-box.playing .eq-bars span:nth-child(3) { animation-delay: 0.24s; }
.audio-art-box.playing .eq-bars span:nth-child(4) { animation-delay: 0.36s; }
.audio-art-box.playing .eq-bars span:nth-child(5) { animation-delay: 0.48s; }
.audio-art-box.playing .eq-bars span:nth-child(6) { animation-delay: 0.6s; }
.audio-art-box.playing .eq-bars span:nth-child(7) { animation-delay: 0.72s; }

@keyframes eqBounce {
  0% { height: 7px; opacity: 0.65; }
  100% { height: 34px; opacity: 1; }
}

.audio-hero-meta { min-width: 0; flex: 1; }
.audio-title { font-size: 20px; font-weight: 500; letter-spacing: -0.015em; color: #fff; line-height: 1.3; }
.audio-subtitle { font-size: 12.5px; color: rgba(232, 234, 237, 0.78); margin-top: 4px; }

.audio-spec-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.hero-spec {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: rgba(232, 234, 237, 0.86);
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 6px;
}

.hero-spec-ok {
  color: #81c995;
  background: rgba(129, 201, 149, 0.14);
}

.audio-deck {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 4px;
}

.audio-timeline-wrap { padding: 7px 0; cursor: pointer; }

.audio-timeline-track {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.audio-timeline-buffer {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.32);
}

.audio-timeline-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0%;
  border-radius: 999px;
  background: #8ab4f8;
}

.audio-timeline-thumb {
  position: absolute;
  top: 50%;
  left: 0%;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.45);
}

.audio-controls-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.audio-controls-left, .audio-controls-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.audio-play-fab {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: #ffffff;
  color: #0b57d0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.14s, background 0.14s;
}

.audio-play-fab:hover { transform: scale(1.05); background: #e8f0fe; }
.audio-play-fab .ms { font-size: 26px; font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24; }

.actrl-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.actrl-btn:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.actrl-time {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.88);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

.actrl-speed-btn {
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #f1f3f4;
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  cursor: pointer;
}

.actrl-speed-btn:hover { background: rgba(255, 255, 255, 0.18); }

.audio-sheet {
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  border-top: 1px solid var(--outline);
}

.audio-sheet-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.audio-sheet-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.phase2-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--ink-muted);
  font-size: 11.5px;
  border: 1px dashed var(--outline-strong);
}

.phase2-pill .ms { font-size: 15px; }

.detail-drawer {
  padding-top: 14px;
  border-top: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-pane {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
}

.source-row-card {
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--surface-container);
  border: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  gap: 3px;
  text-decoration: none;
  color: var(--ink);
}

.source-row-card:hover { border-color: var(--primary); }
.source-row-title { font-size: 12.5px; font-weight: 500; line-height: 1.35; }
.source-row-url { font-family: "JetBrains Mono", monospace; font-size: 10.5px; color: var(--ink-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.detail-code-pane {
  max-height: 280px;
  overflow-y: auto;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--console-bg);
  border: 1px solid var(--outline);
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--console-ink);
  white-space: pre-wrap;
  word-break: break-word;
}

/* --------------------------------------------------------------------------
   Buttons & Segmented Controls
   -------------------------------------------------------------------------- */
.btn-filled, .btn-tonal, .btn-outlined, .btn-danger-outline {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
}

.btn-sm { height: 32px; padding: 0 12px; font-size: 12px; }
.full-w { width: 100%; }

.btn-filled { border: none; background: var(--primary); color: var(--primary-ink); }
.btn-filled:hover { background: var(--primary-hover); }
.btn-filled:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-tonal { border: none; background: var(--primary-container); color: var(--on-primary-container); }
.btn-tonal:hover { opacity: 0.9; }

.btn-outlined { border: 1px solid var(--outline-strong); background: var(--surface); color: var(--ink); }
.btn-outlined:hover { background: var(--surface-container); }

.btn-danger-outline {
  height: 30px;
  padding: 0 12px;
  font-size: 12px;
  border: 1px solid var(--danger);
  background: transparent;
  color: var(--danger);
}

.btn-danger-outline:hover { background: var(--danger-bg); }

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--surface-container);
}

.segmented.full { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }

.segmented button {
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.segmented button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

/* --------------------------------------------------------------------------
   Episode Library Grid
   -------------------------------------------------------------------------- */
.library-section { display: flex; flex-direction: column; gap: 14px; }

.library-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.library-title { display: flex; align-items: center; gap: 8px; }
.library-title h3 { font-size: 15px; font-weight: 500; }

.count-pill {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--surface-container);
  color: var(--ink-secondary);
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(276px, 1fr));
  gap: 12px;
}

.ep-card {
  border-radius: 16px;
  border: 1px solid var(--outline);
  background: var(--surface);
  padding: 14px 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.ep-card:hover {
  border-color: var(--outline-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.ep-card.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.ep-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.ep-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 999px;
}

.state-completed { background: var(--success-bg); color: var(--success); }
.state-running, .state-queued { background: var(--primary-container); color: var(--on-primary-container); }
.state-failed, .state-cancelled { background: var(--danger-bg); color: var(--danger); }

.ep-mode-tag {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px;
  color: var(--ink-muted);
}

.ep-title {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.38;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ep-meta-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 11.5px;
  color: var(--ink-secondary);
  font-family: "JetBrains Mono", monospace;
}

.ep-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--outline);
  font-size: 11.5px;
  color: var(--ink-muted);
}

.card-quick-actions { display: inline-flex; align-items: center; gap: 2px; }

.card-icon-act {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  text-decoration: none;
}

.card-icon-act .ms { font-size: 17px; }
.card-icon-act:hover { background: var(--surface-container-high); color: var(--ink); }
.card-icon-act.act-del:hover { background: var(--danger-bg); color: var(--danger); }

.library-empty {
  grid-column: 1 / -1;
  padding: 28px 20px;
  border-radius: 16px;
  background: var(--surface-dim);
  border: 1px dashed var(--outline-strong);
  text-align: center;
  color: var(--ink-muted);
  font-size: 13px;
}

/* --------------------------------------------------------------------------
   Floating Bottom Omni-Composer (Google Gemini / AI Studio Signature)
   -------------------------------------------------------------------------- */
.composer-dock {
  flex-shrink: 0;
  padding: 12px 24px 16px;
  background: var(--surface);
  border-top: 1px solid var(--outline);
}

.composer-wrap {
  width: 100%;
  max-width: 940px;
  margin: 0 auto;
  position: relative;
}

.composer-card {
  background: var(--surface-container);
  border: 1px solid var(--outline);
  border-radius: 24px;
  padding: 12px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: var(--shadow-composer);
  transition: background 0.18s, border-color 0.18s;
}

.composer-card:focus-within {
  background: var(--surface-elevated);
  border-color: var(--primary);
}

.company-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.company-field {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--outline);
  border-radius: 14px;
  padding: 0 12px;
  height: 42px;
}

.company-field:focus-within { border-color: var(--primary); }
.company-field-main { flex: 1.8; }
.company-field-ticker { flex: 0.9; }

.field-icon { font-size: 18px; color: var(--primary); flex-shrink: 0; }

.company-field input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 500;
}

.company-field input::placeholder { color: var(--ink-muted); font-weight: 400; }

.vs-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-container);
  padding: 4px 9px;
  border-radius: 999px;
  flex-shrink: 0;
}

.focus-input-row input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  padding: 2px 4px;
}

.focus-input-row input::placeholder { color: var(--ink-muted); }

.composer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 2px;
}

.composer-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}

.composer-pills::-webkit-scrollbar { display: none; }

.param-pill {
  height: 32px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--outline);
  background: var(--surface);
  color: var(--ink-secondary);
  font-size: 12.5px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.param-pill .ms { font-size: 16px; }
.param-pill .chev { opacity: 0.7; margin-left: -2px; }
.param-pill:hover { background: var(--surface-container-high); color: var(--ink); }
.param-pill.open, .param-pill.active-override {
  background: var(--primary-container);
  border-color: transparent;
  color: var(--on-primary-container);
}

.composer-send { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.est-chip {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  color: var(--ink-muted);
  white-space: nowrap;
}

.send-fab {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--primary);
  color: var(--primary-ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, transform 0.12s;
}

.send-fab:hover { background: var(--primary-hover); transform: scale(1.04); }
.send-fab:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.composer-popover {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  max-width: 480px;
  width: 100%;
  background: var(--surface-elevated);
  border: 1px solid var(--outline);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow-popover);
  z-index: 50;
  animation: popIn 0.14s ease;
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.pop-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pop-title { font-size: 13px; font-weight: 600; }
.pop-sub { font-size: 11.5px; color: var(--ink-muted); }

.choice-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.choice-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }

.choice-tile {
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--outline);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.choice-tile:hover { background: var(--surface-container); }
.choice-tile.active { background: var(--primary-container); border-color: var(--primary); }
.choice-main { font-size: 13px; font-weight: 500; color: var(--ink); }
.choice-tile.active .choice-main { color: var(--on-primary-container); }
.choice-sub { font-size: 11px; color: var(--ink-muted); line-height: 1.35; }

/* --------------------------------------------------------------------------
   Right Collapsible Run Settings Panel
   -------------------------------------------------------------------------- */
.inspector-panel {
  width: 348px;
  flex-shrink: 0;
  border-left: 1px solid var(--outline);
  background: var(--surface-dim);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width 0.2s ease, opacity 0.15s ease;
}

.shell.inspector-closed .inspector-panel {
  width: 0;
  border-left: none;
  opacity: 0;
  pointer-events: none;
}

.inspector-head {
  height: 54px;
  padding: 0 14px 0 20px;
  border-bottom: 1px solid var(--outline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.inspector-title { font-size: 15px; font-weight: 500; }

.inspector-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 30px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.info-tile {
  padding: 14px 15px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--outline);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-tile-head {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
}

.info-tile-head .ms { font-size: 17px; color: var(--primary); }
.info-tile-desc { font-size: 12px; color: var(--ink-secondary); line-height: 1.5; }

.setting-group { display: flex; flex-direction: column; gap: 7px; }
.setting-label { font-size: 12.5px; font-weight: 500; color: var(--ink); }
.setting-label-inline { font-size: 13px; font-weight: 500; }
.setting-help { font-size: 11.5px; color: var(--ink-muted); line-height: 1.45; }

.m3-select, .m3-input, .m3-input-sm, .m3-textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--outline-strong);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  padding: 9px 12px;
  outline: none;
}

.m3-select:focus, .m3-input:focus, .m3-input-sm:focus, .m3-textarea:focus {
  border-color: var(--primary);
}

.m3-input-sm { padding: 7px 10px; font-size: 12.5px; }
.dual-mini-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.btn-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mono-area { font-family: "JetBrains Mono", monospace; font-size: 11.5px; line-height: 1.55; }

.setting-row-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--outline);
}

.m3-switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.m3-switch input { opacity: 0; width: 0; height: 0; }
.m3-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--outline-strong);
  cursor: pointer;
  transition: background 0.18s;
}
.m3-slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.18s;
}
.m3-switch input:checked + .m3-slider { background: var(--primary); }
.m3-switch input:checked + .m3-slider::before { transform: translateX(18px); }

/* --------------------------------------------------------------------------
   Dialogs & Modals (Material 3)
   -------------------------------------------------------------------------- */
.dialog-scrim {
  position: fixed;
  inset: 0;
  z-index: 120;
  background: rgba(15, 20, 30, 0.56);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.m3-dialog {
  width: 100%;
  max-width: 440px;
  background: var(--surface-elevated);
  border: 1px solid var(--outline);
  border-radius: 26px;
  padding: 24px;
  box-shadow: var(--shadow-popover);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.m3-dialog-lg { max-width: 600px; }
.m3-dialog-xl { max-width: 780px; max-height: 88vh; }

.dialog-head { display: flex; align-items: center; gap: 12px; }
.dialog-head h2 { font-size: 18px; font-weight: 500; }
.dialog-head-between { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog-head-actions { display: flex; align-items: center; gap: 8px; }
.dialog-sub { font-size: 12px; color: var(--ink-muted); margin-top: 2px; }
.dialog-desc { font-size: 13px; color: var(--ink-secondary); line-height: 1.55; }

.dialog-icon-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--primary-container);
  color: var(--on-primary-container);
  flex-shrink: 0;
}

.dialog-form { display: flex; flex-direction: column; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.dialog-actions-between { justify-content: space-between; align-items: center; }
.dialog-actions-left, .dialog-actions-right { display: flex; gap: 8px; }

.form-error { font-size: 12.5px; color: var(--danger); }
.form-msg { font-size: 12.5px; padding: 8px 12px; border-radius: 10px; }
.form-msg.ok { background: var(--success-bg); color: var(--success); }
.form-msg.err { background: var(--danger-bg); color: var(--danger); }
.form-hint { font-size: 11.5px; color: var(--ink-muted); }

.prompt-modal-tabs {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.prompt-editor-area { min-height: 300px; max-height: 48vh; resize: vertical; }

.nlm-list-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  max-height: 58vh;
  padding-right: 4px;
}

.nlm-loading { text-align: center; padding: 36px 16px; color: var(--ink-muted); }

.nlm-row {
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--outline);
  background: var(--surface-dim);
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.nlm-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.nlm-row-title { font-size: 14px; font-weight: 500; }
.nlm-row-date { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--ink-muted); flex-shrink: 0; }

.nlm-audio-list { display: flex; flex-direction: column; gap: 6px; }

.nlm-audio-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--outline);
}

.nlm-audio-name {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  min-width: 0;
}

.nlm-audio-name .ms { color: var(--primary); font-size: 18px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  background: #202124;
  color: #f1f3f4;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 13px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}

[data-theme="dark"] .toast { background: #e3e3e3; color: #1f1f1f; }

/* Responsive */
@media (max-width: 1120px) {
  .starter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .inspector-panel { position: fixed; right: 0; top: 56px; bottom: 0; z-index: 60; box-shadow: var(--shadow-popover); }
}

@media (max-width: 720px) {
  .hide-sm { display: none; }
  .stepper { grid-template-columns: repeat(2, 1fr); }
  .company-input-row { flex-direction: column; align-items: stretch; }
  .est-chip { display: none; }
  .audio-hero-main { flex-direction: column; align-items: flex-start; }
  .starter-grid { grid-template-columns: 1fr; }
}
