/* ─────────────────────────────────────────────────────────────────────────
   WSC QA Platform — Stylesheet v2.5
   Based on official WSC Sports brand identity:
   - Base: black (#000), greys (#808080, #dcdcdc, #e3e3e6)
   - Primary accent: deep blue (#031d9a, #2d51ff)
   - Light blue accents: #a7cafc, #e5f1ff
   - Yellow (#e5ff00) RESERVED for hover states + tiny LIVE indicators
   ───────────────────────────────────────────────────────────────────────── */

@keyframes wsc-spin {
  to { transform: rotate(360deg); }
}
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--grey-4);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: wsc-spin 0.7s linear infinite;
  vertical-align: middle;
}

:root {
  /* ── Brand palette ── */
  --black: #000000;
  --grey-1: #0a0a0a;
  --grey-2: #141414;
  --grey-3: #1c1c1c;
  --grey-4: #242424;
  --grey-5: #2a2a2a;
  --grey-text: #808080;
  --grey-light: #dcdcdc;
  --grey-lighter: #e3e3e6;
  --white: #ffffff;

  --blue-deep: #031d9a;   /* hero accent — for primary buttons, headers */
  --blue: #2d51ff;        /* main interactive blue */
  --blue-light: #5070ff;  /* hover on blue */
  --blue-soft: #a7cafc;   /* secondary text on dark blue */
  --blue-pale: #e5f1ff;   /* subtle backgrounds */

  /* v3.25 — Calmer accent system.
     --yellow stays as the legacy neon token (existing rules reference it),
     but everything new should use --accent instead. --accent is a desaturated
     lime that reads as "tech yellow" without the neon screech. --accent-strong
     is the bright variant — reserved for genuine hover/focus highlights only. */
  --yellow: #d4e600;            /* legacy alias — desaturated from #e5ff00 */
  --yellow-soft: #f5ffa1;
  --accent: #c9d92e;            /* primary accent token going forward */
  --accent-strong: #d4e600;     /* hover only */
  --accent-soft: rgba(201,217,46,0.14);
  --accent-border: rgba(201,217,46,0.32);

  --red: #dc2626;
  --green: var(--blue);   /* PASS uses brand blue, not green */

  /* ── Semantic ── */
  --bg: var(--black);
  --panel: var(--grey-1);
  --panel-2: var(--grey-2);
  --panel-3: var(--grey-3);
  --border: var(--grey-4);
  --border-strong: var(--grey-5);
  --text: rgba(255,255,255,0.95);
  --text-dim: rgba(255,255,255,0.6);
  --text-mute: rgba(255,255,255,0.4);
  --text-faint: rgba(255,255,255,0.25);

  --radius: 6px;
  --radius-sm: 4px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text", system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

/* ─── Layout ─────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.2s ease;
}
.layout.sidebar-collapsed { grid-template-columns: 56px 1fr; }

.sidebar {
  background: var(--grey-1);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  padding: 24px 0;
  position: relative;
  overflow: hidden;
}
/* v3.23 — Subtle technological texture: faint vertical accent line + radial
   glow at the top so the brand area feels anchored. Decorative only —
   no pointer events. */
.sidebar::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  width: 1px;
  height: 100%;
  background: linear-gradient(180deg,
    rgba(229,255,0,0.32) 0%,
    rgba(229,255,0,0.10) 14%,
    transparent 28%);
  pointer-events: none;
  z-index: 0;
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar-toggle {
  position: absolute;
  top: 18px; right: -12px;
  width: 24px; height: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 50%;
  color: var(--text-mute);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 10;
  transition: all 0.15s ease;
  padding: 0;
}
.sidebar-toggle:hover {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
}
.sidebar-toggle svg { width: 12px; height: 12px; transition: transform 0.2s ease; }
.layout.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }

/* When collapsed: hide text + secondary widgets, keep the brand mark + nav icons.
   v3.39 — The brand stays visible (logo on top), the bell hides because at 56px
   wide it would overlap the centered mark.
   v3.39.1 — Nav labels are wrapped in .nav-text spans (raw text nodes can't
   be targeted by CSS), so we hide that span instead of the no-op
   `.nav-item span:not(.nav-icon)`. */
.layout.sidebar-collapsed .nav-label,
.layout.sidebar-collapsed .nav-text,
.layout.sidebar-collapsed .sidebar-footer .user-info,
.layout.sidebar-collapsed .sidebar-footer button,
.layout.sidebar-collapsed .notif-bell { display: none; }
.layout.sidebar-collapsed .nav-item { justify-content: center; padding: 10px 0; gap: 0; }
.layout.sidebar-collapsed .nav-icon { margin: 0; }
.layout.sidebar-collapsed .nav-item.active::before { display: none; }
.layout.sidebar-collapsed .sidebar-footer { padding: 12px 0; }

.main {
  padding: 32px 40px;
  overflow-x: hidden;
  max-width: 1400px;
  transition: max-width 0.2s ease;
}
.layout.sidebar-collapsed .main { max-width: 1540px; }
/* Workspace view: full width, no padding constraint */
.view-workspace { max-width: none; }

/* ─── Brand: WSC Studios · Atlas lockup in sidebar (v3.25 — calm rewrite) ─── */
.brand {
  padding: 6px 18px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  /* No tinted gradient — the lockup speaks for itself. */
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  outline: none;
  padding: 2px 0;
}
.brand-lockup:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}
.wsc-mark {
  display: block;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}
.brand-wordmark {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  line-height: 1.15;
}
.brand-title {
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: 0.01em;
  text-transform: none;
}
.brand-product {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
/* Hide wordmark when sidebar is collapsed */
.layout.sidebar-collapsed .brand-wordmark { display: none; }
.layout.sidebar-collapsed .brand { padding: 6px 0 12px; text-align: center; }
.layout.sidebar-collapsed .brand-lockup { justify-content: center; padding: 0; }
.layout.sidebar-collapsed .wsc-mark { width: 26px; height: 26px; }

/* Legacy classes still referenced by older code paths — keep silent fallbacks */
.brand-title-accent { color: inherit; }
.brand-product-dot { display: none; }
.brand-product-meta { display: none; }
.wsc-logo-svg { display: block; height: 28px; width: auto; }
.brand-badge { display: none; }

/* ─── Sidebar nav ────────────────────────────────────────── */
.nav-list { list-style: none; margin: 0; padding: 0 12px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  width: 100%; text-align: left;
  padding: 9px 12px;
  background: transparent; border: 0;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit; font-size: 13px; font-weight: 500;
  border-radius: var(--radius-sm);
  margin-bottom: 1px;
  transition: all 0.12s ease;
}
.nav-item:hover {
  color: var(--black);
  background: var(--yellow);     /* ← YELLOW HOVER */
  font-weight: 600;
}
.nav-item.active {
  color: var(--white);
  background: var(--grey-3);
  font-weight: 600;
}
.nav-item.active::before {
  content: ""; display: block; width: 3px; height: 18px;
  background: var(--yellow);
  margin-left: -12px; margin-right: 9px;
  border-radius: 0 2px 2px 0;
}
.nav-icon {
  display: inline-block; width: 18px; height: 18px;
  text-align: center; line-height: 18px;
}
.nav-icon svg { width: 16px; height: 16px; vertical-align: middle; }

.nav-section { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.nav-label {
  padding: 0 20px 8px; font-size: 9px;
  letter-spacing: 0.14em; color: var(--text-faint);
  font-weight: 700; text-transform: uppercase;
}

.sidebar-footer {
  margin-top: auto; padding: 14px 16px 0;
  border-top: 1px solid var(--border);
}
.user-info { padding: 0 4px 10px; }
.user-name { font-size: 13px; font-weight: 600; color: var(--text); }
.user-role {
  font-size: 9px; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-faint); margin-top: 2px;
}

/* ─── Buttons ────────────────────────────────────────────── */
.primary-btn {
  background: var(--blue);
  color: var(--white);
  border: 0;
  padding: 9px 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  font-size: 13px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: all 0.12s ease;
}
.primary-btn:hover {
  background: var(--yellow);     /* ← YELLOW HOVER */
  color: var(--black);
}

.ghost-btn {
  display: inline-block;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--border-strong);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: all 0.12s ease;
}
.ghost-btn:hover {
  background: var(--yellow);     /* ← YELLOW HOVER */
  color: var(--black);
  border-color: var(--yellow);
  font-weight: 600;
}
.ghost-btn-block { display: block; width: 100%; text-align: center; margin-bottom: 4px; }

/* v3.54 — Global disabled-button affordance. Buttons with `disabled` get
   muted opacity, a not-allowed cursor, and stop swallowing pointer events
   so hovering the parent reveals tooltips. */
button:disabled,
.primary-btn:disabled,
.ghost-btn:disabled,
.danger-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: saturate(0.6);
}
button:disabled:hover,
.primary-btn:disabled:hover,
.ghost-btn:disabled:hover,
.danger-btn:disabled:hover {
  /* Don't tint on hover when disabled */
  background: inherit;
  color: inherit;
  border-color: inherit;
  font-weight: inherit;
}

.danger-btn {
  background: transparent;
  color: var(--red);
  border: 1px solid rgba(220,38,38,0.3);
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-family: inherit;
  transition: all 0.12s ease;
}
.danger-btn:hover {
  background: var(--red);
  color: var(--white);
  border-color: var(--red);
}

/* ─── Inputs ─────────────────────────────────────────────── */
input, select, textarea {
  width: 100%;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 9px 12px;
  font-family: inherit;
  font-size: 13px;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.12s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--blue);
}
input::placeholder { color: var(--text-faint); }
textarea { font-family: "JetBrains Mono", monospace; font-size: 12.5px; resize: vertical; }

/* ─── Headers ────────────────────────────────────────────── */
h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--white);
}
h2.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 28px 0 12px;
}
.page-hint {
  color: var(--text-mute);
  font-size: 13px;
  margin: 0 0 24px;
  max-width: 720px;
  line-height: 1.55;
}
.page-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 16px; margin-bottom: 24px;
}

.view { display: none; }
.view.active { display: block; }

.label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-faint);
}
.label-strong {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-dim);
  margin: 16px 0 8px;
}

/* ─── Stats grid ─────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 18px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.stat-card:hover { border-color: var(--blue); }
.stat-num {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
  color: var(--white);
  letter-spacing: -0.02em;
}
.stat-label {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 600;
}

/* ─── Filter bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 10px 12px;
  margin-bottom: 16px;
  border-radius: var(--radius);
}
.filter-bar input { flex: 1; min-width: 220px; }
.filter-bar select { width: auto; min-width: 130px; }

/* ─── Panel ──────────────────────────────────────────────── */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 18px;
  border-radius: var(--radius);
  margin-bottom: 12px;
}
.placeholder-block {
  background: var(--panel);
  border: 1px dashed var(--border-strong);
  padding: 32px;
  text-align: center;
  color: var(--text-mute);
  border-radius: var(--radius);
}

/* ─── Row item (used in Recent Scripts, Project Scripts) ── */
.row-item {
  display: grid; grid-template-columns: 1fr 160px 80px 110px 100px;
  gap: 14px; align-items: center;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.row-item:hover {
  border-color: var(--yellow);
  background: var(--panel-2);
}
.row-title { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.row-meta { font-size: 11.5px; color: var(--text-mute); }

/* ─── Skills cards ───────────────────────────────────────── */
.cat-group { margin-bottom: 28px; }
.cat-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.cat-bar { width: 3px; height: 16px; border-radius: 2px; }
.cat-title {
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 12px;
}
.cat-hint { font-size: 11px; color: var(--text-faint); margin-left: 6px; }
.cat-count { font-family: "JetBrains Mono", monospace; font-size: 10px; color: var(--text-faint); }

.skill-card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: var(--radius);
  margin-bottom: 8px;
  transition: all 0.12s ease;
}
.skill-card:hover { border-color: var(--border-strong); }
.skill-card.inactive { opacity: 0.5; }
.skill-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.skill-name { font-weight: 600; font-size: 14px; color: var(--text); }
.skill-content {
  font-family: "JetBrains Mono", monospace;
  font-size: 11.5px; line-height: 1.6;
  color: var(--text-mute);
  background: var(--panel-2);
  padding: 10px 12px;
  margin-top: 6px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
  max-height: 90px; overflow-y: auto;
}
.skill-actions { display: flex; gap: 6px; margin-top: 10px; }

/* ─── Pills / badges ─────────────────────────────────────── */
.pill {
  font-size: 9px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.08em;
  font-weight: 700;
  text-transform: uppercase;
  font-family: "JetBrains Mono", monospace;
  white-space: nowrap;
}
.pill-version { background: var(--panel-3); color: var(--text-faint); }
.pill-active {
  background: rgba(45,81,255,0.12);
  color: var(--blue-soft);
  border: 1px solid rgba(45,81,255,0.3);
}
.pill-inactive { background: var(--panel-3); color: var(--text-faint); }
.pill-priority { color: var(--text-faint); margin-left: auto; }
.pill-cond {
  background: rgba(167,202,252,0.08);
  color: var(--blue-soft);
  border: 1px solid rgba(167,202,252,0.2);
}
.pill-pass {
  background: rgba(45,81,255,0.12);
  color: var(--blue-soft);
  border: 1px solid var(--blue);
}
.pill-revise {
  background: rgba(220,38,38,0.1);
  color: #fca5a5;
  border: 1px solid rgba(220,38,38,0.3);
}
.pill-pending {
  background: var(--panel-3);
  color: var(--text-mute);
  border: 1px solid var(--border-strong);
}

/* ─── Grid helpers (used by modals) ──────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-2-tight { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
/* v3.40 — Removed dead QA Report CSS (.score-*, .verdict-*, .flagged-*)
   along with the Run-QA workflow they served. */

/* ─── Resolve preview ────────────────────────────────────── */
.resolve-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.78);
  display: none; align-items: center; justify-content: center;
  /* v3.63 — must sit above the Studio overlay (z-index: 200). Earlier value
     of 100 rendered every modal completely hidden when Studio was open. */
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal-bg.open { display: flex; }
.modal {
  background: var(--grey-1);
  border: 1px solid var(--border-strong);
  padding: 28px;
  width: 92%; max-width: 720px;
  max-height: 90vh; overflow-y: auto;
  border-radius: var(--radius);
}
.modal h2 {
  margin: 0 0 16px;
  color: var(--white);
  font-weight: 700;
  letter-spacing: -0.01em;
  font-size: 20px;
}
.form-row { margin-bottom: 14px; }
.form-row label {
  display: block;
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 700; color: var(--text-mute);
  margin-bottom: 5px;
}
.modal-actions {
  display: flex; gap: 8px; justify-content: flex-end;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

/* ─── Client card (Clients & Projects page) ──────────────── */
.client-card {
  background: var(--panel);
  border: 1px solid var(--border);
  padding: 16px;
  border-radius: var(--radius);
  margin-bottom: 10px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.client-card:hover {
  border-color: var(--yellow);
  background: var(--panel-2);
}
.client-row { display: flex; align-items: center; gap: 14px; }
.client-icon {
  width: 40px; height: 40px;
  background: var(--black);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: var(--yellow);
  font-weight: 800; font-size: 16px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.client-card:hover .client-icon {
  background: var(--yellow); color: var(--black);
}

/* ─── Client logos (v3.39) ───────────────────────────────────────────────
   Two variants share the same base size class:
   - .client-logo-gen renders a colored monogram (set with inline background)
   - .client-logo-imgwrap renders an <img> with a neutral backdrop in case the
     source has transparency.                                                */
.client-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  vertical-align: middle;
  overflow: hidden;
  font-family: inherit;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.18);
}
.client-logo-imgwrap {
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.client-logo-imgwrap img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.client-logo-sm { width: 28px; height: 28px; border-radius: 6px; font-size: 11px; }
.client-logo-md { width: 40px; height: 40px; border-radius: 9px; font-size: 14px; }
.client-logo-lg { width: 72px; height: 72px; border-radius: 14px; font-size: 24px; }

/* Card hover state still tints the LEGACY .client-icon (kept for any remaining
   call sites); the new .client-logo doesn't need a hover swap — it already
   has color. */

/* Modal logo editor */
.client-logo-edit-row label { display: block; margin-bottom: 6px; }
.client-logo-edit {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.client-logo-edit-preview { flex-shrink: 0; }
.client-logo-edit-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.client-logo-btn-row { display: flex; flex-wrap: wrap; gap: 6px; }
.client-logo-upload-btn {
  /* native <label> styled like a ghost-btn but accepts the hidden file input
     as a child so clicking anywhere on the chip triggers the file picker. */
  cursor: pointer;
  display: inline-flex;
  align-items: center;
}
.client-meta-line {
  display: flex; gap: 12px;
  font-size: 11.5px; color: var(--text-mute);
  margin-top: 2px;
}
.client-name { font-weight: 700; font-size: 16px; color: var(--text); }

.league-row {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
.league-row:first-child { border-top: 0; padding-top: 0; }
.league-name {
  font-size: 13px; font-weight: 600;
  color: var(--text); margin-bottom: 6px;
  display: flex; align-items: center; gap: 8px;
}
.league-sport-tag {
  display: inline-block;
  font-size: 9px; padding: 2px 8px;
  background: var(--panel-3);
  color: var(--text-mute);
  border-radius: 2px;
  letter-spacing: 0.08em; font-weight: 700;
  text-transform: uppercase;
}
.project-chip {
  display: inline-block;
  font-size: 12px; padding: 4px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  border-radius: var(--radius-sm);
  margin: 4px 4px 0 0;
  cursor: pointer;
  transition: all 0.12s ease;
}
.project-chip:hover {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
  font-weight: 600;
}
.project-chip-meta { color: var(--text-faint); margin-left: 6px; font-size: 10px; }

/* ─── Project detail page ────────────────────────────────── */
.breadcrumb {
  display: flex; gap: 6px; align-items: center;
  font-size: 12px; color: var(--text-mute);
  margin-bottom: 16px;
}
.breadcrumb a {
  color: var(--text-dim); text-decoration: none; cursor: pointer;
  padding: 3px 8px; border-radius: var(--radius-sm);
  transition: all 0.12s ease;
}
.breadcrumb a:hover {
  background: var(--yellow);
  color: var(--black);
}
.breadcrumb-sep { color: var(--text-faint); }

.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-faint);
}
.empty-hint {
  font-size: 13px;
  margin-top: 8px;
  color: var(--text-faint);
}

.toast {
  position: fixed;
  bottom: 24px; right: 24px;
  background: var(--blue);
  color: var(--white);
  padding: 12px 18px;
  font-weight: 600;
  border-radius: var(--radius);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.toast.show { opacity: 1; }
.toast.error { background: var(--red); }

.action-row {
  display: flex; gap: 8px; margin-top: 14px;
}
.action-bar {
  display: flex; gap: 8px; align-items: center;
  margin-bottom: 16px;
}

/* ─────────────────────────────────────────────────────────────────────────
   v3 — Task Workspace
   ───────────────────────────────────────────────────────────────────────── */

/* Task list rows */
.task-row {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.12s ease;
  display: grid;
  grid-template-columns: 1fr 140px 100px 100px 110px;
  gap: 14px;
  align-items: center;
}
.task-row:hover { border-color: var(--yellow); }
.task-status-open       { color: var(--text-mute); }
.task-status-in_progress{ color: var(--yellow); }
.task-status-review     { color: var(--blue-soft); }
.task-status-closed     { color: var(--blue); opacity: 0.7; }

/* Workspace — full-width split */
.view-workspace { display: none; }
.view-workspace.active {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  margin: -32px -40px;
  padding: 0;
}
.ws-header {
  padding: 14px 24px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--grey-1);
  flex-shrink: 0;
}
.ws-header-main {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  flex-wrap: wrap;
}
.ws-header-left { flex: 1; min-width: 200px; }
.ws-header-left .breadcrumb { font-size: 11px; margin-bottom: 4px; }
.ws-title-row {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.ws-title-row h1 {
  font-size: 17px;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ws-status-pills { display: flex; gap: 6px; align-items: center; }
.ws-action-bar {
  display: flex; gap: 8px; align-items: center;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.ws-action-bar .meta-info {
  color: var(--text-mute);
  font-size: 11px;
  margin-right: 6px;
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.8 — Resizable workspace panes
   Two drag handles:
     1. Vertical:    between ws-left and ws-right
     2. Horizontal:  inside ws-right, between video panel and chat
   Default split: 60/40 vertical, video=auto / chat=fill
   Sizes persisted to localStorage on drag-end.
   ───────────────────────────────────────────────────────────────────────── */

.ws-body {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  /* Default vertical split — overridden by inline style after first drag */
  --ws-left-pct: 60%;
  --ws-video-px: 280px;
}
.ws-left {
  width: var(--ws-left-pct);
  flex-shrink: 0;
  border-right: 0;  /* removed — the resizer handles the visual seam */
  overflow-y: auto;
  padding: 20px 24px;
  min-width: 360px;
}
.ws-right {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--grey-1);
  overflow: hidden;
  min-width: 320px;
}

/* Vertical drag handle between left and right */
.ws-resizer-v {
  flex-shrink: 0;
  width: 4px;
  background: var(--border);
  cursor: col-resize;
  position: relative;
  transition: background 0.12s ease;
  user-select: none;
}
.ws-resizer-v::before {
  /* Wider hit target — invisible but easier to grab */
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -3px; right: -3px;
}
.ws-resizer-v::after {
  /* Visible grip dots, appear on hover */
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 2px; height: 28px;
  background: var(--text-faint);
  border-radius: 1px;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.ws-resizer-v:hover,
.ws-resizer-v.dragging {
  background: var(--yellow);
}
.ws-resizer-v:hover::after,
.ws-resizer-v.dragging::after {
  opacity: 0.8;
  background: var(--black);
}

/* Horizontal drag handle inside the right pane */
.ws-resizer-h {
  flex-shrink: 0;
  height: 4px;
  background: var(--border);
  cursor: row-resize;
  position: relative;
  transition: background 0.12s ease;
  user-select: none;
}
.ws-resizer-h::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  top: -3px; bottom: -3px;
}
.ws-resizer-h::after {
  content: "";
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  height: 2px; width: 28px;
  background: var(--text-faint);
  border-radius: 1px;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.ws-resizer-h:hover,
.ws-resizer-h.dragging { background: var(--yellow); }
.ws-resizer-h:hover::after,
.ws-resizer-h.dragging::after {
  opacity: 0.8;
  background: var(--black);
}

/* The video panel inside ws-right — explicit height (controlled by resizer) */
.ws-video-area {
  height: var(--ws-video-px);
  min-height: 0;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.ws-video-area.collapsed {
  /* When videos panel is collapsed by user (the existing collapse button),
     it shrinks to just its header — ignore the height var. */
  height: auto;
}
/* Hide the horizontal resizer if no video panel is shown */
.ws-video-area:empty + .ws-resizer-h,
.ws-right.no-video .ws-resizer-h { display: none; }

.ws-chat-area {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* While dragging, prevent text selection and iframe interception */
body.ws-resizing {
  cursor: col-resize !important;
  user-select: none !important;
}
body.ws-resizing.resizing-h { cursor: row-resize !important; }
body.ws-resizing iframe,
body.ws-resizing video { pointer-events: none; }

/* Script tabs (multiple Hermes files in one task) */
.script-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
  padding-bottom: 0;
}
.script-tab {
  padding: 8px 14px;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.12s ease;
}
.script-tab:hover { color: var(--yellow); }
.script-tab.active {
  color: var(--white);
  border-bottom-color: var(--yellow);
}

/* The Story (top of script) */
.story-block {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 18px;
  position: relative;
}
.story-block summary {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--blue-soft);
  cursor: pointer;
  padding-bottom: 6px;
}
.story-block summary:hover { color: var(--yellow); }
.story-block[open] summary { padding-bottom: 10px; }
.story-block-body {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
}

/* Segment cards */
.segments-header {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  margin: 22px 0 10px;
}
.segment-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  transition: all 0.12s ease;
  position: relative;
}
.segment-card:hover { border-color: var(--border-strong); }
.segment-card.selected {
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow);
}
.segment-card.edited-by-ai { border-left: 3px solid var(--blue); }

.segment-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 8px;
  font-size: 10px;
}
.segment-num {
  display: inline-block;
  background: var(--panel-3);
  color: var(--text);
  padding: 2px 8px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  font-size: 10px;
}
.segment-version {
  background: var(--panel-3);
  color: var(--text-faint);
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 9px;
  font-weight: 700;
}
.segment-tools {
  margin-left: auto;
  display: flex; gap: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}
.segment-card:hover .segment-tools,
.segment-card.selected .segment-tools { opacity: 1; }
.segment-tool {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-mute);
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 3px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.12s ease;
}
.segment-tool:hover {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
}

.segment-content {
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--text);
  cursor: text;
}
.segment-content[contenteditable="true"] {
  outline: none;
  background: var(--panel-2);
  padding: 8px 10px;
  margin: -8px -10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--blue);
}

