/* ========== TRUEDUB Pro — Luxury Dark Mode ========== */

:root {
  /* Surfaces — cool carbon slate */
  --bg-0: oklch(0.145 0.008 250);          /* deepest — app bg */
  --bg-1: oklch(0.175 0.008 250);          /* panel */
  --bg-2: oklch(0.205 0.009 250);          /* elevated card / track lane */
  --bg-3: oklch(0.245 0.010 250);          /* hover / input */
  --bg-4: oklch(0.290 0.012 250);          /* pressed / strong */

  /* Borders */
  --line: oklch(0.275 0.012 250);
  --line-soft: oklch(0.225 0.010 250);
  --line-strong: oklch(0.340 0.014 250);

  /* Text */
  --fg: oklch(0.975 0.004 250);
  --fg-2: oklch(0.86 0.008 250);
  --fg-3: oklch(0.66 0.012 250);
  --fg-4: oklch(0.50 0.012 250);

  /* Accents — warm luxury */
  --accent: oklch(0.80 0.135 78);          /* warm champagne gold */
  --accent-2: oklch(0.85 0.090 78);
  --accent-dim: oklch(0.55 0.090 78);

  /* Functional channel colors */
  --c-video: oklch(0.78 0.13 285);          /* violet */
  --c-audio: oklch(0.80 0.12 200);          /* cyan */
  --c-cap-src: oklch(0.82 0.13 160);        /* mint — source caption */
  --c-cap-es:  oklch(0.78 0.14 30);         /* orange — ES */
  --c-cap-fr:  oklch(0.80 0.13 320);        /* magenta — FR */
  --c-cap-ja:  oklch(0.82 0.13 110);        /* lime — JA */
  --c-dub:     oklch(0.78 0.135 78);        /* gold — dubbed audio */
  --c-error:   oklch(0.68 0.18 25);
  --c-warn:    oklch(0.80 0.13 80);
  --c-ok:      oklch(0.74 0.14 150);

  /* Typography */
  --f-sans: "Geist", "Helvetica Neue", system-ui, sans-serif;
  --f-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;

  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-xl: 14px;

  --pad-row: 8px;
  --pad-pane: 14px;

  --shadow-pop: 0 18px 48px -16px rgba(0,0,0,0.65), 0 2px 8px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg-0);
  color: var(--fg);
  font-family: var(--f-sans);
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
}

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; padding: 0; }
input, select, textarea { font-family: inherit; color: inherit; }
::selection { background: color-mix(in oklch, var(--accent) 35%, transparent); }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--bg-4); background-clip: padding-box; border: 2px solid transparent; }

/* ===== App shell ===== */
.app {
  display: grid;
  grid-template-rows: 48px 1fr 28px;
  height: 100vh;
  width: 100vw;
  background:
    radial-gradient(1200px 600px at 50% -200px, oklch(0.21 0.02 260 / 0.6), transparent 60%),
    var(--bg-0);
}
.body-grid {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) 332px;
  min-height: 0;
  border-top: 1px solid var(--line-soft);
}
.upper-grid {
  display: grid;
  grid-template-rows: minmax(240px, 1fr) 5px 320px; /* rows: video | splitter | timeline */
  min-height: 0;
  border-right: 1px solid var(--line-soft);
  border-left: 1px solid var(--line-soft);
}

/* Draggable horizontal divider between video panel and timeline */
.v-splitter {
  height: 5px;
  background: var(--line);
  cursor: row-resize;
  flex-shrink: 0;
  z-index: 20;
  transition: background 120ms;
  position: relative;
}
.v-splitter::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 3px;
  border-radius: 2px;
  background: var(--line-strong);
  pointer-events: none;
}
.v-splitter:hover,
.v-splitter.dragging {
  background: var(--accent-dim);
}
.v-splitter:hover::after,
.v-splitter.dragging::after {
  background: var(--accent);
}

