/* ============================================================
   Khmer Dubbing Studio — visual identity: "Neon Creator Studio"
   Booth-black base + an RGB glow rail (the kind of light strip a
   streamer or content creator runs behind their desk) standing in
   for the old brass trim. Bold gradient CTAs, pill shapes, punchy
   saturated signal colors — built mobile-first, sidebar collapses
   into a proper slide-down nav under 860px.
   Every class name below is referenced by ~20 PHP templates —
   selectors are stable; only values + a few additive rules changed.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600&display=swap');

:root {
  /* console body */
  --ink-950: #0e0d16;
  --ink-850: #171625;
  --ink-800: #201f33;
  --ink-700: #2b2a42;
  /* signature — RGB creator-studio glow rail (was brass) */
  --neon-1: #8b5cf6;   /* violet */
  --neon-2: #ec4899;   /* hot pink */
  --neon-3: #fb923c;   /* coral */
  --neon-grad: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  --neon-soft: rgba(139, 92, 246, .20);
  /* signal lights — punchier, more saturated than pastel */
  --sig-red: #ff3b5c;
  --sig-red-soft: #ffe2e7;
  --sig-green: #17c07a;
  --sig-green-soft: #d9f9ea;
  --sig-amber: #ffab1f;
  --sig-amber-soft: #fff1da;
  --sig-blue: #4f7dff;
  --sig-blue-soft: #e7ecff;
  --sig-violet: #a855f7;
  --sig-violet-soft: #f4e7ff;
  /* canvas */
  --canvas: #f5f4fa;
  --surface: #ffffff;
  --ink: #17162a;
  --muted: #6f6d85;
  --line: #e6e4f0;
  --line-soft: #efeef7;
  /* type */
  --f-display: "Space Grotesk", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", Consolas, "Courier New", monospace;
  --f-khmer: "Khmer OS System", "Khmer OS", "Noto Sans Khmer", "Leelawadee UI", sans-serif;
  --shadow-1: 0 1px 2px rgba(23,22,42,.05), 0 1px 1px rgba(23,22,42,.03);
  --shadow-2: 0 10px 30px rgba(23,22,42,.10), 0 2px 8px rgba(23,22,42,.06);
  --radius: 16px;
  --radius-pill: 999px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font: 400 15px/1.55 var(--f-body);
  background: var(--canvas);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--sig-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--neon-soft); }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 250px; flex-shrink: 0;
  background: var(--ink-950); color: #bcb9ce;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  border-right: 1px solid #0a0912;
  position: relative;
}
.sidebar::before {
  /* signature RGB glow rail */
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 3px;
  background: linear-gradient(180deg, var(--neon-1) 0%, var(--neon-2) 50%, var(--neon-3) 100%);
  box-shadow: 0 0 14px 1px rgba(139,92,246,.5);
}
.content { flex: 1; padding: 30px 36px; max-width: 1320px; min-width: 0; }

