:root {
  --bg: #10141c;
  --text: #e2e8f0;
  --muted: #8a929e;
  --card: #1a1f2b;
  --accent: #e6b85c;
  --border: #2a2f3a;
  --F: #e07070;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--text); margin-top: 0; }
input, textarea, select, button { font-family: inherit; font-size: 1em; }
input[type="text"], input[type="password"], input[type="email"], textarea {
  background: #0f1217; color: var(--text); border: 1px solid var(--border);
  border-radius: 4px; padding: 8px 10px;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 22px; background: var(--card); border-bottom: 1px solid var(--border);
}
.topbar .brand {
  color: var(--accent); font-weight: 700; font-size: 1.1em; letter-spacing: 0.04em;
  text-decoration: none;
}
.topbar nav { display: flex; gap: 18px; }
.topbar nav a {
  color: var(--muted); text-decoration: none; font-size: 0.9em;
  padding: 6px 4px; border-bottom: 2px solid transparent; transition: 120ms;
}
.topbar nav a:hover { color: var(--text); border-bottom-color: var(--border); }

main { max-width: 1400px; margin: 0 auto; padding: 22px; }

.btn {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  padding: 6px 14px; border-radius: 4px; cursor: pointer; font-size: 0.9em;
  transition: 120ms;
}
.btn:hover:not(:disabled) { background: #232936; border-color: var(--accent); color: var(--accent); }
.btn-muted { background: transparent; color: var(--muted); }
.btn-muted:hover:not(:disabled) { color: var(--text); border-color: var(--border); background: var(--card); }

/* Suppress the global a:hover underline for any anchor styled as a button */
a.btn, a.btn:hover, a.btn:focus, a.btn:visited { text-decoration: none; }

table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 10px; }
/* Dashboard organization */
.dash-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}
.dash-head h1 { margin: 0; }

.fmt-tabs { display: flex; gap: 4px; background: var(--card);
  border: 1px solid var(--border); border-radius: 6px; padding: 4px; }
.fmt-tab {
  background: transparent; color: var(--muted); border: 0; padding: 6px 14px;
  border-radius: 4px; cursor: pointer; font-size: 0.9em; transition: 120ms;
}
.fmt-tab:hover { color: var(--text); }
.fmt-tab.active { background: var(--accent); color: #1a1a1a; font-weight: 600; }

.chan-section {
  margin-bottom: 36px; padding: 16px 20px 4px;
  background: rgba(26,31,43,0.4); border: 1px solid var(--border);
  border-radius: 8px;
}
.chan-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border);
}
.chan-title { margin: 0; font-size: 1.15em; color: var(--accent); }
.chan-meta { color: var(--muted); font-size: 0.85em; font-family: monospace; }