/* ===== Top Bar ===== */
.topbar {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr) auto;
  align-items: center;
  height: 48px;
  background: linear-gradient(180deg, oklch(0.21 0.012 250) 0%, var(--bg-1) 100%);
  border-bottom: 1px solid var(--line);
  padding-right: 12px;
  overflow: visible;
}
.topbar-middle {
  display: flex;
  align-items: center;
  height: 100%;
  min-width: 0;
  overflow: hidden;
}
.step-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: 14px;
  flex-shrink: 1;
  min-width: 0;
  overflow: hidden;
}
.step-pill {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 5px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 11.5px;
  white-space: nowrap;
  flex-shrink: 0;
}
.step-pill .step-dot {
  width: 16px; height: 16px; border-radius: 999px;
  display: grid; place-items: center;
  font-family: var(--f-mono); font-size: 9px; font-weight: 700;
}
@media (max-width: 1480px) {
  .step-pill .step-lbl { display: none; }
  .step-pill { padding: 4px; }
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  height: 100%;
  border-right: 1px solid var(--line-soft);
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background:
    linear-gradient(135deg, var(--accent) 0%, oklch(0.62 0.14 50) 100%);
  position: relative;
  box-shadow: inset 0 0 0 1px oklch(0.92 0.06 78 / 0.4), 0 4px 12px oklch(0.6 0.13 78 / 0.25);
}
.brand-mark::after{
  content:"";
  position:absolute; inset: 6px;
  border-radius: 2px;
  background: var(--bg-0);
  clip-path: polygon(0 0, 100% 0, 100% 35%, 35% 35%, 35% 100%, 0 100%);
}
.brand-name {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.14em;
}
.brand-name .pro {
  color: var(--accent);
  font-weight: 500;
  margin-left: 6px;
  letter-spacing: 0.18em;
  font-size: 11px;
}
.menubar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding-left: 8px;
}
.menubar button {
  padding: 6px 10px;
  color: var(--fg-2);
  font-size: 12.5px;
  border-radius: var(--r-sm);
}
.menubar button:hover { background: var(--bg-2); color: var(--fg); }
.project-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-left: 16px;
  font-size: 12px;
  color: var(--fg-2);
}
.project-pill .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-ok); box-shadow: 0 0 10px var(--c-ok); }
.topbar-right {
  display: flex; align-items: center; gap: 8px;
}
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px;
  border-radius: 7px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--fg);
  font-size: 12.5px;
  font-weight: 500;
  transition: background 120ms, border-color 120ms, transform 80ms;
}
.btn:hover { background: var(--bg-3); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-2); }
.btn.primary {
  background: linear-gradient(180deg, var(--accent) 0%, oklch(0.72 0.135 70) 100%);
  color: oklch(0.16 0.02 70);
  border: 1px solid oklch(0.85 0.10 78);
  font-weight: 600;
  box-shadow: 0 4px 14px -4px oklch(0.78 0.13 78 / 0.5), inset 0 1px 0 oklch(0.95 0.06 78 / 0.4);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: color-mix(in oklch, var(--c-error) 18%, var(--bg-2)); border-color: color-mix(in oklch, var(--c-error) 35%, var(--line)); }
.btn .kbd { font-family: var(--f-mono); font-size: 10.5px; color: var(--fg-3); padding: 1px 5px; border: 1px solid var(--line); border-radius: 3px; margin-left: 4px; }
.btn.sm { height: 24px; padding: 0 8px; font-size: 11.5px; }
.btn.icon { width: 30px; padding: 0; justify-content: center; }
.btn.icon.sm { width: 24px; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

.avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.55 0.12 260), oklch(0.45 0.13 320));
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  color: var(--fg);
  margin-left: 6px;
  border: 1px solid var(--line-strong);
}

/* ===== Generic panel ===== */
.panel {
  display: flex; flex-direction: column;
  background: var(--bg-1);
  min-height: 0;
}
.panel-header {
  display: flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 12px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  flex-shrink: 0;
}
.panel-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-3);
}
.panel-title.accent { color: var(--accent); }
.panel-tabs {
  display: flex; gap: 0;
  margin-left: auto;
}
.panel-tabs button {
  font-size: 11.5px;
  padding: 4px 9px;
  color: var(--fg-3);
  border-radius: 4px;
}
.panel-tabs button.active { color: var(--fg); background: var(--bg-3); }
.panel-tabs button:hover:not(.active) { color: var(--fg-2); }
.panel-body { flex: 1; min-height: 0; overflow-y: auto; }
.panel-body.pad { padding: 12px; }

/* ===== Left panel — Pipeline ===== */
.left-panel { border-right: 1px solid var(--line-soft); background: var(--bg-1); }

