/* ─── Voz Studio — tema oscuro profesional ─────────────────────────── */

:root {
  /* Paleta */
  --bg-0: #0E0F13;
  --bg-1: #1F2026;         /* sidebar ahora más claro (antes #17181C) */
  --bg-2: #272831;
  --bg-3: #33343E;
  --border: #393A45;
  --border-strong: #4A4B58;

  --text: #F0F0F3;
  --text-muted: #C4C5CE;   /* legible (antes #9FA0A8) */
  --text-dim: #9A9BA4;     /* legible pero secundario (antes #6C6D75) */

  --red: #C41E3A;
  --red-dim: #8A1428;
  --red-glow: rgba(196, 30, 58, 0.35);
  --cyan: #5AC8D4;
  --amber: #F4B744;
  --green: #4ADE80;

  /* Tipografía */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'Consolas', monospace;

  /* Layout */
  --sidebar-w: 260px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --shadow-sm: 0 1px 2px rgba(0,0,0,.3);
  --shadow: 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.5);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  height: 100%;
  overflow: hidden;
}

body {
  display: flex;
}

#app {
  display: flex;
  width: 100%;
  height: 100vh;
}

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: #4E505A; }

/* ─── Sidebar ─────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--bg-1);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 20px 14px;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 20px;
}
.brand-logo {
  width: 40px; height: 40px;
  background: var(--red);
  color: #fff;
  border-radius: var(--radius);
  display: grid; place-items: center;
  font-weight: 800;
  font-size: 22px;
  box-shadow: var(--shadow-sm);
}
.brand-title {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -0.3px;
}
.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-top: -2px;
}

.btn-new {
  width: 100%;
  justify-content: center;
  margin-bottom: 10px;
}

.btn-queue-view {
  width: 100%;
  justify-content: center;
  margin-bottom: 20px;
  position: relative;
  gap: 8px;
}
.queue-badge {
  background: var(--red);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 0 6px;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  font-variant-numeric: tabular-nums;
}

.sidebar-section { flex: 1; overflow-y: auto; min-height: 0; }
.sidebar-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-dim);
  padding: 0 8px 8px;
}

.project-list { display: flex; flex-direction: column; gap: 4px; }

.project-item {
  display: flex;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 150ms;
  color: var(--text);
}
.project-item:hover { background: var(--bg-2); }
.project-item.active {
  background: var(--bg-2);
  box-shadow: inset 3px 0 0 var(--red);
}
.project-item-thumb {
  width: 40px; height: 40px;
  background: var(--bg-3);
  border-radius: 6px;
  flex-shrink: 0;
  object-fit: cover;
}
.project-item {
  position: relative;
  align-items: center;
}
.project-item-main {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.project-item-title {
  font-weight: 500;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.project-item-trash {
  background: transparent;
  border: none;
  color: var(--text-dim);
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 150ms, background 150ms, color 150ms;
  flex-shrink: 0;
}
.project-item:hover .project-item-trash { opacity: 1; }
.project-item-trash:hover {
  background: rgba(255, 107, 107, 0.12);
  color: #FF6B6B;
}
.project-item-sub {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
  align-items: center;
}
.status-pill {
  padding: 1px 6px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}
.status-pill.draft { background: #3A2A1D; color: var(--amber); }
.status-pill.breaking_down,
.status-pill.generating { background: #1D2A3A; color: var(--cyan); }
.status-pill.storyboard_ready { background: #1D3A2A; color: var(--green); }
.status-pill.done { background: #3A1D2D; color: var(--red); }
.status-pill.error { background: #3A1D1D; color: #FF6B6B; }

.sidebar-footer {
  padding-top: 10px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
}

.loader { color: var(--text-dim); font-size: 12px; padding: 8px; }

/* ─── Workspace ───────────────────────────────────────────────────── */
.workspace {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  background: var(--bg-0);
}

.empty-state {
  height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-muted);
}
.empty-state h2 {
  font-size: 32px;
  font-weight: 800;
  margin: 16px 0 8px;
  color: var(--text);
  letter-spacing: -0.5px;
}
.empty-icon { color: var(--red); opacity: 0.6; }

.screen {
  max-width: 940px;
  margin: 0 auto;
  padding: 40px 32px 80px;
  animation: fadeIn 240ms ease;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.screen-header {
  margin-bottom: 24px;
}
.screen-header.row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
}
.screen-header h1 {
  font-size: 30px;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: -0.5px;
}
.screen-subtitle {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0;
}

/* ─── Cards ────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 16px;
}

.label {
  display: block;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 10px;
  color: var(--text);
}
.label-sm {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

/* ─── Inputs ───────────────────────────────────────────────────────── */
.input, .textarea {
  width: 100%;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text);
  transition: border-color 150ms, box-shadow 150ms;
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--red);
  box-shadow: 0 0 0 3px var(--red-glow);
}
.textarea {
  font-family: var(--font-sans);
  resize: vertical;
  line-height: 1.5;
}

