:root {
  color-scheme: dark;
  /* Backgrounds */
  --bg-base: #222831;
  --bg-surface: #393E46;
  --bg-elevated: #2C3038;

  /* Background overlay */
  --bg-overlay: rgba(57, 62, 70, 0.82);

  /* Brand primaires */
  --color-primary: #948979; /* Warm Taupe (CTA/brand) */
  --color-accent: #DFD0B8;  /* Sand Beige (texte primaire) */
  --color-violet: #5E7A8A;  /* Slate Blue (infos/liens) */
  --color-violet-deep: #C4964A; /* Amber Warm (warning) */

  /* Actions */
  --color-cta: #948979;
  --color-cta-hover: #C9B99A; /* Beige Mid */
  --color-secondary-cta: #2C3038;
  --color-secondary-cta-border: #5E7A8A;

  /* Textes */
  --text-primary: #DFD0B8;
  --text-secondary: #C9B99A;
  --text-muted: #948979;

  /* États */
  --color-success: #6B8F71;
  --color-warning: #C4964A;
  --color-error: #A85858;
  --color-progress: #948979;

  /* Secondaires pastel */
  --light-blue: #5E7A8A;
  --light-mint: #6B8F71;
  --light-violet: #F0EDE6; /* Sand Light */
  --light-yellow: #F0EDE6; /* Sand Light (alias) */
  --light-orange: #C4964A;

  /* Typographie */
  --font-sans: 'Inter', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;

  /* Aliases legacy (compat CSS existant) */
  --primary: var(--color-primary);
  --primary-hover: var(--color-cta-hover);
  --primary-glow: rgba(148, 121, 121, 0.35);
  --accent: var(--color-accent);
  --accent-2: var(--color-violet-deep);
  --accent-glow: rgba(223, 208, 184, 0.25);
  --text: var(--text-primary);

  --border: rgba(74, 80, 88, 0.35);
  --border-hover: rgba(74, 80, 88, 0.55);
  --border-focus: rgba(148, 121, 121, 0.6);
  --ring: rgba(148, 121, 121, 0.25);

  --ok: var(--color-success);
  --ok-bg: rgba(107, 143, 113, 0.10);
  --err: var(--color-error);
  --err-bg: rgba(168, 88, 88, 0.10);
  --warning: var(--color-warning);
  --warning-bg: rgba(196, 150, 74, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  height: 100vh;
  overflow: hidden;
  font-family: var(--font-sans);
  background:
    radial-gradient(circle at 8% 10%, rgba(148,121,121,0.35) 0%, transparent 40%),
    radial-gradient(circle at 90% 15%, rgba(94,122,138,0.25) 0%, transparent 38%),
    radial-gradient(circle at 50% 90%, rgba(201,185,154,0.18) 0%, transparent 40%),
    linear-gradient(160deg, var(--bg-surface) 0%, var(--bg-base) 50%, #1A1E24 100%);
  color: var(--text);
  display: flex;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: 220px;
  flex-shrink: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  background: rgba(34, 40, 49, 0.6);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
  padding: 24px 12px;
  gap: 4px;
  z-index: 10;
}

.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.sidebar-logo {
  width: 32px; height: 32px; border-radius: 6px; flex-shrink: 0;
  background: #948979;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; color: #222831; letter-spacing: 0.06em;
}
.sidebar-brand-text { flex: 1; }
.sidebar-brand-name { font-size: 0.8rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.sidebar-brand-sub  { font-size: 0.65rem; color: var(--text-muted); letter-spacing: 0.04em; text-transform: uppercase; }

.sidebar-section-label {
  font-size: 0.62rem; font-weight: 700; color: var(--text-muted);
  letter-spacing: 0.08em; text-transform: uppercase;
  padding: 8px 12px 4px;
}

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px; cursor: pointer;
  border-left: 3px solid transparent;
  border: 1px solid transparent;
  background: none;
  transition: background 150ms, box-shadow 150ms, color 150ms;
  text-decoration: none; color: rgba(223,208,184,0.5);
  user-select: none; position: relative;
}
.nav-item:hover:not(.nav-item-soon) {
  background: rgba(148,121,121,0.12);
  color: var(--text-secondary);
}

.nav-item-soon { opacity: 0.38; cursor: default; }

/* Liseret neon gradient — contour complet */
.nav-item.active {
  color: var(--text-primary);
  border: 1px solid transparent;
  background: rgba(148,121,121,0.20);
  box-shadow: none;
  border-color: var(--color-violet);
}
.nav-item.active::before { display: none; }

.nav-icon {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(223,208,184,0.06);
  transition: background 150ms;
}
.nav-item.active .nav-icon {
  background: linear-gradient(135deg, var(--primary), var(--accent-2));
  box-shadow: 0 4px 12px var(--primary-glow);
}
.nav-item-text { flex: 1; }
.nav-item-name { font-size: 0.82rem; font-weight: 600; line-height: 1.2; }
.nav-item-desc { font-size: 0.68rem; color: rgba(223,208,184,0.5); margin-top: 1px; }
.nav-item.active .nav-item-name { color: var(--text); }
.nav-item.active .nav-item-desc  { color: var(--text-secondary); }

.nav-badge {
  font-size: 0.6rem; font-weight: 700; padding: 2px 7px;
  border-radius: 999px; letter-spacing: 0.04em; text-transform: uppercase;
}
.nav-badge-soon {
  background: rgba(223,208,184,0.08); color: var(--text-muted);
  border: 1px solid var(--border);
}

.sidebar-spacer { flex: 1; }

.sidebar-footer {
  padding: 12px;
  border-top: 1px solid var(--border);
}
.sidebar-footer-text {
  font-size: 11px;
  color: var(--color-violet);
  line-height: 1.5;
  text-align: center;
}

/* ===== APP SHELL ===== */
.app-shell {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: 40px 32px 40px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

/* ===== PAGES ===== */
.page { display: none; }
.page.active { display: block; }

.app-wrap { width: min(1720px, 100%); display: flex; flex-direction: column; gap: 20px; }

/* Blank page */
.blank-page {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60vh; gap: 20px; text-align: center;
}
.blank-icon {
  width: 64px; height: 64px; border-radius: 20px;
  background: rgba(223,208,184,0.07); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted);
}
.blank-title { font-size: 1.1rem; font-weight: 700; margin: 0; color: var(--text-secondary); }
.blank-sub   { font-size: 0.85rem; color: var(--text-muted); margin: 0; }

@media (max-width: 960px) {
  .sidebar { width: 180px; }
}

/* 2-col layout */
.app-content {
  display: grid;
  grid-template-columns: 356px 1fr;
  gap: 20px;
  align-items: start;
  overflow: hidden;
}
.app-content > main {
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

/* Info card */
.info-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  position: sticky;
  top: 24px;
}

.info-card .panel {
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.info-headline {
  font-size: 1.1rem;
  font-weight: 800;
  line-height: 1.3;
  margin: 0;
  letter-spacing: -0.01em;
}
.info-headline span {
  background: none;
  background-clip: initial;
  -webkit-background-clip: initial;
  -webkit-text-fill-color: var(--color-accent);
  color: var(--color-accent);
}

.info-steps { display: flex; flex-direction: column; gap: 20px; }

.info-step {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px;
  background: var(--bg-elevated);
  border: 1px solid rgba(74, 80, 88, 0.6);
  border-radius: var(--radius-md);
}

.info-step-icon {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-size: 1.1rem;
}
.info-step-icon.c1,
.info-step-icon.c2,
.info-step-icon.c3 {
  background: rgba(148, 121, 121, 0.15);
  border: 1px solid rgba(74, 80, 88, 0.6);
}
.info-step-icon svg path { stroke: var(--color-violet) !important; }

.info-step-body { flex: 1; }
.info-step-title {
  font-size: 0.875rem; font-weight: 700;
  margin: 0 0 3px; color: var(--text);
}
.info-step-desc {
  font-size: 0.78rem; color: var(--text-secondary);
  line-height: 1.5; margin: 0;
}

.info-divider {
  height: 1px; background: var(--border); margin: 0 0 0 52px;
}

.info-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(148, 121, 121, 0.08);
  border: 1px solid var(--border);
}
.info-footer-dot {
  width: 6px; height: 6px; border-radius: 999px;
  background: var(--color-primary); flex-shrink: 0;
  box-shadow: 0 0 10px rgba(148,121,121,0.45);
  animation: pulse-subtle 2.2s ease-in-out infinite;
}
.info-footer-text {
  font-size: 0.72rem; color: var(--text-secondary); line-height: 1.4;
}

@keyframes pulse-subtle {
  0%,100% { transform: scale(1); opacity: 0.92; }
  50% { transform: scale(1.25); opacity: 1; }
}

.studio-badge {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 800;
  color: #222831;
  background: #948979;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 4px;
}
.studio-badge-dot { display: none; }

.studio-badge--soon {
  background: #C4964A;
  color: #222831;
}

.info-tagline {
  margin: -2px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  line-height: 1.4;
}

@media (max-width: 860px) {
  .app-content { grid-template-columns: 1fr; }
  .info-card { position: static; }
}

/* Panel */
.panel {
  background:
    linear-gradient(150deg, rgba(148,121,121,0.12) 0%, rgba(148,121,121,0.02) 40%, rgba(94,122,138,0.06) 100%),
    var(--bg-overlay);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  backdrop-filter: blur(10px);
}

/* Banner */
.banner {
  border-radius: 12px; padding: 12px 16px; border: 1px solid;
  font-size: 0.85rem; line-height: 1.55; margin-bottom: 20px;
}
.banner-warning { border-color: rgba(196,150,74,0.4); background: var(--warning-bg); }
.banner-warning strong { color: var(--warning); }
.banner code {
  font-size: 0.82em; padding: 1px 6px; border-radius: 5px;
  background: rgba(0,0,0,0.25);
}

/* Field */
.field { margin-bottom: 20px; }
.field-label {
  display: block; font-size: 0.75rem; font-weight: 600;
  color: var(--text-secondary); margin-bottom: 8px;
  letter-spacing: 0.05em; text-transform: uppercase;
}
.field-input {
  width: 100%; background: rgba(223,208,184,0.06);
  border: 1px solid var(--border); border-radius: 12px;
  padding: 11px 14px; color: var(--text); font-size: 0.94rem;
  font-family: inherit; outline: none;
  transition: border-color 150ms, box-shadow 150ms;
}
.field-input:focus { border-color: var(--border-focus); box-shadow: 0 0 0 3px var(--ring); }
.field-input::placeholder { color: var(--text-muted); }

/* Dropzone */
.dropzone {
  min-height: 130px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px;
  border: 2px dashed var(--color-violet);
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  cursor: pointer; user-select: none; outline: none; text-align: center;
  margin-bottom: 16px;
  transition: border-color 150ms, background 150ms, transform 150ms, box-shadow 150ms;
}
.dropzone:hover, .dropzone:focus-visible {
  border-color: var(--color-primary);
  background: var(--bg-surface);
  box-shadow: 0 0 0 3px var(--ring);
}
.dropzone.is-dragover {
  border-color: var(--color-primary); border-style: solid;
  background: rgba(148,121,121,0.10);
  box-shadow: 0 0 0 4px var(--ring);
  transform: scale(1.01);
  animation: dz-pulse 1.4s ease-in-out infinite;
}
.dropzone.is-error {
  border-color: var(--err); border-style: solid;
  background: var(--err-bg);
  animation: dz-shake 0.38s ease;
}
.dropzone.is-success {
  border-color: var(--ok); border-style: solid;
  background: var(--ok-bg); cursor: default;
}
.dropzone.is-success:hover { transform: none; box-shadow: none; }

.dz-icon {
  width: 44px; height: 44px; border-radius: 14px;
  background: rgba(223,208,184,0.08);
  display: flex; align-items: center; justify-content: center; color: var(--text-secondary);
}
.dz-title { font-size: 0.95rem; font-weight: 700; margin: 0; }
.dz-sub   { font-size: 0.82rem; color: var(--text-secondary); margin: 0; line-height: 1.45; }

/* Dropzone — empty/error/success states */
.dz-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.dz-error-title { display: none; font-size: 0.9rem; font-weight: 700; color: var(--err); margin: 0; }
.dz-error-sub   { display: none; font-size: 0.8rem; color: var(--text-secondary); margin: 0; }

.dropzone.is-error .dz-empty       { display: none; }
.dropzone.is-error .dz-error-title { display: block; }
.dropzone.is-error .dz-error-sub   { display: block; }

.dz-file { display: none; align-items: center; gap: 14px; width: 100%; }
.dropzone.is-success .dz-empty { display: none; }
.dropzone.is-success .dz-file  { display: flex; }

.dz-file-icon {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--ok-bg); border: 1px solid rgba(107,143,113,0.3);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.dz-file-info  { flex: 1; text-align: left; min-width: 0; }
.dz-file-name  { font-size: 0.875rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dz-file-meta  { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; }
.dz-file-change {
  font-size: 0.78rem; color: var(--accent); text-decoration: underline;
  cursor: pointer; background: none; border: none; padding: 8px;
  min-height: 44px; min-width: 44px; font-family: inherit; flex-shrink: 0;
}
.dz-file-change:hover { color: var(--text); }

/* Extract option */
.option-row { margin-top: 14px; }
.checkbox-label {
  display: flex; align-items: flex-start; gap: 8px;
  cursor: pointer; color: var(--text-secondary);
  font-size: 0.875rem; font-weight: 500; line-height: 1.45;
}
.checkbox-label input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--accent); flex-shrink: 0; }
.option-hint { margin: 5px 0 0 24px; font-size: 0.78rem; color: var(--text-muted); line-height: 1.35; }

/* Collapsible settings (backend mode / URL) */
.settings-disclosure {
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(223, 208, 184, 0.04);
}
.settings-disclosure-summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 14px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-secondary);
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 120ms, color 120ms;
}
.settings-disclosure-summary::-webkit-details-marker { display: none; }
.settings-disclosure-summary::marker { content: ''; }
.settings-disclosure-summary:hover {
  background: rgba(148, 121, 121, 0.08);
  color: var(--text-primary);
}
.settings-disclosure[open] .settings-disclosure-summary {
  border-bottom: 1px solid var(--border);
}
.settings-disclosure-icon {
  font-size: 1rem;
  line-height: 1;
  opacity: 0.9;
}
.settings-disclosure-body {
  padding: 14px;
}
.settings-disclosure-body > .option-row:first-child { margin-top: 0; }
.settings-disclosure-body .field:last-child { margin-bottom: 0; }