.pipeline { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; }
.pipe-step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 8px;
  cursor: default;
  position: relative;
  align-items: center;
}
.pipe-step.clickable { cursor: pointer; }
.pipe-step.clickable:hover { background: var(--bg-2); }
.pipe-step.active { background: linear-gradient(180deg, var(--bg-3) 0%, var(--bg-2) 100%); box-shadow: inset 0 0 0 1px var(--line); }
.pipe-step.done { opacity: 0.78; }
.pipe-num {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-3);
  font-weight: 600;
}
.pipe-step.active .pipe-num { background: var(--accent); color: oklch(0.16 0.02 70); border-color: var(--accent-2); }
.pipe-step.done .pipe-num { background: oklch(0.30 0.06 150 / 0.4); border-color: var(--c-ok); color: var(--c-ok); }
.pipe-label { font-size: 12.5px; font-weight: 500; color: var(--fg); }
.pipe-sub { font-size: 11px; color: var(--fg-3); margin-top: 2px; }
.pipe-status { font-size: 10.5px; font-family: var(--f-mono); color: var(--fg-3); }
.pipe-status.live { color: var(--accent); }
.pipe-status.ok { color: var(--c-ok); }

.pipe-line {
  position: absolute;
  left: 22px;
  top: 32px;
  bottom: -4px;
  width: 1px;
  background: var(--line-soft);
}
.pipe-step:last-child .pipe-line { display: none; }

/* Media bin */
.media-bin { padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.media-card {
  display: flex; gap: 10px; padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  align-items: center;
}
.media-thumb {
  width: 56px; height: 36px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(45deg, oklch(0.30 0.02 250) 0 4px, oklch(0.26 0.02 250) 4px 8px);
  flex-shrink: 0;
  display: grid; place-items: center;
  color: oklch(0.55 0.04 250);
  font-family: var(--f-mono);
  font-size: 9px;
  position: relative;
  overflow: hidden;
}
.media-thumb.audio {
  background: linear-gradient(180deg, oklch(0.25 0.04 200) 0%, oklch(0.20 0.04 200) 100%);
  color: var(--c-audio);
}
.media-meta { font-size: 11.5px; min-width: 0; flex: 1; }
.media-meta .nm { font-weight: 500; color: var(--fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.media-meta .sub { font-family: var(--f-mono); font-size: 10.5px; color: var(--fg-3); margin-top: 2px; }

/* Section header within sidebars */
.section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 6px;
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--fg-3);
}

/* ===== Video panel ===== */
.video-panel { background: var(--bg-1); display: flex; flex-direction: column; min-height: 0; }

.video-stage {
  flex: 1;
  background:
    radial-gradient(circle at 50% 50%, oklch(0.18 0.01 250) 0%, var(--bg-0) 80%);
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
  min-height: 0;
}
.video-frame {
  position: relative;
  aspect-ratio: 16/9;
  width: min(100%, 880px);
  max-height: 100%;
  margin: 18px;
  background: #000;
  border-radius: 6px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,0.9), 0 0 0 1px var(--line-strong);
  overflow: hidden;
  display: grid;
  place-items: center;
}
.video-frame.empty {
  background: repeating-linear-gradient(135deg, oklch(0.16 0.01 250) 0 12px, oklch(0.18 0.01 250) 12px 24px);
}
.video-placeholder {
  font-family: var(--f-mono);
  font-size: 11px;
  color: var(--fg-4);
  text-align: center;
  letter-spacing: 0.06em;
}

/* the synthetic clip */
.scene {
  position: absolute; inset: 0;
  background:
    radial-gradient(80% 60% at 30% 35%, oklch(0.55 0.18 35) 0%, transparent 60%),
    radial-gradient(70% 80% at 80% 75%, oklch(0.4 0.18 290) 0%, transparent 60%),
    linear-gradient(180deg, oklch(0.15 0.05 270) 0%, oklch(0.08 0.04 270) 100%);
}
.scene::before{
  content:"";
  position:absolute; left: 14%; right: 14%; bottom: 0; top: 30%;
  background: linear-gradient(180deg, oklch(0.30 0.04 30 / 0) 0%, oklch(0.30 0.05 30 / 0.4) 100%);
  clip-path: polygon(0 100%, 18% 30%, 40% 60%, 58% 20%, 78% 55%, 100% 25%, 100% 100%);
}
.scene::after{
  content:"";
  position: absolute;
  left: 50%;
  top: 38%;
  width: 80px; height: 130px;
  transform: translate(-50%, 0);
  background:
    radial-gradient(circle at 50% 22%, oklch(0.72 0.08 50) 0 16%, transparent 17%),
    linear-gradient(180deg, oklch(0.45 0.08 260) 0%, oklch(0.30 0.06 260) 100%);
  border-radius: 40px 40px 8px 8px / 60px 60px 8px 8px;
}