.segment-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 10px;
  color: var(--text-faint);
}
.segment-footer .moment-links {
  display: flex; gap: 4px; flex-wrap: wrap;
}
.moment-link {
  background: var(--panel-3);
  color: var(--blue-soft);
  padding: 1px 6px;
  border-radius: 2px;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer;
  transition: all 0.12s ease;
}
.moment-link:hover {
  background: var(--yellow);
  color: var(--black);
}

/* Key Moments panel */
.key-moments-block {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 24px;
}
.key-moments-block summary {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-mute);
  cursor: pointer;
  padding-bottom: 6px;
}
.key-moments-block summary:hover { color: var(--yellow); }
.key-moments-list {
  max-height: 400px;
  overflow-y: auto;
  margin-top: 10px;
}
.moment-item {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.5;
}
.moment-item:last-child { border-bottom: 0; }
.moment-item.highlighted {
  background: rgba(229,255,0,0.08);
  border-left: 2px solid var(--yellow);
  padding-left: 6px;
}
.moment-number {
  font-family: "JetBrains Mono", monospace;
  color: var(--text-faint);
  font-weight: 700;
  font-size: 11px;
}

/* ── Video panel ─────────────────────────────────────────────────────── */
.video-panel {
  background: var(--panel);
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.vp-header {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  cursor: pointer; user-select: none;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.vp-header:hover { background: var(--grey-4); }
.vp-toggle { font-size: 10px; color: var(--text-mute); width: 10px; flex-shrink: 0; }
.vp-title  { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-dim); }
.vp-switcher { padding: 6px 10px; flex-shrink: 0; }
.vp-select {
  width: 100%;
  background: var(--bg); color: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 5px 8px; font-size: 12px; font-family: inherit;
}
.vp-select:focus { outline: none; border-color: var(--yellow); }
.vp-player {
  background: #000;
  line-height: 0;
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
}
.vp-player video,
.vp-player iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  object-fit: contain;
}
.vp-controls {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.vp-label { font-size: 11px; color: var(--text-dim); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-icon-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--text-mute); padding: 2px 7px;
  border-radius: var(--radius-sm); font-size: 12px;
  cursor: pointer; line-height: 1.4; flex-shrink: 0;
}
.vp-icon-btn:hover { background: var(--grey-4); color: var(--white); border-color: var(--border-strong); }
.vp-icon-btn.vp-remove:hover { background: #450a0a; color: #fca5a5; border-color: #7f1d1d; }
.vp-add-btn {
  background: transparent; border: 1px solid var(--border);
  color: var(--blue); padding: 3px 9px;
  border-radius: var(--radius-sm); font-size: 11px;
  cursor: pointer; font-family: inherit; white-space: nowrap; flex-shrink: 0;
}
.vp-add-btn:hover { background: var(--blue); color: var(--white); border-color: var(--blue); }
.vp-add { padding: 8px 10px; }
.vp-empty { padding: 12px; font-size: 12px; color: var(--text-faint); text-align: center; background: #000; }

/* Chat panel */
.chat-header {
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-header h3 {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin: 0;
  font-weight: 700;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
}
.msg-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 10px;
}
.msg-author {
  font-weight: 700;
  color: var(--blue-soft);
}
.msg-ai .msg-author { color: var(--yellow); }
.msg-system .msg-author { color: var(--text-faint); }
.msg-time { color: var(--text-faint); font-family: "JetBrains Mono", monospace; }

.msg-body {
  padding: 10px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
}
.msg-ai .msg-body {
  background: rgba(229,255,0,0.04);
  border-color: rgba(229,255,0,0.2);
}
.msg-system {
  align-self: center;
  font-size: 11px;
  color: var(--text-faint);
  font-style: italic;
  padding: 4px 12px;
  background: var(--panel-2);
  border-radius: 999px;
}
.msg-system .msg-body { background: transparent; border: 0; padding: 0; }
.msg-mine { align-self: flex-end; }
.msg-mine .msg-author { color: var(--white); }
.msg-mine .msg-meta { justify-content: flex-end; }
.msg-mine .msg-body { background: var(--blue); border-color: var(--blue); color: var(--white); }

/* AI proposed edit card inside chat */
.proposed-edit {
  margin-top: 8px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 12px;
}
.proposed-edit-diff {
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  white-space: pre-wrap;
  line-height: 1.4;
  margin: 6px 0;
  max-height: 180px;
  overflow-y: auto;
}
.diff-removed { background: rgba(220,38,38,0.12); color: #fca5a5; }
.diff-added   { background: rgba(45,81,255,0.15); color: var(--blue-soft); }
.proposed-edit-actions {
  display: flex; gap: 6px; margin-top: 8px;
}
.proposed-edit-status {
  display: inline-block;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 2px;
  letter-spacing: 0.08em;
  font-weight: 700;
  text-transform: uppercase;
  font-family: "JetBrains Mono", monospace;
}
.pe-applied  { background: rgba(45,81,255,0.15); color: var(--blue-soft); border: 1px solid var(--blue); }
.pe-rejected { background: rgba(220,38,38,0.15); color: #fca5a5;        border: 1px solid rgba(220,38,38,0.4); }

/* Chat input */
.chat-input-bar {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  background: var(--grey-1);
}
.chat-input-bar textarea {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  font-family: inherit;
  font-size: 13px;
}
.chat-input-bar button {
  align-self: flex-end;
}
.chat-hint {
  font-size: 10px;
  color: var(--text-faint);
  padding: 0 12px 8px;
}

/* Status pills */
.status-pill {
  font-size: 10px;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.08em;
  font-weight: 700;
  text-transform: uppercase;
  font-family: "JetBrains Mono", monospace;
}
.status-open       { background: var(--panel-3); color: var(--text-mute); }
.status-in_progress{ background: rgba(229,255,0,0.1); color: var(--yellow); border: 1px solid rgba(229,255,0,0.3); }
.status-review     { background: rgba(167,202,252,0.12); color: var(--blue-soft); border: 1px solid rgba(167,202,252,0.3); }
.status-closed     { background: rgba(45,81,255,0.12); color: var(--blue); border: 1px solid var(--blue); }

/* Drop zone for Hermes file */
.drop-zone {
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 30px;
  text-align: center;
  color: var(--text-mute);
  cursor: pointer;
  transition: all 0.12s ease;
  margin: 20px 0;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--yellow);
  color: var(--yellow);
  background: rgba(229,255,0,0.04);
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.1 — Users & Assignees
   ───────────────────────────────────────────────────────────────────────── */

.user-row {
  display: flex; align-items: center; gap: 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 6px;
  transition: border-color 0.12s ease;
}
.user-row:hover { border-color: var(--border-strong); }
.user-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.role-pill {
  display: inline-block;
  font-size: 9px;
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: 0.1em;
  font-weight: 700;
  text-transform: uppercase;
  font-family: "JetBrains Mono", monospace;
}
.role-admin   { background: rgba(229,255,0,0.12); color: var(--yellow); border: 1px solid rgba(229,255,0,0.3); }
.role-manager { background: rgba(45,81,255,0.15); color: var(--blue-soft); border: 1px solid var(--blue); }
.role-editor  { background: var(--panel-3); color: var(--text-dim); border: 1px solid var(--border-strong); }

/* Assignee avatars in the task workspace header */
.assignee-chip {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--grey-3);
  color: var(--text-dim);
  font-size: 9px; font-weight: 700;
  border: 1px solid var(--border-strong);
  letter-spacing: 0.02em;
  cursor: default;
}

/* Assign modal list */
.assign-list { max-height: 380px; overflow-y: auto; padding-right: 4px; }
.assign-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  background: var(--panel);
}
.assign-row.assigned { border-color: var(--blue); background: rgba(45,81,255,0.05); }

/* ─────────────────────────────────────────────────────────────────────────
   v3.2 — Right panel tabs (Chat / QA), Segment history, QA result
   ───────────────────────────────────────────────────────────────────────── */

.ws-right { padding: 0; }

.right-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  flex-shrink: 0;
}
.right-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: all 0.12s ease;
  display: flex; align-items: center; gap: 8px;
}
.right-tab:hover { color: var(--yellow); }
.right-tab.active {
  color: var(--white);
  border-bottom-color: var(--yellow);
}
.right-tab:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}
.right-tab:disabled:hover { color: var(--text-faint); }
.tab-badge {
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  background: var(--panel-3);
  color: var(--text-mute);
  padding: 1px 7px;
  border-radius: 999px;
}

.right-panel-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Make chat panel fill the tab body */
#rightPanelBody .chat-messages { padding: 14px 16px; flex: 1; overflow-y: auto; }
#rightPanelBody .chat-input-bar { padding: 12px; border-top: 1px solid var(--border); }

/* ── Inline code in hints ─────────────────────────────────────────────── */
.chat-hint code {
  background: var(--panel-3);
  color: var(--blue-soft);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
}

/* v3.40 — Removed dead .qa-* panel CSS along with the retired Run-QA flow. */

/* ── Segment history modal ────────────────────────────────────────────── */
.history-list {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.history-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
}
.history-item.history-current {
  border-color: var(--blue);
  background: rgba(45,81,255,0.04);
}
.history-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.history-kind {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-family: "JetBrains Mono", monospace;
  margin-bottom: 6px;
}
.history-content {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
  background: var(--panel-2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  white-space: pre-wrap;
}

/* Make segment-version clickable cursor */
.segment-version { cursor: pointer; transition: all 0.12s ease; }
.segment-version:hover { background: var(--yellow); color: var(--black); }

/* ─────────────────────────────────────────────────────────────────────────
   v3.3 — Dashboard portfolio view (Manus-style)
   ───────────────────────────────────────────────────────────────────────── */

.status-bar-container {
  margin-bottom: 12px;
}
.status-bar {
  display: flex;
  width: 100%;
  height: 12px;
  border-radius: 2px;
  overflow: hidden;
  gap: 1px;
}
.status-bar-segment {
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.15s ease;
  min-width: 2px;
}
.status-bar-segment:hover {
  opacity: 1;
  transform: scaleY(1.3);
}
.status-bar-segment.active {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--white);
}
.status-bar-segment:not(.active) { opacity: 0.7; }
.status-bar-empty {
  height: 12px;
  background: var(--panel-2);
  border-radius: 2px;
  color: var(--text-faint);
  font-size: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.status-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}
.status-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.12s ease;
}
.status-legend-item:hover {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
  font-weight: 600;
}
.status-legend-item.active {
  background: var(--panel-3);
  color: var(--white);
  border-color: var(--white);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.status-count {
  font-family: "JetBrains Mono", monospace;
  background: var(--panel-3);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  color: var(--text-mute);
}

/* Drilldown card — appears when a status is clicked */
.drilldown-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.drilldown-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.drilldown-clients {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.drilldown-client {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  transition: border-color 0.12s ease;
}
.drilldown-client:hover { border-color: var(--border-strong); }
.drilldown-client.expanded { border-color: var(--yellow); }
.drilldown-client-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  cursor: pointer;
}
.drilldown-client-row:hover { background: var(--panel-3); }
.client-icon-sm {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--black);
  color: var(--yellow);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}
.drilldown-client.expanded .client-icon-sm {
  background: var(--yellow);
  color: var(--black);
}
.arrow {
  color: var(--text-faint);
  font-size: 14px;
}
.drilldown-client-projects {
  padding: 8px 14px 12px 54px;
  border-top: 1px solid var(--border);
  background: var(--grey-1);
}
.drilldown-projects-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.drilldown-project {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
}
.drilldown-project:hover {
  background: var(--yellow);
  color: var(--black);
}
.drilldown-project:hover .row-meta { color: rgba(0,0,0,0.7); }

/* ─────────────────────────────────────────────────────────────────────────
   v3.3 — Left panel tabs for Script / QA
   ───────────────────────────────────────────────────────────────────────── */

.ws-tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  padding: 0 8px;
  flex-shrink: 0;
  background: var(--grey-1);
  margin: -20px -24px 16px;
  padding-left: 24px;
  padding-right: 24px;
}
.ws-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  padding: 12px 16px;
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: all 0.12s ease;
}
.ws-tab:hover:not(:disabled) { color: var(--yellow); }
.ws-tab.active {
  color: var(--white);
  border-bottom-color: var(--yellow);
}
.ws-tab:disabled {
  color: var(--text-faint);
  cursor: not-allowed;
}
.ws-tab-body {
  /* fills the rest of the panel */
}

/* Flagged item action row */
.flagged-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}
.flagged-actions .ghost-btn {
  padding: 3px 10px;
  font-size: 10px;
}

/* Pill for "active" / "current" labels */
.pill-active {
  background: var(--blue);
  color: var(--white);
  font-size: 9px;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.4 — AI status badge + AI tool button
   ───────────────────────────────────────────────────────────────────────── */

.ai-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 10px;
  font-family: "JetBrains Mono", monospace;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  letter-spacing: 0.04em;
  font-weight: 600;
  cursor: help;
}
.ai-status-loading {
  color: var(--text-faint);
  background: var(--panel-2);
}
.ai-status-active {
  color: #4ade80;
  background: rgba(74,222,128,0.08);
  border-color: rgba(74,222,128,0.25);
}
.ai-status-mock {
  color: var(--text-mute);
  background: var(--panel-2);
}
.ai-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor;
  display: inline-block;
  box-shadow: 0 0 6px currentColor;
}
.ai-status-mock .ai-dot { box-shadow: none; opacity: 0.5; }

/* Special styling for the AI Rewrite segment button */
.segment-tool-ai {
  background: linear-gradient(90deg, rgba(45,81,255,0.1), rgba(229,255,0,0.08));
  border-color: rgba(45,81,255,0.3);
  color: var(--blue-soft);
}
.segment-tool-ai:hover {
  background: linear-gradient(90deg, var(--blue), var(--yellow)) !important;
  color: var(--black) !important;
  border-color: var(--yellow);
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.5 — Settings page
   ───────────────────────────────────────────────────────────────────────── */

.settings-section {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 720px;
}
.settings-section h2 {
  font-size: 16px;
  margin: 0 0 8px;
  font-weight: 600;
}

.settings-status {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin: 16px 0 24px;
}
.settings-status.status-active {
  border-color: rgba(74,222,128,0.3);
  background: rgba(74,222,128,0.04);
}
.settings-status.status-inactive {
  border-color: var(--border);
  background: var(--panel-2);
}
.settings-status-row {
  display: flex; align-items: center; gap: 12px;
}

.settings-actions {
  display: flex; gap: 10px; align-items: center;
  margin-top: 20px; padding-top: 16px;
  border-top: 1px solid var(--border);
}

.settings-test-ok {
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.3);
  color: #4ade80;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: "JetBrains Mono", monospace;
}
.settings-test-err {
  background: rgba(220,38,38,0.08);
  border: 1px solid rgba(220,38,38,0.3);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 12px;
}