/* URL list */
.url-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.url-row { display: flex; gap: 8px; align-items: center; }
.url-row .input { flex: 1; }
.url-row .btn-remove {
  padding: 8px;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
}
.url-row .btn-remove:hover { color: #FF6B6B; border-color: #FF6B6B; }

/* ─── Buttons ──────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: background 150ms, transform 80ms, box-shadow 150ms, color 150ms;
  color: var(--text);
  background: var(--bg-2);
  white-space: nowrap;
}
.btn:hover { background: var(--bg-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 14px var(--red-glow);
}
.btn-primary:hover { background: #D12747; }

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-2); }

.btn-large { padding: 14px 24px; font-size: 15px; }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; }
.btn-icon { padding: 9px; gap: 0; }
.btn-icon svg { width: 16px; height: 16px; }

/* ─── Radio cards (orientation) ────────────────────────────────────── */
.radio-group { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.radio-group-3 { grid-template-columns: 1fr 1fr 1fr; }
.radio-card {
  cursor: pointer;
  position: relative;
}
.radio-card input[type="radio"] {
  position: absolute; opacity: 0; pointer-events: none;
}
.radio-card-body {
  background: var(--bg-2);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transition: all 150ms;
}
.radio-card:hover .radio-card-body { border-color: var(--border-strong); }
.radio-card input:checked + .radio-card-body {
  border-color: var(--red);
  background: #22171B;
  box-shadow: 0 0 0 4px var(--red-glow);
}

.radio-card-visual {
  background: var(--bg-3);
  border-radius: 6px;
  padding: 6px;
  display: grid;
  place-items: center;
}
.radio-card-visual.horizontal { width: 100px; height: 56px; }
.radio-card-visual.vertical { width: 56px; height: 100px; }
.radio-card-visual.both {
  width: 110px; height: 100px;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
}
.radio-card-visual .screen-preview {
  background: linear-gradient(135deg, #2b2d36, #3a3c48);
  width: 100%; height: 100%;
  border-radius: 3px;
}
.radio-card-visual.both .screen-preview.both-h { width: 56px; height: 32px; flex-shrink: 0; }
.radio-card-visual.both .screen-preview.both-v { width: 32px; height: 56px; flex-shrink: 0; }
.radio-card-title { font-weight: 600; font-size: 14px; }
.radio-card-desc { font-size: 11px; color: var(--text-muted); }

/* ─── Stepper ──────────────────────────────────────────────────────── */
.duration-control { display: flex; flex-direction: column; gap: 10px; }
.duration-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 0;
}
.duration-label { color: var(--text-muted); font-size: 13px; }
.duration-total { color: var(--text); font-size: 13px; padding-top: 8px; border-top: 1px solid var(--border); }
.duration-total strong { color: var(--red); font-size: 15px; }

.stepper {
  display: flex;
  align-items: center;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.stepper-btn {
  width: 32px; height: 32px;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: background 120ms;
}
.stepper-btn:hover { background: var(--bg-3); }
.stepper-value {
  width: 50px;
  background: transparent;
  border: none;
  color: var(--text);
  font-weight: 600;
  text-align: center;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.stepper-value:focus { outline: none; }

/* ─── Toggle card ──────────────────────────────────────────────────── */
.toggle-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  cursor: pointer;
}
.toggle-text { flex: 1; }
.toggle-title { font-weight: 600; font-size: 14px; margin-bottom: 4px; }
.toggle-desc { font-size: 12px; color: var(--text-muted); line-height: 1.5; }

.toggle-switch {
  position: relative;
  width: 48px; height: 28px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--bg-3);
  border-radius: 14px;
  transition: background 200ms;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  left: 3px; top: 3px;
  background: var(--text);
  border-radius: 50%;
  transition: transform 200ms, background 200ms;
}
.toggle-switch input:checked + .toggle-slider {
  background: var(--red);
}
.toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(20px);
  background: #fff;
}

/* ─── Actions ──────────────────────────────────────────────────────── */
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* ─── STATUS SCREEN (ventana grande durante ejecución) ─────────────── */
.screen-status {
  max-width: 820px;
  padding-top: 8vh;
}
.status-card {
  background: linear-gradient(145deg, #1F1A1E, #14121A);
  border: 1px solid var(--border-strong);
  border-radius: 24px;
  padding: 48px 56px;
  box-shadow: var(--shadow-lg), 0 0 60px var(--red-glow);
  position: relative;
  overflow: hidden;
}
.status-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(600px circle at top right, var(--red-glow), transparent 60%);
  pointer-events: none;
  opacity: 0.5;
}

.status-phase-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}
.status-phase-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--red);
  color: #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  box-shadow: 0 2px 8px var(--red-glow);
}
.status-phase-badge::before {
  content: '';
  width: 8px; height: 8px;
  background: #fff;
  border-radius: 50%;
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.7); }
}

.status-elapsed {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.status-message {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.6px;
  margin: 8px 0 32px;
  color: #fff;
  min-height: 100px;
  position: relative;
  z-index: 1;
}

.status-progress-track {
  height: 8px;
  background: var(--bg-3);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 40px;
  position: relative;
  z-index: 1;
}
.status-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--red), #F04060);
  box-shadow: 0 0 16px var(--red-glow);
  border-radius: 4px;
  transition: width 400ms ease;
}

.status-phases {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  position: relative;
  z-index: 1;
}
.status-phase {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  opacity: 0.4;
  transition: opacity 250ms;
}
.status-phase.active { opacity: 1; }
.status-phase.done { opacity: 0.75; }
.status-phase-dot {
  width: 14px; height: 14px;
  border: 2px solid var(--text-muted);
  border-radius: 50%;
  background: transparent;
  transition: all 250ms;
}
.status-phase.active .status-phase-dot {
  border-color: var(--red);
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-glow);
  animation: pulse-dot 1.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 4px var(--red-glow); }
  50% { box-shadow: 0 0 0 8px rgba(196, 30, 58, 0.1); }
}
.status-phase.done .status-phase-dot {
  background: var(--green);
  border-color: var(--green);
}
.status-phase-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}
.status-phase.active .status-phase-label,
.status-phase.done .status-phase-label { color: var(--text); }