.video-overlay-captions {
  position: absolute;
  left: 50%;
  bottom: 8%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  max-width: 80%;
  pointer-events: none;
}
.video-caption {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  padding: 6px 14px;
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  text-align: center;
  max-width: 100%;
  line-height: 1.35;
}
.video-caption.translated {
  font-size: 17px;
  color: white;
  border-left: 2px solid var(--clr);
  padding-left: 12px;
}
.video-caption.source {
  font-size: 14px;
  color: oklch(0.85 0.008 250);
  background: rgba(0, 0, 0, 0.45);
  font-weight: 400;
}
.video-caption .cap-flag {
  font-family: var(--f-mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 2px 5px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.7);
  flex-shrink: 0;
  align-self: center;
}
.video-caption.translated .cap-flag {
  background: var(--clr);
  color: oklch(0.16 0.02 70);
}
.video-caption .cap-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* Editable text — applies wherever we use <EditableText /> */
.editable {
  outline: none;
  cursor: text;
  border-radius: 3px;
  padding: 1px 4px;
  margin: -1px -4px;
  transition: background 120ms, box-shadow 120ms;
  white-space: pre-wrap;
  word-break: break-word;
}
.editable:hover { background: color-mix(in oklch, var(--accent) 8%, transparent); }
.editable:focus { background: color-mix(in oklch, var(--accent) 14%, var(--bg-0)); box-shadow: 0 0 0 1px var(--accent-dim); color: var(--fg); }
/* Inside video overlay, dim hover; keep focus glow */
.video-caption .editable:hover { background: rgba(255, 255, 255, 0.08); }
.video-caption .editable:focus {
  background: rgba(0, 0, 0, 0.55);
  color: white;
  box-shadow: 0 0 0 1px var(--accent), 0 0 14px oklch(0.8 0.13 78 / 0.4);
}
.video-overlay-tc {
  position: absolute; top: 10px; left: 10px;
  background: rgba(0,0,0,0.6); border: 1px solid rgba(255,255,255,0.08);
  padding: 4px 8px; border-radius: 3px;
  font-family: var(--f-mono); font-size: 11px; color: var(--fg-2);
  letter-spacing: 0.04em;
}
.video-overlay-tc .red { color: var(--c-error); }
.video-overlay-res {
  position: absolute; top: 10px; right: 10px;
  display: flex; gap: 6px;
}
.tag {
  font-family: var(--f-mono); font-size: 9.5px;
  background: rgba(0,0,0,0.55);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 3px 6px;
  border-radius: 3px;
  color: var(--fg-2);
  letter-spacing: 0.05em;
}

/* Transport */
.transport {
  height: 56px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-1);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
  flex-shrink: 0;
}
.transport-left, .transport-right {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--f-mono); font-size: 12px;
  color: var(--fg-2);
}
.transport-right { justify-content: flex-end; }
.transport-tc { font-size: 18px; color: var(--fg); font-weight: 500; letter-spacing: 0.02em; }
.transport-tc .ms { color: var(--fg-3); }
.transport-controls { display: flex; align-items: center; gap: 4px; }
.transport-controls .play {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(180deg, var(--accent) 0%, oklch(0.7 0.135 70) 100%);
  display: grid; place-items: center;
  color: oklch(0.15 0.02 70);
  box-shadow: 0 4px 14px -4px oklch(0.78 0.13 78 / 0.5);
  border: 1px solid oklch(0.88 0.08 78);
}
.transport-controls .play:hover { filter: brightness(1.08); }
.transport-controls .ctrl {
  width: 32px; height: 32px;
  border-radius: 7px;
  display: grid; place-items: center;
  color: var(--fg-2);
}
.transport-controls .ctrl:hover { background: var(--bg-3); color: var(--fg); }