/* ---------- Sidebar ---------- */
.brand { display: flex; gap: 11px; align-items: center; padding: 22px 20px 18px; position: relative; }
.brand-dot {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--sig-red);
  box-shadow: 0 0 0 3px rgba(255,59,92,.22), 0 0 10px rgba(255,59,92,.6);
  animation: recpulse 2.4s ease-in-out infinite;
  flex-shrink: 0;
}
@keyframes recpulse { 50% { box-shadow: 0 0 0 6px rgba(255,59,92,.10), 0 0 14px rgba(255,59,92,.45); } }
@media (prefers-reduced-motion: reduce) { .brand-dot { animation: none; } }
.brand-name { font: 700 16px/1.2 var(--f-display); color: #fff; letter-spacing: -.1px; }
.brand-sub { font-size: 11px; color: #7d7a92; margin-top: 2px; }

.sidebar nav { flex: 1; padding: 4px 12px; overflow-y: auto; }
.nav-group {
  font: 600 10px/1 var(--f-display); text-transform: uppercase; letter-spacing: 1.6px;
  color: #5c5a72; margin: 18px 10px 7px;
}
.sidebar nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin: 2px 0;
  color: #bcb9ce; border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 500;
  transition: background .12s ease, color .12s ease;
}
.sidebar nav a svg { flex-shrink: 0; opacity: .8; }
.sidebar nav a:hover { background: var(--ink-800); text-decoration: none; color: #fff; }
.sidebar nav a.active {
  background: linear-gradient(135deg, rgba(139,92,246,.28), rgba(236,72,153,.22));
  color: #fff; font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(139,92,246,.35);
}
.sidebar nav a.active svg { opacity: 1; color: #d8b4fe; }

.sidebar-user { padding: 15px 20px; border-top: 1px solid #201f33; font-size: 13px; }
.u-name { color: #fff; font-weight: 600; font-family: var(--f-display); }
.u-role { color: #7d7a92; font-size: 11.5px; margin: 1px 0 7px; }
.logout { color: #928fa6; font-size: 12px; }
.logout:hover { color: #fff; }

/* ---------- Mobile top bar + nav toggle (hidden on desktop) ---------- */
.mobile-topbar { display: none; }
.nav-toggle {
  display: none; width: 38px; height: 38px; border-radius: 10px;
  background: var(--ink-800); border: none; color: #fff; cursor: pointer;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.nav-toggle svg { pointer-events: none; }

/* ---------- Headings / page chrome ---------- */
h1 { font: 700 25px/1.25 var(--f-display); margin: 0 0 5px; letter-spacing: -.4px; color: var(--ink); }
h2 { font: 700 16px/1.3 var(--f-display); margin: 28px 0 12px; color: var(--ink); letter-spacing: -.1px; }
.page-sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }

/* ---------- Cards / tables ---------- */
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px;
  box-shadow: var(--shadow-1); position: relative;
}
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th {
  text-align: left; font: 600 10.5px/1 var(--f-display); text-transform: uppercase;
  letter-spacing: 1px; color: var(--muted);
  padding: 9px 11px; border-bottom: 2px solid var(--line);
}
td { padding: 10px 11px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tr:hover td { background: #faf9ff; }

/* ---------- Khmer & Chinese text ---------- */
.khmer { font-family: var(--f-khmer); font-size: 17px; line-height: 1.9; }
.chinese { font-size: 15.5px; }
.time-code {
  font-family: var(--f-mono); font-size: 12px; color: var(--muted);
  white-space: nowrap; letter-spacing: .2px;
}

/* ---------- Badges (tinted pill + dot) ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: var(--radius-pill);
  font: 700 11px/1 var(--f-body); white-space: nowrap;
  background: #ece9f7; color: #58566e;
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.b-approved, .b-completed, .b-done { background: var(--sig-green-soft); color: var(--sig-green); }
.b-pending, .b-not_assigned, .b-not_started { background: #ece9f7; color: #6f6d85; }
.b-ai_translated, .b-uploaded, .b-assigned { background: var(--sig-blue-soft); color: var(--sig-blue); }
.b-under_review, .b-translation_review, .b-reviewed, .b-in_progress,
.b-translating, .b-recording, .b-editing, .b-qc { background: var(--sig-amber-soft); color: #b3760a; }
.b-needs_correction, .b-needs_rerecord, .b-rejected { background: var(--sig-red-soft); color: var(--sig-red); }
.b-recorded { background: var(--sig-violet-soft); color: var(--sig-violet); }

/* ---------- Forms ---------- */
label { display: block; font: 600 12.5px/1 var(--f-body); margin: 13px 0 5px; color: var(--ink); }
input[type=text], input[type=password], input[type=number], input[type=file],
select, textarea {
  width: 100%; padding: 10px 12px; font: inherit;
  border: 1px solid #dcdae8; border-radius: 10px; background: #fff;
  color: var(--ink); transition: border-color .12s ease, box-shadow .12s ease;
}
textarea.khmer, input.khmer { font-family: var(--f-khmer); font-size: 17px; }
textarea { resize: vertical; min-height: 64px; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--neon-1);
  box-shadow: 0 0 0 3px var(--neon-soft);
}
button:focus-visible, a:focus-visible { outline: 2px solid var(--sig-blue); outline-offset: 2px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px; border-radius: var(--radius-pill);
  border: 1px solid transparent; cursor: pointer;
  font: 700 13.5px/1 var(--f-body);
  background: var(--neon-grad); color: #fff;
  box-shadow: 0 4px 14px rgba(139,92,246,.35);
  transition: transform .06s ease, box-shadow .12s ease, filter .12s ease;
  min-height: 40px;
}
.btn:hover { filter: brightness(1.06); text-decoration: none; }
.btn:active { transform: translateY(1px); box-shadow: 0 2px 6px rgba(139,92,246,.3); }
.btn-ok { background: var(--sig-green); box-shadow: 0 4px 14px rgba(23,192,122,.32); }
.btn-rec { background: var(--sig-red); box-shadow: 0 4px 14px rgba(255,59,92,.32); }
.btn-ghost {
  background: transparent; color: var(--ink); border-color: #dcdae8;
  box-shadow: none;
}
.btn-ghost:hover { background: #efedf9; filter: none; }
.btn-sm { padding: 6px 13px; font-size: 12px; min-height: 32px; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; filter: none; }

/* ---------- Flash messages ---------- */
.flash {
  padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-size: 13.5px;
  border-left: 3px solid; background: var(--surface); box-shadow: var(--shadow-1);
}
.flash-ok { border-color: var(--sig-green); color: #0e7a4c; background: var(--sig-green-soft); }
.flash-err { border-color: var(--sig-red); color: #c81638; background: var(--sig-red-soft); }
.flash-info { border-color: var(--sig-blue); color: #2650c9; background: var(--sig-blue-soft); }

/* ---------- Dashboard stats ---------- */
.stat { text-align: left; }
.stat .n { font: 700 30px/1 var(--f-display); letter-spacing: -.6px; color: var(--ink); }
.stat .l { font: 700 11px/1 var(--f-body); color: var(--muted); text-transform: uppercase; letter-spacing: 1px; margin-top: 6px; }

/* ---------- Progress — segmented neon meter ---------- */
.progress {
  background: #e9e7f3; border-radius: 999px; height: 10px; overflow: hidden;
  position: relative;
}
.progress > span {
  display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--neon-1), var(--neon-2), var(--neon-3));
  background-size: 340px 100%;
  transition: width .3s ease;
}
.progress::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: repeating-linear-gradient(90deg, rgba(245,244,250,.9) 0 2px, transparent 2px 9px);
}
.progress-row { display: flex; align-items: center; gap: 12px; margin: 9px 0; flex-wrap: wrap; }
.progress-row .pn { width: 200px; font-weight: 600; font-size: 13.5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress-row .progress { flex: 1; min-width: 90px; }
.progress-row .pv { width: 44px; text-align: right; font: 700 12.5px var(--f-mono); color: var(--muted); }

/* ---------- Pipeline steps on project page ---------- */
.pipeline { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 6px; }
.pipe-step {
  padding: 6px 14px; border-radius: var(--radius-pill); font: 700 11.5px/1 var(--f-body);
  background: #ece9f7; color: var(--muted);
}
.pipe-step.on { background: var(--neon-grad); color: #fff; }
.pipe-step.done { background: var(--sig-green-soft); color: var(--sig-green); }

/* ---------- Recording screen line cards ---------- */
.rec-line {
  background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--line);
  border-radius: var(--radius); padding: 18px 22px; margin-bottom: 16px;
  box-shadow: var(--shadow-1);
}
.rec-line.active { border-left-color: var(--sig-red); }
.rec-dialogue { font-family: var(--f-khmer); font-size: 21px; line-height: 2; margin: 8px 0; }
.rec-meta { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.rec-timer { font-family: var(--f-mono); font-size: 15px; color: var(--sig-red); font-weight: 700; }

/* ---------- QC checklist ---------- */
.qc-item { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line-soft); }
.qc-item input { width: auto; margin-top: 4px; accent-color: var(--neon-1); }

/* ---------- Misc ---------- */
.muted { color: var(--muted); font-size: 13px; }
.mt { margin-top: 14px; }
.right { text-align: right; }
.inline-form { display: inline; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 14px; }
.filters label { margin: 0 0 4px; }
.filters > div { min-width: 150px; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(600px 400px at 15% 10%, rgba(139,92,246,.20), transparent 60%),
    radial-gradient(500px 350px at 90% 90%, rgba(236,72,153,.14), transparent 60%),
    var(--ink-950);
  padding: 24px 16px;
}
.login-card {
  width: 400px; max-width: 100%; background: var(--surface); border-radius: 26px;
  padding: 38px 30px 34px; box-shadow: 0 30px 70px rgba(0,0,0,.4);
}
.login-card h1 { font-size: 25px; }

.logo-badge {
  width: 82px; height: 82px; margin: 0 auto 20px; position: relative;
  border-radius: 50%; padding: 6px;
  background: conic-gradient(from 200deg, var(--neon-1), var(--neon-2), var(--neon-3), var(--neon-1));
}
.logo-badge-inner {
  width: 100%; height: 100%; border-radius: 50%; background: var(--ink-950);
  display: flex; align-items: center; justify-content: center;
}
.logo-badge-dot {
  position: absolute; top: 2px; right: 2px; width: 13px; height: 13px; border-radius: 50%;
  background: var(--sig-red); border: 2.5px solid #fff;
  box-shadow: 0 0 8px rgba(255,59,92,.6);
  animation: recpulse 2.4s ease-in-out infinite;
}

.login-error {
  display: flex; align-items: center; gap: 8px;
  color: var(--sig-red); background: var(--sig-red-soft);
  border-radius: 12px; padding: 10px 14px; font-size: 13px; font-weight: 600;
  margin-bottom: 16px;
}
.login-error svg { flex-shrink: 0; }

.input-icon { position: relative; }
.input-icon > svg:first-child {
  position: absolute; left: 15px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none;
}
.input-icon input {
  padding-left: 42px; padding-right: 42px;
  border-radius: var(--radius-pill);
}
.input-icon-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 50%; border: none; background: transparent;
  color: var(--muted); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.input-icon-toggle:hover { background: var(--line-soft); color: var(--ink); }
.input-icon-toggle.is-visible { color: var(--neon-1); }

/* ---------- Video preview cards (project page + subtitle editor) ---------- */
.video-card { border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; background: #fafaff; }
.video-card:last-of-type { margin-bottom: 0; }
.video-preview {
  width: 100%; max-height: 260px; display: block; border-radius: 12px;
  background: var(--ink-950); outline: none;
}
.video-preview-fallback {
  height: 120px; display: flex; align-items: center; justify-content: center;
  color: #9d9ab0; font-size: 13px; background: var(--ink-950); border-radius: 12px;
}
.sub-video-card { position: sticky; top: 16px; z-index: 5; }
.sub-video-card .video-preview { max-height: 300px; }

/* ---------- Recording page: character grouping ---------- */
.rec-project-title { font: 700 15px var(--f-display); margin: 24px 0 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; }
.char-group { margin-bottom: 26px; }
.char-group-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.char-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font: 700 15px var(--f-display); color: #fff; background: var(--muted);
}
.char-avatar.is-m { background: linear-gradient(135deg, var(--sig-blue), var(--neon-1)); }
.char-avatar.is-f { background: linear-gradient(135deg, var(--neon-2), var(--sig-violet)); }
.char-group-name { font: 700 15px var(--f-display); color: var(--ink); }
.char-group-actor { font-size: 12.5px; color: var(--muted); margin-top: 1px; }

/* ============================================================
   Studio recorder panel (recording.php) — same console language
   ============================================================ */
.studio {
  background: var(--ink-950); border-radius: 14px; padding: 16px 18px;
  color: #bcb9ce; margin-top: 12px; border: 1px solid #0a0912;
}
.studio .btn-ghost { color: #bcb9ce; border-color: #38364e; }
.studio .btn-ghost:hover { background: var(--ink-800); }
.studio label { color: #928fa6; }
.studio-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.vu {
  flex: 1; min-width: 100px; height: 14px; border-radius: 999px;
  background: #0a0912; overflow: hidden; border: 1px solid #2b2a42;
}
.vu-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--sig-green) 0%, var(--sig-green) 60%, var(--sig-amber) 80%, var(--sig-red) 100%);
  background-size: 260px 100%;
  transition: width .06s linear;
}
.wave {
  width: 100%; display: block; margin-top: 11px; border-radius: 12px;
  background: #0a0912; border: 1px solid #2b2a42;
}
.studio-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 9px; }
.trim-label { display: flex; align-items: center; gap: 6px; font-size: 12px; margin: 0; font-weight: 400; }
.trim-label input[type=range] { width: 120px; max-width: 40vw; accent-color: var(--neon-2); }
.studio .rec-timer { min-width: 52px; }
.studio input[type=file] { background: #0a0912; border-color: #2b2a42; color: #bcb9ce; }

/* ============================================================
   MOBILE — real support, not just reflow. Sidebar becomes a
   slide-down panel behind a hamburger; tables scroll instead of
   breaking; touch targets grow; sticky video un-stickies so it
   doesn't eat the whole screen while scrolling review lines.
   ============================================================ */
@media (max-width: 860px) {
  .layout { flex-direction: column; }

  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 10px; padding: 10px 14px; background: var(--ink-950);
    position: sticky; top: 0; z-index: 30;
    border-bottom: 1px solid #201f33;
  }
  .mobile-topbar .brand { padding: 0; }
  .mobile-topbar .brand-name { font-size: 14px; }
  .mobile-topbar .brand-sub { display: none; }
  .nav-toggle { display: flex; }

  .sidebar {
    width: 100%; height: auto; position: static;
    display: none; /* opened via .nav-open */
  }
  .sidebar.nav-open { display: flex; }
  .sidebar .brand { display: none; } /* shown in mobile-topbar instead */

  .content { padding: 18px 16px; }
  h1 { font-size: 21px; }
  .btn, select, input, textarea { min-height: 42px; } /* touch target */
  .progress-row .pn { width: 100%; order: -1; }
  .filters > div { min-width: 100%; }

  /* tables scroll horizontally instead of squeezing / breaking layout */
  table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  td, th { white-space: normal; }

  .sub-video-card { position: static; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }

  .login-card { padding: 30px 22px 26px; border-radius: 20px; }
}

@media (min-width: 861px) {
  .mobile-topbar { display: none !important; }
  .sidebar { display: flex !important; }
}

/* ---------- Auto-mix progress (indeterminate — ffmpeg has no reliable %) ---------- */
.am-indeterminate {
  background: linear-gradient(90deg, var(--neon-1), var(--neon-2), var(--neon-3), var(--neon-1)) !important;
  background-size: 300% 100% !important;
  animation: am-shimmer 1.8s linear infinite;
}
@keyframes am-shimmer { 0% { background-position: 0% 0; } 100% { background-position: -300% 0; } }
@media (prefers-reduced-motion: reduce) { .am-indeterminate { animation: none; } }

/* ---------- Video trim tool (project page) ---------- */
.trim-tool { background: #fafaff; border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; }
.trim-tool .js-trim-range { font-family: var(--f-mono); font-size: 12px; }

/* ---------- Editing: sync-check timeline ---------- */
.timeline-bar {
  position: relative; height: 60px; background: var(--ink-950);
  border-radius: 10px; overflow: hidden; border: 1px solid #2b2a42;
}
.timeline-block {
  position: absolute; top: 8px; height: 44px; min-width: 22px; border-radius: 6px;
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  background-clip: padding-box; box-sizing: border-box;
  border: 2px solid var(--ink-950); /* seam so touching blocks stay visually distinct */
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer; box-shadow: 0 2px 6px rgba(0,0,0,.3);
  transition: transform .1s ease;
}
.timeline-block:hover { transform: translateY(-2px); z-index: 2; }
.timeline-block { cursor: grab; touch-action: none; user-select: none; }
.timeline-block.is-dragging { cursor: grabbing; z-index: 3; transform: translateY(-2px) scale(1.04); box-shadow: 0 6px 16px rgba(0,0,0,.45); transition: none; }
.timeline-block.is-overlap { background: linear-gradient(135deg, var(--sig-red), #a6231f); }
.timeline-block.is-saving { opacity: .6; }
.timeline-block.is-save-error { outline: 2px solid var(--sig-red); animation: block-shake .4s ease; }
@keyframes block-shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-3px); } 75% { transform: translateX(3px); } }
@media (prefers-reduced-motion: reduce) { .timeline-block.is-save-error { animation: none; } }
.timeline-playhead {
  position: absolute; top: 0; bottom: 0; width: 2px; background: #fff;
  box-shadow: 0 0 6px rgba(255,255,255,.8); pointer-events: none; z-index: 4;
}
.timeline-playhead::before {
  content: ""; position: absolute; top: -1px; left: 50%; transform: translateX(-50%);
  width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid #fff;
}

/* ---------- Time ruler + track labels ---------- */
.timeline-ruler { position: relative; height: 20px; margin-bottom: 2px; }
.timeline-ruler-tick {
  position: absolute; top: 0; font: 600 10.5px var(--f-mono); color: var(--muted);
  border-left: 1px solid var(--line); padding-left: 4px; white-space: nowrap;
}
.timeline-track-label {
  font: 700 10.5px var(--f-display); text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted); margin: 6px 0 3px;
}
.timeline-track-video {
  height: 22px; border-radius: 6px; background: var(--ink-950); border: 1px solid #2b2a42;
  overflow: hidden; margin-bottom: 8px;
}
.timeline-track-video-fill {
  height: 100%; width: 100%;
  background: repeating-linear-gradient(90deg, #23223a 0 18px, #1c1b2e 18px 36px);
}

/* ---------- Waveform-textured take blocks ---------- */
.timeline-block {
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.22) 0 2px, transparent 2px 5px),
    linear-gradient(135deg, var(--neon-1), var(--neon-2));
}
.timeline-block.is-overlap {
  background-image:
    repeating-linear-gradient(90deg, rgba(255,255,255,.22) 0 2px, transparent 2px 5px),
    linear-gradient(135deg, var(--sig-red), #a6231f);
}
.timeline-block.is-active { outline: 2px solid #fff; box-shadow: 0 0 0 4px var(--neon-soft), 0 4px 10px rgba(0,0,0,.4); }

/* ---------- Quick ±ms nudge buttons ---------- */
.ms-nudge-group { display: flex; align-items: center; gap: 4px; }
.ms-nudge-group .js-nudge { padding: 4px 8px; font-size: 11px; min-height: 28px; }
.ms-nudge-group input[type=number] { text-align: center; }

/* ---------- Row highlight (timeline click / re-record deep-link target) ---------- */
.row-flash { animation: row-flash-anim 1.8s ease; }
@keyframes row-flash-anim {
  0%, 100% { background: transparent; }
  15% { background: var(--neon-soft); }
}
tr.row-flash { display: table-row; }
.rec-line.row-flash { box-shadow: 0 0 0 3px var(--neon-1); }
@media (prefers-reduced-motion: reduce) { .row-flash { animation: none; } .rec-line.row-flash { box-shadow: 0 0 0 3px var(--neon-1); } }

/* ---------- Clip editor (ffmpeg.wasm, clip_editor.php) ---------- */
.ce-timeline {
  display: flex; gap: 3px; height: 60px; padding: 6px;
  background: var(--ink-950); border-radius: 10px; border: 1px solid #2b2a42;
  overflow-x: auto;
}
.ce-clip {
  position: relative; flex-shrink: 0; min-width: 46px; height: 100%;
  border-radius: 6px; background: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  color: #fff; font: 700 11px var(--f-mono); display: flex; align-items: center; justify-content: center;
  cursor: grab; user-select: none; touch-action: none;
  border: 2px solid var(--ink-950); box-sizing: border-box;
}
.ce-clip.is-selected { outline: 2px solid #fff; box-shadow: 0 0 0 4px var(--neon-soft); }
.ce-clip.is-dragging { cursor: grabbing; opacity: .8; }
.ce-clip-del {
  position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: rgba(0,0,0,.4); color: #fff; border: none; font-size: 10px; line-height: 1;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.ce-clip-del:hover { background: var(--sig-red); }

/* ---------- Dashboard: new-work notification ---------- */
.flash-new-work {
  background: linear-gradient(135deg, var(--neon-1), var(--neon-2));
  color: #fff; padding: 14px 18px; border-radius: 12px;
  font-weight: 600; box-shadow: 0 4px 14px rgba(139,92,246,.35);
}
.badge-new {
  display: inline-block; background: var(--sig-red); color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: .5px;
  padding: 2px 7px; border-radius: 20px; vertical-align: middle;
}
.card-accent-work { border-left: 4px solid var(--neon-1); }
tr.row-is-new { background: var(--neon-soft); }