.settings-section .form-row {
  margin-bottom: 14px;
}
.settings-section .form-row label {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.6 — Active Jobs table widget
   ───────────────────────────────────────────────────────────────────────── */

.active-jobs-table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.active-jobs-header,
.active-jobs-row {
  display: grid;
  grid-template-columns: 1.4fr 1.8fr 100px 1.8fr 110px 1.2fr 90px 1.2fr;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 12px;
}
.active-jobs-header {
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  color: var(--text-mute);
  font-weight: 600;
}
.active-jobs-row {
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}
.active-jobs-row:last-child { border-bottom: 0; }
.active-jobs-row:hover {
  background: var(--yellow);
  color: var(--black);
}
.active-jobs-row:hover .row-meta { color: rgba(0,0,0,0.7); }
.active-jobs-row:hover .status-pill { filter: brightness(1.1); }

.aj-cell-client {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
}
.aj-cell-job {
  font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.aj-cell-desc {
  color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.aj-cell-due { font-variant-numeric: tabular-nums; }
.aj-cell-cs {
  display: flex; align-items: center; gap: 6px;
}

.due-overdue   { color: #f87171; font-weight: 600; }
.due-soon      { color: #fbbf24; font-weight: 600; }
.due-this-week { color: var(--blue-soft); }

/* ─────────────────────────────────────────────────────────────────────────
   v3.6 — External QA tab (team-facing, inside job workspace)
   ───────────────────────────────────────────────────────────────────────── */

.ext-qa-list {
  display: flex; flex-direction: column; gap: 12px;
}
.ext-qa-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
}
.ext-qa-head {
  display: flex; align-items: flex-start; gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.ext-qa-name {
  font-weight: 600; font-size: 13px;
  display: flex; align-items: center; gap: 8px;
}
.ext-qa-type {
  background: var(--blue);
  color: var(--white);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}
.ext-qa-actions {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
}
.ext-qa-status {
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 10px;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.ext-stat-sent { background: var(--panel-3); color: var(--text-mute); }
.ext-stat-prog { background: rgba(251,191,36,0.15); color: var(--yellow); }
.ext-stat-done { background: rgba(74,222,128,0.15); color: #4ade80; }
.ext-qa-del {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-mute);
  width: 24px; height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
}
.ext-qa-del:hover {
  background: #f87171; color: var(--white); border-color: #f87171;
}
.ext-qa-share {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
}
.ext-qa-share input {
  flex: 1; padding: 6px 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
}
.ext-qa-feedback {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.ext-qa-fb-list {
  display: flex; flex-direction: column; gap: 6px;
  margin: 6px 0;
}
.ext-qa-fb-item {
  background: var(--panel-2);
  border-left: 2px solid var(--blue);
  padding: 8px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* Chat message style for external messages */
.msg-external {
  background: rgba(45, 81, 255, 0.08) !important;
  border-left: 2px solid var(--blue);
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.19 — External QA panel: unified feedback list + reviewer chips
   ───────────────────────────────────────────────────────────────────────── */
.ext-qa-page {
  display: flex; flex-direction: column; gap: 14px;
  padding: 4px 4px 16px;
}
.ext-qa-toolbar {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.ext-qa-toolbar-title {
  font-weight: 700; font-size: 14px;
}
.ext-qa-reviewers {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.ext-reviewer-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  min-width: 220px;
  flex: 1 1 220px;
  max-width: 360px;
}
.ext-reviewer-head {
  display: flex; align-items: center; gap: 8px;
}
.ext-reviewer-name {
  font-weight: 600; font-size: 12px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.ext-reviewer-meta {
  font-size: 11px; color: var(--text-faint);
  margin: 4px 0 6px;
}
.ext-qa-feedback-wrap {
  display: flex; flex-direction: column; gap: 8px;
}
.ext-qa-feedback-head {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.ext-qa-filter-tabs {
  display: flex; gap: 4px;
  margin-left: auto;
}
.ext-filter-tab {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.ext-filter-tab.active {
  background: var(--yellow);
  color: #1a1a1a;
  border-color: var(--yellow);
  font-weight: 600;
}
.ext-qa-feedback-list {
  display: flex; flex-direction: column; gap: 8px;
}
.ext-fb-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  transition: opacity 0.15s;
}
.ext-fb-status-open           { border-left-color: var(--yellow); }
.ext-fb-status-done           { border-left-color: #4ade80; }  /* v3.21: removed opacity:0.65 — done cards stay readable, green border signals state */
.ext-fb-status-back_to_review { border-left-color: #60a5fa; }
.ext-fb-head {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.ext-fb-author { font-weight: 600; font-size: 12px; }
.ext-fb-body {
  font-size: 12px; line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.ext-ts-badge {
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--blue-soft);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  cursor: pointer;
}
.ext-ts-badge:hover {
  background: var(--blue);
  color: var(--white);
}
.ext-fb-status-select {
  margin-left: auto;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-family: inherit;
}
.ext-fb-status-select.status-open           { color: var(--yellow); }
.ext-fb-status-select.status-done           { color: #4ade80; }
.ext-fb-status-select.status-back_to_review { color: #60a5fa; }

/* ─────────────────────────────────────────────────────────────────────────
   v3.7 — Forced password change modal (blocking)
   ───────────────────────────────────────────────────────────────────────── */

/* The modal-bg.open default styling already centers the modal — we just
   need to make sure the input fields look right and the modal is visually
   distinct as a "you must do this" prompt. */
#forcePwModal .modal {
  border-top: 3px solid var(--yellow);
}
#forcePwModal input[type="password"] {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: inherit;
  font-size: 13px;
}
#forcePwModal input[type="password"]:focus {
  outline: none;
  border-color: var(--yellow);
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.8 — Dashboard section design + edit-on-hover
   ───────────────────────────────────────────────────────────────────────── */

.dashboard-header {
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.dashboard-header-text { min-width: 0; flex: 1 1 auto; }
.dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.dashboard-header h1 {
  font-size: 32px;
  margin: 6px 0 6px;
  font-weight: 800;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--white) 0%, var(--text-dim) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.dashboard-header .dashboard-sub {
  color: var(--text-mute);
  font-size: 13px;
  margin: 0;
}

/* v3.23 — WSC Studios · Atlas brand strip above the Dashboard h1 */
.dashboard-brand-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.dbs-bar {
  width: 4px;
  height: 18px;
  background: var(--yellow);
  border-radius: 2px;
  box-shadow: 0 0 12px rgba(229,255,0,0.45);
}
.dbs-label { color: var(--white); font-weight: 600; }
.dbs-label strong { color: var(--yellow); font-weight: 700; }
.dbs-sep { color: var(--text-faint); }
.dbs-product {
  color: var(--white);
  font-weight: 700;
}
.dbs-tag {
  color: var(--text-mute);
  font-size: 10px;
  text-transform: none;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* Section block — card containing a distinct area of content */
.dash-section {
  margin-bottom: 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.dash-section-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
  position: relative;
}
/* Colored accent bar on the left */
.dash-section-header::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent, var(--blue));
}
.dash-section-clients { --accent: var(--blue); }
.dash-section-jobs    { --accent: var(--yellow); }

.dash-section-icon {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--accent, var(--blue));
  color: var(--white);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.dash-section-jobs .dash-section-icon { color: var(--black); }
.dash-section-icon svg { width: 18px; height: 18px; }

.dash-section-title { flex: 1; }
.dash-section-title h2 {
  font-size: 16px;
  margin: 0 0 2px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.dash-section-title .dash-section-sub {
  font-size: 12px;
  color: var(--text-mute);
  margin: 0;
}
.dash-section-meta {
  color: var(--text-mute);
  font-size: 11px;
  font-family: "JetBrains Mono", monospace;
  text-align: right;
}
.dash-section-meta strong {
  color: var(--white);
  font-size: 18px;
  font-weight: 700;
  display: block;
  line-height: 1;
}
.dash-section-body { padding: 18px 22px; }

/* Stats inline (4 small cards in a row inside section) */
.dash-stats-inline {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
.dash-stat-mini {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.dash-stat-mini:hover {
  border-color: var(--yellow);
  background: rgba(229, 255, 0, 0.04);
}
.dash-stat-mini .stat-num {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  margin-bottom: 6px;
}
.dash-stat-mini .stat-label {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Active Jobs table - polish + edit-on-hover */
.dash-section-jobs .active-jobs-table {
  background: transparent;
  border: 0;
  border-radius: 0;
}
.dash-section-jobs .active-jobs-header,
.dash-section-jobs .active-jobs-row {
  grid-template-columns: 1.3fr 1.6fr 100px 1.6fr 100px 1.1fr 80px 1.1fr 36px;
  padding: 10px 14px;
}
.dash-section-jobs .active-jobs-header { background: var(--panel-3); }
.dash-section-jobs .active-jobs-row { border-bottom-color: var(--border); }
.dash-section-jobs .active-jobs-row:hover .aj-edit-btn { opacity: 1; }
.aj-edit-btn {
  width: 26px; height: 26px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-mute);
  cursor: pointer;
  opacity: 0;
  transition: all 0.12s ease;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
}
.aj-edit-btn:hover {
  background: var(--black);
  color: var(--yellow);
  border-color: var(--yellow);
}
.active-jobs-row:hover .aj-edit-btn:hover { background: var(--black); color: var(--yellow); }

/* Status drilldown — edit pencil on clients */
.drilldown-client-row { position: relative; }
.drilldown-client:hover .dd-edit-btn { opacity: 1; }
.dd-edit-btn {
  position: absolute;
  right: 36px; top: 50%;
  transform: translateY(-50%);
  width: 24px; height: 24px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-mute);
  cursor: pointer;
  opacity: 0;
  transition: all 0.12s ease;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  font-size: 11px;
}
.dd-edit-btn:hover {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
}

/* Status bar inside the new section card */
.dash-section-clients .status-bar-container { margin-bottom: 14px; }
.dash-section-clients .status-bar { height: 14px; border-radius: 3px; }
.dash-section-clients .status-legend { margin-bottom: 0; }

/* Responsive — stack stats on narrow screens */
@media (max-width: 900px) {
  .dash-stats-inline { grid-template-columns: repeat(2, 1fr); }
  .dash-section-jobs .active-jobs-header,
  .dash-section-jobs .active-jobs-row {
    grid-template-columns: 1.2fr 1.6fr 90px 1.6fr 90px 1fr 70px 1fr 32px;
    font-size: 11px;
  }
}

/* Mobile / narrow — disable horizontal split, stack vertically */
@media (max-width: 768px) {
  .ws-body { flex-direction: column; }
  .ws-left { width: 100% !important; border-right: 0; border-bottom: 1px solid var(--border); }
  .ws-resizer-v { display: none; }
  .ws-right { flex: 1; }
  .ws-video-area { height: 240px !important; }
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.8 — Inline segment comments + comment items
   ───────────────────────────────────────────────────────────────────────── */

.segment-card.comments-open { border-color: var(--blue-soft); }
.segment-card .segment-content { cursor: pointer; }
.segment-card .segment-content:hover { background: rgba(229, 255, 0, 0.04); }

.seg-comments {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.seg-comments-empty {
  color: var(--text-faint);
  font-size: 12px;
  font-style: italic;
  padding: 4px 0;
}
.seg-comments-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Comment item */
.comment-item {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  max-width: 92%;
}
.comment-item.comment-mine {
  background: rgba(45, 81, 255, 0.08);
  border-color: rgba(45, 81, 255, 0.3);
  align-self: flex-end;
}
.comment-item.comment-external {
  border-left: 2px solid var(--blue);
}
.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
}
.comment-author { font-weight: 600; color: var(--text-dim); }
.comment-time { color: var(--text-faint); margin-left: auto; }
.comment-timestamp {
  background: var(--black);
  color: var(--yellow);
  border: 0;
  padding: 1px 7px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}
.comment-timestamp:hover { background: var(--yellow); color: var(--black); }
.comment-del {
  background: transparent;
  border: 0;
  color: var(--text-dim);  /* v3.21: bumped from --text-faint */
  cursor: pointer;
  font-size: 11px;
  padding: 0 4px;
  opacity: 0.55;  /* v3.21: low-but-visible by default so the X is discoverable */
  transition: opacity 0.12s ease, color 0.12s ease;
}
.comment-item:hover .comment-del,
.vp-comment-card:hover .comment-del { opacity: 1; }
.comment-del:hover { color: #fca5a5; opacity: 1; }
.comment-body { font-size: 13px; line-height: 1.5; color: var(--white); }

/* Comment input form */
.seg-comments-form {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.seg-comments-form textarea {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 36px;
  max-height: 120px;
}
.seg-comments-form textarea:focus { outline: none; border-color: var(--yellow); }
.seg-comments-form button { padding: 7px 14px; font-size: 12px; flex-shrink: 0; }

/* Footer toggle button */
.segment-comment-toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-mute);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 10px;
  font-family: inherit;
  cursor: pointer;
  margin-right: 8px;
  transition: all 0.12s ease;
}
.segment-comment-toggle:hover {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}
.segment-card.comments-open .segment-comment-toggle {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.8 — Video pane: add-comment button + timeline + comments list
   ───────────────────────────────────────────────────────────────────────── */

.vp-player { position: relative; }
/* v3.21 — Add Comment button moved OUT of the player overlay so it no longer
   covers the native video timeline scrubber. It now sits above the timeline,
   as a top-right floating pill, with a subtle backdrop so it's readable on
   any frame. The composer overlay below also rises higher to keep clear of
   the native controls. */
.vp-add-comment {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(0, 0, 0, 0.78);
  color: var(--yellow);
  border: 1px solid var(--yellow);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 10;
  backdrop-filter: blur(8px);
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
  transition: background 0.12s, color 0.12s, transform 0.12s;
}
.vp-add-comment:hover {
  background: var(--yellow);
  color: var(--black);
  transform: translateY(-1px);
}

/* Video comment composer (overlay above player) */
/* v3.21 — Anchored top so it doesn't cover the native video scrubber while open. */
.vp-composer {
  position: absolute;
  left: 12px; right: 12px; top: 52px;
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid var(--yellow);
  border-radius: var(--radius-sm);
  padding: 10px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 6px;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.vp-composer-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--yellow);
  font-family: "JetBrains Mono", monospace;
}
.vp-composer-close {
  margin-left: auto;
  background: transparent; border: 0;
  color: var(--text-mute);
  cursor: pointer; font-size: 14px;
  padding: 0 4px;
}
.vp-composer-close:hover { color: var(--white); }
.vp-composer textarea {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: none;
  min-height: 48px;
}
.vp-composer textarea:focus { outline: none; border-color: var(--yellow); }
.vp-composer-actions {
  display: flex; gap: 6px; justify-content: flex-end;
}

/* Timeline overlay with comment dots (only for direct video) */
.vp-timeline-overlay {
  position: absolute;
  left: 0; right: 0;
  bottom: 56px;        /* sits just above the native controls */
  height: 18px;
  pointer-events: none;
  z-index: 9;
}
.vp-timeline-marker {
  position: absolute;
  width: 10px; height: 10px;
  background: var(--yellow);
  border: 2px solid var(--black);
  border-radius: 50%;
  transform: translateX(-50%);
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.12s ease;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.2);
}
.vp-timeline-marker:hover {
  transform: translateX(-50%) scale(1.4);
}
.vp-timeline-marker .vp-marker-tooltip {
  position: absolute;
  bottom: 22px; left: 50%;
  transform: translateX(-50%);
  background: var(--black);
  color: var(--white);
  border: 1px solid var(--yellow);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vp-timeline-marker:hover .vp-marker-tooltip { opacity: 1; }

/* Video comments list below the player */
.vp-comments-section {
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  flex-shrink: 0;
  max-height: 220px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.vp-comments-head {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  font-weight: 600;
  user-select: none;
  border-bottom: 1px solid var(--border);
}
.vp-comments-head:hover { background: var(--grey-4); }
.vp-comments-list {
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.vp-comments-list .comment-item { max-width: 100%; }

/* ─────────────────────────────────────────────────────────────────────────
   v3.8r2 — Video pane redesign (no more job chat, bigger video, polished comments)
   ───────────────────────────────────────────────────────────────────────── */

/* Empty-pane state when no videos exist */
.vp-empty-pane {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-mute);
}
.vp-empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 4px;
}
.vp-empty-hint { font-size: 12px; }

/* The video panel now fills the entire right pane.
   Structure:
     .video-panel (column flex, fills 100%)
       .vp-header (collapse toggle)
       .vp-switcher? (only when multiple videos)
       .vp-player-wrap (flex:1 OR fixed depending on comments)
         .vp-player (video + overlay + composer)
       .vp-controls (label + edit + add)
       .vp-comments-section (only when comments exist)
         .vp-filter-bar
         .vp-comments-list (scrollable)
*/

.video-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--panel);
}

/* When NO video comments → player gets all available space.
   When comments exist → player gets a sensible maximum and comments take the rest.
   We achieve this with flex-basis: auto on the player wrap, max-height
   capping when comments are present (via :has). */
.vp-player-wrap {
  flex: 1 1 auto;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  position: relative;
}
/* When comments are present, the player can scroll-fit nicely */
.video-panel:has(.vp-comments-section) .vp-player-wrap {
  flex: 1 1 60%;
  max-height: 60%;
}

/* The actual player surface */
.vp-player {
  flex: 1;
  position: relative;
  background: #000;
  overflow: hidden;
}
.vp-player video,
.vp-player iframe {
  width: 100%;
  height: 100%;
  display: block;
  border: 0;
  object-fit: contain;
}

/* v3.21 — Second .vp-add-comment definition removed (rule lived twice in
   this file with the same selector but with bottom/right positioning,
   covering the native video controls). The top-anchored definition above
   is now the single source of truth. */

/* Composer overlay */
/* v3.21 — Anchored top so the composer never sits on top of the timeline scrubber. */
.vp-composer {
  position: absolute;
  left: 12px; right: 12px; top: 52px;
  background: rgba(0, 0, 0, 0.92);
  border: 1px solid var(--yellow);
  border-radius: var(--radius-sm);
  padding: 12px;
  z-index: 11;
  display: flex;
  flex-direction: column;
  gap: 8px;
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.vp-composer-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--yellow);
  font-family: "JetBrains Mono", monospace;
}
.vp-composer-close {
  margin-left: auto;
  background: transparent; border: 0;
  color: var(--text-mute);
  cursor: pointer; font-size: 14px;
  padding: 0 4px;
}
.vp-composer-close:hover { color: var(--white); }
.vp-composer textarea {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: none;
  min-height: 56px;
  line-height: 1.4;
}
.vp-composer textarea:focus { outline: none; border-color: var(--yellow); }
.vp-composer-segment {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-mute);
}
.vp-composer-segment label { flex-shrink: 0; }
.vp-composer-segment select {
  flex: 1;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12px;
}
.vp-composer-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* v3.78 — "Now Playing" panel under the source video.
   Replaces the previously-wasted empty-comments stub. Live-updated by
   updateNowPlayingPanel() each rVFC tick (signature-gated). */
.vp-now-playing {
  flex: 0 0 auto;
  background: var(--panel);
  border-top: 1px solid var(--border);
  padding: 10px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.vpn-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.vpn-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent, #c9d92e);
  font-weight: 700;
}
.vpn-time {
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.vpn-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 38px;
}
.vpn-empty {
  font-size: 12px;
  color: var(--text-mute);
  padding: 4px 0 2px;
  font-style: italic;
}
.vpn-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--text);
}
.vpn-row-seg {
  border-left: 3px solid var(--accent, #c9d92e);
}
.vpn-row-clip {
  border-left: 3px solid var(--blue, #2d51ff);
  font-size: 11.5px;
  color: var(--text-dim);
}
.vpn-tag {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 7px;
  background: rgba(201,217,46,0.14);
  color: var(--accent, #c9d92e);
  border-radius: 999px;
  white-space: nowrap;
}
.vpn-tag-clip {
  background: rgba(45,81,255,0.16);
  color: #8ea4ff;
}
.vpn-row-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.vpn-row-actions {
  display: flex;
  gap: 4px;
  align-items: center;
}
.vpn-btn {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  font-weight: 700;
  padding: 4px 8px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.vpn-btn:hover {
  background: var(--accent, #c9d92e);
  color: #1a1a1a;
  border-color: var(--accent, #c9d92e);
}
.vpn-btn-ghost {
  background: transparent;
  color: var(--text-mute);
  border-color: rgba(255,255,255,0.1);
  padding: 4px 7px;
}
.vpn-btn-ghost:hover {
  background: var(--panel-3);
  color: var(--text);
  border-color: var(--border);
}

/* When Now Playing is present, the video gets a sensible cap so the panel
   stays visible. The existing :has(.vp-comments-section) rule already caps
   at 60%; we apply a softer cap when only Now Playing is below. */
.video-panel:has(.vp-now-playing):not(:has(.vp-comments-section)) .vp-player-wrap {
  flex: 1 1 auto;
  max-height: calc(100% - 120px);
}

/* Comments section — the bottom half when feedback exists */
.vp-comments-section {
  flex: 1 1 40%;
  min-height: 120px;
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.vp-filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  background: var(--panel-3);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  flex-shrink: 0;
}
.vp-filter-label {
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
}
.vp-filter-select {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  padding: 4px 8px;
  font-family: inherit;
  font-size: 12px;
}
.vp-filter-select:focus { outline: none; border-color: var(--yellow); }
.vp-filter-clear {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-mute);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
}
.vp-filter-clear:hover { color: var(--white); border-color: var(--white); }

.vp-comments-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.vp-comments-empty {
  color: var(--text-faint);
  font-size: 12px;
  font-style: italic;
  text-align: center;
  padding: 14px 0;
}

/* v3.8r2 — Whole-card-clickable comment */
.vp-comment-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.12s ease;
  position: relative;
}
.vp-comment-card:hover {
  border-color: var(--yellow);
  background: rgba(229, 255, 0, 0.04);
  transform: translateX(2px);
}
.vp-comment-card:hover .vp-comment-time-badge {
  background: var(--yellow);
  color: var(--black);
}
.vp-comment-card.comment-mine {
  border-left: 2px solid var(--blue);
}
.vp-comment-card.comment-external {
  border-left: 2px solid #f59e0b;
}

.vp-comment-head {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 6px;
  font-size: 11px;
}
.vp-comment-time-badge {
  background: var(--black);
  color: var(--yellow);
  padding: 2px 9px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  transition: all 0.12s ease;
}
.vp-comment-seg-badge {
  background: var(--blue);
  color: var(--white);
  padding: 2px 8px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.vp-comment-seg-badge:hover { background: var(--white); color: var(--black); }
.vp-comment-author {
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
}
.vp-comment-time {
  color: var(--text-dim);  /* v3.21: bumped from --text-faint */
  margin-left: auto;
  font-size: 10px;
}
.vp-comment-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--white);
}

/* v3.15 — Active segment highlighted by video timeupdate sync */
.segment-card.segment-active {
  background: rgba(229, 255, 0, 0.06);
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px var(--yellow), 0 0 12px rgba(229, 255, 0, 0.15);
  position: relative;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.segment-card.segment-active::before {
  content: "▶ now playing";
  position: absolute;
  top: -8px;
  left: 8px;  /* v3.21: moved from right→left to avoid colliding with .segment-tools row */
  background: var(--yellow);
  color: var(--black);
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  font-family: "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  z-index: 2;
}

/* v3.14 — Category badge on video comments */
.comment-cat-badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  white-space: nowrap;
}

/* v3.14 — Category dropdown in video composer */
.vp-category-select {
  width: 100%;
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--white);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 12px;
  margin-bottom: 6px;
}
.vp-category-select:focus { outline: none; border-color: var(--yellow); }

/* Flash highlight when scrolling to a segment from a video comment badge */
.segment-card.segment-highlight-flash {
  animation: segFlash 1.2s ease-out;
}
@keyframes segFlash {
  0%   { box-shadow: 0 0 0 0 rgba(229, 255, 0, 0); }
  20%  { box-shadow: 0 0 0 4px rgba(229, 255, 0, 0.5); }
  100% { box-shadow: 0 0 0 0 rgba(229, 255, 0, 0); }
}

/* Hide the (now-unused) chat area completely */
.ws-chat-area { display: none !important; }
.ws-resizer-h { display: none !important; }

/* Bigger right pane: since chat is gone, video gets the full pane. */

/* ─────────────────────────────────────────────────────────────────────────
   v3.8r3 — Selected Event Clips block
   ───────────────────────────────────────────────────────────────────────── */

.clips-block {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
}
.clips-block > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-2);
  border-bottom: 1px solid transparent;
  font-weight: 600;
  font-size: 13px;
  user-select: none;
}
.clips-block > summary::-webkit-details-marker { display: none; }
.clips-block > summary::before {
  content: "▸";
  color: var(--text-mute);
  font-size: 10px;
  width: 12px;
  transition: transform 0.12s ease;
}
.clips-block[open] > summary::before { transform: rotate(90deg); }
.clips-block[open] > summary { border-bottom-color: var(--border); }
.clips-block > summary:hover { background: var(--panel-3); }
.clips-count {
  background: var(--yellow);
  color: var(--black);
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-left: auto;
}
.clips-block-body { padding: 14px 16px; }
.clips-hint {
  color: var(--text-mute);
  font-size: 11px;
  margin-bottom: 10px;
  font-style: italic;
}
.clips-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 360px;
  overflow-y: auto;
}
.clip-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  transition: border-color 0.12s ease;
}
.clip-card:hover { border-color: var(--border-strong); }
.clip-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 11px;
  flex-wrap: wrap;
}
.clip-num {
  background: var(--black);
  color: var(--yellow);
  padding: 1px 7px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  flex-shrink: 0;
}
.clip-period {
  background: var(--panel-3);
  color: var(--text-dim);
  padding: 1px 7px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  flex-shrink: 0;
}
.clip-game {
  color: var(--text-dim);
  flex: 1;
  min-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clip-linked-segs { display: flex; gap: 4px; flex-shrink: 0; }
.clip-seg-badge {
  background: var(--blue);
  color: var(--white);
  border: 0;
  padding: 1px 8px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}
.clip-seg-badge:hover { background: var(--white); color: var(--black); }
.clip-no-link {
  color: var(--text-faint);
  font-size: 10px;
  font-style: italic;
  flex-shrink: 0;
}
.clip-reason {
  font-size: 12px;
  line-height: 1.45;
  color: var(--white);
  padding-left: 4px;
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.8r3 — Jobs management table (replaces the old simple rows)
   ───────────────────────────────────────────────────────────────────────── */

.jobs-mgmt-table {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.jobs-mgmt-header,
.jobs-mgmt-row {
  display: grid;
  grid-template-columns: 2fr 1.4fr 1.4fr 100px 100px 100px 130px;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-size: 12px;
}
.jobs-mgmt-header {
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 10px;
  color: var(--text-mute);
  font-weight: 600;
}
.jobs-mgmt-row {
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.12s ease;
}
.jobs-mgmt-row:last-child { border-bottom: 0; }
.jobs-mgmt-row:hover { background: rgba(229, 255, 0, 0.04); }
.jobs-mgmt-row:hover .jmr-action-btn { opacity: 1; }

.jmr-title-main {
  font-weight: 600;
  color: var(--white);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jmr-client {
  display: flex; align-items: center; gap: 8px;
  font-weight: 500;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jmr-project {
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jmr-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.jmr-action-btn {
  width: 28px; height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-mute);
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.12s ease;
  display: flex; align-items: center; justify-content: center;
  font-family: inherit;
  font-size: 13px;
}
.jmr-action-btn:hover {
  background: var(--black);
  color: var(--yellow);
  border-color: var(--yellow);
  opacity: 1;
}
.jmr-action-del:hover {
  background: #dc2626;
  color: var(--white);
  border-color: #dc2626;
}
.jmr-video-btn { color: var(--blue-soft); }

@media (max-width: 1100px) {
  .jobs-mgmt-header,
  .jobs-mgmt-row {
    grid-template-columns: 1.6fr 1.2fr 1.2fr 90px 90px 90px 120px;
    font-size: 11px;
  }
}

/* Videos popup inside a modal */
.jvp-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.jvp-tab {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  transition: all 0.12s ease;
}
.jvp-tab.active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}
.jvp-tab:hover:not(.active) { background: var(--panel-3); }
.jvp-player {
  background: #000;
  border-radius: var(--radius-sm);
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.jvp-player video,
.jvp-player iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Danger button (delete) */
.danger-btn {
  background: transparent;
  color: #fca5a5;
  border: 1px solid #7f1d1d;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.12s ease;
  margin-right: auto;  /* pushes other buttons right */
}
.danger-btn:hover {
  background: #dc2626;
  color: var(--white);
  border-color: #dc2626;
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.9 — Final Script tab + view
   ───────────────────────────────────────────────────────────────────────── */

.ws-tab-final {
  position: relative;
}
.ws-tab-badge {
  display: inline-block;
  background: var(--yellow);
  color: var(--black);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  margin-left: 6px;
  font-family: "JetBrains Mono", monospace;
}

.final-header {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.final-header-info { flex: 1; min-width: 0; }
.final-header-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 4px;
}
.final-duration {
  background: var(--black);
  color: var(--yellow);
  padding: 2px 10px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  font-weight: 700;
}
.final-header-meta {
  font-size: 11px;
  color: var(--text-mute);
}
.final-header-actions {
  display: flex; gap: 6px; flex-shrink: 0;
}
.final-header-actions .danger-btn {
  margin-right: 0;
}

.final-segments {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.final-segment-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color 0.12s ease;
}
.final-segment-card:hover { border-color: var(--border-strong); }
.final-segment-head {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 6px;
  flex-wrap: wrap;
}
.final-tiv-badge {
  background: var(--blue);
  color: var(--white);
  border: 0;
  padding: 3px 10px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
}
.final-tiv-badge:hover {
  background: var(--yellow);
  color: var(--black);
}
.final-index-badge {
  background: var(--black);
  color: var(--text-mute);
  padding: 2px 7px;
  border-radius: 3px;
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
}
.final-meta-tag {
  background: var(--panel-3);
  color: var(--text-dim);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
}
.final-segment-body {
  font-size: 13px;
  line-height: 1.55;
  color: var(--white);
}

/* v3.9 — Final segment markers on the video timeline (blue, distinct from yellow comments) */
.vp-timeline-marker-final {
  background: var(--blue) !important;
  border-color: var(--white) !important;
}
.vp-timeline-marker-final:hover {
  background: var(--white) !important;
}

/* Upload modal extras */
.modal-warning {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid #f59e0b;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: #fbbf24;
  margin-bottom: 14px;
}
.modal-error {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid #dc2626;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: #fca5a5;
  margin-top: 10px;
}
.form-hint {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 4px;
}
.fsm-video-choice { display: flex; flex-direction: column; gap: 4px; }
.fsm-video-option {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
}
.fsm-video-option input[type="radio"] {
  width: auto; margin: 0; flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.9r2 — Script view toggle (Final / Draft) inside Script tab
   ───────────────────────────────────────────────────────────────────────── */

.script-view-toggle {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  padding: 4px;
  background: var(--panel-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: fit-content;
}
.svt-btn {
  background: transparent;
  border: 0;
  color: var(--text-dim);
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.12s ease;
  display: flex; align-items: center; gap: 6px;
}
.svt-btn.active {
  background: var(--blue);
  color: var(--white);
}
.svt-btn:hover:not(.active) {
  background: rgba(255,255,255,0.04);
  color: var(--white);
}
.svt-count {
  display: inline-block;
  background: rgba(255,255,255,0.12);
  color: inherit;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
}
.svt-btn.active .svt-count {
  background: rgba(0,0,0,0.25);
}

/* Final segments live inside .segment-card wrappers now —
   slight visual tweak so they look "final-y" without losing the comment chrome */
.segment-card.final-segment-wrap {
  border-left: 3px solid var(--blue);
}
.segment-card.final-segment-wrap .final-segment-head {
  padding: 10px 14px 4px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.segment-card.final-segment-wrap .segment-content {
  padding: 4px 14px 8px;
}
.segment-card.final-segment-wrap .segment-footer {
  padding: 6px 14px 10px;
}

/* ─────────────────────────────────────────────────────────────────────────
   v3.10 — Final parts tabs + Danger Zone in Settings
   ───────────────────────────────────────────────────────────────────────── */

.final-parts-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.fpt-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 6px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.12s ease;
  display: flex; align-items: center; gap: 8px;
}
.fpt-btn.active {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
}
.fpt-btn:hover:not(.active) {
  border-color: var(--text-mute);
  color: var(--white);
}
.fpt-count {
  background: rgba(255,255,255,0.12);
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  font-family: "JetBrains Mono", monospace;
}
.fpt-btn.active .fpt-count { background: rgba(0,0,0,0.25); }

/* Info banner in upload modal */
.modal-info {
  background: rgba(45, 81, 255, 0.1);
  border: 1px solid rgba(45, 81, 255, 0.3);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 12px;
  color: var(--blue-soft);
  margin-bottom: 14px;
}

/* Settings Danger Zone */
.danger-zone {
  margin-top: 40px;
  padding: 20px;
  background: rgba(220, 38, 38, 0.05);
  border: 1px solid rgba(220, 38, 38, 0.4);
  border-radius: var(--radius);
}
.danger-zone h3 {
  color: #fca5a5;
  font-size: 14px;
  margin: 0 0 4px;
  font-weight: 700;
}
.danger-zone > p {
  color: var(--text-mute);
  font-size: 12px;
  margin: 0 0 16px;
}
.danger-zone-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: var(--panel);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.danger-zone-item > div:first-child {
  flex: 1;
}
.danger-zone-item strong {
  font-size: 13px;
  display: block;
  margin-bottom: 2px;
}
.danger-zone-item .danger-btn { flex-shrink: 0; margin-right: 0; }

/* ─────────────────────────────────────────────────────────────────────────
   v3.12 — Cleaner comment composers (collapsed by default)
   ───────────────────────────────────────────────────────────────────────── */

.seg-comments-add-btn {
  background: transparent;
  border: 1px dashed var(--border);
  color: var(--text-mute);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  width: fit-content;
  transition: all 0.12s ease;
}
.seg-comments-add-btn:hover {
  border-color: var(--yellow);
  color: var(--yellow);
  background: rgba(229, 255, 0, 0.04);
}

.seg-comments-form.open {
  flex-direction: column;
  gap: 8px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 10px;
}
.seg-comments-form.open textarea {
  width: 100%;
  flex: none;
  min-height: 48px;
}
.seg-comments-form-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}
.seg-comments-form-actions .ghost-btn,
.seg-comments-form-actions .primary-btn {
  padding: 6px 12px;
  font-size: 12px;
}

/* Comment edit button (next to delete X) */
.comment-edit-btn {
  background: transparent;
  border: 0;
  color: var(--text-dim);  /* v3.21: bumped from --text-faint */
  cursor: pointer;
  font-size: 11px;
  padding: 0 4px;
  opacity: 0.55;  /* v3.21: low-but-visible by default — discoverable without hover */
  transition: opacity 0.12s ease, color 0.12s ease;
}
.comment-item:hover .comment-edit-btn,
.vp-comment-card:hover .comment-edit-btn { opacity: 1; }
.comment-edit-btn:hover { color: var(--yellow); opacity: 1; }

/* Editing-state comment card */
.comment-editing {
  background: rgba(229, 255, 0, 0.04) !important;
  border-color: var(--yellow) !important;
}
.comment-editing textarea {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  padding: 6px 10px;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  min-height: 48px;
  margin: 6px 0;
}
.comment-editing textarea:focus { outline: none; border-color: var(--yellow); }
.comment-edit-actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  margin-top: 4px;
}
.comment-edit-actions .ghost-btn,
.comment-edit-actions .primary-btn {
  padding: 5px 12px;
  font-size: 11px;
}

/* v3.17 — Job ID badge */
.job-id-badge {
  display: inline-block;
  padding: 2px 8px;
  margin-right: 6px;
  background: var(--panel-3);
  color: var(--yellow);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: "JetBrains Mono", monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  vertical-align: baseline;
}

/* v3.17 — Project detail Jobs section rows */
.proj-jobs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}
.proj-job-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.proj-job-row:hover {
  background: var(--panel-2);
  border-color: var(--yellow);
}
.proj-job-main {
  flex: 1;
  min-width: 0;
}
.proj-job-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--white);
  margin-bottom: 2px;
}
.proj-job-meta {
  font-size: 11px;
  color: var(--text-faint);
}

/* v3.17 — Thread open button */
.thread-open-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 8px 0 12px;
  padding: 6px 14px;
  background: var(--panel-2);
  color: var(--yellow);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.thread-open-btn:hover {
  background: var(--panel-3);
  border-color: var(--yellow);
}
.thread-open-hint {
  color: var(--text-faint);
  font-weight: 400;
  font-size: 11px;
}

/* v3.24 — Unified script selector. One tab strip lists every Hermes draft +
   the single Final. Picking one swaps both the script and the bound video. */
.script-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding: 4px 0 10px;
  border-bottom: 1px solid var(--border);
}
.script-sel-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  max-width: 280px;
}
.script-sel-tab:hover {
  background: var(--panel-3);
  color: var(--text);
  border-color: var(--text-mute);
}
.script-sel-tab.active {
  background: var(--yellow);
  color: #1a1a1a;
  border-color: var(--yellow);
  box-shadow: 0 0 0 1px rgba(229,255,0,0.4), 0 0 12px rgba(229,255,0,0.15);
}
.script-sel-tab .ssi { font-size: 13px; line-height: 1; }
.script-sel-tab .ssl {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.script-sel-tab .ssc {
  display: inline-block;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  background: rgba(0,0,0,0.25);
  color: inherit;
  border-radius: 999px;
  opacity: 0.85;
}
.script-sel-tab.active .ssc { background: rgba(26,26,26,0.18); }

/* v3.78 — Hover-visible delete affordance on each script tab */
.script-sel-tab .ssd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px;
  margin-left: 2px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-mute);
  background: transparent;
  opacity: 0;
  transition: opacity 0.12s, background 0.12s, color 0.12s;
  cursor: pointer;
}
.script-sel-tab:hover .ssd,
.script-sel-tab:focus-within .ssd { opacity: 0.85; }
.script-sel-tab .ssd:hover {
  background: rgba(255,60,60,0.18);
  color: #ff6868;
  opacity: 1;
}
.script-sel-tab.active .ssd { color: rgba(26,26,26,0.55); }
.script-sel-tab.active .ssd:hover {
  background: rgba(180,30,30,0.85);
  color: #fff;
}
.script-sel-tab-final {
  border-left: 3px solid var(--blue);
}
.script-sel-tab-final.active {
  background: var(--yellow);
  border-left-color: var(--yellow);
}

/* v3.18 — Multi-Hermes filter input above the tabs */
.script-tabs-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
}
.hermes-tab-filter {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-family: inherit;
  max-width: 280px;
}
.hermes-tab-filter:focus {
  outline: none;
  border-color: var(--yellow);
}

/* v3.21 — Users page filter bar */
.users-filter-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 0 14px;
  flex-wrap: wrap;
}
.users-filter-bar input,
.users-filter-bar select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-family: inherit;
  font-size: 12px;
}
.users-filter-bar input { min-width: 240px; }
.users-filter-bar input:focus,
.users-filter-bar select:focus { outline: none; border-color: var(--yellow); }
.role-pill.role-external_qa {
  background: rgba(96,165,250,0.15);
  color: #60a5fa;
}

/* v3.20 — AI Rewrite menu (per-segment popup) */
.ai-rewrite-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}
.ai-rewrite-card {
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text);
  font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.ai-rewrite-card:hover {
  background: var(--panel-3);
  border-color: var(--yellow);
}
.ai-rewrite-name {
  font-weight: 700;
  font-size: 13px;
  margin-bottom: 2px;
}
.ai-rewrite-desc {
  font-size: 11px;
  color: var(--text-dim);
  line-height: 1.4;
}
#aiRewriteModal.open .modal-thread {
  max-width: 540px;
  width: 540px;
  height: auto;
  max-height: 80vh;
}
.segment-rewrite-btn {
  padding: 2px 8px !important;
  font-size: 11px !important;
  color: #fde68a !important;
  border-color: rgba(251,191,36,0.3) !important;
}
.segment-rewrite-btn:hover {
  background: rgba(251,191,36,0.15) !important;
  border-color: var(--yellow) !important;
}

/* v3.29 — Custom-model fallback input shown under the model dropdown when
   the user picks "Custom…". */
.model-custom-input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: 4px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
}
.model-custom-input:focus { outline: none; border-color: var(--accent); }
.model-custom-input[hidden] { display: none; }

/* v3.26 — Notification bell + feed drawer */
.brand { position: relative; }
.notif-bell {
  position: absolute;
  top: 8px;
  right: 14px;
  width: 30px;
  height: 30px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  padding: 0;
}
.notif-bell svg { width: 16px; height: 16px; }
.notif-bell:hover { background: var(--panel-3); color: var(--text); border-color: var(--accent); }
.notif-bell.has-unread { color: var(--accent); border-color: var(--accent-border); }
.notif-bell-count {
  position: absolute;
  top: -5px; right: -5px;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  background: #ef4444;             /* v3.33: red, harder to miss than the accent yellow */
  color: #ffffff;
  border: 1.5px solid var(--panel);  /* punches out from the bell so it reads as a real badge */
  border-radius: 999px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.4);
}
/* v3.33 — critical: without this, `display: flex` above overrides the
   browser's [hidden] default (same bug as the drawer fixed in v3.28.2),
   leaving the badge stuck on "0" even when there are no unread items. */
.notif-bell-count[hidden] { display: none !important; }
.layout.sidebar-collapsed .notif-bell { right: 10px; top: 6px; width: 28px; height: 28px; }

/* v3.28 — Backdrop catches clicks outside the drawer to close it. */
.notif-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 199;
  cursor: pointer;
  animation: notif-backdrop-in 0.12s ease-out;
}
@keyframes notif-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.notif-drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 380px;
  max-width: 95vw;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  flex-direction: column;
  animation: notif-drawer-in 0.16s ease-out;
}
/* v3.28.2 — Critical: without this, `display: flex` above overrides the
   browser's default `[hidden] { display: none }`, leaving the drawer
   permanently visible. That's why the X / backdrop / Esc all appeared
   to do nothing — they were toggling the attribute, but CSS ignored it. */