.group-block { margin-bottom: 18px; }
.group-title {
  margin: 0 0 8px 0; font-size: 0.88em; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase;
}
.group-title.needs-review { color: #e6c677; }
.group-title.approved-sum {
  color: #a5d6a7; cursor: pointer; user-select: none; padding: 4px 0;
  list-style: none;
}
.group-title.approved-sum::-webkit-details-marker { display: none; }
.group-title.approved-sum::before { content: "▸ "; transition: 120ms; }
details[open] .group-title.approved-sum::before { content: "▾ "; }

.fmt-badge {
  display: inline-block; font-family: monospace; font-size: 0.75em;
  padding: 2px 8px; border-radius: 3px; text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fmt-badge.fmt-short { background: #2a2f3f; color: #9ab8e8; }
.fmt-badge.fmt-podcast { background: #3a2f40; color: #d9a5e8; }
.fmt-badge.fmt-deepdive { background: #2e3f3a; color: #a5e8c9; }

.dashboard { margin-top: 0; }
.dashboard th { font-size: 0.82em; letter-spacing: 0.03em; }
.dashboard tr.ep-row td { padding: 8px 12px; }

.status-pill, .build-chip {
  display: inline-block; padding: 2px 9px; border-radius: 10px;
  font-size: 0.78em; font-family: monospace; letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #3b2e2a; color: #e6c677;
}
/* Lifecycle states */
.status-pill.s-review   { background: #3b2e2a; color: #e6c677; }
.status-pill.s-approved { background: #33293f; color: #c9a5e8; }
.status-pill.s-shipped  { background: #2a3b2e; color: #a5d6a7; }
.status-pill.s-purged   { background: #2a2e3b; color: #8ea2c7; }
/* In-flight build states (apply to both .status-pill and legacy .build-chip) */
.status-pill.build-building, .build-chip.build-building { background: #2a2f3f; color: #9ab8e8; animation: pulse 1.4s infinite; }
.status-pill.build-uploading, .build-chip.build-uploading { background: #3a2f40; color: #d9a5e8; animation: pulse 1.4s infinite; }
.status-pill.build-failed,    .build-chip.build-failed    { background: #402a2a; color: var(--F); }
.status-pill.build-built,     .build-chip.build-built     { background: #2a3b2e; color: #a5d6a7; }
.status-pill.build-shipped,   .build-chip.build-shipped   { background: #2a3b2e; color: #a5d6a7; }
.status-pill.build-purged,    .build-chip.build-purged    { background: #2a2e3b; color: #8ea2c7; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

.ep-actions { white-space: nowrap; display: flex; gap: 6px; align-items: center; justify-content: flex-end; }
.ep-actions .btn { padding: 4px 10px; font-size: 0.82em; }
.ep-dur { color: #9ab8e8; font-family: monospace; margin-left: 6px; font-size: 0.92em; }
.btn.btn-danger { background: #3b2a2a; color: #e8a5a5; border-color: #5a3030; }
.btn.btn-danger:hover:not(:disabled) { background: #552e2e; color: #ffd0d0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.preview-modal {
  display: none; position: fixed; inset: 0; background: rgba(5,7,11,0.92);
  z-index: 1200; align-items: center; justify-content: center; padding: 20px;
}
.preview-modal.open { display: flex; }
.preview-inner {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 16px; max-width: 94vw; max-height: 92vh;
  display: flex; flex-direction: column; gap: 10px; position: relative;
}
.preview-inner video {
  max-width: 320px; max-height: 55vh; background: #000; border-radius: 4px;
}
.preview-close {
  position: absolute; top: 6px; right: 10px; background: transparent;
  color: var(--text); border: 0; font-size: 1.6em; line-height: 1; cursor: pointer;
}
.preview-close:hover { color: var(--accent); }
.preview-title { color: var(--muted); font-family: monospace; font-size: 0.85em; }
.dashboard td.ep-title { max-width: 380px; white-space: normal; word-break: break-word; line-height: 1.35; }

.card-img[data-full] { cursor: zoom-in; }
.lightbox {
  display: none; position: fixed; inset: 0; background: rgba(5,7,11,0.92);
  z-index: 1000; align-items: center; justify-content: center;
}
.lightbox.open { display: flex; }
.lightbox img {
  max-width: 94vw; max-height: 90vh; object-fit: contain;
  border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,0.6);
}
.lightbox-caption {
  position: absolute; top: 16px; left: 50%; transform: translateX(-50%);
  color: var(--accent); font-family: monospace; font-size: 1em;
  background: rgba(0,0,0,0.5); padding: 4px 12px; border-radius: 4px;
}
.lightbox-close {
  position: absolute; top: 14px; right: 18px; background: transparent;
  color: var(--text); border: 0; font-size: 2.2em; line-height: 1; cursor: pointer;
  padding: 4px 12px;
}
.lightbox-close:hover { color: var(--accent); }
.lightbox-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  background: rgba(26,31,43,0.7); color: var(--text); border: 1px solid var(--border);
  font-size: 2.4em; line-height: 1; cursor: pointer; padding: 6px 18px; border-radius: 6px;
}
.lightbox-nav:hover { background: var(--card); color: var(--accent); }
.lb-prev { left: 20px; }
.lb-next { right: 20px; }

.img-actions { display: flex; align-items: center; gap: 10px; font-size: 0.82em; }
.btn-sm { padding: 4px 10px; font-size: 0.82em; display: inline-flex; align-items: center; }
.upload-status { font-family: monospace; font-size: 0.82em; color: var(--muted); }
.upload-status.pending { color: var(--accent); }
.upload-status.ok { color: #a5d6a7; }
.upload-status.err { color: var(--F); }

.regen-modal {
  display: none; position: fixed; inset: 0; background: rgba(5,7,11,0.88);
  z-index: 1100; align-items: center; justify-content: center; padding: 20px;
}
.regen-modal.open { display: flex; }
.regen-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 8px;
  padding: 20px; width: 100%; max-width: 960px; max-height: 90vh; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
}
.regen-head { display: flex; align-items: center; justify-content: space-between; }
.regen-head h3 { margin: 0; font-size: 1.1em; }
.regen-head .lightbox-close { position: static; font-size: 1.8em; }
.regen-label { color: var(--muted); font-size: 0.82em; margin-top: 4px; }
.regen-panel textarea {
  width: 100%; background: #0f1217; color: var(--text); border: 1px solid var(--border);
  border-radius: 4px; padding: 10px; font-family: inherit; font-size: 0.92em;
  resize: vertical; line-height: 1.4;
}
.regen-meta { display: flex; justify-content: space-between; font-size: 0.82em; color: var(--muted); font-family: monospace; }
.regen-status.pending { color: var(--accent); }
.regen-status.muted { color: var(--muted); font-style: italic; }
.regen-reset-link {
  margin-left: 10px; font-size: 0.78em; color: var(--muted);
  text-decoration: underline dotted; cursor: pointer;
}
.regen-reset-link:hover { color: var(--accent); }

/* Phase 3 step A (2026-05-16) — visible localStorage override indicator.
   When the prompt textarea differs from the server default (because it was
   loaded from localStorage), the user gets a clear visual cue so they don't
   silently regen with stale-overridden text. */
.regen-prompt-overridden, .regen-negative-overridden {
  border: 2px solid #d6a800 !important;
  box-shadow: 0 0 0 2px rgba(214, 168, 0, 0.18);
}
.regen-status.overridden {
  color: #ffcf3f; font-weight: bold;
}

.regen-prompt-tools {
  float: right; display: inline-flex; align-items: center; gap: 8px;
}
.regen-tool-btn {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  padding: 2px 8px; border-radius: 3px; font-size: 0.78em; cursor: pointer;
  font-family: inherit;
}
.regen-tool-btn:hover:not(:disabled) { background: #2a3140; color: var(--accent); }
.regen-tool-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.regen-help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--border);
  color: var(--muted); font-size: 0.78em; font-weight: 600;
  cursor: help; position: relative; user-select: none;
}
.regen-help:hover, .regen-help:focus { color: var(--accent); border-color: var(--accent); outline: none; }
.regen-help-tip {
  display: none; position: absolute; right: 0; top: calc(100% + 6px);
  z-index: 1200; width: min(380px, 90vw);
  background: #0a0c12; border: 1px solid var(--border); border-radius: 6px;
  padding: 12px 14px; color: var(--text); font-weight: 400; font-size: 0.82em;
  line-height: 1.5; text-align: left; white-space: normal;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.regen-help:hover .regen-help-tip,
.regen-help:focus .regen-help-tip { display: block; }
.regen-help-tip code {
  background: #2a3140; padding: 1px 5px; border-radius: 3px; font-size: 0.9em;
}
.regen-help-tip strong { color: var(--accent); }
.regen-help-tip em { color: #a5d6a7; font-style: normal; }

.music-panel {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 14px 18px; margin: 0 0 22px;
}
.music-panel h3 {
  margin: 0 0 12px; font-size: 1em; color: var(--accent);
  display: flex; align-items: center; gap: 8px;
}
.music-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
}
.music-card {
  background: #0f1217; border: 1px solid var(--border); border-radius: 5px;
  padding: 10px 12px; display: flex; flex-direction: column; gap: 8px;
}
.music-label { color: var(--muted); font-size: 0.85em; font-family: monospace; }
.music-card audio { width: 100%; }
.music-card .audio.missing {
  color: var(--muted); font-style: italic; font-size: 0.85em; padding: 4px 0;
}
.music-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
@media (max-width: 720px) {
  .music-row { grid-template-columns: 1fr; }
}

.nb2-group { display: inline-flex; gap: 6px; align-items: center; }

/* Color-coded paid backends in the regen modal */
.btn.btn-imagen {
  background: #2e7d4f; color: #ffffff; border: 1px solid #1f5a37;
}
.btn.btn-imagen:hover:not(:disabled) {
  background: #379357; filter: none;
}
.btn.btn-nb {
  background: #b03a3a; color: #ffffff; border: 1px solid #7d2828;
}
.btn.btn-nb:hover:not(:disabled) {
  background: #c44545; filter: none;
}

/* Grouped backend rows in regen modal */
.regen-backends { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.backend-row {
  display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: center;
}
.backend-label {
  color: var(--muted); font-size: 0.85em; font-family: monospace; letter-spacing: 0.02em;
}
.backend-sub { color: var(--muted); font-size: 0.85em; }
.backend-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.backend-row-top {
  background: rgba(230, 198, 119, 0.06);
  padding: 6px 8px; border-radius: 4px; margin-bottom: 4px;
}

.regen-current {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: #0f1217; border: 1px solid var(--border); border-radius: 6px;
  padding: 10px; margin-bottom: 6px;
}
.regen-current-label {
  align-self: flex-start; color: var(--muted); font-size: 0.8em;
  font-family: monospace; letter-spacing: 0.04em;
}
.regen-current img {
  max-width: 100%; max-height: 280px; border-radius: 4px;
  cursor: zoom-in; object-fit: contain;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
}
.backend-row-top .backend-label { color: var(--accent); font-weight: 600; }
.backend-note {
  color: var(--muted); font-size: 0.78em; font-style: italic;
  margin: 4px 0 0 0; padding-top: 8px; border-top: 1px solid var(--border);
}
@media (max-width: 600px) {
  .backend-row { grid-template-columns: 1fr; gap: 4px; }
  .backend-label { padding-top: 6px; }
}
.regen-status.ok { color: #a5d6a7; }
.regen-status.err { color: var(--F); }
.regen-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.regen-log {
  background: #0a0c12; color: var(--muted); font-size: 0.78em;
  padding: 8px; border-radius: 4px; max-height: 140px; overflow-y: auto;
  margin: 0; white-space: pre-wrap; word-break: break-word;
}
.regen-log:empty { display: none; }

.caption-actions { margin-top: 4px; }
.caption-actions .btn-sm { font-size: 0.78em; padding: 3px 8px; }

/* Analytics page */
.analytics-channels { display: flex; flex-direction: column; gap: 24px; margin-top: 16px; }
.analytics-panel { border: 1px solid var(--border, #2a2f3a); border-radius: 8px; background: #14171d; }
.analytics-summary { padding: 14px 18px; cursor: pointer; list-style: none; }
.analytics-summary::-webkit-details-marker { display: none; }
.ch-header { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ch-thumb { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--border, #2a2f3a); }
.ch-meta { flex: 1; min-width: 220px; }
.ch-meta h2 { margin: 0 0 4px 0; font-size: 1.15em; }
.ch-stats { display: flex; gap: 18px; font-size: 0.88em; color: #b0b8c4; flex-wrap: wrap; }
.ch-stat strong { color: #fff; font-size: 1.05em; }
.ch-actions { display: flex; align-items: center; gap: 12px; }
.ch-fetched { font-size: 0.78em; color: #6a7280; font-style: italic; }
.analytics-table { width: 100%; border-collapse: collapse; margin: 0; font-size: 0.88em; }
.analytics-table thead { background: #1a1f28; }
.analytics-table th { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border, #2a2f3a); font-weight: 600; }
.analytics-table th.sortable { cursor: pointer; user-select: none; }
.analytics-table th.sortable:hover { background: #232a35; }
.analytics-table th.sort-asc::after { content: " \2191"; color: #6a90ff; }
.analytics-table th.sort-desc::after { content: " \2193"; color: #6a90ff; }
.analytics-table td { padding: 8px 10px; border-bottom: 1px solid #1f242c; vertical-align: middle; }
.analytics-table tr:hover td { background: #1a1f28; }
.analytics-table .col-thumb img { width: 80px; height: 45px; object-fit: cover; border-radius: 3px; display: block; }
.analytics-table .col-title { max-width: 360px; }
.analytics-table .col-title a { color: #d8e0ec; text-decoration: none; }
.analytics-table .col-title a:hover { color: #fff; text-decoration: underline; }
.analytics-table .col-views,
.analytics-table .col-likes,
.analytics-table .col-comments,
.analytics-table .col-dur { text-align: right; font-variant-numeric: tabular-nums; }
.priv { font-size: 0.75em; padding: 2px 8px; border-radius: 10px; text-transform: uppercase; letter-spacing: 0.04em; }
.priv-public { background: #1e4a2e; color: #7be59f; }
.priv-private { background: #4a3520; color: #ffc77d; }
.priv-unlisted { background: #2a3344; color: #9bb3d8; }
.error-card { background: #4a2530; border: 1px solid #6a3540; border-radius: 6px; padding: 12px 16px; margin: 16px 0; color: #ffbac4; }
.empty { padding: 16px; color: #6a7280; font-style: italic; }

/* Channel configuration panel (top of dashboard) */
.channel-config {
  margin: 16px 0 28px; background: rgba(26,31,43,0.4);
  border: 1px solid var(--border); border-radius: 8px; padding: 0 4px 12px;
}
.channel-config-summary {
  cursor: pointer; padding: 12px 16px; font-weight: 600; font-size: 0.95em;
  color: var(--accent); list-style: none; user-select: none;
}
.channel-config-summary::-webkit-details-marker { display: none; }
.channel-config-summary::before { content: "▾ "; }
.channel-config:not([open]) .channel-config-summary::before { content: "▸ "; }
.cc-hint { color: var(--muted); font-weight: 400; font-size: 0.85em; margin-left: 6px; }

.cc-body { padding: 4px 12px 0; }
.cc-tabs {
  display: flex; gap: 2px; border-bottom: 1px solid var(--border);
  margin-bottom: 14px; flex-wrap: wrap;
}
.cc-tab {
  background: transparent; color: var(--muted); border: 0;
  padding: 8px 14px; font-size: 0.88em; cursor: pointer;
  border-bottom: 2px solid transparent; transition: 120ms;
}
.cc-tab:hover { color: var(--text); }
.cc-tab.active { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.cc-panel { display: none; }
.cc-panel.active { display: block; }
.cc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.cc-card {
  background: #14171f; border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 14px;
}
.cc-card.cc-wide { grid-column: 1 / -1; }
.cc-label {
  font-size: 0.72em; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); margin-bottom: 6px;
}
.cc-value { font-size: 0.92em; color: var(--text); margin-bottom: 4px; }
.cc-value strong { color: var(--accent); }
.cc-spk {
  display: inline-block; min-width: 90px; font-family: monospace;
  font-size: 0.85em; color: #9ab8e8;
}
.cc-sub { color: var(--muted); font-size: 0.85em; }
.cc-note {
  font-size: 0.78em; color: var(--muted); font-style: italic;
  margin: 2px 0 6px; padding-left: 90px;
}
@media (max-width: 700px) {
  .cc-grid { grid-template-columns: 1fr; }
  .cc-note { padding-left: 0; }
}

/* Future Episodes list inside channel config */
.cc-future {
  margin: 8px 0 0 0;
  padding-left: 22px;
  list-style: decimal;
}
.cc-future-item {
  margin: 0 0 10px 0;
  padding-left: 4px;
  color: var(--text);
  line-height: 1.4;
}
.cc-future-item strong { color: var(--accent); }
.cc-future-tradition {
  display: inline-block; margin-left: 8px; font-size: 0.78em;
  background: rgba(255,255,255,0.06); color: var(--muted);
  padding: 1px 7px; border-radius: 3px; font-family: monospace; letter-spacing: 0.04em;
}
.cc-future-next {
  display: inline-block; margin-left: 6px; font-size: 0.72em;
  background: #2a3b2e; color: #a5d6a7;
  padding: 2px 7px; border-radius: 3px; font-weight: 600; letter-spacing: 0.06em;
}
.cc-future-hook {
  font-size: 0.85em; color: var(--muted); font-style: italic;
  margin-top: 2px; padding-left: 0;
}

/* Episode page (turn cards) — reconstructed 2026-04-26 */
.ep-header { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 16px; margin-bottom: 16px; }
.ep-header h1 { margin: 0; font-size: 1.4em; }
.ep-meta { color: var(--muted); font-size: 0.88em; font-family: monospace; }
.ep-meta a { color: var(--accent); }

.progress { color: var(--muted); font-size: 0.88em; margin: 8px 0 18px; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px; margin-top: 12px;
}
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: 6px;
  padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 8px;
  transition: 120ms;
}
.card.approved { border-color: #3a5a45; background: rgba(30,50,38,0.35); }
.card-head { display: flex; justify-content: space-between; align-items: center; font-size: 0.82em; color: var(--muted); }
.turn-idx {
  font-family: monospace; background: rgba(255,255,255,0.06);
  padding: 2px 6px; border-radius: 3px; color: var(--text);
}
.card-img {
  width: 100%; max-width: 220px; height: auto;
  border-radius: 4px; display: block; margin: 4px auto 0;
  background: #0a0c12;
}
.card-img.missing {
  background: #1a1f28; color: var(--muted); padding: 24px 8px;
  text-align: center; font-style: italic; font-size: 0.85em;
  border: 1px dashed var(--border); width: 100%; max-width: none;
}
.caption {
  font-size: 0.85em; color: var(--text); line-height: 1.4;
  background: rgba(0,0,0,0.2); padding: 6px 8px; border-radius: 3px;
  word-break: break-word;
}
audio { width: 100%; height: 32px; outline: none; }
audio.missing { background: #1a1f28; color: var(--muted); padding: 6px; text-align: center; font-size: 0.78em; }

.approve-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  cursor: pointer; user-select: none; font-size: 0.85em; color: var(--muted);
}
.approve-toggle input[type="checkbox"] { cursor: pointer; }
.approve-toggle:hover { color: var(--text); }
.card.approved .approve-toggle { color: #7be59f; }

/* Speaker badges (F = pink, M = blue, N = white narrator) */
.spk-F { background: #3a2f40; color: #d9a5e8; padding: 2px 7px; border-radius: 3px; font-size: 0.72em; font-family: monospace; letter-spacing: 0.04em; }
.spk-M { background: #2a2f3f; color: #9ab8e8; padding: 2px 7px; border-radius: 3px; font-size: 0.72em; font-family: monospace; letter-spacing: 0.04em; }
.spk-N { background: #ffffff; color: #1a1a1a; padding: 2px 7px; border-radius: 3px; font-size: 0.72em; font-family: monospace; letter-spacing: 0.04em; }
.spk-Q, .spk- { background: rgba(255,255,255,0.06); color: var(--muted); padding: 2px 7px; border-radius: 3px; font-size: 0.72em; font-family: monospace; }

/* Open button — same shape as Build/Preview/Ship, just an anchor */
.btn.act-open { color: var(--text); }
.btn.act-open:hover:not(:disabled) {
  background: #232936; border-color: var(--accent); color: var(--accent);
}
/* Locked Open button — pipeline is touching this episode; click is a no-op */
.btn.act-open.locked {
  color: var(--muted); cursor: not-allowed; opacity: 0.65;
  background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.10);
  pointer-events: auto; /* keep tooltip-on-hover */
}
.btn.act-open.locked:hover { background: rgba(255,255,255,0.04); border-color: rgba(255,255,255,0.10); color: var(--muted); }

/* YT link — same shape as other buttons, swaps gold accent for light red on hover */
.btn.act-yt { color: var(--text); }
.btn.act-yt:hover:not(:disabled) {
  background: #232936; border-color: #ff7a7a; color: #ff7a7a;
}

/* Reset — soft action, sky-blue accent on hover (clears build state, keeps approvals) */
.btn.act-reset { color: var(--text); }
.btn.act-reset:hover:not(:disabled) {
  background: #232936; border-color: #9ab8e8; color: #9ab8e8;
}

/* ───── Voices page ───── */
.voices-legend { display: flex; gap: 6px; align-items: center; }
.voices-intro { color: var(--muted); margin: 6px 0 18px; max-width: 880px; line-height: 1.5; }
.voices-section { margin: 22px 0 32px; }
.voices-channel { font-size: 1.1rem; margin: 0 0 12px; padding: 6px 12px; border-left: 3px solid var(--accent); background: rgba(255,255,255,0.02); border-radius: 0 4px 4px 0; }
.voices-channel.ch-tales     { border-color: #e6b85c; }
.voices-channel.ch-history   { border-color: #ffaa33; }
.voices-channel.ch-religion  { border-color: #ffe5b4; }
.voices-channel.ch-mysteries { border-color: #66b3ff; }
.voices-channel.ch-\(infra\) { border-color: #888; opacity: 0.85; }
.voices-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; }
.voice-card {
  background: var(--card-bg, #1a1f2a);
  border: 1px solid var(--card-border, #2a3140);
  border-radius: 6px;
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 6px;
}
.voice-card.status-active   { border-left: 3px solid #6abf69; }
.voice-card.status-backup   { border-left: 3px solid #d4a052; }
.voice-card.status-parked   { border-left: 3px solid #6c8ec9; }
.voice-card.status-retired  { border-left: 3px solid #555; opacity: 0.78; }
.voice-head { display: flex; gap: 8px; align-items: center; }
.voice-use { color: var(--muted); font-size: 0.85em; }
.voice-title { font-size: 0.98em; }
.voice-name { color: var(--muted); }
.voice-source { color: var(--text); font-size: 0.85em; opacity: 0.85; }
.voice-meta { display: flex; gap: 14px; font-size: 0.78em; color: var(--muted); flex-wrap: wrap; }
.voice-meta b { color: var(--text); font-weight: 600; opacity: 0.8; margin-right: 3px; }
.voice-ref { font-size: 0.75em; color: var(--muted); word-break: break-all; }
.voice-ref code { background: rgba(255,255,255,0.04); padding: 1px 4px; border-radius: 3px; }
.voice-notes { color: var(--muted); font-size: 0.85em; line-height: 1.45; padding-top: 4px; border-top: 1px solid rgba(255,255,255,0.05); }
.vstatus { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 0.72em; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.vstatus.s-active  { background: #1f3a23; color: #a5d6a7; }
.vstatus.s-backup  { background: #3a2f1f; color: #e6c690; }
.vstatus.s-parked  { background: #1f2a3a; color: #a5c5e6; }
.vstatus.s-retired { background: #2a2a2a; color: #888; }

/* ───── Edit/Regen modal — bottom help panel ───── */
.regen-help-panel {
  margin-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 10px;
}
.regen-help-panel > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.9em;
  font-weight: 600;
  padding: 6px 0;
  list-style: none;
  user-select: none;
}
.regen-help-panel > summary::-webkit-details-marker { display: none; }
.regen-help-panel > summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s;
}
.regen-help-panel[open] > summary::before { content: "▾ "; }
.regen-help-panel > summary:hover { color: var(--accent); filter: brightness(1.15); }

.regen-help-body {
  margin-top: 10px;
  font-size: 0.92em;
  line-height: 1.55;
  color: var(--text);
  max-height: 480px;
  overflow-y: auto;
  padding-right: 8px;
}
.regen-help-body section { margin-bottom: 16px; }
.regen-help-body section:last-child { margin-bottom: 0; }
.regen-help-body h4 {
  color: var(--accent);
  font-size: 0.95em;
  margin: 0 0 6px;
  text-transform: none;
  letter-spacing: 0;
}
.regen-help-body p { margin: 4px 0; }
.regen-help-body ul { margin: 4px 0; padding-left: 20px; }
.regen-help-body li { margin: 2px 0; }
.regen-help-body code {
  background: rgba(255,255,255,0.07);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.92em;
}

/* ───── Image-gen help panel cost table ───── */
.img-cost-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85em;
  margin-top: 6px;
}
.img-cost-table th, .img-cost-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  vertical-align: top;
}
.img-cost-table th {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.8em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.img-cost-table tr.cost-free td:nth-child(3) { color: #6abf69; font-weight: 600; }
.img-cost-table tr.cost-low  td:nth-child(3) { color: #a5d6a7; }
.img-cost-table tr.cost-mid  td:nth-child(3) { color: #e6c690; }
.img-cost-table tr.cost-high td:nth-child(3) { color: #ff9a76; font-weight: 600; }
.img-cost-table code { font-size: 0.92em; background: rgba(255,255,255,0.05); padding: 1px 4px; border-radius: 3px; }

/* ───── Episode Metadata Panel (title / description / tags) ───── */
.meta-panel {
  background: var(--card-bg, #1a1f2a);
  border: 1px solid var(--card-border, #2a3140);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  margin: 16px 0 18px;
  padding: 0 14px;
}
.meta-summary {
  cursor: pointer;
  list-style: none;
  user-select: none;
  padding: 12px 4px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95em;
}
.meta-summary::-webkit-details-marker { display: none; }
.meta-summary::before {
  content: "▸ ";
  color: var(--accent);
  display: inline-block;
}
.meta-panel[open] > .meta-summary::before { content: "▾ "; }
.meta-label { font-weight: 600; color: var(--text); }
.meta-source-hint { color: var(--muted); font-size: 0.82em; font-style: italic; }
.meta-body { padding: 6px 4px 14px; display: flex; flex-direction: column; gap: 12px; }
.meta-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.9em;
}
.meta-row.meta-row-multiline { align-items: flex-start; }
.meta-row.meta-row-inline { flex-wrap: wrap; }
.meta-row-label {
  min-width: 110px;
  color: var(--muted);
  font-size: 0.85em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.meta-row input[type="text"], .meta-row textarea, .meta-row select {
  flex: 1;
  background: #0f1217;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.92em;
  font-family: inherit;
}
.meta-row textarea { min-height: 130px; line-height: 1.5; resize: vertical; }
.meta-row select { flex: 0 0 auto; min-width: 180px; }
.meta-counter {
  color: var(--muted);
  font-size: 0.78em;
  font-family: monospace;
  white-space: nowrap;
  min-width: 110px;
  text-align: right;
}
.meta-actions {
  display: flex; gap: 12px; align-items: center;
  padding-top: 4px;
}
.regen-status.ok { color: #6abf69; }
.regen-status.err { color: #ff7a7a; }

/* ───── Approved table — AMBER (ready to ship, not yet shipped) ───── */
.group-approved {
  margin-top: 18px;
  border-top: 2px solid rgba(230, 184, 92, 0.30);
  padding-top: 10px;
}
.group-approved .group-title.approved-sum {
  color: #e6c690;
  font-size: 0.95em;
  font-weight: 600;
  margin: 0 0 8px;
  padding: 4px 10px;
  border-left: 3px solid #d4a052;
  background: rgba(212, 160, 82, 0.06);
  border-radius: 0 4px 4px 0;
  cursor: default;
}
.dashboard-approved tr.ep-row-approved {
  background: rgba(212, 160, 82, 0.05);
}
.dashboard-approved tr.ep-row-approved:hover {
  background: rgba(212, 160, 82, 0.12);
}
.dashboard-approved tr.ep-row-approved td:first-child {
  border-left: 3px solid rgba(212, 160, 82, 0.55);
}
.dashboard-approved thead th {
  color: #e6c690;
  opacity: 0.75;
}

/* ───── Complete table — GREEN (shipped to YouTube) ───── */
.group-complete {
  margin-top: 18px;
  border-top: 2px solid rgba(106, 191, 105, 0.25);
  padding-top: 10px;
}
.group-complete .group-title.complete-sum {
  color: #a5d6a7;
  font-size: 0.95em;
  font-weight: 600;
  margin: 0 0 8px;
  padding: 4px 10px;
  border-left: 3px solid #6abf69;
  background: rgba(106, 191, 105, 0.05);
  border-radius: 0 4px 4px 0;
  cursor: default;
}
.dashboard-complete tr.ep-row-complete {
  background: rgba(106, 191, 105, 0.04);
}
.dashboard-complete tr.ep-row-complete:hover {
  background: rgba(106, 191, 105, 0.10);
}
.dashboard-complete tr.ep-row-complete td:first-child {
  border-left: 3px solid rgba(106, 191, 105, 0.5);
}
.dashboard-complete thead th {
  color: #a5d6a7;
  opacity: 0.75;
}

/* ───── Channel tab strip (filters dashboard to one channel at a time) ───── */
.chan-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.chan-tab {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88em;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: 120ms;
}
.chan-tab:hover { color: var(--text); border-color: #4a5060; }
.chan-tab.active {
  color: var(--text);
  background: #1a1f2a;
  border-color: var(--accent);
}
/* Per-channel left-edge accent so each tab feels like its channel even when inactive */
.chan-tab-tales.active     { border-left: 3px solid #e6b85c; }
.chan-tab-history.active   { border-left: 3px solid #ffaa33; }
.chan-tab-religion.active  { border-left: 3px solid #ffe5b4; }
.chan-tab-mysteries.active { border-left: 3px solid #66b3ff; }
.chan-tab-badge {
  background: rgba(255, 122, 122, 0.18);
  color: #ff9a9a;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 0.75em;
  font-weight: 600;
  font-family: monospace;
}

/* GPT-image-2 button — distinct from Banana */
.btn.btn-gpt { background: #1f2a3a; color: #b3d9b3; border-color: #2f4a3a; }
.btn.btn-gpt:hover:not(:disabled) { background: #2a3a4a; border-color: #6abf69; color: #c8e6c9; }

/* ───── Lab (image-backend shootout) page ───── */
.lab-meta { color: var(--muted); font-family: monospace; font-size: 0.85em; }
.lab-empty { color: var(--muted); padding: 24px; text-align: center; background: var(--card); border-radius: 6px; }
.lab-empty code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 3px; }

.lab-prompt-panel, .lab-help-panel {
  background: var(--card-bg, #1a1f2a);
  border: 1px solid var(--card-border, #2a3140);
  border-radius: 6px;
  padding: 0 14px;
  margin: 12px 0 18px;
}
.lab-prompt-panel summary, .lab-help-panel summary {
  cursor: pointer; user-select: none; list-style: none;
  padding: 12px 4px; font-size: 0.95em; font-weight: 600;
  color: var(--accent);
}
.lab-prompt-panel summary::-webkit-details-marker,
.lab-help-panel summary::-webkit-details-marker { display: none; }
.lab-prompt-panel summary::before,
.lab-help-panel summary::before { content: "▸ "; transition: 120ms; }
.lab-prompt-panel[open] summary::before,
.lab-help-panel[open] summary::before { content: "▾ "; }
.lab-prompt-body, .lab-help-body { padding: 6px 4px 14px; font-size: 0.9em; line-height: 1.55; }
.lab-prompt-section { margin-bottom: 12px; }
.lab-prompt-label { color: var(--muted); font-size: 0.78em; text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.lab-prompt-text { background: #0f1217; border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px; font-family: inherit; white-space: pre-wrap; word-break: break-word; margin: 0; font-size: 0.9em; }
.lab-prompt-text.muted { color: var(--muted); }
.lab-hint { color: var(--muted); font-size: 0.85em; margin-top: 8px; }
.lab-hint code { background: rgba(255,255,255,0.06); padding: 2px 6px; border-radius: 3px; }
.lab-help-body code { background: rgba(255,255,255,0.06); padding: 1px 5px; border-radius: 3px; }
.lab-help-body ul { margin: 6px 0; padding-left: 22px; }

.lab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin: 16px 0;
}
.lab-card {
  background: var(--card-bg, #1a1f2a);
  border: 1px solid var(--card-border, #2a3140);
  border-radius: 6px;
  overflow: hidden;
  display: flex; flex-direction: column;
}
.lab-card.tier-free  { border-left: 3px solid #6abf69; }
.lab-card.tier-low   { border-left: 3px solid #a5d6a7; }
.lab-card.tier-mid   { border-left: 3px solid #d4a052; }
.lab-card.tier-high  { border-left: 3px solid #ff9a76; }
.lab-card.lab-failed { opacity: 0.55; border-left-color: #b04545; }

.lab-img-wrap {
  display: block;
  background: #000;
  aspect-ratio: 9/16;
  position: relative;
}
.lab-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lab-img-wrap:hover .lab-img { opacity: 0.92; transition: 100ms; }
.lab-failed-banner {
  display: flex; align-items: center; justify-content: center;
  color: #b04545; font-weight: 600; font-size: 1.1em; letter-spacing: 0.08em;
}

.lab-card-body { padding: 10px 12px; display: flex; flex-direction: column; gap: 5px; }
.lab-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.lab-name { color: var(--text); font-size: 0.95em; }
.lab-cost {
  display: inline-block;
  padding: 1px 8px; border-radius: 10px;
  font-family: monospace; font-size: 0.75em; font-weight: 600;
  white-space: nowrap;
}
.lab-cost-free { background: #1f3a23; color: #a5d6a7; }
.lab-cost-low  { background: #1f3a23; color: #c5e8c5; }
.lab-cost-mid  { background: #3a2f1f; color: #e6c690; }
.lab-cost-high { background: #3a1f1f; color: #ff9a76; }
.lab-model { font-size: 0.78em; color: var(--muted); word-break: break-all; }
.lab-model code { font-size: 0.92em; background: rgba(255,255,255,0.04); padding: 1px 4px; border-radius: 3px; }
.lab-meta-row { display: flex; gap: 10px; font-size: 0.8em; color: var(--muted); font-family: monospace; }
.lab-meta-cell b { color: var(--text); font-weight: 600; }
.lab-note { color: var(--muted); font-size: 0.78em; padding-top: 4px; border-top: 1px solid rgba(255,255,255,0.05); margin-top: 4px; }
.lab-err { color: #ff7a7a; font-size: 0.78em; font-family: monospace; padding-top: 4px; border-top: 1px solid rgba(255,122,122,0.2); margin-top: 4px; word-break: break-word; }

/* ───── Channels page (standalone, was /home inline panel) ───── */
.channel-config-page { margin-top: 16px; }
.channel-config-page .cc-tabs { margin-bottom: 14px; }

/* ───── Add-slide pill (giant +) at end of turn-cards list ───── */
.add-slide-pill-row {
  display: flex;
  justify-content: center;
  margin: 24px 0 40px;
}
.add-slide-pill {
  display: inline-flex; align-items: center; gap: 14px;
  padding: 18px 36px;
  font-size: 1.15em; font-family: inherit; font-weight: 600;
  color: #1a1a1a;
  background: linear-gradient(135deg, #e6b85c 0%, #d4a052 100%);
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(230, 184, 92, 0.25);
  transition: transform 120ms, box-shadow 120ms, filter 120ms;
}
.add-slide-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 22px rgba(230, 184, 92, 0.4);
  filter: brightness(1.05);
}
.add-slide-pill:active { transform: translateY(0); }
.add-slide-plus {
  font-size: 1.6em; line-height: 1; font-weight: 700;
}

/* ───── Back-to-top floating button (always visible) ───── */
#back-to-top {
  position: fixed;
  right: 24px; bottom: 24px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: #1a1a1a;
  border: 0;
  font-size: 1.7em; line-height: 1; font-weight: 700;
  cursor: pointer;
  transition: background 120ms, color 120ms, transform 120ms;
  box-shadow: 0 6px 18px rgba(0,0,0,0.5);
  z-index: 9999;
}
#back-to-top:hover {
  background: #fff; color: #1a1a1a;
  transform: translateY(-3px);
}

/* ───── Download button (between Preview and Ship) ───── */
.btn.act-download { color: var(--text); }
.btn.act-download:hover:not(:disabled) {
  background: #232936; border-color: #66b3ff; color: #66b3ff;
}

/* ───── YT button — show inline YouTube logo SVG instead of text ───── */
.btn.act-yt {
  padding: 4px 8px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1;
}
.btn.act-yt svg { width: 22px; height: 16px; display: block; }
.btn.act-yt:hover:not(:disabled) svg { opacity: 0.85; transition: opacity 100ms; }

/* ───── Capes Unwound channel color (purple — distinct from the 4 painterly channels) ───── */
.chan-tab-capes.active     { border-left: 3px solid #b984ff; }
.voices-channel.ch-capes   { border-color: #b984ff; }

/* ───── Niche / Differentiation card on /channels page ───── */
.cc-card.cc-niche {
  border-left: 3px solid var(--accent);
  background: rgba(230, 184, 92, 0.04);
}
.cc-niche-headline {
  font-size: 1.05em;
  color: var(--text);
  font-weight: 600;
  margin: 6px 0 14px;
  font-style: italic;
}
.cc-niche-section { margin: 10px 0; font-size: 0.9em; }
.cc-niche-label {
  display: inline-block;
  color: var(--muted);
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-right: 6px;
}
.cc-niche-comp { color: var(--text); font-size: 0.92em; }
.cc-niche-moat { color: #a5d6a7; font-style: italic; }
.cc-niche-table {
  width: 100%; margin-top: 6px; border-collapse: collapse; font-size: 0.88em;
}
.cc-niche-table th {
  text-align: left; padding: 6px 8px;
  color: var(--muted); font-size: 0.78em;
  text-transform: uppercase; letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
.cc-niche-table td {
  padding: 8px; vertical-align: top;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.cc-niche-table td:first-child { color: var(--muted); width: 40%; }
.cc-niche-table td strong { color: var(--accent); }