.vu-meter { display: flex; gap: 2px; align-items: end; height: 16px; }
.vu-bar { width: 3px; background: var(--bg-3); border-radius: 1px; }

/* ===== Inspector ===== */
.inspector { background: var(--bg-1); border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; min-height: 0; }

.insp-section { padding: 10px 14px 14px; border-bottom: 1px solid var(--line-soft); }
.insp-section:last-child { border-bottom: none; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.row + .row { margin-top: 8px; }
.field-label { font-size: 11px; color: var(--fg-3); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500; }
.field-value { font-family: var(--f-mono); font-size: 11.5px; color: var(--fg-2); }

.input {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  width: 100%;
  color: var(--fg);
  outline: none;
  transition: border-color 120ms;
}
.input:focus { border-color: var(--accent-dim); }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--fg-3) 50%), linear-gradient(135deg, var(--fg-3) 50%, transparent 50%); background-position: calc(100% - 14px) 14px, calc(100% - 10px) 14px; background-size: 4px 4px; background-repeat: no-repeat; padding-right: 26px; }

.slider {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 24px;
  background: transparent; outline: none;
}
.slider::-webkit-slider-runnable-track {
  height: 3px; background: var(--bg-3); border-radius: 2px;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--bg-0);
  margin-top: -5px;
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.chip-row { display: flex; flex-wrap: wrap; gap: 4px; }
.chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  color: var(--fg-2);
  cursor: pointer;
  transition: all 120ms;
}
.chip:hover { background: var(--bg-3); }
.chip.active {
  background: color-mix(in oklch, var(--accent) 22%, var(--bg-2));
  border-color: color-mix(in oklch, var(--accent) 50%, var(--line));
  color: var(--fg);
}

.voice-card {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  cursor: pointer;
  transition: all 120ms;
}
.voice-card:hover { background: var(--bg-3); }
.voice-card.active { border-color: var(--accent-dim); background: color-mix(in oklch, var(--accent) 8%, var(--bg-2)); }
.voice-card + .voice-card { margin-top: 6px; }
.voice-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.55 0.10 220), oklch(0.40 0.10 260));
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600;
  color: white;
  font-family: var(--f-mono);
}
.voice-meta .nm { font-size: 12.5px; font-weight: 500; }
.voice-meta .sub { font-size: 10.5px; color: var(--fg-3); font-family: var(--f-mono); margin-top: 2px; }
.voice-wave { display: flex; gap: 1.5px; align-items: center; height: 18px; }
.voice-wave div { width: 2px; background: var(--accent); border-radius: 1px; }

/* IO range card */
.io-card {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  font-family: var(--f-mono);
  font-size: 11px;
}
.io-card .io-row {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  color: var(--fg-2);
}
.io-card .io-label {
  font-weight: 600;
  color: var(--accent);
}
.io-card .duration {
  margin-top: 6px; padding-top: 6px;
  border-top: 1px dashed var(--line);
  display: flex; justify-content: space-between;
  color: var(--fg-3);
}
.io-card .duration b { color: var(--fg); font-weight: 500; }

/* Caption text picked */
.caption-pick {
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px;
  font-size: 12px;
  line-height: 1.45;
}
.caption-pick .meta {
  display: flex; gap: 8px;
  font-family: var(--f-mono); font-size: 10px;
  color: var(--fg-3);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.caption-pick .meta .spk { color: var(--c-cap-src); }
.caption-pick .text { color: var(--fg); }
.caption-pick .translated { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); color: var(--fg-2); font-style: italic; }

/* progress */
.progress-rail {
  height: 4px; background: var(--bg-2);
  border-radius: 2px; overflow: hidden;
  position: relative;
}
.progress-rail .fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--accent) 0%, oklch(0.85 0.13 60) 100%);
  border-radius: 2px;
  transition: width 200ms ease-out;
  box-shadow: 0 0 8px oklch(0.8 0.13 78 / 0.5);
}
.progress-rail .fill.indet {
  width: 28% !important;
  animation: indet 1.4s ease-in-out infinite;
}
@keyframes indet { 0% { left: -28%; } 100% { left: 100%; } }