.notif-drawer[hidden] { display: none !important; }
@keyframes notif-drawer-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
.notif-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.notif-drawer-title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.notif-drawer-actions { display: flex; align-items: center; gap: 6px; }
.notif-drawer-actions .ghost-btn { padding: 4px 10px; font-size: 11px; }
.notif-drawer-close {
  background: transparent;
  border: 0;
  color: var(--text-mute);
  cursor: pointer;
  font-size: 14px;
  padding: 0 6px;
}
.notif-drawer-close:hover { color: var(--text); }
.notif-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px 8px 16px;
}
.notif-item {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 6px;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: background 0.1s, border-color 0.1s;
}
.notif-item:hover { background: var(--panel-2); }
.notif-item.notif-unread {
  border-left: 3px solid var(--accent);
  background: rgba(201,217,46,0.04);
}
.notif-item-icon { font-size: 16px; line-height: 1.2; flex-shrink: 0; }
.notif-item-body { flex: 1; min-width: 0; cursor: pointer; }
.notif-item-headline {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
}
.notif-item-headline strong { font-weight: 700; }
.notif-item-headline em { font-style: normal; color: var(--accent); }
.notif-item-preview {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  padding: 4px 8px;
  background: var(--panel-2);
  border-left: 2px solid var(--border);
  border-radius: 0 4px 4px 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 60px;
  overflow: hidden;
}
.notif-item-meta {
  font-size: 11px;
  color: var(--text-mute);
  margin-top: 4px;
}
.notif-item-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-end;
  flex-shrink: 0;
}
.notif-act {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 22px; height: 22px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.notif-act:hover { background: var(--accent); color: #1a1a1a; border-color: var(--accent); }
.notif-act-dismiss:hover { background: #ef4444; color: var(--white); border-color: #ef4444; }

/* v3.35 — Segment "Covers" row. Each segment in a generated script reveals
   which numbered key moments it narrates, with a short preview of the
   moment text. Click → scrolls to that moment in the Key Moments panel. */
.segment-covers {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
  padding: 8px 14px 10px;
  margin-top: 6px;
  background: rgba(201,217,46,0.05);
  border-top: 1px dashed var(--border);
  font-size: 11px;
}
.segment-covers .covers-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin-right: 4px;
}
.segment-covers .covers-hint {
  color: var(--text-faint);
  font-style: italic;
}
.segment-covers .moment-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  color: var(--text-dim);
  font-size: 11px;
  cursor: pointer;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.segment-covers .moment-link:hover {
  background: var(--accent-soft);
  color: var(--text);
  border-color: var(--accent);
}
.segment-covers .moment-link strong {
  color: var(--accent);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-weight: 700;
}
.segment-covers-empty {
  background: var(--panel-2);
  color: var(--text-mute);
}

/* v3.35 — Generated tab + selector variant */
.ws-tab-count {
  display: inline-block;
  background: var(--accent);
  color: #1a1a1a;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 999px;
  margin-left: 4px;
  vertical-align: 1px;
}
.script-sel-tab-generated {
  border-left: 3px solid var(--accent);
}
.script-sel-tab-generated.active {
  background: var(--accent);
  color: #1a1a1a;
  border-left-color: var(--accent);
}

/* v3.34 — Hermes-view toolbar: thread + generate button on one row. */
.hermes-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 8px 0 12px;
}
.hermes-toolbar .thread-open-btn { margin: 0; }
.generate-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: linear-gradient(135deg, var(--accent), #b8c423);
  color: #1a1a1a;
  border: 1px solid var(--accent-strong);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s, transform 0.08s;
}
.generate-btn:hover:not(:disabled) {
  background: var(--accent-strong);
  transform: translateY(-1px);
}
.generate-btn:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}
.generated-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.05em;
}
/* v3.38 — Change video + Convert to Final buttons in the script toolbar */
.change-video-btn {
  padding: 6px 12px !important;
  font-size: 12px !important;
  font-weight: 600;
}
.promote-btn {
  padding: 6px 14px !important;
  font-size: 12px !important;
  font-weight: 700;
  background: var(--blue) !important;
  color: var(--white) !important;
  border-color: var(--blue) !important;
}
.promote-btn:hover {
  background: var(--blue-light) !important;
  border-color: var(--blue-light) !important;
}

/* v3.25 — Open external-feedback badge (jobs list + dashboard active jobs) */
.ext-feedback-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  margin-left: 8px;
  background: rgba(201, 217, 46, 0.12);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  vertical-align: 2px;
}
.jobs-mgmt-row.has-open-feedback {
  border-left: 3px solid var(--accent);
}

/* v3.20 — Banner inside QA result when default rules were used as fallback */
.qa-default-banner {
  margin-top: 8px;
  padding: 8px 12px;
  border-left: 3px solid var(--yellow);
  background: rgba(251, 191, 36, 0.10);
  color: var(--yellow);
  font-size: 12px;
  border-radius: 0 4px 4px 0;
}

/* v3.19 — Quote block inside thread messages (when message starts with "> ") */
.thread-msg-quote {
  margin: 4px 0 6px;
  padding: 6px 10px;
  border-left: 3px solid var(--yellow);
  background: rgba(251, 191, 36, 0.08);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
  border-radius: 0 4px 4px 0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* v3.18 — Per-segment shortcut to the script-wide thread */
.segment-thread-btn {
  padding: 2px 8px !important;
  font-size: 11px !important;
  margin-left: auto;
  color: var(--yellow) !important;
}
.segment-thread-btn:hover {
  border-color: var(--yellow) !important;
}

/* v3.18 — Apply-revision button states inside QA flagged items */
.qa-apply-btn.applied {
  background: var(--panel-3);
  color: var(--text-faint);
  cursor: default;
}
.qa-history-row:hover {
  background: var(--panel-2);
}

/* v3.17 — Thread modal (Slack-style side panel) */
#threadModal.open .modal-thread {
  max-width: 560px;
  width: 560px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  padding: 0;
}
.thread-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.thread-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  margin-bottom: 4px;
}
.thread-hint {
  font-size: 11px;
  color: var(--text-faint);
  max-width: 420px;
  line-height: 1.4;
}
.thread-hint code {
  background: var(--panel-3);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--yellow);
  font-family: "JetBrains Mono", monospace;
  font-size: 10px;
}
.thread-close-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 8px;
}
.thread-close-btn:hover { color: var(--white); }

.thread-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.thread-loading, .thread-empty {
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
  padding: 30px 10px;
}
.thread-empty code {
  background: var(--panel-3);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--yellow);
}

.thread-msg {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.thread-msg-mine {
  background: rgba(229, 255, 0, 0.05);
  border-color: rgba(229, 255, 0, 0.3);
}
.thread-msg-atlas {
  background: rgba(99, 102, 241, 0.06);
  border-color: rgba(99, 102, 241, 0.35);
}
.thread-msg-system {
  background: var(--panel);
  border-style: dashed;
  font-size: 11px;
  color: var(--text-dim);  /* v3.21: bumped from --text-faint (was unreadable on dim bg) */
}
.thread-msg-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.thread-msg-author {
  font-size: 12px;
  font-weight: 600;
  color: var(--white);
}
.thread-msg-atlas .thread-msg-author { color: #c7d2fe; }
.thread-msg-time {
  font-size: 10px;
  color: var(--text-faint);
}
.thread-msg-head .comment-del {
  margin-left: auto;
}
.thread-msg-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--white);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.thread-composer {
  border-top: 1px solid var(--border);
  padding: 12px 18px;
  flex-shrink: 0;
  background: var(--panel-2);
}
.thread-composer textarea {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  margin-bottom: 8px;
}
.thread-composer textarea:focus {
  outline: none;
  border-color: var(--yellow);
}
.thread-composer-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

/* ─── v3.41 — Edit Decision List (right-pane editor) ───────────────────── */

.vp-edl-toggle {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.vp-edl-toggle:hover {
  color: var(--black);
  background: var(--accent);
  border-color: var(--accent);
}
.vp-edl-toggle.is-on {
  color: var(--black);
  background: var(--accent);
  border-color: var(--accent);
}

.edl-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  overflow: hidden;
}
.edl-header {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.edl-title strong {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.edl-title .row-meta {
  display: block;
  margin-top: 2px;
  font-size: 11px;
}
.edl-header-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.edl-header-actions .ghost-btn,
.edl-header-actions .primary-btn {
  padding: 5px 10px;
  font-size: 11px;
}
.edl-header-actions .primary-btn[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}

.edl-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--text-mute);
  font-size: 13px;
}
.edl-empty p { margin: 0 0 12px; }
.edl-empty-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.edl-clip-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px 10px 16px;
}
.edl-clip-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  margin-bottom: 6px;
  transition: background 0.12s, opacity 0.12s, border-color 0.12s;
}
.edl-clip-card:hover {
  border-color: var(--border-strong);
}
.edl-clip-card.is-skipped {
  opacity: 0.5;
  background: var(--panel);
}
.edl-clip-card.is-external {
  border-left: 3px solid var(--blue);
}
.edl-clip-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}
.edl-clip-index {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-faint);
  min-width: 22px;
  text-align: center;
  background: var(--panel-3);
  padding: 3px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.edl-clip-info {
  flex: 1;
  min-width: 0;
}
.edl-clip-label {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.edl-clip-meta {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 2px;
  display: flex;
  gap: 8px;
}
.edl-clip-src {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-mute);
}
.edl-clip-src-external { color: var(--blue-soft); }