.status-log-details {
  margin-top: 24px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
}
.status-log-details summary {
  cursor: pointer;
  font-size: 12px;
  color: var(--text-muted);
  user-select: none;
}
.status-log {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 12px;
  max-height: 240px;
  overflow-y: auto;
  white-space: pre-wrap;
  line-height: 1.5;
}
.status-log .log-info { color: var(--text-muted); }
.status-log .log-warn { color: var(--amber); }
.status-log .log-error { color: #FF6B6B; }

/* ─── Storyboard ──────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.scene-list { display: flex; flex-direction: column; gap: 16px; }

.scene-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: border-color 150ms;
}
.scene-card:hover { border-color: var(--border-strong); }

.scene-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  user-select: none;
}
.scene-card-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-step {
  background: var(--bg-3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 6px;
  cursor: pointer;
  transition: all 120ms;
}
.btn-step:hover { color: var(--text); background: var(--red); border-color: var(--red); }
.btn-step:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-step:disabled:hover { background: var(--bg-3); color: var(--text-muted); border-color: var(--border); }
.scene-card-ghost {
  opacity: 0.4;
  background: var(--bg-3);
}
.scene-number {
  font-weight: 700;
  font-size: 15px;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}
.scene-duration {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-3);
  padding: 2px 8px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
}

.scene-card-body {
  display: grid;
  grid-template-columns: 220px auto 1fr;
  gap: 14px;
}
.scene-media {
  position: relative;
  background: var(--bg-3);
  border-radius: var(--radius);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.scene-thumb { width: 100%; height: 100%; object-fit: cover; display: block; }
.scene-media-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
  min-width: 108px;
}
.scene-media-actions .btn {
  justify-content: center;
  white-space: nowrap;
  padding: 6px 10px;
  font-size: 11px;
}

.scene-fields { display: flex; flex-direction: column; gap: 10px; }

/* ─── Player ───────────────────────────────────────────────────────── */
.player-card { padding: 0; overflow: hidden; position: relative; }
.player-card video {
  width: 100%;
  display: block;
  background: #000;
  max-height: 60vh;
}

/* Player dual cuando orientation = "ambos" */
.final-ambos {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  align-items: start;
}
.final-ambos .player-card { padding: 0; }
.final-ambos-label {
  position: absolute;
  top: 8px; left: 8px;
  z-index: 2;
  background: rgba(0,0,0,0.65);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  pointer-events: none;
}
.final-ambos-h video { max-height: 60vh; }
.final-ambos-v video { max-height: 60vh; }
@media (max-width: 900px) {
  .final-ambos { grid-template-columns: 1fr; }
}

/* ─── Storyboard H/V toggle (proyectos "ambos") ─────────────────────── */
.sb2-kf-toggle {
  display: flex;
  gap: 4px;
  padding: 6px 10px 4px;
  border-bottom: 1px solid var(--border);
}
.sb2-kf-btn {
  flex: 1;
  padding: 4px 0;
  font-size: 12px;
  font-weight: 600;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.sb2-kf-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ─── Publish section ───────────────────────────────────────────────── */
.publish-section {
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.pub-title {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-right: 4px;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
}
.badge-green { background: #1A3A26; color: #4ADE80; }
.badge-gray  { background: #2A2A2A; color: var(--text-muted); }
.pub-danger { color: #F87171; }
.pub-danger:hover { background: rgba(248, 113, 113, .12); }

.pub-ambos-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.pub-ambos-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 6px 0;
  border-top: 1px solid var(--border);
}
.pub-orient {
  font-size: 13px;
  width: 130px;
  flex-shrink: 0;
}

.pub-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 2px;
  font-size: 13px;
  color: var(--text-muted);
}
.pub-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* ─── Drawer (Settings) ───────────────────────────────────────────── */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
  z-index: 100;
  display: flex;
  justify-content: flex-end;
  animation: fadeIn 200ms;
}
.drawer {
  width: 440px;
  max-width: 95vw;
  background: var(--bg-1);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,0.5);
  animation: slideIn 240ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes slideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}
.drawer-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.drawer-body {
  flex: 1;
  padding: 18px 22px;
  overflow-y: auto;
}
.drawer-body .card { padding: 16px; }
.drawer-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 16px 22px;
  border-top: 1px solid var(--border);
}

.btn-icon {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
}
.btn-icon:hover { background: var(--bg-2); color: var(--text); }

/* Radio row (column) */
.radio-group-column {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.radio-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 150ms;
}
.radio-row:has(input:checked) {
  border-color: var(--red);
  background: #22171B;
}
.radio-row input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--red);
}

/* Segmented */
.segmented {
  display: flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  gap: 3px;
}
.segmented label {
  flex: 1;
  position: relative;
  cursor: pointer;
}
.segmented input { position: absolute; opacity: 0; inset: 0; }
.segmented label span {
  display: block;
  text-align: center;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all 150ms;
}
.segmented label:hover span { color: var(--text); }
.segmented input:checked + span {
  background: var(--red);
  color: #fff;
  font-weight: 600;
}