.spinner-xs {
  display: inline-block;
  width: 11px; height: 11px;
  border: 1.5px solid color-mix(in oklch, var(--accent) 30%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Timeline ===== */
.timeline {
  background: var(--bg-1);
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.timeline-toolbar {
  height: 36px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  flex-shrink: 0;
}
.tt-divider { width: 1px; height: 16px; background: var(--line); margin: 0 4px; }
.tt-btn {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 8px; font-size: 11.5px;
  border-radius: 5px;
  color: var(--fg-2);
}
.tt-btn:hover { background: var(--bg-3); color: var(--fg); }
.tt-btn.active { background: var(--bg-3); color: var(--accent); }
.tt-tc { margin-left: auto; font-family: var(--f-mono); font-size: 11.5px; color: var(--fg-2); }
.zoom { display: flex; align-items: center; gap: 6px; }
.zoom input[type=range] { width: 96px; }

.timeline-body {
  flex: 1;
  display: grid;
  grid-template-columns: 168px 1fr;
  min-height: 0;
  overflow: hidden;
}

.track-heads {
  background: var(--bg-1);
  border-right: 1px solid var(--line-soft);
  overflow-y: hidden;   /* scrollTop is driven programmatically by onLaneScroll */
  overflow-x: hidden;
}

.track-canvas {
  position: relative;
  overflow-x: auto;
  overflow-y: auto;
  background:
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-1) 100%);
}
.track-canvas-inner {
  position: relative;
  min-width: 100%;
}

.ruler {
  position: sticky;
  top: 0;
  height: 26px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--fg-3);
  z-index: 4;
}
.ruler-cap {
  position: sticky;
  top: 0; left: 0;
  height: 26px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line-soft);
  z-index: 5;
  display: flex; align-items: center;
  padding: 0 10px;
  font-family: var(--f-mono);
  font-size: 10px;
  color: var(--fg-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}
.ruler-tick {
  position: absolute; top: 0; bottom: 0;
  border-left: 1px solid var(--line);
}
.ruler-tick.major { border-color: var(--line-strong); }
.ruler-tick .lbl { position: absolute; top: 6px; left: 4px; }

.track-head {
  height: 60px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  background: var(--bg-1);
}

/* Group divider rows — span both the heads column and the lanes column.
   Identical height in both so rows stay aligned. */
.group-head {
  display: flex; align-items: center; gap: 8px;
  height: 24px;
  padding: 0 10px;
  background: linear-gradient(90deg,
    color-mix(in oklch, var(--gclr) 16%, var(--bg-2)) 0%,
    color-mix(in oklch, var(--gclr) 4%, var(--bg-1)) 100%);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-left: 3px solid var(--gclr);
}
.group-head .g-flag {
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  background: var(--gclr);
  color: oklch(0.16 0.02 70);
  border-radius: 3px;
  letter-spacing: 0.06em;
}
.group-head .g-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg);
  letter-spacing: 0.04em;
}
.group-head .g-sub {
  font-family: var(--f-mono);
  font-size: 9.5px;
  color: var(--fg-3);
  margin-left: auto;
}
.group-band {
  height: 24px;
  background: linear-gradient(90deg,
    color-mix(in oklch, var(--gclr) 10%, var(--bg-1)) 0%,
    color-mix(in oklch, var(--gclr) 3%, var(--bg-1)) 30%,
    var(--bg-1) 100%);
  border-bottom: 1px solid var(--line);
  border-top: 1px solid var(--line);
  position: relative;
}
.group-band::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--gclr);
}
.group-band .g-band-lbl {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 600;
  color: color-mix(in oklch, var(--gclr) 80%, var(--fg-2));
  letter-spacing: 0.18em;
  text-transform: uppercase;
  pointer-events: none;
}
.track-head.tall { height: 76px; }
.track-head .swatch {
  width: 3px; height: 24px;
  border-radius: 2px;
  background: var(--c-audio);
  flex-shrink: 0;
}
.track-head .nm { font-size: 12px; font-weight: 500; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-head .sub { font-size: 10px; color: var(--fg-3); font-family: var(--f-mono); }
.track-head .head-info { flex: 1; min-width: 0; }
.track-head .head-ctrls { display: flex; gap: 2px; flex-shrink: 0; }
.track-head .micro {
  width: 18px; height: 18px;
  border-radius: 3px;
  display: grid; place-items: center;
  font-family: var(--f-mono); font-size: 9px;
  font-weight: 600;
  background: var(--bg-2);
  color: var(--fg-4);
  border: 1px solid var(--line-soft);
}
.track-head .micro:hover { color: var(--fg); }
.track-head .micro.on.m { color: var(--c-error); border-color: var(--c-error); background: color-mix(in oklch, var(--c-error) 12%, var(--bg-2)); }
.track-head .micro.on.s { color: var(--c-warn); border-color: var(--c-warn); background: color-mix(in oklch, var(--c-warn) 18%, var(--bg-2)); }
.track-head .micro.on.r { color: var(--c-error); border-color: var(--c-error); background: color-mix(in oklch, var(--c-error) 12%, var(--bg-2)); }

.track-lane {
  height: 60px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  background:
    repeating-linear-gradient(90deg, transparent 0 79px, oklch(0.18 0.008 250) 79px 80px);
}
.track-lane.tall { height: 76px; }
.track-lane.dropzone { background: repeating-linear-gradient(135deg, oklch(0.20 0.01 250) 0 12px, oklch(0.18 0.01 250) 12px 24px); }
.track-lane.dropzone .empty-cue {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--fg-4);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  pointer-events: none;
}