.edl-clip-controls {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.edl-icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  width: 26px;
  height: 26px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s ease;
}
.edl-icon-btn:hover:not([disabled]) {
  background: var(--accent);
  color: var(--black);
  border-color: var(--accent);
}
.edl-icon-btn[disabled] {
  opacity: 0.25;
  cursor: not-allowed;
}
.edl-icon-btn.is-on {
  background: var(--panel-3);
  color: var(--accent);
  border-color: var(--border);
}
.edl-icon-btn-danger:hover:not([disabled]) {
  background: #c33;
  color: #fff;
  border-color: #c33;
}

/* v3.43 — In-panel "+ External clip" form */
.edl-external-form {
  margin: 8px 10px;
  padding: 12px 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 7px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.edl-external-form-title {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 700;
  margin-bottom: 4px;
}
.edl-external-form label {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  margin-top: 4px;
}
.edl-external-form input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 9px;
  border-radius: 5px;
  outline: none;
}
.edl-external-form input:focus {
  border-color: var(--accent);
}
.edl-external-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  margin-top: 8px;
}
.edl-external-form-actions .ghost-btn,
.edl-external-form-actions .primary-btn {
  padding: 5px 12px;
  font-size: 11.5px;
}

/* v3.44 — Per-clip drawer (label, trim, ops). Click anywhere on the clip
   row to open; controls in the row stop propagation. */
.edl-clip-row { cursor: pointer; }
.edl-clip-card.is-expanded {
  border-color: var(--accent);
  background: var(--panel);
}
.edl-clip-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  color: var(--text-faint);
  font-size: 12px;
  flex-shrink: 0;
}
.edl-clip-op-badge {
  display: inline-block;
  background: var(--accent);
  color: var(--black);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 8px;
  margin-left: 6px;
}

.edl-clip-drawer {
  padding: 10px 12px 12px;
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12px;
}
.edl-drawer-row { display: flex; flex-direction: column; gap: 4px; }
.edl-drawer-row > label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 700;
}
.edl-drawer-row > label .row-meta { text-transform: none; letter-spacing: 0; font-weight: 500; }
.edl-drawer-row > input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 12.5px;
  padding: 6px 9px;
  border-radius: 5px;
  outline: none;
}
.edl-drawer-row > input[type="text"]:focus { border-color: var(--accent); }

.edl-trim-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 6px;
  align-items: end;
}
.edl-trim-cell { display: flex; flex-direction: column; gap: 2px; }
.edl-trim-label {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.edl-trim-cell input {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  padding: 5px 7px;
  border-radius: 4px;
  outline: none;
  width: 100%;
  box-sizing: border-box;
}
.edl-trim-cell input:focus { border-color: var(--accent); }
.edl-clip-drawer-duration {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--text);
  padding: 5px 0;
  font-weight: 600;
}
.edl-trim-test { padding: 5px 10px; font-size: 11px; white-space: nowrap; }

/* Op chips + add-op form */
.edl-op-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.edl-op-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel-3);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11.5px;
  padding: 4px 4px 4px 9px;
  border-radius: 999px;
  max-width: 100%;
}
.edl-op-chip-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}
.edl-op-chip-x {
  background: transparent;
  border: 0;
  color: var(--text-faint);
  width: 18px;
  height: 18px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 11px;
  transition: all 0.12s ease;
}
.edl-op-chip-x:hover { background: #c33; color: #fff; }

.edl-add-op-btn { margin-top: 4px; padding: 5px 12px; font-size: 11.5px; }

.edl-add-op-form {
  margin-top: 6px;
  padding: 10px;
  background: var(--bg);
  border: 1px solid var(--accent-border, var(--accent));
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.edl-add-op-head {
  display: flex;
  align-items: center;
  gap: 8px;
}
.edl-add-op-head select {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 5px;
}
.edl-op-form-x {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  width: 26px;
  height: 26px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
}
.edl-op-form-x:hover { background: var(--panel-3); }
.edl-add-op-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.edl-op-field-label {
  font-size: 10px;
  color: var(--text-faint);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.edl-add-op-body input,
.edl-add-op-body select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 5px;
  outline: none;
}
.edl-add-op-body input:focus,
.edl-add-op-body select:focus { border-color: var(--accent); }
.edl-op-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.edl-add-op-actions { display: flex; justify-content: flex-end; }
.edl-add-op-actions .primary-btn { padding: 5px 14px; font-size: 11.5px; }

/* ─── v3.46 — Audio generation in the workspace ─────────────────────── */
.audio-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  margin: 8px 0 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 7px;
}
.audio-toolbar-label { font-size: 12px; color: var(--text); }
.audio-toolbar-label strong { font-weight: 700; }
.audio-toolbar .audio-pick {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 12px;
  padding: 5px 8px;
  border-radius: 5px;
  max-width: 260px;
}
.audio-toolbar .audio-pick:focus { border-color: var(--accent); outline: none; }
.audio-toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 4px;
}
.audio-toolbar .ghost-btn,
.audio-toolbar .primary-btn { padding: 5px 12px; font-size: 11.5px; }

.audio-toolbar-wrap { margin: 8px 0 14px; }
.audio-toolbar-wrap .audio-toolbar { margin: 0; }

.audio-status-banner {
  position: relative;
  margin-top: 8px;
  padding: 10px 14px;
  font-size: 12px;
  line-height: 1.55;
  border-radius: 6px;
  word-break: break-word;
}
.audio-status-banner strong { font-weight: 600; }
.audio-status-banner-warn {
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.5);
  color: #fde68a;
}
.audio-status-banner-error {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  padding-right: 36px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  white-space: pre-wrap;
}
.audio-status-banner-x {
  position: absolute;
  top: 6px;
  right: 8px;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  padding: 2px 6px;
  border-radius: 4px;
}
.audio-status-banner-x:hover { background: rgba(0,0,0,0.2); }

/* Segment-card additions */
.segment-audio-check {
  display: inline-flex;
  align-items: center;
  margin-right: 6px;
  cursor: pointer;
}
.segment-audio-check input[type="checkbox"] {
  width: 14px;
  height: 14px;
  cursor: pointer;
}
.segment-audio-btn {
  padding: 4px 10px;
  font-size: 11px;
}
.segment-audio-btn.has-audio {
  border-color: var(--accent);
  color: var(--accent);
}
.segment-audio-btn[disabled] { opacity: 0.6; cursor: wait; }

.segment-audio-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  margin-top: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}
.segment-audio-row audio {
  flex: 1;
  height: 32px;
  max-width: 360px;
}
.segment-audio-meta {
  font-size: 10.5px;
  color: var(--text-faint);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.segment-audio-del {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-faint);
  width: 24px;
  height: 24px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}
.segment-audio-del:hover { background: #c33; color: #fff; border-color: #c33; }

.spinner-mini {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--text-faint);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── v3.45 — Voices admin page ──────────────────────────────────────── */
.voice-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 10px;
  transition: border-color 0.12s;
}
.voice-card:hover { border-color: var(--border-strong); }
.voice-card.is-expanded { border-color: var(--accent); }
.voice-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  cursor: pointer;
}
.voice-card-info { flex: 1; min-width: 0; }
.voice-card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.voice-card-desc {
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.45;
}
.voice-card-meta {
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 6px;
}
.voice-card-controls { display: flex; gap: 6px; flex-shrink: 0; }
.voice-card-controls .ghost-btn,
.voice-card-controls .danger-btn { padding: 4px 10px; font-size: 11px; }
.voice-card-chev {
  color: var(--text-faint);
  font-size: 12px;
  width: 14px;
  text-align: center;
}
.voice-card-body {
  border-top: 1px solid var(--border);
  background: var(--panel-2);
  padding: 14px 16px;
}

.voice-section { margin-bottom: 16px; }
.voice-section:last-child { margin-bottom: 0; }
.voice-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.voice-section-head strong {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text);
}
.voice-section-head .ghost-btn { padding: 4px 10px; font-size: 11px; }

.voice-sample-list, .voice-prompt-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.voice-sample-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.voice-sample-info { min-width: 0; }
.voice-sample-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.voice-sample-meta {
  font-size: 10.5px;
  color: var(--text-faint);
  margin-top: 2px;
}
.voice-sample-row audio { width: 240px; max-width: 30vw; }
.voice-sample-actions { display: flex; gap: 6px; }
.voice-sample-actions .ghost-btn,
.voice-sample-actions .danger-btn { padding: 4px 10px; font-size: 11px; }

.voice-prompt-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.voice-prompt-info { flex: 1; min-width: 0; }
.voice-prompt-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.voice-prompt-preview {
  font-size: 11.5px;
  color: var(--text-dim);
  margin-top: 4px;
  line-height: 1.5;
  font-style: italic;
}
.voice-prompt-actions { display: flex; gap: 6px; flex-shrink: 0; }
.voice-prompt-actions .ghost-btn,
.voice-prompt-actions .danger-btn { padding: 4px 10px; font-size: 11px; }

.voices-prompts-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.voices-section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.voices-section-title .row-meta { font-size: 11px; font-weight: 400; }

/* ─── v3.49 — Studio (full-viewport editor) ──────────────────────────────
   Overlays the entire viewport when active. Three-column grid:
   left media bin · center main (preview + timeline + transcript) · right properties. */
.studio {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: var(--bg);
  color: var(--text);
  display: grid;
  grid-template-rows: 50px 1fr;
  overflow: hidden;
}
.studio[hidden] { display: none; }

.studio-top-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: var(--grey-1);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 var(--border);
}
.studio-back-btn {
  background: transparent;
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 5px 12px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.studio-back-btn:hover {
  background: var(--panel-3);
  border-color: var(--accent);
}
.studio-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}
.studio-title strong { color: var(--text); }
.studio-title .row-meta { font-size: 11.5px; }
.studio-top-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.studio-top-actions .ghost-btn,
.studio-top-actions .primary-btn {
  padding: 5px 12px;
  font-size: 12px;
}
.studio-top-actions .studio-mode-btn {
  border-radius: 999px;
}
.studio-top-actions .studio-mode-btn.is-active {
  background: rgba(201, 217, 46, 0.14);
  border-color: rgba(201, 217, 46, 0.55);
  color: var(--text);
}
.studio-dirty-pill {
  background: var(--accent);
  color: var(--black);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.studio-body {
  display: grid;
  grid-template-columns: 240px 1fr 300px;
  min-height: 0;
  overflow: hidden;
}
.studio-body.left-collapsed   { grid-template-columns: 36px 1fr 300px; }
.studio-body.right-collapsed  { grid-template-columns: 240px 1fr 36px; }
.studio-body.left-collapsed.right-collapsed { grid-template-columns: 36px 1fr 36px; }

.studio-left, .studio-right {
  background:
    radial-gradient(circle at 20% 0%, rgba(201, 217, 46, 0.045), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,0.025), rgba(255,255,255,0.008)),
    var(--panel);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.studio-right {
  border-right: 0;
  border-left: 1px solid var(--border);
}
.studio-body.left-collapsed .studio-left > :not(.studio-panel-header),
.studio-body.right-collapsed .studio-right > :not(.studio-panel-header) {
  display: none !important;
}
.studio-body.left-collapsed .studio-left,
.studio-body.right-collapsed .studio-right {
  overflow: hidden;
}
.studio-body.left-collapsed .studio-left .studio-panel-header,
.studio-body.right-collapsed .studio-right .studio-panel-header {
  justify-content: center;
  padding: 0;
  font-size: 0;
  height: 100%;
  writing-mode: vertical-rl;
}
.studio-body.left-collapsed .studio-left .studio-panel-collapse,
.studio-body.right-collapsed .studio-right .studio-panel-collapse {
  margin: 0;
  font-size: 13px;
  width: 28px;
  height: 28px;
}

.studio-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
  flex-shrink: 0;
  background: rgba(255,255,255,0.025);
  backdrop-filter: blur(10px);
}
.studio-panel-collapse {
  margin-left: auto;
  background: rgba(255,255,255,0.035);
  border: 1px solid rgba(255,255,255,0.075);
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 3px 7px;
  border-radius: 999px;
}
.studio-panel-collapse:hover {
  background: rgba(201, 217, 46, 0.13);
  border-color: rgba(201, 217, 46, 0.45);
  color: var(--text);
}

/* Left panel (media bin) — list of source clips */
.studio-bin-section { padding: 10px 10px 2px; }
.studio-bin-section-title {
  padding: 4px 4px 8px;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 700;
}
.studio-bin-item {
  display: flex;
  gap: 8px;
  padding: 8px 9px;
  margin-bottom: 6px;
  cursor: pointer;
  font-size: 12px;
  border: 1px solid rgba(255,255,255,0.065);
  border-radius: 10px;
  background: rgba(255,255,255,0.025);
  transition: background 0.1s, border-color 0.1s, transform 0.1s;
  align-items: center;
}
.studio-bin-item:hover {
  background: rgba(201, 217, 46, 0.06);
  border-color: rgba(201, 217, 46, 0.35);
  transform: translateY(-1px);
}
.studio-bin-item-index {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--accent);
  background: rgba(201, 217, 46, 0.09);
  border: 1px solid rgba(201, 217, 46, 0.14);
  padding: 2px 6px;
  border-radius: 999px;
  font-weight: 700;
  flex-shrink: 0;
}
.studio-bin-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.studio-bin-item-meta {
  font-size: 10px;
  color: var(--text-faint);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  flex-shrink: 0;
}
.source-library-card {
  border: 1px solid rgba(201, 217, 46, 0.16);
  border-radius: 14px;
  background:
    radial-gradient(circle at 10% 0%, rgba(201, 217, 46, 0.10), transparent 38%),
    rgba(255,255,255,0.028);
  padding: 12px;
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.source-library-card:hover {
  transform: translateY(-1px);
  border-color: rgba(201, 217, 46, 0.42);
  background: rgba(201, 217, 46, 0.055);
}
.source-library-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.source-library-card-top strong {
  display: block;
  margin-top: 3px;
  font-size: 18px;
  color: var(--text);
}
.source-library-card-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.source-library-card-meta span {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(255,255,255,0.055);
  color: var(--text-dim);
  font-size: 10px;
  font-weight: 700;
}
.source-library-card-hint {
  margin-top: 10px;
  color: var(--text-mute);
  font-size: 11px;
  line-height: 1.45;
}

.source-library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.source-library-head h2 {
  margin: 3px 0 4px;
}
.source-library-tools {
  position: sticky;
  top: 0;
  z-index: 2;
  display: grid;
  gap: 10px;
  padding: 10px 0 12px;
  background: var(--panel);
}
.source-library-tools input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.035);
  color: var(--text);
  padding: 11px 12px;
  outline: none;
}
.source-library-tools input:focus { border-color: rgba(201, 217, 46, 0.55); }
.source-library-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.source-library-filters .ghost-btn {
  border-radius: 999px;
  padding: 6px 10px;
}
.source-library-filters .ghost-btn.is-active {
  border-color: rgba(201, 217, 46, 0.6);
  background: rgba(201, 217, 46, 0.12);
  color: var(--text);
}
.source-library-filters .ghost-btn span {
  margin-left: 5px;
  color: var(--text-mute);
  font-family: ui-monospace, monospace;
}
.source-library-results {
  display: grid;
  gap: 9px;
  max-height: min(62vh, 640px);
  overflow: auto;
  padding-right: 4px;
}
.source-library-clip {
  display: grid;
  grid-template-columns: auto 44px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255,255,255,0.075);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.018));
  padding: 10px;
  cursor: pointer;
}
.source-library-clip.has-bulk {
  grid-template-columns: auto auto 44px minmax(0, 1fr) auto auto;
}
.source-library-clip:hover {
  border-color: rgba(201, 217, 46, 0.35);
  background: rgba(201, 217, 46, 0.045);
}
.source-library-clip-index {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: rgba(201, 217, 46, 0.10);
  color: var(--accent);
  font-family: ui-monospace, monospace;
  font-weight: 800;
  font-size: 12px;
}
.source-library-clip-main { min-width: 0; }
.source-library-clip-title {
  color: var(--text);
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-library-clip-meta {
  color: var(--text-dim);
  font-size: 11px;
  margin-top: 3px;
}
.source-library-clip-desc {
  color: var(--text-mute);
  font-size: 11px;
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.source-library-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
  max-width: 210px;
}
.source-library-badge {
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.035);
  font-size: 10px;
  font-weight: 750;
}
.source-library-badge.is-used { color: #bfdbfe; border-color: rgba(96,165,250,0.35); background: rgba(96,165,250,0.10); }
.source-library-badge.is-timed { color: #bbf7d0; border-color: rgba(74,222,128,0.35); background: rgba(74,222,128,0.10); }
.source-library-badge.is-warn { color: #fde68a; border-color: rgba(251,191,36,0.32); background: rgba(251,191,36,0.09); }
.source-library-actions {
  display: flex;
  gap: 6px;
}
.source-library-actions .ghost-btn,
.source-library-actions .primary-btn {
  padding: 6px 10px;
  font-size: 11px;
}

#sourceLibraryModal .modal-thread {
  width: min(96vw, 980px);
  max-width: 980px;
}
.source-library-head-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.source-library-head-actions .ghost-btn.is-active {
  border-color: rgba(201, 217, 46, 0.6);
  background: rgba(201, 217, 46, 0.12);
}
.source-library-coverage {
  margin-bottom: 14px;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
}
.source-library-coverage-empty { padding: 8px 10px; }
.source-library-coverage-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 700;
}
.source-library-coverage-bar {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
}
.source-library-coverage-seg {
  position: absolute;
  top: 0;
  bottom: 0;
  border-radius: 2px;
  opacity: 0.95;
}
.source-library-coverage-seg.is-used {
  background: linear-gradient(180deg, #60a5fa, #3b82f6);
  box-shadow: 0 0 0 1px rgba(96,165,250,0.35);
}
.source-library-coverage-seg.is-unused {
  background: linear-gradient(180deg, rgba(201,217,46,0.55), rgba(201,217,46,0.28));
  box-shadow: 0 0 0 1px rgba(201,217,46,0.22);
}
.source-library-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 14px;
  align-items: start;
}
.source-library-main { min-width: 0; }
.source-library-side {
  position: sticky;
  top: 0;
}
.source-library-preview {
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 14px;
  overflow: hidden;
  background: #000;
}
.source-library-preview video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  object-fit: contain;
}
.source-library-preview-meta {
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  display: grid;
  gap: 4px;
}
.source-library-preview-meta strong {
  font-size: 12px;
  line-height: 1.35;
  color: var(--text);
}
.source-library-preview-empty,
.source-library-preview-no-video,
.source-library-preview-placeholder {
  display: grid;
  place-items: center;
  min-height: 158px;
  padding: 16px;
  text-align: center;
  color: var(--text-mute);
  font-size: 12px;
  background: rgba(255,255,255,0.025);
}
.source-library-toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
  align-items: flex-start;
}
.source-library-view-toggles {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.source-library-view-toggles .ghost-btn {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
}
.source-library-view-toggles .ghost-btn.is-active {
  border-color: rgba(201, 217, 46, 0.6);
  background: rgba(201, 217, 46, 0.12);
}
.source-library-bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px dashed rgba(201, 217, 46, 0.35);
  background: rgba(201, 217, 46, 0.06);
  font-size: 12px;
}
.source-library-bulk-bar label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-dim);
  cursor: pointer;
}
.source-library-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 2px 4px;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--text-mute);
}
.source-library-section-label span {
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  font-family: ui-monospace, monospace;
  letter-spacing: 0;
  text-transform: none;
}
.source-library-clip.is-previewing {
  border-color: rgba(201, 217, 46, 0.55);
  box-shadow: 0 0 0 1px rgba(201, 217, 46, 0.18);
}
.source-library-clip.is-pinned {
  background: linear-gradient(180deg, rgba(251,191,36,0.08), rgba(255,255,255,0.018));
}
.source-library-clip.is-selected {
  border-color: rgba(96,165,250,0.45);
  background: rgba(96,165,250,0.08);
}
.source-library-check {
  display: grid;
  place-items: center;
  width: 22px;
}
.source-library-check input { cursor: pointer; }
.source-library-pin {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  background: rgba(255,255,255,0.03);
  color: var(--text-mute);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}