/* Key-value row */
.kv-row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.kv-row:last-child { border-bottom: none; }
.kv-label { color: var(--text-muted); }
.kv-val { font-family: var(--font-mono); font-size: 12px; }
.text-dim { color: var(--text-dim); }

.hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 10px;
}
.hint code {
  background: var(--bg-2);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}

/* Card collapsible */
.card-collapsible { padding: 0; overflow: hidden; }
.card-collapsible summary {
  list-style: none;
  padding: 18px 20px;
  cursor: pointer;
  font-weight: 600;
  color: var(--text);
  user-select: none;
  position: relative;
}
.card-collapsible summary::-webkit-details-marker { display: none; }
.card-collapsible summary::after {
  content: '⌄';
  position: absolute;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  transition: transform 200ms;
  font-size: 18px;
}
.card-collapsible[open] summary::after { transform: translateY(-50%) rotate(180deg); }
.collapsible-body {
  padding: 0 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.advanced-row { display: flex; flex-direction: column; gap: 8px; }

.music-picker-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.music-picker-row select { flex: 1; }

/* Header actions layout */
.screen-header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

/* ─── Modal (Preview) ─────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(6px);
  z-index: 200;
  display: grid;
  place-items: center;
  animation: fadeIn 200ms;
  padding: 24px;
}
.modal {
  background: var(--bg-1);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  width: min(920px, 100%);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: popIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes popIn {
  from { transform: scale(0.96); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 18px; font-weight: 700; }
.modal-body {
  padding: 20px;
  overflow-y: auto;
  display: grid;
  place-items: center;
  min-height: 300px;
}
.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}
.preview-hint { font-size: 13px; }

/* Preview status */
.preview-status {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px;
}
.preview-spinner {
  width: 56px; height: 56px;
  border: 4px solid var(--bg-3);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 900ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.preview-msg {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
}
.preview-sub {
  font-size: 13px;
  color: var(--text-muted);
}

.preview-video {
  width: 100%;
  max-height: 60vh;
  background: #000;
  border-radius: 8px;
}

/* ─── Scene card badges ─────────────────────────────────────────── */
.scene-badge-imported {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--cyan);
  color: #000;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 4px;
  z-index: 2;
}
.scene-thumb-video { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ─── Video Importer Modal ──────────────────────────────────────── */
.modal-wide { width: min(1040px, 100%); }
.modal-body-vi { padding: 20px; display: flex; flex-direction: column; gap: 16px; min-height: 420px; }

.vi-drop {
  border: 2px dashed var(--border-strong);
  border-radius: 12px;
  padding: 40px 20px;
  display: grid;
  place-items: center;
  transition: border-color 180ms, background 180ms;
}
.vi-drop:hover, .vi-drop.dragover {
  border-color: var(--red);
  background: #22171B;
}
.vi-drop-label {
  cursor: pointer;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
}
.vi-drop-label span { font-weight: 600; color: var(--text); font-size: 15px; }
.vi-drop-label small { font-size: 12px; }

.vi-video {
  width: 100%;
  max-height: 320px;
  background: #000;
  border-radius: 8px;
}

.vi-controls { display: flex; flex-direction: column; gap: 12px; }

.vi-waveform {
  background: var(--bg-2);
  border-radius: 8px;
  padding: 8px;
  min-height: 90px;
  position: relative;
}

.vi-trim-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.vi-trim-info strong { color: var(--red); font-variant-numeric: tabular-nums; }

.vi-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-2);
  border-radius: 8px;
  padding: 12px 14px;
}
.vi-option {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  cursor: pointer;
}
.vi-option input[type="checkbox"] { accent-color: var(--red); }
.vi-volume-row { gap: 12px; }
.vi-volume { flex: 1; accent-color: var(--red); }
.vi-volume-val { font-family: var(--font-mono); min-width: 50px; text-align: right; }

/* Regions del wavesurfer — custom */
.wavesurfer-region { background: rgba(196, 30, 58, 0.25) !important; }
.wavesurfer-handle { background: var(--red) !important; width: 4px !important; }