/* Generic clip */
.clip {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 4px;
  overflow: hidden;
  font-size: 11px;
  color: white;
  cursor: grab;
  transition: filter 120ms, box-shadow 120ms;
  border: 1px solid rgba(0,0,0,0.4);
}
.clip:active { cursor: grabbing; }
.clip:hover { filter: brightness(1.08); }
.clip.selected { box-shadow: 0 0 0 2px var(--accent), 0 4px 16px rgba(0,0,0,0.4); z-index: 3; }

/* Trim handles */
.trim-handle {
  position: absolute;
  top: 0; bottom: 0;
  width: 6px;
  z-index: 4;
  cursor: ew-resize;
  background: transparent;
  transition: background 120ms;
}
.trim-handle.l { left: 0; }
.trim-handle.r { right: 0; }
.trim-handle::after {
  content: "";
  position: absolute;
  top: 25%; bottom: 25%;
  width: 2px;
  background: rgba(255, 255, 255, 0.4);
  border-radius: 1px;
  transition: background 120ms, width 120ms;
}
.trim-handle.l::after { left: 2px; }
.trim-handle.r::after { right: 2px; }
.clip:hover .trim-handle::after { background: rgba(255, 255, 255, 0.7); }
.trim-handle:hover { background: rgba(255, 255, 255, 0.12); }
.trim-handle:hover::after { background: white; width: 3px; }
.clip.selected .trim-handle::after { background: var(--accent); }

/* Video clip */
.clip.video {
  background: linear-gradient(180deg, oklch(0.45 0.10 285) 0%, oklch(0.32 0.10 285) 100%);
  border-color: oklch(0.55 0.12 285);
}
.clip.video .clip-label {
  position: absolute; top: 4px; left: 6px;
  font-family: var(--f-mono); font-size: 10px;
  color: oklch(0.95 0.04 285);
  letter-spacing: 0.04em;
}
.clip.video .filmstrip {
  position: absolute; inset: 18px 2px 2px 2px;
  display: flex;
  gap: 1px;
}
.clip.video .filmstrip > div {
  flex: 1;
  background:
    linear-gradient(180deg, oklch(0.55 0.12 var(--h)) 0%, oklch(0.30 0.10 var(--h)) 100%);
  border-radius: 2px;
}

/* Audio clip with waveform */
.clip.audio {
  background: linear-gradient(180deg, oklch(0.30 0.08 200) 0%, oklch(0.22 0.06 200) 100%);
  border-color: oklch(0.45 0.10 200);
}
.clip.audio .clip-label {
  position: absolute; top: 4px; left: 6px;
  font-family: var(--f-mono); font-size: 10px;
  color: oklch(0.92 0.04 200);
  letter-spacing: 0.04em;
  text-shadow: 0 1px 2px rgba(0,0,0,0.5);
  z-index: 2;
}
.waveform {
  position: absolute; inset: 16px 2px 2px 2px;
  display: flex; align-items: center;
  gap: 1px;
}
.waveform > div {
  flex: 1;
  background: oklch(0.85 0.08 200);
  border-radius: 1px;
  opacity: 0.9;
}
.clip.dub .waveform > div { background: oklch(0.88 0.10 78); }