.source-library-pin.is-active {
  color: #fbbf24;
  border-color: rgba(251,191,36,0.35);
  background: rgba(251,191,36,0.10);
}
.source-library-badge.is-editorial.is-goal { color: #fde68a; border-color: rgba(251,191,36,0.35); background: rgba(251,191,36,0.10); }
.source-library-badge.is-editorial.is-penalty { color: #fecaca; border-color: rgba(248,113,113,0.35); background: rgba(248,113,113,0.10); }
.source-library-badge.is-editorial.is-replay { color: #cbd5e1; border-color: rgba(148,163,184,0.30); background: rgba(148,163,184,0.08); }
.source-library-badge.is-editorial.is-save { color: #bfdbfe; border-color: rgba(96,165,250,0.35); background: rgba(96,165,250,0.10); }
.source-library-badge.is-editorial.is-assist { color: #ddd6fe; border-color: rgba(167,139,250,0.35); background: rgba(167,139,250,0.10); }
.source-library-badge.is-editorial.is-defense { color: #a7f3d0; border-color: rgba(52,211,153,0.30); background: rgba(52,211,153,0.08); }
.source-library-badge.is-editorial.is-turnover { color: #fdba74; border-color: rgba(251,146,60,0.30); background: rgba(251,146,60,0.08); }
.source-library-badge.is-editorial.is-highlight { color: #fbcfe8; border-color: rgba(244,114,182,0.30); background: rgba(244,114,182,0.08); }
.source-library-empty {
  text-align: center;
  padding: 28px 18px 10px;
  border: 1px dashed rgba(255,255,255,0.12);
  border-radius: 16px;
  background: rgba(255,255,255,0.02);
}
.source-library-empty.is-soft {
  padding: 22px 16px;
  margin-top: 4px;
}
.source-library-empty-icon {
  font-size: 34px;
  margin-bottom: 8px;
  opacity: 0.85;
}
.source-library-empty h3 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 16px;
}
.source-library-empty p {
  margin: 0 auto 14px;
  max-width: 420px;
  color: var(--text-mute);
  font-size: 12px;
  line-height: 1.5;
}
.source-library-empty-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}
@media (max-width: 860px) {
  .source-library-layout {
    grid-template-columns: 1fr;
  }
  .source-library-side {
    position: static;
    order: -1;
  }
}

/* Center main: preview · timeline · transcript */
.studio-main {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  min-height: 0;
  overflow: hidden;
}
.studio-preview {
  flex: 1;
  min-height: 200px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.studio-preview video {
  max-width: 100%;
  max-height: 100%;
  display: block;
}
.studio-no-video {
  color: var(--text-mute);
  font-size: 13px;
  padding: 32px;
  text-align: center;
}
.studio-no-video-setup {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text);
}
.studio-no-video-setup h3 {
  margin: 0;
  font-size: 18px;
}
.studio-no-video-setup p {
  max-width: 360px;
  margin: 0 0 6px;
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.45;
}

/* Timeline area inside the Studio */
.studio-timeline {
  flex-shrink: 0;
  /* v3.73 — match handoff mockup height (7 lanes + ruler + toolbar). */
  height: 440px;
  background: var(--grey-1);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Transcript bar — Descript-style horizontal strip of segment cards */
.studio-transcript {
  flex-shrink: 0;
  height: 120px;
  background: var(--panel);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.studio-transcript-header {
  display: flex;
  align-items: center;
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 700;
  flex-shrink: 0;
}
.studio-transcript-list {
  flex: 1;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 14px;
  scroll-behavior: smooth;
}
.studio-segment-card {
  flex: 0 0 240px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  cursor: pointer;
  transition: all 0.12s ease;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: hidden;
}
.studio-segment-card:hover { border-color: var(--accent); }
.studio-segment-card.is-active {
  border-color: var(--accent);
  background: rgba(201, 217, 46, 0.08);
  box-shadow: 0 0 0 1px var(--accent);
}
.studio-segment-card-head {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 10px;
  color: var(--text-faint);
}
.studio-segment-card-head .pill {
  font-size: 9px;
  padding: 1px 5px;
}
.studio-segment-card-text {
  font-size: 11.5px;
  color: var(--text);
  line-height: 1.45;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
}

/* Right panel (Properties) */
.studio-props-empty {
  margin: 12px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.065);
  border-radius: 14px;
  background: rgba(255,255,255,0.025);
  font-size: 12px;
  color: var(--text-mute);
  line-height: 1.55;
}
.studio-props-empty h3 {
  font-size: 14px;
  margin: 0 0 10px;
  color: var(--text);
}
.studio-props-empty p {
  margin: 0;
  color: var(--text-dim);
}
.studio-shortcuts {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.065);
}
.studio-shortcuts-title {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
  margin-bottom: 8px;
}
.studio-shortcuts dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 11px;
}
.studio-shortcuts dt {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  text-align: center;
  color: var(--text);
}
.studio-shortcuts dd { margin: 0; color: var(--text-dim); }

.studio-props-body {
  padding: 12px 14px;
}

/* ─── v3.48 — Timeline strip below the video ─────────────────────────── */
.ws-timeline-strip {
  flex-shrink: 0;
  height: 230px;
  background: var(--grey-1);
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ws-timeline-strip[hidden] { display: none; }

.tl-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 12px;
}

.tl-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  font-size: 11px;
  flex-shrink: 0;
}
.tl-zoom-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
  font-weight: 700;
}
.tl-zoom-btn {
  padding: 3px 8px;
  font-size: 11px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  min-width: 28px;
}
.tl-hint {
  margin-left: auto;
  font-size: 10.5px;
}

.tl-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  position: relative;
}
.tl-canvas {
  position: relative;
  height: 100%;
  min-width: 100%;
  user-select: none;
}

/* Ruler */
.tl-ruler {
  position: relative;
  height: 22px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--border);
}
.tl-tick {
  position: absolute;
  top: 12px;
  bottom: 0;
  width: 1px;
  background: var(--text-faint);
  opacity: 0.4;
}
.tl-tick.is-major {
  top: 0;
  opacity: 0.8;
  background: var(--text-dim);
}
.tl-tick-label {
  position: absolute;
  top: 2px;
  left: 4px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-mute);
  white-space: nowrap;
}

/* Tracks */
.tl-track {
  position: relative;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: stretch;
}
.tl-track-clips  { height: 56px; }
.tl-track-audio  { height: 40px; }
.tl-track-ops    { height: 28px; }
.tl-track-label {
  position: sticky;
  left: 0;
  z-index: 3;
  width: 56px;
  flex-shrink: 0;
  background: var(--panel);
  border-right: 1px solid var(--border);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tl-track-blocks {
  position: relative;
  flex: 1;
  min-width: 0;
}
.tl-track-empty {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  font-size: 10.5px;
  color: var(--text-faint);
  font-style: italic;
}

/* Generic block */
.tl-block {
  position: absolute;
  top: 4px;
  bottom: 4px;
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 8px;
  font-size: 11px;
  color: #fff;
  border: 1px solid transparent;
  transition: filter 0.1s ease, box-shadow 0.1s ease;
  white-space: nowrap;
  min-width: 8px;
}
.tl-block:hover { filter: brightness(1.15); }

/* Clip block */
.tl-clip {
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  border-color: var(--border-strong);
  font-weight: 600;
}
.tl-clip.is-external {
  background: linear-gradient(180deg, #1e3a8a 0%, #1e293b 100%);
  border-color: var(--blue);
}
.tl-clip.is-skipped {
  background: repeating-linear-gradient(45deg, #2a2a2a 0 6px, #1f1f1f 6px 12px);
  color: var(--text-faint);
  font-style: italic;
}
.tl-clip.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px rgba(201, 217, 46, 0.25);
}
.tl-clip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.tl-op-badge {
  flex-shrink: 0;
  margin-left: 6px;
  background: var(--accent);
  color: var(--black);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 8px;
}

/* Audio block — green tone, fake "waveform" via repeating gradient */
.tl-audio {
  background: linear-gradient(180deg, #0f5132 0%, #14532d 100%);
  border-color: #16a34a;
  top: 6px;
  bottom: 6px;
}
.tl-audio.is-overflow {
  border-right: 3px solid #ef4444;
  box-shadow: inset -3px 0 0 #ef4444;
}
.tl-audio.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px rgba(201, 217, 46, 0.3);
}

/* v3.50 — Audio properties stale banner in the right panel */
.studio-stale-banner {
  background: rgba(251, 146, 60, 0.12);
  border: 1px solid rgba(251, 146, 60, 0.5);
  color: #fdba74;
  padding: 8px 10px;
  border-radius: 5px;
  font-size: 11.5px;
  line-height: 1.4;
  margin-bottom: 12px;
}
.tl-audio-wave {
  display: block;
  width: 100%;
  height: 100%;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(34, 197, 94, 0.7) 0 2px,
    rgba(34, 197, 94, 0) 2px 6px
  );
  opacity: 0.65;
}

/* Op block — accent for overlay_text, others tinted by type */
.tl-op {
  background: linear-gradient(180deg, #78350f 0%, #451a03 100%);
  border-color: #d97706;
  top: 4px;
  bottom: 4px;
  font-size: 10px;
}
.tl-op-overlay_text { background: linear-gradient(180deg, #713f12 0%, #422006 100%); border-color: var(--accent); color: #fde68a; }
.tl-op-speed        { background: linear-gradient(180deg, #7c2d12 0%, #431407 100%); border-color: #f97316; }
.tl-op-freeze_frame { background: linear-gradient(180deg, #134e4a 0%, #042f2e 100%); border-color: #2dd4bf; }
.tl-op-mute_audio   { background: linear-gradient(180deg, #4b5563 0%, #1f2937 100%); border-color: #9ca3af; }
.tl-op-crop         { background: linear-gradient(180deg, #581c87 0%, #2e1065 100%); border-color: #a855f7; }
.tl-op-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ─── v3.53 — AI Edit modal ──────────────────────────────────────── */
.studio-ai-btn {
  background: linear-gradient(135deg, var(--accent) 0%, #84cc16 100%);
  color: var(--black);
  border-color: var(--accent);
  font-weight: 700;
}
.studio-ai-btn:hover {
  filter: brightness(1.08);
  color: var(--black);
}

#aiEditModal .modal-thread {
  max-width: 700px;
  width: 92vw;
}
.ai-edit-head { margin-bottom: 16px; }
.ai-edit-head h2 { margin: 0 0 4px; }

.ai-edit-instruction-recap {
  background: var(--panel-2);
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  border-radius: 0 5px 5px 0;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.45;
}
.ai-edit-instruction-recap .row-meta {
  display: block;
  font-size: 9px;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  font-weight: 700;
}

.ai-edit-note {
  background: rgba(96, 165, 250, 0.08);
  border: 1px solid rgba(96, 165, 250, 0.4);
  color: #93c5fd;
  padding: 8px 11px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 12px;
}

.ai-edit-error {
  margin-top: 10px;
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 8px 11px;
  border-radius: 5px;
  font-size: 12px;
  line-height: 1.5;
}

.ai-edit-examples {
  margin: 6px 0 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}
.ai-edit-examples .row-meta { width: 100%; }
.ai-edit-example {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-family: inherit;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.ai-edit-example:hover {
  background: var(--accent);
  color: var(--black);
  border-color: var(--accent);
}

.ai-edit-patches-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 10px;
}
.ai-edit-patches-head strong { font-size: 12px; }
.ai-edit-patches-head .row-meta { font-size: 11px; }

.ai-edit-patch-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 460px;
  overflow-y: auto;
  padding-right: 4px;
}

.ai-edit-patch {
  display: flex;
  gap: 10px;
  padding: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.ai-edit-patch:hover { border-color: var(--accent); }
.ai-edit-patch.is-excluded {
  opacity: 0.45;
  filter: grayscale(0.4);
}
.ai-edit-patch input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  cursor: pointer;
}
.ai-edit-patch-body { flex: 1; min-width: 0; }
.ai-edit-patch-human {
  font-size: 13px;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 4px;
}
.ai-edit-patch-human code, .ai-edit-patch-human strong {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11.5px;
  background: var(--panel-3);
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 600;
}
.ai-edit-patch-meta {
  display: flex;
  gap: 6px;
  font-size: 10px;
  color: var(--text-faint);
  align-items: center;
  margin-bottom: 3px;
}
.ai-edit-patch-op {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  padding: 1px 5px;
  border-radius: 2px;
  background: var(--panel-3);
}
.ai-edit-patch-meta code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--text-mute);
}
.ai-edit-patch-rationale {
  font-size: 11px;
  color: var(--text-mute);
  line-height: 1.45;
  font-style: italic;
}

/* ─── v3.52 — A2/A3 mix tracks + bin asset rows ───────────────────── */

.tl-track-mix { height: 32px; }
.tl-track-mix-a2 .tl-track-label { color: #c084fc; }
.tl-track-mix-a3 .tl-track-label { color: #fcd34d; }

.tl-mix {
  top: 4px;
  bottom: 4px;
  font-size: 10.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 8px;
}
.tl-mix-a2 {
  background: linear-gradient(180deg, #581c87 0%, #3b0764 100%);
  border-color: #a855f7;
  color: #f3e8ff;
}
.tl-mix-a3 {
  background: linear-gradient(180deg, #78350f 0%, #422006 100%);
  border-color: #f59e0b;
  color: #fef3c7;
}
.tl-mix.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px rgba(201, 217, 46, 0.3);
}
.tl-mix-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.tl-mix-vol {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  background: rgba(0,0,0,0.4);
  padding: 1px 4px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Media-bin asset rows */
.studio-bin-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.studio-bin-add {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-faint);
  width: 18px;
  height: 18px;
  border-radius: 3px;
  cursor: pointer;
  font-size: 11px;
  line-height: 1;
  padding: 0;
  font-family: inherit;
  font-weight: 700;
}
.studio-bin-add:hover {
  background: var(--accent);
  color: var(--black);
  border-color: var(--accent);
}
.studio-bin-asset-add {
  background: transparent;
  border: 0;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  font-weight: 800;
  padding: 0 6px;
  border-radius: 3px;
}
.studio-bin-asset-add:hover {
  background: var(--accent);
  color: var(--black);
}

/* ─── v3.51 — Graphics track, transitions, crop frame ─────────────── */

.tl-track-graphics { height: 36px; }
.tl-graphic {
  background: linear-gradient(180deg, #1e40af 0%, #1e3a8a 100%);
  border-color: #3b82f6;
  color: #dbeafe;
  font-size: 11px;
  top: 4px;
  bottom: 4px;
}
.tl-graphic-caption {
  background: linear-gradient(180deg, #475569 0%, #334155 100%);
  border-color: #94a3b8;
}
.tl-graphic.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px rgba(201, 217, 46, 0.3);
}
.tl-graphic-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Transition marker — spans ± duration/2 around the clip boundary (v3.59).
   The icon sits centered; the band carries a gradient that signals the
   transition type. */
.tl-transition {
  position: absolute;
  top: 4px;
  bottom: 4px;
  margin: 0;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  z-index: 4;
  cursor: pointer;
  overflow: hidden;
  min-width: 8px;
  transition: filter 0.12s ease, transform 0.12s ease;
}
.tl-transition .tl-transition-icon {
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}
.tl-transition:hover { filter: brightness(1.2); }
.tl-transition.is-selected {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  box-shadow: 0 0 0 3px rgba(201, 217, 46, 0.3);
}
.tl-trans-dissolve,
.tl-trans-cross_fade {
  background: linear-gradient(90deg, rgba(56, 189, 248, 0) 0%, rgba(56, 189, 248, 0.55) 50%, rgba(56, 189, 248, 0) 100%);
  border: 1px solid rgba(56, 189, 248, 0.55);
  color: #e0f2fe;
}
.tl-trans-white_flash {
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.85) 50%, rgba(255, 255, 255, 0) 100%);
  border: 1px solid rgba(255, 255, 255, 0.85);
  color: #1f2937;
}
.tl-trans-fade_to_black {
  background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.85) 50%, rgba(0, 0, 0, 0) 100%);
  border: 1px solid rgba(0, 0, 0, 0.85);
  color: #fde68a;
}
.tl-trans-fade_out,
.tl-trans-fade_in {
  background: linear-gradient(90deg, rgba(201, 217, 46, 0) 0%, rgba(201, 217, 46, 0.55) 50%, rgba(201, 217, 46, 0) 100%);
  border: 1px solid rgba(201, 217, 46, 0.55);
  color: #1f2937;
}

/* v3.59 — Program-monitor white flash overlay. Driven each frame via direct
   opacity write in paintEdlOverlays; pointer-events disabled so the user can
   still scrub the video underneath. */
.edl-overlay-flash {
  position: absolute;
  inset: 0;
  background: #ffffff;
  pointer-events: none;
  z-index: 50;
  mix-blend-mode: screen;
}

/* "Active" duration chip in the transition inspector */
.ghost-btn.is-active {
  background: rgba(245, 158, 11, 0.18);
  border-color: #fbbf24;
  color: #fde68a;
}

/* ═════════════════════════════════════════════════════════════════════
   v3.61 — Studio timeline visual overhaul (NLE-style match to Petar's
   mockup). The timeline now has a 148px non-scrolling header column
   on the left + a horizontally-scrolling track canvas on the right.
   Track heights match the mockup; rows have alternating shades + a
   1-second column-stripe grid; playhead is a blue line with a triangle
   handle in the ruler.
   ═════════════════════════════════════════════════════════════════════ */

#studioTimeline {
  /* Studio-scoped tokens. Don't leak to other components. */
  --tl-bg-0: #1a1a1a;
  --tl-bg-1: #141414;
  --tl-bg-2: #1c1c1c;
  --tl-bg-3: #252525;
  --tl-border:   #2a2a2a;
  --tl-border-2: #353535;
  --tl-border-3: #4a4a4a;
  --tl-text:     #e8e8e8;
  --tl-text-dim: #a0a0a0;
  --tl-text-faint:#6e6e6e;
  --tl-accent:   #c9d92e;
  --tl-accent-soft: rgba(201, 217, 46, 0.13);
  --tl-blue:     #2d68d6;
  --tl-blue-h:   #4a85f0;
  --tl-blue-soft: rgba(45, 104, 214, 0.22);
  --tl-playhead: #4a9fff;

  --tl-th-w: 148px;
  --tl-ruler-h: 26px;

  /* Track heights tuned so 7 tracks + toolbar + ruler fit ~410px studio-timeline. */
  --tl-h-v3: 34px;
  --tl-h-v2: 34px;
  --tl-h-v1: 54px;
  --tl-h-a1: 58px;
  --tl-h-a2: 52px;
  --tl-h-a3: 52px;
  --tl-h-mix:38px;

  background: var(--tl-bg-0);
  display: flex;
  flex-direction: column;
}

/* Toolbar — sleeker than the old chunky one */
#studioTimeline .tl-toolbar {
  background: var(--tl-bg-1);
  border-bottom: 1px solid var(--tl-border);
  padding: 5px 12px;
  gap: 10px;
  height: 36px;
  font-size: 11px;
}
#studioTimeline .tl-hint {
  margin-left: auto;
  font-size: 10.5px;
  color: var(--tl-text-faint);
}
#studioTimeline .tl-toolbar .ghost-btn {
  background: var(--tl-bg-2);
  border-color: var(--tl-border-2);
  color: var(--tl-text);
  padding: 4px 9px;
  font-size: 11px;
  border-radius: 4px;
}
#studioTimeline .tl-toolbar .ghost-btn:hover {
  background: var(--tl-bg-3);
  border-color: var(--tl-border-3);
}
#studioTimeline .tl-toolbar .ghost-btn.is-active {
  background: var(--tl-blue-soft);
  border-color: var(--tl-blue);
  color: var(--tl-blue-h);
}

/* v3.80 — Smart Timeline: default review-first view; Manual Edit keeps the full NLE. */
.timeline-floating-chip {
  position: fixed;
  right: 96px;
  bottom: 18px;
  z-index: 180;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(201, 217, 46, 0.45);
  background: rgba(18, 20, 24, 0.86);
  color: var(--text);
  backdrop-filter: blur(12px);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.28);
  cursor: pointer;
}
.timeline-floating-chip:hover { border-color: var(--accent); transform: translateY(-1px); }
.timeline-chip-icon { color: var(--accent); font-size: 13px; }
.timeline-chip-label { font-size: 12px; font-weight: 700; letter-spacing: 0.02em; }

.timeline-launcher-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
}
.timeline-launcher-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.035), rgba(255,255,255,0.015));
  padding: 16px;
}
.timeline-launcher-card h3 { margin: 4px 0 6px; font-size: 17px; }
.timeline-launcher-advanced {
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  padding: 9px 10px;
}
.timeline-launcher-advanced summary {
  cursor: pointer;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 700;
}
.timeline-launcher-advanced[open] summary { margin-bottom: 10px; color: var(--text); }
.tl-launcher-kicker {
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.timeline-launcher-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  margin-top: 14px;
}
.timeline-launcher-job {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(255,255,255,0.025);
  color: var(--text);
  padding: 11px 12px;
  cursor: pointer;
}
.timeline-launcher-job:hover {
  border-color: rgba(201, 217, 46, 0.55);
  background: rgba(201, 217, 46, 0.065);
}
.tl-launcher-job-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
}
.tl-launcher-job-meta { color: var(--text-dim); font-size: 11px; }

#studioTimeline .smart-timeline-shell {
  height: 100%;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(circle at 20% 0%, rgba(74, 159, 255, 0.10), transparent 32%),
    linear-gradient(180deg, #101216 0%, #0c0d10 100%);
}
#studioTimeline .smart-timeline-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.07);
}
#studioTimeline .smart-timeline-head strong {
  color: var(--tl-text);
  font-size: 13px;
  letter-spacing: 0.01em;
}
#studioTimeline .smart-timeline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
#studioTimeline .smart-timeline-scroll {
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  min-height: 0;
}
#studioTimeline .smart-timeline-canvas {
  position: relative;
  min-width: 100%;
  height: 100%;
  padding: 12px 16px 14px 104px;
  background-image:
    repeating-linear-gradient(90deg, transparent, transparent calc(var(--zoom-px, 60px) - 1px), rgba(255,255,255,0.035) calc(var(--zoom-px, 60px) - 1px), rgba(255,255,255,0.035) var(--zoom-px, 60px));
}
#studioTimeline .smart-lane {
  position: relative;
  height: 48px;
  margin-bottom: 10px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 14px;
  background: rgba(255,255,255,0.032);
  overflow: hidden;
}
#studioTimeline .smart-lane-label {
  position: sticky;
  left: 0;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  width: 88px;
  height: 100%;
  padding-left: 12px;
  background: rgba(10, 11, 14, 0.86);
  color: var(--tl-text-dim);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
#studioTimeline .smart-lane-blocks {
  position: absolute;
  inset: 6px 0 6px 102px;
}
#studioTimeline .smart-block {
  position: absolute;
  top: 0;
  height: 34px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 34px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #f8fafc;
  text-align: left;
  cursor: pointer;
  padding: 0 10px;
}
#studioTimeline .smart-block:hover,
#studioTimeline .smart-block.is-selected {
  border-color: rgba(255,255,255,0.48);
  filter: brightness(1.08);
}
#studioTimeline .smart-clip {
  background: linear-gradient(135deg, rgba(45,104,214,0.96), rgba(42,69,155,0.88));
}
#studioTimeline .smart-clip.is-skipped {
  opacity: 0.34;
  filter: grayscale(0.55);
}
#studioTimeline .smart-graphic {
  background: linear-gradient(135deg, rgba(148,163,184,0.92), rgba(71,85,105,0.84));
}
#studioTimeline .smart-audio {
  background: linear-gradient(135deg, rgba(168,85,247,0.86), rgba(14,165,233,0.70));
}
#studioTimeline .smart-block-label {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 11px;
  font-weight: 750;
}
#studioTimeline .smart-block-meta {
  margin-left: auto;
  color: rgba(255,255,255,0.72);
  font-family: ui-monospace, monospace;
  font-size: 10px;
}
#studioTimeline .smart-wave {
  width: 24px;
  height: 14px;
  flex: 0 0 auto;
  opacity: 0.75;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.35) 0 2px, transparent 2px 5px);
  border-radius: 8px;
}
#studioTimeline .smart-empty {
  position: absolute;
  left: 102px;
  top: 10px;
  color: var(--tl-text-faint);
  font-size: 11px;
}
#studioTimeline .smart-marker {
  position: absolute;
  top: 2px;
  width: 2px;
  height: 30px;
  background: var(--tl-accent);
  box-shadow: 0 0 16px rgba(201,217,46,0.45);
}
#studioTimeline .smart-playhead {
  top: 12px;
  bottom: 14px;
}
#studioTimeline .tl-filter-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  border: 1px solid var(--tl-border-2);
  border-radius: 6px;
  background: var(--tl-bg-2);
}
#studioTimeline .tl-filter-group .ghost-btn {
  padding: 3px 8px;
  font-size: 10px;
}
#studioTimeline .tl-tools-divider {
  width: 1px; height: 18px;
  background: var(--tl-border-2);
  margin: 0 2px;
}
#studioTimeline .zoom-pill {
  display: inline-flex;
  align-items: stretch;
  background: var(--tl-bg-2);
  border: 1px solid var(--tl-border-2);
  border-radius: 4px;
  overflow: hidden;
}
#studioTimeline .zoom-pill-btn {
  background: transparent;
  border: 0;
  padding: 3px 10px;
  color: var(--tl-text);
  cursor: pointer;
  font-size: 13px;
}
#studioTimeline .zoom-pill-btn:hover { background: var(--tl-bg-3); }
#studioTimeline .zoom-pill-level {
  min-width: 62px;
  text-align: center;
  padding: 4px 6px;
  font-size: 10.5px;
  color: var(--tl-text-dim);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  border-left: 1px solid var(--tl-border-2);
  border-right: 1px solid var(--tl-border-2);
}