/* ─── Debug panel (Ctrl+F12) ─────────────────────────────────────── */
.debug-panel {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-w);
  right: 0;
  height: 38vh;
  background: #0a0b10;
  border-top: 2px solid var(--red);
  box-shadow: 0 -8px 32px rgba(0,0,0,0.6);
  z-index: 300;
  display: none;               /* oculto por default */
  flex-direction: column;
}
.debug-panel.open {
  display: flex;
  animation: slideUp 200ms ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.debug-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 8px 14px;
  background: #14151D;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.debug-head strong { color: var(--red); letter-spacing: 0.3px; }
.debug-hint { color: var(--text-dim); font-size: 11px; flex: 1; }
.debug-actions { display: flex; gap: 6px; align-items: center; }
.debug-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.55;
  color: #B4B5BE;
}
.debug-body .dlog-line {
  display: flex;
  gap: 10px;
  padding: 1px 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.debug-body .dlog-t { color: var(--text-dim); flex-shrink: 0; min-width: 78px; }
.debug-body .dlog-tag { flex-shrink: 0; min-width: 50px; font-weight: 700; }
.debug-body .dlog-tag.INFO { color: #6EB5FF; }
.debug-body .dlog-tag.WS { color: #5AC8D4; }
.debug-body .dlog-tag.API { color: #ABE27A; }
.debug-body .dlog-tag.WARN { color: var(--amber); }
.debug-body .dlog-tag.ERR { color: #FF6B6B; }
.debug-body .dlog-tag.JS  { color: #FF8FA8; }
.debug-body .dlog-body { flex: 1; }

/* ─── Screen: Cola de procesamiento ──────────────────────────────── */
.queue-list { display: flex; flex-direction: column; gap: 10px; }
.queue-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  transition: border-color 150ms, background 150ms;
}
.queue-item:hover { border-color: var(--border-strong); background: var(--bg-2); }
.queue-drag {
  color: var(--text-dim);
  cursor: grab;
  font-size: 14px;
  letter-spacing: -2px;
  font-weight: bold;
  user-select: none;
}
.queue-drag:active { cursor: grabbing; }
.queue-item-body { flex: 1; min-width: 0; }
.queue-item-title {
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.queue-item-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
  display: flex;
  gap: 8px;
}
.queue-item-actions { display: flex; gap: 6px; align-items: center; }
.queue-item-ghost { opacity: 0.4; background: var(--bg-3); }

.empty-queue {
  background: var(--bg-1);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 48px;
  text-align: center;
  color: var(--text-muted);
}

.queue-runner-card {
  background: linear-gradient(135deg, #1F1F28, #2A1D22) !important;
  border-color: var(--red) !important;
}
.queue-runner-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.queue-runner-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 4px var(--red-glow);
  animation: pulse 1.2s ease-in-out infinite;
  flex-shrink: 0;
}
.queue-runner-title { font-weight: 700; font-size: 14px; }
.queue-runner-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* Back button */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  background: transparent;
  border: none;
  padding: 6px 10px;
  margin-bottom: 12px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.btn-back:hover { color: var(--text); background: var(--bg-2); }

.warning-card {
  background: #3A2A1D !important;
  border-color: #6B4A1D !important;
  color: var(--amber);
}
.warning-card code {
  background: rgba(0,0,0,0.3);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
}

/* ═══════════════════════════════════════════════════════════════════
   STORYBOARD v2 — layout 3 columnas (sidebar + editor + propiedades)
   ═══════════════════════════════════════════════════════════════════ */
.sb2 {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 22px 26px 26px;
  box-sizing: border-box;
  height: 100vh;
}
.sb2 > * { min-height: 0; }

.sb2-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-bottom: 1px solid var(--border);
  padding-bottom: 14px;
}
.sb2-title-block h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.4px;
}
.sb2-title-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  display: flex;
  gap: 12px;
  align-items: center;
}
.sb2-title-sub .dot { width: 3px; height: 3px; background: var(--text-dim); border-radius: 50%; }
.sb2-header-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.sb2-title-block { min-width: 0; }
.sb2-title-block h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Columna izquierda: lista de escenas ─────────────────────── */
.sb2-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding-right: 2px;
  padding-top: 4px;
}
.sb2-left-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 4px 6px;
}
.sb2-left-head .title {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sb2-left-head .count {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--bg-2);
  border-radius: 999px;
  padding: 2px 9px;
  font-variant-numeric: tabular-nums;
}