/* Caption clip */
.clip.caption {
  background: linear-gradient(180deg, color-mix(in oklch, var(--clr) 30%, var(--bg-2)) 0%, color-mix(in oklch, var(--clr) 18%, var(--bg-1)) 100%);
  border-color: color-mix(in oklch, var(--clr) 50%, var(--line));
  display: flex; align-items: center;
  padding: 0 8px;
  color: var(--fg);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  text-shadow: 0 1px 2px rgba(0,0,0,0.45);
}
.clip.caption .spk {
  display: inline-block;
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 600;
  padding: 2px 4px;
  margin-right: 6px;
  background: rgba(0,0,0,0.35);
  color: var(--clr);
  border-radius: 2px;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

/* Dub clip = gold gradient with waveform */
.clip.dub {
  background: linear-gradient(180deg, oklch(0.48 0.13 78) 0%, oklch(0.32 0.12 78) 100%);
  border-color: oklch(0.62 0.13 78);
}
.clip.dub .clip-label {
  color: oklch(0.95 0.04 78);
}
.clip.dub.preview { opacity: 0.85; outline: 1px dashed oklch(0.78 0.13 78); }

/* Playhead */
.playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--accent);
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 0 8px oklch(0.8 0.13 78 / 0.5);
}
.playhead-handle {
  position: absolute;
  left: -8px;
  top: 0;
  width: 17px;
  height: 22px;
  background: var(--accent);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 50% 100%, 0 55%);
  pointer-events: auto;
  cursor: ew-resize;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.playhead-handle::before {
  content: "";
  position: absolute;
  top: 4px; bottom: 8px;
  left: 50%;
  width: 1px;
  background: oklch(0.16 0.02 70);
  transform: translateX(-0.5px);
}
.playhead.scrubbing { background: oklch(0.92 0.10 78); }
.playhead.scrubbing .playhead-handle { background: oklch(0.92 0.10 78); }

/* IO markers */
.io-marker {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--c-cap-es);
  pointer-events: none;
  z-index: 9;
}
.io-marker.in::before, .io-marker.out::before {
  content: attr(data-label);
  position: absolute;
  top: 2px;
  font-family: var(--f-mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 3px;
  background: var(--c-cap-es);
  color: black;
  border-radius: 2px;
}
.io-marker.in::before { left: 1px; content: "I"; }
.io-marker.out::before { right: 1px; content: "O"; }
.io-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: oklch(0.78 0.14 30 / 0.10);
  border-top: 1px solid var(--c-cap-es);
  border-bottom: 1px solid var(--c-cap-es);
  pointer-events: none;
  z-index: 8;
}

/* ===== Status bar ===== */
.statusbar {
  display: flex; align-items: center; gap: 18px;
  height: 28px;
  padding: 0 14px;
  background: var(--bg-1);
  border-top: 1px solid var(--line);
  font-family: var(--f-mono);
  font-size: 10.5px;
  color: var(--fg-3);
  letter-spacing: 0.03em;
}
.statusbar .stat { display: flex; align-items: center; gap: 5px; }
.statusbar .stat b { font-weight: 500; color: var(--fg-2); }
.statusbar .stat .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--c-ok); box-shadow: 0 0 8px var(--c-ok); }
.statusbar .grow { flex: 1; }
.statusbar .right { display: flex; gap: 18px; }

/* ===== Modal ===== */
.modal-shade {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 100;
}
.modal {
  width: 520px;
  background: var(--bg-1);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
}
.modal-head {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-head .ttl { font-size: 14px; font-weight: 600; }
.modal-body { padding: 18px; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--line-soft); display: flex; justify-content: flex-end; gap: 8px; background: var(--bg-2); }

/* Toast */
.toast {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-2);
  border: 1px solid var(--line-strong);
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  box-shadow: var(--shadow-pop);
  display: flex; align-items: center; gap: 10px;
  z-index: 200;
  animation: toast-in 200ms ease-out;
}
.toast .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c-ok); box-shadow: 0 0 10px var(--c-ok); }
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }

/* fade-in entrance */
.fade-in { animation: fade-in 240ms ease-out both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* Skeletons */
.skel {
  background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%);
  background-size: 200% 100%;
  animation: skel 1.4s ease-in-out infinite;
  border-radius: 3px;
}
@keyframes skel { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