/* Two-column body: headers (non-scrolling) | scroll (horizontal) */
#studioTimeline .tl-body {
  flex: 1;
  display: grid;
  grid-template-columns: var(--tl-th-w) 1fr;
  overflow: hidden;
  min-height: 0;
}

/* Left column — track headers */
#studioTimeline .tl-headers {
  background: var(--tl-bg-1);
  border-right: 1px solid var(--tl-border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 2;
}
#studioTimeline .tl-th-ruler-spacer {
  height: var(--tl-ruler-h);
  background: var(--tl-bg-2);
  border-bottom: 1px solid var(--tl-border-2);
}
#studioTimeline .tl-th {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  border-bottom: 1px solid var(--tl-border);
  font-size: 11px;
  color: var(--tl-text-dim);
}
#studioTimeline .tl-th-v3   { height: var(--tl-h-v3); }
#studioTimeline .tl-th-v2   { height: var(--tl-h-v2); }
#studioTimeline .tl-th-v1   { height: var(--tl-h-v1); }
#studioTimeline .tl-th-a1   { height: var(--tl-h-a1); }
#studioTimeline .tl-th-a2   { height: var(--tl-h-a2); }
#studioTimeline .tl-th-a3   { height: var(--tl-h-a3); }
#studioTimeline .tl-th-mix  { height: var(--tl-h-mix); background: var(--tl-bg-2); }
#studioTimeline .tl-th-badge {
  width: 28px;
  text-align: center;
  background: var(--tl-bg-3);
  border: 1px solid var(--tl-border-2);
  color: var(--tl-text-dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 3px 0;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
#studioTimeline .tl-th-badge-blue   { color: #cfe5ff; background: rgba(45, 104, 214, 0.30); border-color: var(--tl-blue); }
#studioTimeline .tl-th-badge-purple { color: #f3e8ff; background: rgba(168, 85, 247, 0.25); border-color: #a855f7; }
#studioTimeline .tl-th-badge-amber  { color: #fef3c7; background: rgba(245, 158, 11, 0.22); border-color: #f59e0b; }
#studioTimeline .tl-th-badge-mix    { color: #1f2937; background: var(--tl-accent); border-color: var(--tl-accent); }
#studioTimeline .tl-th-name {
  font-size: 10.5px;
  color: var(--tl-text-dim);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#studioTimeline .tl-th-mix .tl-mix-master-slider {
  flex: 1;
  min-width: 0;
  margin: 0;
  height: 4px;
  border-radius: 2px;
  accent-color: var(--tl-accent);
  cursor: pointer;
}
#studioTimeline .tl-th-mix .tl-mix-master-db {
  font-family: ui-monospace, monospace;
  font-size: 10px;
  color: var(--tl-text);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
}

/* Right column — horizontally-scrolling track canvas */
#studioTimeline .tl-scroll {
  background: var(--tl-bg-0);
  overflow-x: auto;
  overflow-y: hidden;
  min-width: 0;
}
#studioTimeline .tl-canvas {
  position: relative;
  height: 100%;
  min-width: 100%;
  user-select: none;
  background-image:
    repeating-linear-gradient(90deg, transparent, transparent calc(var(--zoom-px, 60px) - 1px), rgba(255, 255, 255, 0.03) calc(var(--zoom-px, 60px) - 1px), rgba(255, 255, 255, 0.03) var(--zoom-px, 60px));
}

/* Ruler — sticky at top of the scroll area */
#studioTimeline .tl-ruler {
  position: sticky;
  top: 0;
  height: var(--tl-ruler-h);
  background: var(--tl-bg-2);
  border-bottom: 1px solid var(--tl-border-2);
  z-index: 4;
}
#studioTimeline .tl-tick {
  position: absolute;
  top: 14px;
  bottom: 0;
  width: 1px;
  background: var(--tl-text-faint);
  opacity: 0.35;
}
#studioTimeline .tl-tick.is-major {
  top: 0;
  opacity: 0.6;
  background: var(--tl-text-dim);
}
#studioTimeline .tl-tick-label {
  position: absolute;
  top: 4px;
  left: 4px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--tl-text-faint);
  white-space: nowrap;
}

/* Tracks region — column-stripe grid drawn into the bg via repeating
   gradient. The --zoom-px CSS variable is set inline on .tl-canvas so the
   stripes track the live zoom. */
#studioTimeline .tl-tracks { position: relative; }
#studioTimeline .tl-track {
  position: relative;
  border-bottom: 1px solid var(--tl-border);
  display: block;            /* override the old flex-with-label layout */
  background:
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent calc(var(--zoom-px, 60px) - 1px),
      rgba(255, 255, 255, 0.025) calc(var(--zoom-px, 60px) - 1px),
      rgba(255, 255, 255, 0.025) var(--zoom-px, 60px)
    );
}
#studioTimeline .tl-track-v3       { height: var(--tl-h-v3); }
#studioTimeline .tl-track-graphics { height: var(--tl-h-v2); }
#studioTimeline .tl-track-clips    { height: var(--tl-h-v1); background-color: rgba(45, 104, 214, 0.04); }
#studioTimeline .tl-track-a1       { height: var(--tl-h-a1); background-color: rgba(45, 104, 214, 0.05); }
#studioTimeline .tl-track-mix-a2   { height: var(--tl-h-a2); background-color: rgba(168, 85, 247, 0.04); }
#studioTimeline .tl-track-mix-a3   { height: var(--tl-h-a3); background-color: rgba(245, 158, 11, 0.04); }
#studioTimeline .tl-track-mix-master {
  height: var(--tl-h-mix);
  background: var(--tl-bg-2);
  border-bottom: 2px solid var(--tl-border-3);
}
#studioTimeline .tl-track-empty {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  font-size: 10.5px;
  color: var(--tl-text-faint);
  font-style: italic;
  pointer-events: none;
}
#studioTimeline .tl-track-blocks {
  position: relative;
  height: 100%;
}

/* Generic block reset — keep the size/position bits, drop the old flex
   center so structured children (thumb + body) flow nicely. */
#studioTimeline .tl-block {
  top: 3px;
  bottom: 3px;
  border-radius: 3px;
  display: flex;
  align-items: stretch;
  padding: 0;
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

/* V1 clip block — thumbnail tile + body with name + sub line */
#studioTimeline .tl-clip {
  background: linear-gradient(180deg, #2d68d6 0%, #1f4ea0 100%);
  border: 1px solid rgba(96, 151, 220, 0.45);
  cursor: grab;
}
#studioTimeline .tl-clip.is-external {
  background: linear-gradient(180deg, #475569 0%, #1e293b 100%);
  border-color: #94a3b8;
}
#studioTimeline .tl-clip.is-skipped {
  background: repeating-linear-gradient(45deg, #2a2a2a 0 6px, #1f1f1f 6px 12px);
  border-color: var(--tl-border-2);
  color: var(--tl-text-faint);
}
#studioTimeline .tl-clip.is-selected {
  outline: 2px solid var(--tl-accent);
  outline-offset: -1px;
  box-shadow: 0 0 0 4px rgba(201, 217, 46, 0.22);
  z-index: 5;
}
#studioTimeline .tl-clip-thumb {
  width: 38px;
  flex-shrink: 0;
  background: linear-gradient(135deg, #1a2e48 0%, #2e4570 50%, #6b4a28 100%);
  border-right: 1px solid rgba(0, 0, 0, 0.35);
  position: relative;
}
#studioTimeline .tl-clip-thumb::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 50%; height: 50%;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255, 255, 255, 0.30);
  border-radius: 50%;
}
#studioTimeline .tl-clip-body {
  flex: 1;
  min-width: 0;
  padding: 5px 8px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
}
#studioTimeline .tl-clip-name {
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.55);
}
#studioTimeline .tl-clip-sub {
  font-size: 9.5px;
  color: rgba(255, 255, 255, 0.7);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#studioTimeline .tl-op-badge {
  position: absolute;
  top: 4px; right: 6px;
  z-index: 3;
}

/* Audio blocks (A2/A3) — refresh gradients */
#studioTimeline .tl-mix-a2 {
  background: linear-gradient(180deg, #6b21a8 0%, #4a1d80 100%);
  border-color: rgba(168, 85, 247, 0.55);
}
#studioTimeline .tl-mix-a3 {
  background: linear-gradient(180deg, #b45309 0%, #78350f 100%);
  border-color: rgba(245, 158, 11, 0.6);
}

/* Graphics block (V2) — softer panel */
#studioTimeline .tl-graphic {
  background: linear-gradient(180deg, #1e3a8a 0%, #172554 100%);
  border-color: rgba(96, 151, 220, 0.55);
  padding: 0 8px;
  align-items: center;
}
#studioTimeline .tl-graphic-caption {
  background: linear-gradient(180deg, #475569 0%, #1f2937 100%);
  border-color: rgba(148, 163, 184, 0.55);
}

/* Playhead — blue vertical line + downward-pointing triangle sitting in
   the ruler at the very top of the canvas. */
#studioTimeline .tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 1.5px solid var(--tl-playhead);
  z-index: 20;
  pointer-events: none;
}
#studioTimeline .tl-playhead-head {
  position: absolute;
  top: 0;
  left: -8px;
  width: 16px;
  height: 14px;
  cursor: ew-resize;
  pointer-events: auto;
  background: transparent;
}
#studioTimeline .tl-playhead-head::after {
  content: "";
  display: block;
  width: 0;
  height: 0;
  margin: 0 auto;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid var(--tl-playhead);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5));
}
body.tl-playhead-dragging { cursor: ew-resize !important; }

#studioTimeline .tl-tick.is-minor {
  height: 8px;
  opacity: 0.45;
}
#studioTimeline .tl-tick-label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.02em;
}

#studioTimeline .tl-toolbar .tl-chip.is-active {
  border-color: var(--tl-accent);
  color: var(--tl-accent);
  background: var(--tl-accent-soft);
}
#studioTimeline .zoom-pill-fit {
  margin-left: 4px;
  font-size: 10px;
  padding: 2px 8px !important;
}
#studioTimeline .tl-cursor-tc {
  margin-left: auto;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
  color: var(--tl-playhead);
  min-width: 88px;
  text-align: right;
}
#studioTimeline .tl-duration-tc {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--tl-text-faint);
  padding-left: 8px;
  border-left: 1px solid var(--tl-border);
}

.studio-preview-stack {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.studio-preview-stack video {
  flex: 1;
  min-height: 0;
  width: 100%;
  max-height: calc(100% - 28px);
}
.studio-preview-transport {
  flex-shrink: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 4px 12px 8px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.75));
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
}
.studio-tc-current { color: var(--tl-playhead, #4a9fff); font-weight: 600; }
.studio-tc-sep, .studio-tc-duration { color: var(--text-mute); }

/* A1 mirror — refresh to match the new palette */
#studioTimeline .tl-a1-mirror {
  top: 4px; bottom: 4px;
  background: linear-gradient(180deg, rgba(45, 104, 214, 0.35) 0%, rgba(20, 53, 130, 0.55) 100%);
  border: 1px solid rgba(96, 151, 220, 0.4);
  border-radius: 3px;
  overflow: hidden;
}
#studioTimeline .tl-a1-mirror .ws-wave {
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  opacity: 0.6;
}
#studioTimeline .tl-a1-mirror .tl-mix-label {
  left: 8px;
  top: 3px;
  color: #cfe5ff;
}

/* Crop letterbox frame on the preview */
.edl-crop-frame {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
}
.edl-crop-frame-inner {
  height: 100%;
  /* aspect-ratio set inline. Width derives from aspect-ratio. */
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55), inset 0 0 0 2px var(--accent);
  border-radius: 2px;
}
.edl-crop-frame-label {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: var(--black);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 2px 8px;
  border-radius: 3px;
}

/* Lower-third with subtitle (two-line variant) */
.edl-overlay-l3 {
  display: flex;
  flex-direction: column;
  gap: 2px;
  white-space: normal;
  line-height: 1.2;
}
.edl-overlay-l3-main { font-size: clamp(14px, 2.6vw, 24px); font-weight: 700; }
.edl-overlay-l3-sub  { font-size: clamp(11px, 1.8vw, 16px); font-weight: 500; opacity: 0.92; }

/* v3.50 — Drag-to-reorder visual states */
.tl-clip.is-dragging { opacity: 0.45; cursor: grabbing; }
.tl-clip:hover { cursor: grab; }
.tl-drop-indicator {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(201, 217, 46, 0.7);
  z-index: 6;
  transition: left 0.05s linear;
}

/* v3.50 — Transcript card editing state */
.studio-segment-card-text {
  cursor: text;
  border-radius: 3px;
  padding: 2px 0;
  outline: none;
  transition: background 0.15s ease;
}
.studio-segment-card-text:hover { background: rgba(255, 255, 255, 0.025); }
.studio-segment-card-text.is-editing {
  background: var(--bg);
  border: 1px solid var(--accent);
  padding: 4px 6px;
  margin: -2px -4px;
  cursor: text;
  -webkit-line-clamp: unset;
  display: block;
  overflow: visible;
  white-space: pre-wrap;
  min-height: 40px;
}
.studio-segment-card:has(.studio-segment-card-text.is-editing) {
  flex: 0 0 320px;
  z-index: 2;
}

/* Playhead — vertical line across all tracks */
.tl-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 0;
  border-left: 2px solid var(--accent);
  pointer-events: none;
  z-index: 5;
  box-shadow: 0 0 6px rgba(201, 217, 46, 0.6);
}
.tl-playhead::before {
  /* Triangle head at the top of the playhead */
  content: "";
  position: absolute;
  top: 0;
  left: -6px;
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 8px solid var(--accent);
}

/* The selected-clip drawer in the chat area when nothing is picked */
.edl-selected-clip { padding: 0 10px 10px; }
.edl-selected-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 4px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.edl-selected-head .ghost-btn {
  margin-left: auto;
  padding: 3px 9px;
  font-size: 11px;
}

/* v3.47 — Live EDL overlay layer painted on top of the <video> during
   Edit-mode preview. Renders overlay_text ops with one of four positions.
   Click-through (pointer-events:none) so the native player controls keep
   working underneath. */
.edl-overlay-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 4;
}
.edl-overlay {
  position: absolute;
  font-family: "Inter", system-ui, sans-serif;
  font-weight: 700;
  font-size: clamp(13px, 2.4vw, 22px);
  color: #fff;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7);
  padding: 8px 14px;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.72) 0%, rgba(0, 0, 0, 0.45) 80%, transparent 100%);
  border-left: 3px solid var(--accent);
  letter-spacing: 0.01em;
  max-width: 70%;
  line-height: 1.3;
  animation: edlOverlayIn 180ms ease-out;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@keyframes edlOverlayIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.edl-overlay-lower_third {
  bottom: 12%;
  left: 5%;
}
.edl-overlay-top {
  top: 6%;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.45));
  border-left: 0;
  border-top: 3px solid var(--accent);
}
.edl-overlay-center {
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: clamp(18px, 3.5vw, 32px);
  background: rgba(0, 0, 0, 0.6);
  border-left: 0;
  text-align: center;
  padding: 14px 24px;
}
.edl-overlay-bottom {
  bottom: 4%;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(0deg, rgba(0, 0, 0, 0.72), rgba(0, 0, 0, 0.45));
  border-left: 0;
}

/* Preview overlay shown over the video for external clips during preview */
.edl-preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 14, 0.92);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  padding: 24px;
  white-space: pre-line;
  z-index: 5;
  pointer-events: none;
}

/* ─── v3.55 — 7-track layout (V3 / V2 / V1 / A1 / A2 / A3 / Mix) ───── */
.tl-track-v3      { height: 28px; }
.tl-track-a1      { height: 48px; }
.tl-track-mix     { height: 48px; }
.tl-track-mix-master { height: 36px; }