.sb2-scenes { display: flex; flex-direction: column; gap: 8px; }
.sb2-scene-mini {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 11px;
  align-items: center;
  background: var(--bg-1);
  border: 1.5px solid var(--border);
  border-radius: 11px;
  padding: 10px;
  cursor: pointer;
  transition: all 160ms cubic-bezier(.2,.8,.2,1);
  position: relative;
}
.sb2-scene-mini:hover {
  border-color: var(--border-strong);
  background: var(--bg-2);
  transform: translateX(2px);
}
.sb2-scene-mini.active {
  border-color: var(--red);
  background: linear-gradient(135deg, #2A1920 0%, #1D161A 100%);
  box-shadow: 0 0 0 3px rgba(196,30,58,.18), 0 4px 14px rgba(0,0,0,.4);
}
.sb2-scene-mini-thumb {
  width: 72px; height: 42px;
  transition: width 150ms, height 150ms;
  background: var(--bg-3);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.sb2-scene-mini.active .sb2-scene-mini-thumb {
  box-shadow: 0 0 0 1.5px var(--red);
}
.sb2-scene-mini-thumb img,
.sb2-scene-mini-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }

.sb2-scenes.kf-portrait .sb2-scene-mini-thumb { width: 42px; height: 72px; }
.sb2-scene-mini-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.sb2-scene-mini-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.sb2-motion-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; color: var(--text-dim); cursor: pointer;
  padding: 2px 6px; border-radius: 4px;
  background: var(--bg-2); border: 1px solid var(--border);
  user-select: none;
}
.sb2-motion-toggle input { margin: 0; cursor: pointer; transform: scale(0.85); }
.sb2-motion-toggle:has(input:checked) {
  color: var(--text); border-color: var(--green-soft, #4ade80);
}
.sb2-scene-mini-num { font-weight: 700; font-size: 13px; color: var(--text); }
.sb2-scene-mini-dur {
  font-size: 10px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.sb2-scene-mini-snippet {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.35;
}
.sb2-scene-mini.active .sb2-scene-mini-snippet { color: var(--text); }
.sb2-scene-mini-badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.sb2-scene-mini-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1.5px 6px;
  border-radius: 4px;
  letter-spacing: 0.6px;
}
.sb2-scene-mini-badge.imported { background: #1D2A38; color: var(--cyan); }
.sb2-scene-mini-badge.custom { background: #3A2A1D; color: var(--amber); }
.sb2-scene-mini-badge.search { background: #1D3A28; color: #4ADE80; }

/* ─── Narración read-only en scene editor ──────────────────────── */
.sb2-narration-readonly {
  margin: 0;
  padding: 12px 14px;
  background: var(--bg-2, #1c1d24);
  border: 1px solid var(--border, #2a2b34);
  border-radius: 10px;
  color: var(--text, #e8e8ec);
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.55;
  min-height: 56px;
}

/* ─── Search modal (Google CSE) ────────────────────────────────── */
.search-modal .sm-body {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  place-items: stretch;
  gap: 12px;
  min-height: 420px;
}
.sm-search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.sm-search-row .sm-query { flex: 1; }
.sm-which-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}
.sm-which-label {
  font-size: 12px;
  color: var(--text-muted);
}
.sm-which-toggle {
  display: inline-flex;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2px;
  gap: 2px;
}
.sm-which-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.sm-which-btn:hover { color: var(--text); }
.sm-which-btn.active {
  background: var(--red);
  color: #fff;
}
.sm-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-content: start;
}
@media (max-width: 720px) {
  .sm-grid { grid-template-columns: repeat(2, 1fr); }
}
.sm-cell {
  background: var(--bg-2, #1c1d24);
  border: 1px solid var(--border, #2a2b34);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  transition: border-color 140ms, transform 140ms;
}
.sm-cell:hover {
  border-color: var(--red, #C41E3A);
  transform: translateY(-2px);
}
.sm-cell-img {
  aspect-ratio: 1 / 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.sm-cell-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.sm-cell-meta {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  padding: 6px 8px;
  font-size: 11px;
  color: var(--text-muted, #9ca0ac);
  background: rgba(0,0,0,0.25);
}
.sm-cell-dim { font-weight: 600; color: var(--text, #e8e8ec); }
.sm-cell-src { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sm-cell-loading {
  opacity: 0.5;
  pointer-events: none;
}

.sb2-add-scene {
  border: 1.5px dashed var(--border-strong);
  background: transparent;
  color: var(--text-muted);
  padding: 14px;
  border-radius: 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: all 180ms;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}
.sb2-add-scene:hover {
  border-color: var(--red);
  color: var(--red);
  background: rgba(196,30,58,0.05);
}

/* ── Columna centro: editor ────────────────────────────────── */
.sb2-main {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow-y: auto;
  padding: 24px 28px;
  box-shadow: 0 4px 18px rgba(0,0,0,.25);
}
.sb2-main-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.sb2-main-head h2 {
  font-size: 22px;
  font-weight: 800;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.3px;
}
.sb2-chip {
  font-size: 11px;
  font-weight: 700;
  background: var(--bg-3);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.sb2-main-head .actions-row { display: flex; gap: 6px; }

.sb2-section { margin-bottom: 18px; }
.sb2-section-label {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  margin: 0 0 10px;
}
.sb2-media {
  display: grid;
  grid-template-columns: 1fr 128px;
  gap: 14px;
  margin-bottom: 14px;
}
.sb2-thumb {
  position: relative;
  background: var(--bg-3);
  border-radius: 10px;
  aspect-ratio: 16/9;
  overflow: hidden;
  border: 1px solid var(--border);
  transition: aspect-ratio 150ms;
}
.sb2-thumb.kf-portrait {
  aspect-ratio: 9/16;
  max-height: 70vh;
  margin: 0 auto;
}
.sb2-thumb img,
.sb2-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sb2-thumb-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--cyan);
  color: #001418;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 4px;
}
.sb2-media-actions {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.sb2-media-actions .btn {
  width: 100%;
  justify-content: flex-start;
  padding: 9px 12px;
  font-size: 12px;
  gap: 8px;
}

/* Slider de duración */
.sb2-duration-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
}
.sb2-duration-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}
.sb2-duration-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}
.sb2-duration-value {
  font-size: 16px;
  font-weight: 800;
  color: var(--red);
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
}
.sb2-slider { width: 100%; accent-color: var(--red); height: 6px; }
.sb2-duration-hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
}

.sb2-textarea {
  width: 100%;
  font-size: 13.5px;
  padding: 12px 14px;
}

/* Selector de modelo por escena */
.sb2-model-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 8px;
}
.sb2-model-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.sb2-model-hint {
  font-size: 10px;
  color: var(--text-dim);
  margin-top: 6px;
  font-family: var(--font-mono);
}
.sb2-dirty-badge {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  background: var(--amber);
  color: #1a0f00;
}

/* Badge de dirty en la scene-mini */
.sb2-scene-mini-badge.dirty { background: #3A2D14; color: var(--amber); }
.sb2-scene-mini-badge.ltx  { background: #1D2A38; color: var(--cyan); }
.sb2-scene-mini-badge.wan  { background: #251D38; color: #BFA3FF; }

/* ── Columna derecha: globales + propiedades ─────────────── */
.sb2-right {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
  padding-right: 2px;
  padding-top: 4px;
}
.sb2-card {
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  transition: border-color 180ms;
}
.sb2-card:hover { border-color: var(--border-strong); }
.sb2-card h3 {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-dim);
  margin: 0 0 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.sb2-card h3 .marker {
  width: 3px;
  height: 12px;
  background: var(--red);
  border-radius: 2px;
}

.sb2-field { margin-bottom: 12px; }
.sb2-field:last-child { margin-bottom: 0; }
.sb2-field .label-sm {
  font-size: 10px;
  color: var(--text-muted);
  margin-bottom: 5px;
  font-weight: 600;
  letter-spacing: 0.3px;
}
.sb2-field .input,
.sb2-field .textarea { font-size: 13px; padding: 9px 11px; }

.sb2-prop-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
}
.sb2-prop-row + .sb2-prop-row {
  border-top: 1px solid var(--border);
  margin-top: 6px;
  padding-top: 10px;
}
.sb2-prop-row label { font-size: 12.5px; color: var(--text-muted); }
.sb2-prop-row .val {
  font-size: 12px;
  color: var(--text);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.pill-segment {
  display: inline-flex;
  background: var(--bg-2);
  border-radius: 999px;
  padding: 3px;
  font-size: 11px;
  gap: 2px;
}
.pill-segment span {
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
}
.pill-segment span.on {
  background: var(--red);
  color: #fff;
  font-weight: 700;
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .scene-card-body { grid-template-columns: 1fr; }
  .scene-media-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .radio-group { grid-template-columns: 1fr; }
}
@media (max-width: 1200px) {
  .sb2 { grid-template-columns: 260px minmax(0,1fr) 280px; padding: 18px; }
}
@media (max-width: 980px) {
  .sb2 { grid-template-columns: 1fr; height: auto; overflow-y: auto; }
}

/* ── News scout modal ───────────────────────────────────────── */
.url-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.news-scout-modal .modal-card { width: min(720px, 92vw); max-height: 85vh; display: flex; flex-direction: column; }
.news-scout-modal .modal-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }

/* ─── Storyboard ambos modal ───────────────────────────────────────── */
.sb-ambos-modal .modal-card { width: min(880px, 95vw); max-height: 90vh; display: flex; flex-direction: column; }
.sb-ambos-modal .modal-body { display: block; padding: 20px; min-height: 0; overflow-y: auto; }
.sb-ambos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sb-ambos-col {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px;
}
.sb-ambos-col-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sb-ambos-col-head h4 { margin: 0; font-size: 14px; font-weight: 700; }
.sb-ambos-status {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--bg-3);
  color: var(--text-muted);
  white-space: nowrap;
}
.sb-ambos-status[data-state="ready"] { background: #1D3A2A; color: var(--green); }
.sb-ambos-status[data-state="uploading"] { background: #2B2B14; color: #EAB308; }
.sb-ambos-status[data-state="error"]    { background: #3A1F1F; color: #F87171; }

.sb-ambos-copy { width: 100%; justify-content: center; }

.sb-ambos-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 160px;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg-1);
  cursor: pointer;
  text-align: center;
  padding: 16px;
  transition: all 150ms;
}
.sb-ambos-dropzone:hover { border-color: var(--red); background: #1A1014; }
.sb-ambos-dropzone.is-dragover { border-color: var(--red); background: #22171B; box-shadow: 0 0 0 4px var(--red-glow); }
.sb-ambos-dropzone.is-uploading { opacity: 0.6; cursor: wait; }
.sb-ambos-dropzone.is-ready { border-color: var(--green); border-style: solid; background: #112016; }
.sb-ambos-dz-icon { color: var(--text-muted); }
.sb-ambos-dropzone.is-ready .sb-ambos-dz-icon { color: var(--green); }
.sb-ambos-dz-text { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.sb-ambos-dz-text strong { font-weight: 600; }
.sb-ambos-dz-text .text-dim { font-size: 11px; }

@media (max-width: 720px) {
  .sb-ambos-grid { grid-template-columns: 1fr; }
}
.news-tabs { display: flex; gap: 4px; padding: 12px 16px 0; border-bottom: 1px solid var(--border, #333); }
.news-tab {
  background: transparent; border: 0; padding: 8px 14px;
  color: var(--text-muted, #888); cursor: pointer; font-size: 13px;
  border-bottom: 2px solid transparent; transition: color 0.15s, border-color 0.15s;
}
.news-tab:hover { color: var(--text, #ddd); }
.news-tab.is-active { color: var(--text, #fff); border-bottom-color: var(--red, #C41E3A); }
.news-list { flex: 1; overflow-y: auto; padding: 8px; }
.news-loading { padding: 28px 16px; text-align: center; color: var(--text-muted, #888); }
.news-item {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 1px solid var(--border, #2a2a2a);
  padding: 10px 12px; margin-bottom: 6px; border-radius: 8px;
  color: var(--text, #ddd); cursor: pointer; transition: background 0.12s, border-color 0.12s;
}
.news-item:hover { background: var(--hover, #1d1d1d); border-color: var(--red, #C41E3A); }
.news-item.is-used { opacity: 0.55; }
.news-item.is-used:hover { opacity: 0.85; }
.news-item-title { font-size: 14px; font-weight: 500; line-height: 1.35; margin-bottom: 4px; }
.news-item-meta { font-size: 11px; color: var(--text-muted, #888); }
.news-badge-used {
  display: inline-block; margin-left: 8px;
  font-size: 10px; padding: 2px 6px; border-radius: 999px;
  background: rgba(196,30,58,0.15); color: #ff6b8b;
  vertical-align: middle; text-transform: uppercase; letter-spacing: 0.5px;
}

/* ─── Mobile responsive (≤ 768px) ─────────────────────────────────────────── */

/* Hide mobile chrome on desktop */
.mobile-topbar, .mobile-nav, .sidebar-overlay { display: none !important; }

@media (max-width: 768px) {

  /* ── Core layout ── */
  body { overflow: hidden; }

  .mobile-topbar {
    display: flex !important;
    align-items: center;
    height: 52px;
    padding: 0 8px;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    position: fixed; top: 0; left: 0; right: 0; z-index: 600;
    gap: 4px;
  }
  .mobile-topbar-title {
    flex: 1; font-weight: 700; font-size: 15px; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    padding: 0 6px;
  }
  .hamburger-btn {
    width: 42px; height: 42px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; cursor: pointer;
    color: var(--text); border-radius: 10px;
    -webkit-tap-highlight-color: transparent;
    transition: background 0.12s;
  }
  .hamburger-btn:active { background: var(--bg-3); }

  .mobile-nav {
    display: flex !important;
    position: fixed; bottom: 0; left: 0; right: 0; height: 58px;
    background: var(--bg-1); border-top: 1px solid var(--border);
    z-index: 600;
  }
  .mobile-nav-btn {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    background: none; border: none; color: var(--text-dim);
    font-size: 10px; font-family: inherit; font-weight: 500;
    cursor: pointer; padding: 0;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.12s;
  }
  .mobile-nav-btn.active { color: var(--red); }
  .mobile-nav-btn:active { background: var(--bg-2); }

  /* ── Sidebar: off-canvas ── */
  #app { position: relative; }

  .sidebar {
    position: fixed !important;
    top: 0; left: 0; bottom: 0; z-index: 700;
    width: 280px !important;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4,0,0.2,1);
    box-shadow: none;
    padding-top: 0;
  }
  .sidebar.sidebar-open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.5);
  }
  .sidebar-overlay {
    display: block !important;
    position: fixed; inset: 0; z-index: 699;
    background: rgba(0,0,0,0.55);
    opacity: 0; pointer-events: none;
    transition: opacity 0.25s;
  }
  .sidebar-overlay.visible { opacity: 1; pointer-events: auto; }

  /* ── Workspace ── */
  .workspace {
    margin-left: 0 !important;
    padding-top: 52px !important;
    padding-bottom: 58px !important;
    height: 100dvh !important;
    overflow-y: auto;
  }

  /* ── Screens & cards ── */
  .screen { padding: 14px 12px !important; max-width: 100% !important; }
  .card { padding: 14px !important; }
  .screen-header { margin-bottom: 16px !important; }
  .screen-header h1 { font-size: 20px !important; }

  /* ── Buttons: touch targets ── */
  .btn { min-height: 44px; }
  .btn-sm { min-height: 36px; }

  /* ── Forms ── */
  .input, .textarea, select {
    font-size: 16px !important; /* prevent iOS auto-zoom */
  }
  .radio-group {
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  .radio-card { padding: 12px 10px !important; }
  .radio-card-visual { height: 36px !important; }

  /* ── Storyboard v2: tab layout ── */
  .sb2 {
    display: block !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
  }
  .sb2-left, .sb2-main, .sb2-right {
    display: none !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    border-radius: 0 !important;
  }
  .sb2-left.sb2-tab-active,
  .sb2-main.sb2-tab-active,
  .sb2-right.sb2-tab-active { display: block !important; }

  /* Tab bar for storyboard */
  .sb2-mobile-tabs {
    display: flex;
    background: var(--bg-1);
    border-bottom: 1px solid var(--border);
    position: sticky; top: 52px; z-index: 50;
  }
  .sb2-mobile-tab {
    flex: 1; padding: 11px 4px;
    background: none; border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-dim); font-size: 12px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    text-transform: uppercase; letter-spacing: 0.4px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.12s, border-color 0.12s;
  }
  .sb2-mobile-tab.active { color: var(--text); border-bottom-color: var(--red); }

  /* Scene mini thumbnails: horizontal scroll row */
  .sb2-left .sb2-scenes { display: flex; flex-direction: row; overflow-x: auto; padding: 10px 12px; gap: 10px; }
  .sb2-left .sb2-scene-mini { flex-shrink: 0; width: 100px; }
  .sb2-left .sb2-scene-mini-img { width: 100px; height: 56px; }
  .sb2-left .sb2-add-scene { margin: 0 !important; }

  /* ── Modals: bottom sheet on mobile ── */
  .modal-backdrop {
    align-items: flex-end !important;
    padding: 0 !important;
  }
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    max-height: 92dvh !important;
    border-radius: 16px 16px 0 0 !important;
    overflow-y: auto !important;
    padding: 16px !important;
  }
  /* Handle bar */
  .modal::before {
    content: '';
    display: block; width: 36px; height: 4px;
    background: var(--border-strong);
    border-radius: 2px; margin: 0 auto 16px;
  }

  /* ── Drawers: full width ── */
  .drawer { width: 100% !important; max-width: 100% !important; }

  /* ── Search modal ── */
  .sm-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .search-modal-header { flex-wrap: wrap; gap: 8px; }

  /* ── Done screen ── */
  .final-ambos { grid-template-columns: 1fr !important; }
  .done-actions { flex-wrap: wrap; }

  /* ── Status screen ── */
  .status-card { padding: 24px 16px !important; }

  /* ── Queue screen ── */
  .queue-item { padding: 12px 10px !important; }

  /* ── Debug panel ── */
  .debug-panel { left: 0 !important; }
}