/* Action row */
.action-row {
  display: grid; grid-template-columns: auto 1fr;
  gap: 12px; margin-top: 16px; align-items: center;
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 12px;
  font-family: inherit; font-size: 0.875rem; font-weight: 600;
  border: 1.5px solid transparent; cursor: pointer; outline: none; white-space: nowrap;
  transition: transform 120ms, box-shadow 120ms, background 120ms, border-color 120ms, opacity 120ms;
}
.btn:focus-visible { box-shadow: 0 0 0 3px var(--ring); }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

.btn-ghost {
  background: transparent; border-color: var(--color-violet); color: var(--text-secondary);
  border-width: 1px;
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--color-cta);
  border-color: var(--color-cta);
  color: #222831;
  border-radius: var(--radius-md);
  padding: 14px 24px;
  box-shadow: 0 6px 20px rgba(148,121,121,0.25);
  width: 100%;
}
.btn-primary:hover:not(:disabled) {
  background: var(--color-cta-hover);
  box-shadow: 0 10px 28px rgba(148,121,121,0.30);
  transform: translateY(-1px);
}
.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Progress panel */
.progress-inner { display: flex; flex-direction: column; gap: 20px; }

.stepper {
  display: flex; list-style: none; padding: 0; margin: 0;
  position: relative;
}
.stepper::before {
  content: ''; position: absolute; top: 14px; left: 22px; right: 22px;
  height: 1px; background: var(--border); z-index: 0;
}
.step {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  gap: 8px; position: relative; z-index: 1;
}
.step-dot {
  width: 28px; height: 28px; border-radius: 999px;
  border: 1.5px solid var(--border-hover); background: var(--bg-elevated);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 300ms, background 300ms, box-shadow 300ms;
}
.step[data-status="active"] .step-dot {
  border-color: var(--accent); background: rgba(148,121,121,0.1);
  box-shadow: 0 0 0 3px var(--ring);
  animation: step-ping 1.6s ease-in-out infinite;
}
.step[data-status="done"] .step-dot {
  border-color: var(--ok); background: var(--ok-bg);
  box-shadow: 0 0 10px rgba(107,143,113,0.2);
}
.step[data-status="error"] .step-dot { border-color: var(--err); background: var(--err-bg); }
.step-label { font-size: 0.7rem; font-weight: 600; color: var(--text-muted); text-align: center; line-height: 1.3; }
.step[data-status="active"] .step-label { color: var(--text); }
.step[data-status="done"]   .step-label { color: var(--text-secondary); }

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 0;
}
.progress-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  min-width: 128px;
}
.progress-bar {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: rgba(20, 24, 30, 0.65);
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35);
}
.progress-fill {
  position: relative;
  height: 100%;
  width: 0%;
  min-width: 0;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    rgba(94, 122, 138, 0.55) 0%,
    var(--color-cta) 38%,
    var(--color-cta-hover) 72%,
    rgba(201, 185, 154, 0.95) 100%
  );
  background-size: 220% 100%;
  transition: width 320ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
  box-shadow:
    0 0 14px rgba(148, 121, 121, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
  animation: progress-sweep 2.4s ease-in-out infinite;
}
.progress-fill-highlight {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(
    105deg,
    transparent 0%,
    rgba(255, 255, 255, 0.14) 42%,
    transparent 64%
  );
  background-size: 180% 100%;
  animation: progress-shimmer 2.8s ease-in-out infinite;
  pointer-events: none;
}
@keyframes progress-sweep {
  0% { background-position: 0% 0; }
  100% { background-position: 220% 0; }
}
@keyframes progress-shimmer {
  0% { background-position: -80% 0; }
  100% { background-position: 180% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .progress-fill,
  .progress-fill-highlight {
    animation: none;
  }
  .progress-fill {
    background-position: 50% 0;
  }
}
.progress-eta {
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
  text-align: right;
  letter-spacing: 0.01em;
}
.progress-remain {
  font-size: 0.69rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--color-violet);
  white-space: nowrap;
  text-align: right;
  opacity: 0.92;
}