.tl-track-v3 .tl-track-label      { color: #94a3b8; }
.tl-track-a1 .tl-track-label      { color: #6ee7b7; }
.tl-track-mix-master .tl-track-label { color: #f59e0b; font-weight: 600; }

.tl-mix-master-row {
  display: flex;
  align-items: center;
  padding-left: 12px;
  background: linear-gradient(90deg, rgba(245, 158, 11, 0.10), rgba(245, 158, 11, 0.02) 80%);
  border-left: 2px solid rgba(245, 158, 11, 0.45);
}
.tl-mix-master-readout {
  font-size: 11px;
  color: var(--row-meta, #9ca3af);
  letter-spacing: 0.02em;
}
.tl-mix-master-readout strong {
  color: #fbbf24;
  font-weight: 600;
  margin-left: 6px;
}
/* v3.57 — Mix master slider (range input). Wide enough to hit easily; the
   readout above updates live on input. */
.tl-mix-master-row {
  gap: 14px;
}
.tl-mix-master-slider {
  flex: 1;
  max-width: 360px;
  height: 4px;
  accent-color: #fbbf24;
  cursor: pointer;
}
.tl-mix-master-range {
  font-size: 10px;
  color: var(--row-meta, #9ca3af);
  letter-spacing: 0.04em;
}

/* ─── v3.56 — audio block rendering (waveform, fades, envelope) ───── */

/* Re-paint placement blocks with internal layers stacked below labels. */
.tl-mix {
  position: absolute;
  overflow: hidden;
  isolation: isolate;            /* keep clip-path overlays from bleeding */
}
.tl-mix .ws-wave {
  position: absolute;
  inset: 3px;
  width: calc(100% - 6px);
  height: calc(100% - 6px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}
.tl-mix .tl-mix-label {
  position: absolute;
  left: 8px;
  top: 2px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  white-space: nowrap;
  z-index: 4;
}
.tl-mix .tl-mix-vol {
  position: absolute;
  right: 8px;
  top: 2px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.75);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  pointer-events: none;
  z-index: 4;
}

/* Fade overlay — two triangular shades + a draggable handle on each side. */
.ws-fade-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}
.ws-fade-shade {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
}
.ws-fade-shade.in  { left: 0;  clip-path: polygon(0 0, 100% 0, 0 100%); }
.ws-fade-shade.out { right: 0; clip-path: polygon(0 0, 100% 0, 100% 100%); }
.ws-fade-handle {
  position: absolute;
  top: -4px;
  /* v3.64 — bigger hit-target. Visible 12px but ::before extends the
     clickable area to ~20px without changing the look. */
  width: 12px;
  height: 12px;
  background: #fbbf24;
  border: 1.5px solid #1a1d10;
  border-radius: 50%;
  cursor: ew-resize;
  pointer-events: all;
  z-index: 8;
  transform: translateX(-50%);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
}
.ws-fade-handle::before {
  /* Invisible expander — adds 4px of grab area on every side. */
  content: "";
  position: absolute;
  inset: -8px;
  background: transparent;
}

/* v3.65 — Probe-timing button. Only rendered when source clips are missing
   mp4 timing AND the user has admin/manager role. Distinct amber tint so
   it doesn't blend in with the regular top-bar actions. */
.studio-probe-btn {
  background: rgba(245, 158, 11, 0.20) !important;
  border-color: #f59e0b !important;
  color: #fde68a !important;
}
.studio-probe-btn:hover {
  background: rgba(245, 158, 11, 0.30) !important;
}

/* ═════════════════════════════════════════════════════════════════════
   v3.66 — Studio polish pass (tooltip, ? overlay, segmented control,
   empty-state icons, save flash, panel transitions, UNSAVED pulse-once,
   density toggle, transition icon size, track tint bump).
   ═════════════════════════════════════════════════════════════════════ */

/* (1) Custom tooltip — singleton floats with the cursor. */
.ws-tip {
  position: fixed;
  z-index: 10000;
  display: none;
  background: rgba(20, 20, 20, 0.96);
  color: #e8e8e8;
  font-size: 11px;
  font-weight: 500;
  padding: 5px 9px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  pointer-events: none;
  max-width: 320px;
  line-height: 1.4;
  white-space: normal;
  letter-spacing: 0.01em;
}

/* (2) Shortcuts overlay — two-column dl layout. */
.ws-shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  margin-top: 14px;
}
.ws-shortcuts-col h4 {
  font-size: 10.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--text-mute, #a0a0a0);
  margin: 0 0 8px;
}
.ws-shortcuts-col h4 + h4 { margin-top: 14px; }
.ws-shortcuts-col dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 12px;
}
.ws-shortcuts-col dt { color: var(--text, #e8e8e8); }
.ws-shortcuts-col dd { margin: 0; color: var(--text-dim, #a0a0a0); }
.ws-shortcuts-col kbd {
  background: var(--bg-2, #1a1a1a);
  border: 1px solid var(--border-2, #3a3a3a);
  padding: 1px 6px;
  border-radius: 3px;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 10.5px;
  color: var(--text, #e8e8e8);
}

/* (5) Segmented control — connected buttons with shared border. */
.ws-segmented {
  display: inline-flex;
  border: 1px solid var(--border-2, #3a3a3a);
  border-radius: 4px;
  overflow: hidden;
  background: var(--bg-2, #1a1a1a);
}
.ws-segmented-btn {
  background: transparent;
  border: 0;
  padding: 5px 12px;
  color: var(--text-dim, #a0a0a0);
  font-size: 11px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.ws-segmented-btn + .ws-segmented-btn { border-left: 1px solid var(--border-2, #3a3a3a); }
.ws-segmented-btn:hover { background: rgba(255, 255, 255, 0.05); color: var(--text, #e8e8e8); }
.ws-segmented-btn.is-active {
  background: rgba(201, 217, 46, 0.18);
  color: #d4e600;
}

/* (4) Empty-state icons — inline SVG inside the .tl-track-empty span. */
#studioTimeline .tl-track-empty {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#studioTimeline .tl-empty-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.55;
  color: var(--tl-text-faint, #6e6e6e);
}

/* (6) Save success flash — brief green glow on the Save button. */
@keyframes ws-save-flash {
  0%   { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.0); }
  30%  { box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.55); }
  100% { box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.0); }
}
.studio-top-actions .primary-btn.just-saved {
  animation: ws-save-flash 0.65s ease-out;
}

/* (7) Side-panel transitions — collapse/expand smoothly. The Studio's left
   media bin and right Properties panel grow/shrink via grid-template-columns;
   the inner panels can transition their padding + opacity to feel less abrupt. */
#studio .studio-panel-collapse {
  transition: transform 0.18s ease;
}
#studio .studio-panel-collapse:hover { transform: scale(1.08); }
#studioLeft, #studioRight {
  transition: opacity 0.18s ease;
}

/* (8) Transition icon — bumped from 12px to 14px for better legibility. */
#studioTimeline .tl-transition .tl-transition-icon {
  font-size: 14px;
  line-height: 1;
}

/* (9) UNSAVED pulse-once — animation fires only on first paint of the chip
   (subsequent re-renders don't re-pulse because the keyframes are play-once
   and the element is freshly inserted into the DOM each time only when the
   dirty flag flips false→true. CSS re-runs the anim because innerHTML is
   replaced — accepted; the once-per-paint pulse is gentle enough.). */
@keyframes ws-unsaved-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.6); }
  60%  { box-shadow: 0 0 0 8px rgba(251, 191, 36, 0.0); }
  100% { box-shadow: 0 0 0 0 rgba(251, 191, 36, 0.0); }
}
.studio-dirty-pill {
  animation: ws-unsaved-pulse 1.4s ease-out 1;
}

/* Density toggle — Compact mode tightens track heights by ~6px each. */
body.studio-density-compact #studioTimeline {
  --tl-h-v3: 28px;
  --tl-h-v2: 28px;
  --tl-h-v1: 46px;
  --tl-h-a1: 48px;
  --tl-h-a2: 44px;
  --tl-h-a3: 44px;
  --tl-h-mix: 32px;
}
.studio-density-btn {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
}

/* (10) Track BG tints — bumped from 0.04 → 0.06 for better lane separation. */
#studioTimeline .tl-track-clips    { background-color: rgba(45, 104, 214, 0.06); }
#studioTimeline .tl-track-a1       { background-color: rgba(45, 104, 214, 0.07); }
#studioTimeline .tl-track-mix-a2   { background-color: rgba(168, 85, 247, 0.06); }
#studioTimeline .tl-track-mix-a3   { background-color: rgba(245, 158, 11, 0.06); }
.ws-fade-handle:hover { background: #fcd34d; }
body.ws-fade-dragging * { cursor: ew-resize !important; }

/* Volume envelope — invisible thick hit-area + visible polyline + dots. */
.ws-env-overlay {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 6;
  overflow: visible;
}
.ws-env-line {
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 1.5;
  fill: none;
  pointer-events: stroke;
  cursor: copy;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.ws-env-hot {
  stroke: rgba(255, 255, 255, 0);
  stroke-width: 10;
  fill: none;
  pointer-events: stroke;
  cursor: copy;
}
.ws-kf-dot {
  fill: #fff;
  stroke: #1a1d10;
  stroke-width: 1.5;
  cursor: grab;
  pointer-events: all;
  transition: fill 0.12s;
}
.ws-kf-dot:hover { fill: #fbbf24; }

/* A1 mirror block — waveform-only readout of the V1 clip's source audio. */
.tl-a1-mirror {
  position: absolute;
  top: 4px;
  bottom: 4px;
  background: linear-gradient(180deg, rgba(16, 78, 56, 0.65) 0%, rgba(6, 38, 28, 0.65) 100%);
  border: 1px solid rgba(110, 231, 183, 0.45);
  border-radius: 4px;
  overflow: hidden;
}
.tl-a1-mirror .ws-wave {
  position: absolute;
  inset: 2px;
  width: calc(100% - 4px);
  height: calc(100% - 4px);
  opacity: 0.6;
  pointer-events: none;
}
.tl-a1-mirror .tl-mix-label {
  position: absolute;
  left: 6px;
  top: 1px;
  font-size: 10px;
  font-weight: 600;
  color: #d1fae5;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  pointer-events: none;
  white-space: nowrap;
}

/* ─── v3.58 — Pen tool, keyframe selection, context menu, tooltip ──── */

.tl-tools-divider {
  width: 1px;
  height: 16px;
  background: var(--border, rgba(255, 255, 255, 0.12));
  margin: 0 6px;
}
.tl-tool-btn {
  padding: 4px 10px;
  font-size: 11px;
}
.tl-tool-btn.is-active {
  background: rgba(245, 158, 11, 0.18);
  border-color: #fbbf24;
  color: #fde68a;
}
body.studio-pen-active .ws-env-line {
  stroke: #fbbf24;
  stroke-width: 2;
}
body.studio-pen-active .ws-env-hot {
  cursor: copy;
}
body.studio-pen-active .ws-wave {
  cursor: copy;
}

.ws-kf-dot.is-selected,
.ws-kf-dot.selected {
  fill: #38bdf8 !important;        /* v3.64 — guarantee visible blue */
  stroke: #ffffff !important;
  stroke-width: 2 !important;
  r: 6;                            /* SVG attr override; bumps from 4 → 6 */
  filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.85));
}

.ws-kf-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(15, 23, 42, 0.95);
  color: #fde68a;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 4px;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(251, 191, 36, 0.4);
  font-family: "JetBrains Mono", ui-monospace, monospace;
}

.ws-ctx-menu {
  position: fixed;
  z-index: 9999;
  min-width: 180px;
  background: var(--panel, #1f2937);
  border: 1px solid var(--border-strong, rgba(255, 255, 255, 0.2));
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
  padding: 4px;
  display: flex;
  flex-direction: column;
}
.ws-ctx-menu button {
  background: transparent;
  border: 0;
  color: var(--text, #f3f4f6);
  text-align: left;
  padding: 8px 10px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
}
.ws-ctx-menu button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.07);
}
.ws-ctx-menu button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Keyframe list inside the placement inspector */
.ws-kf-list {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
}
.ws-kf-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ws-kf-row {
  display: grid;
  grid-template-columns: 64px 1fr 38px 28px;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
  margin-bottom: 2px;
  border-radius: 4px;
  font-size: 11px;
}
.ws-kf-row.is-selected {
  background: rgba(56, 189, 248, 0.12);
  outline: 1px solid #38bdf8;
}
.ws-kf-row input[type="number"] {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  padding: 2px 4px;
}
.ws-kf-row input[type="range"] {
  accent-color: #fbbf24;
}
.ws-kf-pct {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  color: var(--row-meta, #9ca3af);
  text-align: right;
}
.ws-kf-del {
  padding: 2px 6px;
  font-size: 11px;
}

/* ── v3.67–72 — Job workspace UX audit ─────────────────────────────────── */

@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 0.7; }
}
.skeleton-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 0;
}
.skeleton-line {
  height: 10px;
  border-radius: 4px;
  background: var(--grey-4);
  animation: skeleton-pulse 1.2s ease-in-out infinite;
}
.skeleton-line.w60 { width: 60%; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w40 { width: 40%; }
.skeleton-loading-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

/* Sidebar user dropdown (Z6) */
.user-menu-wrap { position: relative; width: 100%; }
.user-menu-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 4px;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  border-radius: var(--radius-sm);
}
.user-menu-trigger:hover { background: var(--grey-3); }
.user-menu-trigger .user-info { padding: 0; flex: 1; min-width: 0; }
.user-menu-caret { font-size: 10px; color: var(--text-faint); flex-shrink: 0; margin-left: 6px; }
.user-menu-dropdown {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0; right: 0;
  background: var(--grey-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 200;
  overflow: hidden;
}
.user-menu-dropdown[hidden] { display: none !important; }
.user-menu-dropdown button {
  display: block;
  width: 100%;
  padding: 10px 14px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.user-menu-dropdown button:hover { background: var(--grey-3); color: var(--text); }

/* Flattened workspace header (T1.2) */
.ws-header-left h1 {
  font-size: 17px;
  margin: 4px 0 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.ws-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-mute);
}
.ws-meta-row .meta-info { margin: 0; }

/* Top-bar overflow menu (Z1) */
.ws-overflow-wrap { position: relative; }
.ws-overflow-btn {
  padding: 7px 12px !important;
  font-size: 16px !important;
  line-height: 1;
  letter-spacing: 0.05em;
}
.ws-overflow-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 200px;
  background: var(--grey-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
  z-index: 300;
  overflow: hidden;
}
.ws-overflow-menu[hidden] { display: none !important; }
.ws-overflow-menu button,
.ws-overflow-menu .ws-overflow-info {
  display: block;
  width: 100%;
  padding: 9px 14px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.ws-overflow-menu button:last-child { border-bottom: 0; }
.ws-overflow-menu button:hover { background: var(--grey-3); color: var(--text); }
.ws-overflow-menu button:disabled { opacity: 0.4; cursor: default; }
.ws-overflow-info {
  font-size: 10px;
  color: var(--text-faint);
  cursor: default;
  line-height: 1.4;
}
.ws-overflow-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Tab header add button (T1.1) */
.ws-tab-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.ws-tab-add-btn {
  padding: 4px 10px !important;
  font-size: 11px !important;
}

/* Segment card simplification (T1.4 / Z4) */
.segment-card .segment-head {
  position: relative;
}
.segment-edit-hover {
  opacity: 0;
  transition: opacity 0.12s ease;
}
.segment-card:hover .segment-edit-hover { opacity: 1; }
.segment-overflow-wrap { position: relative; margin-left: auto; }
.segment-overflow-btn {
  padding: 2px 8px !important;
  font-size: 14px !important;
  line-height: 1;
}
.segment-overflow-menu {
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 160px;
  background: var(--grey-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  z-index: 50;
}
.segment-overflow-menu[hidden] { display: none !important; }
.segment-overflow-menu button {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: transparent;
  border: 0;
  color: var(--text-dim);
  font-size: 11px;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}
.segment-overflow-menu button:hover { background: var(--grey-3); }
.segment-card .segment-footer {
  font-size: 10px;
  color: var(--text-faint);
  gap: 6px;
}
.segment-covers-details { margin-top: 6px; }
.segment-covers-details summary {
  font-size: 10px;
  color: var(--text-mute);
  cursor: pointer;
  user-select: none;
}
.bulk-select-toggle {
  font-size: 10px;
  margin-left: 8px;
}

/* Video panel (Z5) */
.vp-add-comment {
  display: none;
}
.vp-player-wrap.vp-paused .vp-add-comment,
.vp-player-wrap.vp-hover-comment .vp-add-comment {
  display: block;
}
.vp-comment-hint {
  font-size: 10px;
  color: var(--text-faint);
  text-align: center;
  padding: 4px;
  opacity: 0;
  transition: opacity 0.12s;
}
.vp-player-wrap:hover .vp-comment-hint { opacity: 1; }
.vp-comments-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 6px;
  border-top: 1px solid var(--border);
  margin-top: 8px;
}
.vp-comment-filters { display: flex; gap: 4px; }
.vp-filter-chip {
  padding: 3px 8px;
  font-size: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-mute);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.vp-filter-chip.active {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(45,81,255,0.08);
}
.vp-comment-card.comment-highlighted {
  outline: 1px solid var(--blue);
  background: rgba(45,81,255,0.06);
}
.vp-segment-badge {
  display: inline-block;
  padding: 1px 6px;
  font-size: 9px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  background: var(--grey-3);
  color: var(--text-dim);
  cursor: pointer;
  margin-right: 4px;
}
.vp-segment-badge:hover { border-color: var(--blue); color: var(--blue); }
.segment-card.comment-linked-highlight {
  outline: 2px solid var(--blue);
  outline-offset: 1px;
}

.bulk-select-toggle.active {
  border-color: var(--blue);
  color: var(--blue);
}

/* Workflow stepper (Z3) */
.ws-stepper {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.ws-step {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 11px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-mute);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: inherit;
}
.ws-step.active {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(45, 81, 255, 0.08);
}
.ws-step.ws-step-disabled,
.ws-step:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Script coverage banner (1.2) */
.coverage-banner {
  font-size: 11px;
  color: var(--text-mute);
  padding: 8px 10px;
  margin: 0 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--grey-3);
}
.coverage-warn { color: var(--amber, #fbbf24); margin-left: 8px; }
.source-refs-wrap { margin-bottom: 12px; }
.source-refs-block { margin: 6px 0; }
.dropped-clips-list { font-size: 11px; color: var(--text-dim); margin: 8px 0 0 16px; }
.segment-overflow-wrap.segment-edit-hover { opacity: 0; transition: opacity 0.12s; }
.segment-card:hover .segment-overflow-wrap.segment-edit-hover,
.segment-card:focus-within .segment-overflow-wrap.segment-edit-hover { opacity: 1; }
.segment-highlight-flash { animation: seg-flash 1.2s ease; }
@keyframes seg-flash {
  0%, 100% { background: transparent; }
  30% { background: rgba(45, 81, 255, 0.12); }
}

/* v3.74 — Studio timeline track controls + trim + admin nav collapse */
.tl-th { position: relative; }
.tl-track-btns {
  display: flex;
  gap: 2px;
  margin-left: auto;
  flex-shrink: 0;
  opacity: 0.15;
  transition: opacity 0.12s ease;
}
.tl-th:hover .tl-track-btns,
.tl-th:focus-within .tl-track-btns,
.tl-th .tl-track-btn.is-on {
  opacity: 1;
}
.tl-track-btn {
  width: 18px;
  height: 16px;
  padding: 0;
  font-size: 9px;
  line-height: 1;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--grey-3);
  color: var(--text-dim);
  cursor: pointer;
  font-family: inherit;
}
.tl-track-btn.is-on {
  border-color: var(--blue);
  color: var(--blue);
  background: rgba(45, 81, 255, 0.12);
}
.tl-trim-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 8px;
  z-index: 4;
  cursor: ew-resize;
  opacity: 0;
  transition: opacity 0.12s;
}
.tl-trim-handle.left { left: 0; }
.tl-trim-handle.right { right: 0; }
.tl-clip:hover .tl-trim-handle,
body.tl-trim-dragging .tl-trim-handle { opacity: 1; }
.tl-trim-handle::after {
  content: "";
  position: absolute;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 1px;
}
.tl-trim-handle.left::after { left: 2px; }
.tl-trim-handle.right::after { right: 2px; }
body.studio-razor-active .tl-canvas { cursor: crosshair; }
body.studio-razor-active .tl-clip { cursor: crosshair; }
.nav-label-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 0;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}
.nav-section-collapsed .nav-list { display: none; }
.nav-section-collapsed .nav-collapse-chevron { transform: rotate(-90deg); }
.studio-bin-item[draggable="true"] { cursor: grab; }
.studio-bin-item[draggable="true"]:active { cursor: grabbing; }

/* ─── v3.76 — F3 Sync to Video ──────────────────────────────────────── */
.segment-ts-pill {
  display: inline-flex;
  align-items: center;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 2px 6px;
  border-radius: 10px;
  background: rgba(74, 144, 226, 0.18);
  border: 1px solid rgba(74, 144, 226, 0.55);
  color: #93c5fd;
  cursor: pointer;
  margin-left: 6px;
  transition: all 0.12s ease;
  flex-shrink: 0;
}
.segment-ts-pill:hover {
  background: rgba(74, 144, 226, 0.35);
  color: #fff;
}

.sync-to-video-btn {
  margin-left: 8px;
  font-size: 11.5px;
  padding: 4px 10px;
}

/* Segment markers row on the video progress bar (above the comment markers).
   Lighter ticks; tooltip on hover. */
.vp-segment-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 56px;            /* sits above the native controls + above .vp-timeline-overlay */
  height: 8px;
  pointer-events: none;
  z-index: 4;
}
.vp-segment-marker {
  position: absolute;
  top: 0;
  width: 2px;
  height: 100%;
  background: rgba(96, 165, 250, 0.85);
  border-radius: 1px;
  cursor: pointer;
  pointer-events: auto;
  transition: background 0.1s ease, transform 0.1s ease;
}
.vp-segment-marker:hover {
  background: var(--accent);
  transform: scaleX(2.5);
}
.vp-segment-marker-tooltip {
  position: absolute;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(10, 10, 14, 0.96);
  color: #fff;
  font-size: 10px;
  padding: 3px 7px;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vp-segment-marker:hover .vp-segment-marker-tooltip { opacity: 1; }

/* v3.76 — Atlas Assistant drawer shell (Ask mode) */
#atlasAssistant {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 420px;
  z-index: 210;
  background: var(--panel-1, var(--panel));
  border-left: 1px solid var(--panel-3);
  display: flex;
  flex-direction: column;
  box-shadow: -18px 0 48px rgba(0, 0, 0, 0.42);
}
#atlasAssistant[hidden] {
  display: none !important;
}
.aa-header {
  height: 50px;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--border);
  background: var(--grey-1);
}
.aa-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
}
.aa-mode {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 6px 12px;
  background: transparent;
  color: var(--text-dim);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.aa-mode:not(.aa-mode-active) {
  border-color: var(--border);
}
.aa-mode-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #101010;
  font-weight: 700;
}
.aa-mode[disabled] {
  opacity: 0.4;
  cursor: not-allowed;
}
.aa-close {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  font: inherit;
}
.aa-close:hover {
  border-color: var(--accent-border);
  color: var(--accent);
}
.aa-context-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 14px;
  min-height: 42px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}
.aa-chip {
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 11px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.aa-chip-empty {
  color: var(--text-mute);
  font-size: 12px;
}
.aa-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.aa-empty {
  margin: auto;
  max-width: 280px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.45;
}
.aa-msg {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.aa-msg-user {
  align-self: flex-end;
  background: var(--accent);
  color: #101010;
  border-bottom-right-radius: 4px;
}
.aa-msg-assistant {
  align-self: flex-start;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-border);
  border-bottom-left-radius: 4px;
}
.aa-msg-mode-edit {
  border-left-color: var(--accent);
}
.aa-msg-mode-agent {
  border-left-color: var(--blue);
}
.aa-msg-system {
  align-self: center;
  max-width: 92%;
  color: var(--text-dim);
  font-style: italic;
  background: transparent;
  border: 0;
}
.aa-msg-error {
  align-self: flex-start;
  background: rgba(220, 38, 38, 0.08);
  color: #fecaca;
  border: 1px solid rgba(220, 38, 38, 0.55);
  border-bottom-left-radius: 4px;
}
.aa-msg-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 92%;
}
.aa-msg-wrap-assistant {
  align-self: flex-start;
}
.aa-action-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.aa-action-card {
  width: min(360px, 100%);
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text-dim);
  font-size: 12px;
}
.aa-action-card.aa-action-error {
  border-color: rgba(220, 38, 38, 0.65);
  background: rgba(220, 38, 38, 0.07);
}
.aa-action-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.aa-action-title {
  min-width: 0;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.aa-action-risk {
  margin-right: 4px;
}
.aa-action-status {
  flex-shrink: 0;
  padding: 2px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-mute);
  font-size: 10px;
  text-transform: uppercase;
}
.aa-action-status-ok {
  color: #101010;
  border-color: var(--accent);
  background: var(--accent);
}
.aa-action-status-error {
  color: #fecaca;
  border-color: rgba(220, 38, 38, 0.7);
  background: rgba(220, 38, 38, 0.16);
}
.aa-action-status-pending {
  position: relative;
}
.aa-action-status-pending::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 4px;
  border-radius: 50%;
  border: 1px solid var(--text-mute);
  border-top-color: transparent;
  animation: wsc-spin 0.7s linear infinite;
}
.aa-action-status-awaiting_confirm {
  color: #fde68a;
  border-color: rgba(251, 191, 36, 0.55);
  background: rgba(251, 191, 36, 0.12);
}
.aa-action-summary,
.aa-action-error,
.aa-action-result {
  margin-top: 5px;
  line-height: 1.35;
}
.aa-action-error {
  color: #fecaca;
}
.aa-action-result {
  color: var(--text-mute);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 10.5px;
}
.aa-action-confirm {
  margin-top: 8px;
  border: 1px solid var(--accent-border);
  border-radius: 7px;
  background: var(--accent);
  color: #101010;
  padding: 5px 9px;
  font: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.aa-working {
  align-self: center;
  color: var(--text-dim);
  font-size: 12px;
  font-style: italic;
  padding: 8px 0 2px;
}
.aa-composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  background: var(--grey-1);
}
.aa-composer textarea {
  flex: 1;
  min-height: 38px;
  max-height: 132px;
  resize: none;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-2);
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  line-height: 19px;
}
.aa-composer textarea:focus {
  outline: none;
  border-color: var(--accent-border);
}
#aaSend.btn.primary {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  background: var(--accent);
  color: #101010;
  font-weight: 700;
  cursor: pointer;
}
#aaSend.btn.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.aa-composer textarea:disabled {
  opacity: 0.6;
  cursor: wait;
}
.aa-footer {
  padding: 8px 14px 10px;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 12px;
  background: var(--grey-1);
}
.aa-floating-chip {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 209;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 13px;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: rgba(10, 10, 10, 0.92);
  color: var(--text);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
  cursor: pointer;
  font: inherit;
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.aa-floating-chip[hidden] {
  display: none !important;
}
.aa-floating-chip:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.5);
}
.aa-chip-icon {
  color: var(--accent);
}
.aa-chip-label {
  font-size: 12px;
  font-weight: 700;
}
@media (max-width: 768px) {
  #atlasAssistant {
    width: 100%;
  }
}

/* v3.83+ — Timeline-only product slice (reversible via TIMELINE_ONLY=1) */
body[data-platform="timeline"] .full-platform-only {
  display: none !important;
}
body[data-platform="timeline"] .sidebar {
  display: none !important;
}
body[data-platform="timeline"] .layout,
body[data-platform="timeline"] .layout.timeline-shell {
  grid-template-columns: 1fr;
}
body[data-platform="timeline"] .main {
  max-width: none;
  padding: 0;
}
body[data-platform="timeline"] .timeline-only-job-panel {
  padding: 16px 14px;
}
body[data-platform="timeline"] #view-jobs .page-hint {
  max-width: 52ch;
}
/* Launcher on boot — empty shell behind modal; de-emphasize redundant chip */
body[data-platform="timeline"].timeline-launcher-boot .main .view {
  display: none !important;
}
body[data-platform="timeline"].timeline-launcher-boot .timeline-floating-chip {
  opacity: 0.42;
  transform: scale(0.94);
  pointer-events: none;
  box-shadow: none;
}
body[data-platform="timeline"]:not(.timeline-launcher-boot) .timeline-floating-chip {
  right: 22px;
}