/* Export panel */
.export-success {
  display: flex; align-items: center; gap: 16px;
  margin-bottom: 20px; padding: 16px; border-radius: 14px;
  background: var(--ok-bg); border: 1px solid rgba(107,143,113,0.25);
}
.export-success-icon {
  width: 40px; height: 40px; border-radius: 999px;
  background: rgba(107,143,113,0.15); border: 1px solid rgba(107,143,113,0.35);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.export-success-title { font-weight: 700; font-size: 0.95rem; margin: 0 0 2px; }
.export-success-sub   { font-size: 0.82rem; color: var(--text-secondary); margin: 0; }
.export-actions { display: flex; justify-content: flex-end; }

/* Review panel */
.review-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.review-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
}
.review-sub {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.review-stats {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  background: rgba(223,208,184,0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}
.review-player-wrap {
  margin-bottom: 14px;
}
.review-layout {
  display: grid;
  grid-template-columns: minmax(860px, 1fr) minmax(420px, 1fr);
  gap: 20px;
  align-items: start;
}
.review-main {
  min-width: 860px;
}
.review-preview-toggles {
  display: flex;
  gap: 18px;
  margin-bottom: 10px;
}
.review-preview-toggles .checkbox-label {
  font-size: 0.78rem;
}
.review-media-stage {
  position: relative;
}
.review-player {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(223,208,184,0.25);
  background: rgba(0,0,0,0.25);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}
.review-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
  padding: 0 14px;
  pointer-events: none;
}
.review-overlay-speaker {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #fff;
  background: rgba(0, 0, 0, 0.55);
  border-radius: 999px;
  padding: 3px 8px;
}
.review-overlay-text {
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.32;
  text-align: center;
  background: rgba(0, 0, 0, 0.58);
  border-radius: 10px;
  padding: 6px 10px;
  max-width: 94%;
  text-shadow: 0 1px 6px rgba(0,0,0,0.75);
}
.review-caption-panel {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(223,208,184,0.05);
  padding: 10px 12px;
}
.review-caption-speaker {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 3px;
}
.review-caption-text {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.35;
}
.review-list-wrap {
  border: 1px solid rgba(223,208,184,0.22);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}
.review-list-head {
  display: grid;
  grid-template-columns: 74px 74px 132px minmax(320px, 1fr) 60px;
  gap: 8px;
  padding: 10px 10px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(223,208,184,0.72);
  border-bottom: 1px solid rgba(223,208,184,0.12);
  background: rgba(223,208,184,0.06);
}
.review-list {
  max-height: 330px;
  overflow: auto;
  display: flex;
  flex-direction: column;
}
.review-row {
  display: grid;
  grid-template-columns: 74px 74px 132px minmax(320px, 1fr) 60px;
  gap: 8px;
  align-items: start;
  padding: 10px 10px;
  border-bottom: 1px solid rgba(223,208,184,0.08);
  border-left: 4px solid rgba(var(--speaker-rgb, 148,121,121), 0.92);
  background: linear-gradient(95deg, rgba(var(--speaker-rgb, 148,121,121), 0.23), rgba(var(--speaker-rgb, 148,121,121), 0.09) 55%, rgba(35,40,48,0.2));
}
.review-row:last-child {
  border-bottom: none;
}
.review-row.is-active {
  background: linear-gradient(95deg, rgba(var(--speaker-rgb, 148,121,121), 0.34), rgba(var(--speaker-rgb, 148,121,121), 0.16) 55%, rgba(35,40,48,0.24));
  box-shadow: inset 0 0 0 1px rgba(var(--speaker-rgb, 148,121,121), 0.95), 0 0 0 1px rgba(var(--speaker-rgb, 148,121,121), 0.35);
}
.review-time {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(223,208,184,0.86);
  padding-top: 9px;
  font-weight: 600;
}
.review-speaker {
  width: 100%;
  background: rgba(var(--speaker-rgb, 148,121,121), 0.22);
  border: 1.5px solid rgba(var(--speaker-rgb, 148,121,121), 0.95);
  color: #f6f0e4;
  border-radius: 9px;
  padding: 8px 10px;
  font-size: 0.75rem;
  font-family: inherit;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.review-text {
  width: 100%;
  min-height: 58px;
  resize: vertical;
  background: rgba(20,24,30,0.35);
  border: 1.2px solid rgba(var(--speaker-rgb, 148,121,121), 0.75);
  color: #f3ecdf;
  border-radius: 9px;
  padding: 9px 10px;
  font-size: 0.84rem;
  line-height: 1.42;
  font-family: inherit;
}
.review-speaker:focus,
.review-text:focus {
  border-color: var(--border-focus);
  outline: none;
  box-shadow: 0 0 0 2px var(--ring);
}
.review-jump {
  min-height: 36px;
  padding: 0 8px;
  border-radius: 9px;
  border: 1.2px solid rgba(var(--speaker-rgb, 148,121,121), 0.92);
  background: transparent;
  color: #f3ecdf;
  cursor: pointer;
  margin-top: 7px;
}
.review-jump:hover {
  border-color: #f4e4c8;
  color: #ffffff;
  background: rgba(var(--speaker-rgb, 148,121,121), 0.22);
}
.review-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.review-side {
  min-width: 420px;
}
.review-side-card {
  border: 1px solid rgba(223,208,184,0.18);
  background: linear-gradient(160deg, rgba(223,208,184,0.09), rgba(94,122,138,0.08));
  border-radius: 12px;
  padding: 14px;
  min-height: 760px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.review-side-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.review-side-kicker {
  margin: 0;
  font-size: 0.64rem;
  font-weight: 800;
  color: rgba(223,208,184,0.78);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.review-side-title {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text);
}
.review-side-text {
  margin: 0;
  font-size: 0.79rem;
  color: var(--text-secondary);
  line-height: 1.45;
}
.review-side-slot {
  margin-top: 4px;
  border: 1px dashed rgba(223,208,184,0.28);
  border-radius: 10px;
  min-height: 0;
  flex: 1;
  padding: 16px;
  color: rgba(223,208,184,0.66);
  font-size: 0.8rem;
  background: rgba(20,24,30,0.24);
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}
.wording-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wording-generate-btn {
  width: 100%;
}
.wording-source {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(223,208,184,0.86);
}
.wording-status {
  margin: 0;
  font-size: 0.76rem;
  color: rgba(223,208,184,0.72);
  line-height: 1.4;
}
.wording-list {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-right: 2px;
}
.wording-empty {
  border: 1px solid rgba(223,208,184,0.18);
  border-radius: 10px;
  background: rgba(20,24,30,0.35);
  padding: 12px;
  line-height: 1.45;
}
.wording-card {
  border: 1px solid rgba(var(--mood-rgb, 148,121,121), 0.78);
  border-radius: 10px;
  background: linear-gradient(155deg, rgba(var(--mood-rgb, 148,121,121), 0.18), rgba(20,24,30,0.45) 65%);
  padding: 10px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.wording-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.wording-mood {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #f6f0e4;
  background: rgba(var(--mood-rgb, 148,121,121), 0.4);
  border: 1px solid rgba(var(--mood-rgb, 148,121,121), 0.88);
  border-radius: 999px;
  padding: 3px 8px;
}
.wording-copy-btn {
  min-height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid rgba(var(--mood-rgb, 148,121,121), 0.85);
  background: rgba(0,0,0,0.2);
  color: #f6f0e4;
  font-size: 0.7rem;
  font-weight: 700;
  cursor: pointer;
}
.wording-copy-btn:hover {
  background: rgba(var(--mood-rgb, 148,121,121), 0.22);
}
.wording-text {
  margin: 0;
  color: #f6f0e4;
  line-height: 1.45;
  font-size: 0.83rem;
}

@media (max-width: 1320px) {
  .review-layout {
    grid-template-columns: 1fr;
  }
  .review-main {
    min-width: 0;
  }
  .review-side {
    min-width: 0;
  }
  .review-side-card {
    min-height: 320px;
  }
}

/* Toast */
#toast-region {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: 8px; align-items: center;
  width: calc(100vw - 32px); max-width: 460px; pointer-events: none;
}
.toast {
  width: 100%; display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-radius: 12px; border: 1px solid;
  font-size: 0.875rem; backdrop-filter: blur(12px); pointer-events: all;
  animation: toast-in 260ms cubic-bezier(0.34,1.56,0.64,1) forwards;
  background: rgba(168,88,88,0.12); border-color: rgba(168,88,88,0.3);
}
.toast-msg   { flex: 1; line-height: 1.5; color: var(--text); }
.toast-close {
  background: none; border: none; color: var(--text-muted); cursor: pointer;
  padding: 0; font-size: 1rem; min-height: 44px; min-width: 44px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; font-family: inherit;
}
.toast-close:hover { color: var(--text); }

.app-credit {
  position: fixed; bottom: 14px; left: 18px; margin: 0;
  font-size: 0.72rem; color: rgba(223,208,184,0.3);
}

/* Animations */
@keyframes dz-pulse {
  0%,100% { box-shadow: 0 0 0 4px var(--ring); }
  50%      { box-shadow: 0 0 0 7px rgba(148,121,121,0.1); }
}
@keyframes dz-shake {
  0%,100% { transform: translateX(0); }
  20%     { transform: translateX(-5px); }
  40%     { transform: translateX(5px); }
  60%     { transform: translateX(-3px); }
  80%     { transform: translateX(3px); }
}
@keyframes step-ping {
  0%,100% { box-shadow: 0 0 0 3px var(--ring); }
  50%      { box-shadow: 0 0 0 6px rgba(148,121,121,0.1); }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* Next overlay */
.next-panel { isolation: isolate; }
.next-overlay {
  position: absolute; inset: 0; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(148,121,121,0.08) 0%, transparent 70%);
  backdrop-filter: blur(2px);
}
.next-overlay-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: 999px;
  background: rgba(26,30,36,0.9);
  border: 1px solid rgba(148,121,121,0.45);
  color: var(--text-secondary);
  font-size: 0.82rem; font-weight: 600;
  box-shadow: 0 8px 32px rgba(26,30,36,0.5), 0 0 0 1px rgba(255,255,255,0.04) inset;
  letter-spacing: 0.02em;
}

.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

@media (max-width: 580px) {
  .action-row { grid-template-columns: 1fr; }
  .export-actions .btn { width: 100%; }
  .review-list-head,
  .review-row {
    grid-template-columns: 56px 56px 94px 1fr 46px;
    gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }
  .review-preview-toggles {
    flex-direction: column;
    gap: 8px;
  }
  .review-layout {
    grid-template-columns: 1fr;
  }
  .review-actions {
    flex-direction: column;
  }
  .review-actions .btn {
    width: 100%;
  }
}
