/* ============================================
   Vicoflow Design System v1
   ============================================ */
:root {
  /* — Brand — */
  --brand: #5B3CFF;        /* electric violet — primary */
  --brand-deep: #3D1FE0;
  --brand-soft: #EEEAFF;
  --brand-tint: #F5F2FF;
  --brand-ink: #1A0A66;

  --accent-mint: #00E5A0;
  --accent-coral: #FF5A7A;
  --accent-cyan: #38D4FF;

  /* — Neutrals — */
  --ink: #0B0B14;
  --ink-2: #2A2A36;
  --ink-3: #5B5B6E;
  --ink-4: #7B7B8E;
  --ink-5: #B8B8C7;
  --line: #ECECF2;
  --line-2: #DEDEE6;
  --bg: #FFFFFF;
  --bg-soft: #F7F7FB;
  --bg-tint: #F2F1F8;

  /* — Effects — */
  --aurora: radial-gradient(at 20% 20%, rgba(91,60,255,.22), transparent 55%),
            radial-gradient(at 80% 30%, rgba(255,90,122,.18), transparent 55%),
            radial-gradient(at 60% 80%, rgba(0,229,160,.16), transparent 55%);

  --glass-bg: rgba(255,255,255,.62);
  --glass-border: rgba(11,11,20,.06);
  --glass-blur: 18px;

  --shadow-sm: 0 1px 2px rgba(11,11,20,.04), 0 1px 1px rgba(11,11,20,.03);
  --shadow-md: 0 4px 12px rgba(11,11,20,.06), 0 1px 2px rgba(11,11,20,.04);
  --shadow-lg: 0 20px 60px -20px rgba(91,60,255,.35), 0 8px 24px rgba(11,11,20,.08);
  --shadow-pop: 0 24px 80px -20px rgba(91,60,255,.4);

  /* — Radius — */
  --r-xs: 6px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;

  /* — Type — */
  --font-display: "SmileySans-Oblique", "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", "Cascadia Mono", monospace;

  /* Compatibility aliases used by the production progress panels. */
  --surface: var(--bg);
  --sunken: var(--bg-soft);
  --border: var(--line);
  --borderStrong: var(--line-2);
  --text: var(--ink);
  --muted: var(--ink-3);
  --faint: var(--ink-5);
  --accent: var(--brand);
  --accentSoft: var(--brand-soft);
  --accentInk: var(--brand-ink);
  --accentHover: var(--brand-deep);
  --warn: #B57400;
  --danger: var(--accent-coral);
  --ok: var(--accent-mint);
  --font-heading: var(--font-display);
  --shadow-card: var(--shadow-md);
  --pad-card: 18px;
  --pad-card-y: 16px;
  --row-gap: 12px;
  --card-gap: 16px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: 0.005em;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, p { margin: 0; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.mono { font-family: var(--font-mono); letter-spacing: -0.01em; }

/* ============================================
   Reusable atoms
   ============================================ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px;
  padding: 0 20px;
  border-radius: var(--r-pill);
  font-size: 14px;
  font-weight: 500;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn.primary {
  background: var(--ink);
  color: white;
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.brand {
  background: var(--brand);
  color: white;
  box-shadow: 0 8px 24px -8px rgba(91,60,255,.6);
}
.btn.brand:hover { background: var(--brand-deep); transform: translateY(-1px); box-shadow: 0 12px 32px -8px rgba(91,60,255,.7); }
.btn.ghost {
  background: transparent;
  color: var(--ink);
}
.btn.ghost:hover { background: var(--bg-tint); }
.btn.danger {
  background: #FFE7EC;
  color: var(--accent-coral);
  border: 1.5px solid #FFD1DA;
  font-weight: 600;
}
.btn.danger:hover {
  background: var(--accent-coral);
  color: white;
  border-color: var(--accent-coral);
  transform: none;
}
.btn.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--glass-border);
}
.btn.sm { height: 36px; padding: 0 14px; font-size: 13px; }
.btn.lg { height: 52px; padding: 0 26px; font-size: 15px; }

.eyebrow-chip {
  display: inline-flex; align-items: center; gap: 8px;
  height: 30px;
  padding: 0 12px 0 6px;
  border-radius: var(--r-pill);
  background: white;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink-3);
  box-shadow: var(--shadow-sm);
}
.eyebrow-chip .dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--brand);
  display: grid; place-items: center;
  color: white;
  font-size: 9px;
  font-weight: 700;
}
.eyebrow-chip .accent { color: var(--brand); font-weight: 600; }

/* ============================================
   Vico logo (inline-able SVG)
   ============================================ */
.logo {
  display: inline-flex; align-items: center; gap: 10px;
}
.logo-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--ink);
  display: grid; place-items: center;
  position: relative;
  overflow: hidden;
}
.logo-mark::before {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent-coral) 100%);
  opacity: 1;
}
.logo-mark svg {
  position: relative;
  width: 18px; height: 18px;
  color: white;
}
.logo-word {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.logo-word .flow { color: var(--ink-4); font-weight: 400; }
/* ============================================
   Workstation chrome (shared by all step pages)
   Loaded after tokens.css
   ============================================ */
body { background: var(--bg-soft); }
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: 60px 1fr;
  grid-template-areas:
    "head head"
    "side main";
  min-height: 100vh;
}

/* On narrow viewports the 248px sidebar can't share a row with the
   workspace — hide it, collapse the header layout, and let the main
   column fill the screen. Single-column fallback, no hamburger yet. */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "head" "main"; }
  .app .side { display: none; }
  .app .head { grid-template-columns: 1fr auto; }
  .app .brand-cell { padding: 0 14px; border-right: none; }
  .app .proj-cell { padding: 0 14px; }
  .app .head-actions .project-count,
  .app .head-actions .job-switcher { display: none; }
  .app .main { padding: 16px; }
  /* Stack workspace-head vertically, hide verbose description.
     Without these the title + StepActions overflow horizontally. */
  .workspace-head {
    flex-direction: column; align-items: stretch;
    gap: 10px; margin-bottom: 14px;
  }
  .workspace-head h1 { font-size: 20px; }
  .workspace-head .ws-desc { display: none; }
  .ws-actions { flex-wrap: wrap; }
  .crumb { font-size: 10px; margin-bottom: 8px; }
  .crumb span:not(.here):not(.sep),
  .crumb .crumb-link { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* Job-snapshot health bar wraps instead of overflowing */
  .health { flex-wrap: wrap; gap: 8px; padding: 10px 12px; }
  /* Project/Task dashboards collapse multi-column grids */
  .task-dashboard .projects-grid,
  .project-detail .project-grid,
  .debug-checkpoint-body,
  .stats { grid-template-columns: 1fr !important; gap: 12px; }
  /* Panels — the workbench step pages — collapse all 2/3-col layouts. */
  .main .card,
  .main section,
  .main div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }

  /* Storyboard rows turn into vertical cards on mobile. Each cell labels
     itself via a ::before pseudo so users know what they're reading. */
  .sb-wrap { border-radius: var(--r-md); }
  .sb-head { display: none; }
  .sb-row {
    grid-template-columns: 1fr !important;
    gap: 6px;
    padding: 12px 14px;
  }
  .sb-row .sb-col { font-size: 13px; }
  .sb-row .sb-col.c-id::before { content: "#"; color: var(--ink-4); margin-right: 6px; font-size: 11px; }
  .sb-row .sb-col.c-dur::before { content: "时长"; color: var(--ink-4); margin-right: 6px; font-size: 11px; }
  .sb-row .sb-col.c-scene::before { content: "场景 · "; color: var(--ink-4); font-size: 11px; }
  .sb-row .sb-col.c-cast::before { content: "角色 · "; color: var(--ink-4); font-size: 11px; }
  .sb-row .sb-col.c-cam::before { content: "机位 / 运镜 · "; color: var(--ink-4); font-size: 11px; }
  .sb-row .sb-col.c-line::before { content: "台词 · "; color: var(--ink-4); font-size: 11px; }

  /* Card grids collapse to single column on phones. */
  .anchor-grid, .scene-grid { grid-template-columns: 1fr !important; padding: 14px; }
  .anchor-card, .scene-card { width: 100%; }

  /* Filmstrip thumbnails stay scrollable but each item gets bigger for
     thumb-friendly tap targets. */
  .filmstrip { gap: 10px; padding: 12px 14px; }
  .filmstrip .fs-shot { min-width: 140px; }

  /* Touch targets: ≥44px height for primary controls (WCAG 2.5.5).
     Stays compact on desktop, only takes effect ≤760px. */
  .btn, .btn-icon, button:not(.icon-button):not(.toast-close):not(.sb-row *):not(.tag-x),
  .ws-actions .btn { min-height: 44px; padding-left: 14px; padding-right: 14px; }
  .step-actions .btn,
  .stage-actions .btn { min-height: 44px; }
  .review-decision { min-height: 44px; }
  .file-tab, .panel-tab { min-height: 40px; }

  /* Clip trim row already gets 1fr at 980px; on phones we also widen
     the stepper inputs and stack the dual range. */
  .clip-trim-row { padding: 14px; }
  .clip-trim-fields input[type="number"] { min-height: 40px; font-size: 14px; }
  .clip-trim-range { min-height: 44px; }

  /* Delivery config: each block becomes a collapsible-feeling card. */
  .delivery-config-grid { grid-template-columns: 1fr !important; padding: 14px; gap: 14px; }
  .delivery-config-block { padding: 14px; }

  /* Modals / drawers reach edge-to-edge on small screens, leave the
     status bar safe area at top. */
  .drawer, .modal-shell { width: 100vw !important; max-width: 100vw !important; }
  .drawer-grid { grid-template-columns: 1fr !important; }
  .drawer-preview { width: 100% !important; }

  /* Inline grid-template-columns fallback — last-resort catch for
     anything we miss. The .main scope above handles most, but some
     drawer/dialog descendants live outside .main. */
  body div[style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
}

/* HEADER */
.head {
  grid-area: head;
  display: grid;
  grid-template-columns: 248px 1fr auto;
  align-items: center;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  padding-right: 20px;
  z-index: 5;
}
.brand-cell {
  padding: 0 20px;
  display: flex; align-items: center; gap: 10px;
  border-right: 1px solid var(--line);
  height: 100%;
  text-decoration: none; color: inherit;
}
.brand-cell:hover { background: var(--bg-soft); }
.logout-btn {
  display: inline-flex; align-items: center;
  padding: 6px 12px; margin-left: 4px;
  border-radius: var(--r-pill);
  background: var(--bg-soft); color: var(--ink-3);
  font-size: 12px; text-decoration: none;
  border: 1px solid var(--line);
  transition: background .15s, color .15s;
}
.logout-btn:hover { background: var(--brand-soft); color: var(--brand); }
.proj-cell { display: flex; align-items: center; gap: 14px; padding: 0 22px; min-width: 0; }
.proj-cell .name { font-family: var(--font-display); font-size: 16px; letter-spacing: -0.01em; }
.proj-cell .meta { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }
.proj-cell .chev { color: var(--ink-4); }
.proj-cell .switch {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--bg-soft); font-size: 12px; color: var(--ink-3);
}
.proj-cell .switch:hover { background: var(--bg-tint); }
.proj-cell .status-pill {
  display: inline-flex; gap: 6px; align-items: center;
  padding: 4px 10px; border-radius: var(--r-pill);
  background: var(--brand-soft); color: var(--brand);
  font-size: 11px; font-family: var(--font-mono);
}
.proj-cell .status-pill .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.head-actions { display: flex; align-items: center; gap: 8px; }
.job-switcher {
  width: min(240px, 28vw);
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-pill);
  font-size: 12px;
  background: var(--bg-soft);
}
.project-count {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--ink-4);
  font-size: 12px;
  white-space: nowrap;
}

.task-dashboard { display: grid; gap: 18px; }
.debug-checkpoint-card { overflow: hidden; }
.debug-checkpoint-body {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.4fr) auto;
  gap: 10px;
  align-items: end;
  padding: 16px;
  border-top: 1px solid var(--line);
}
.debug-checkpoint-body label {
  display: grid;
  gap: 5px;
  min-width: 0;
}
.debug-checkpoint-body label span {
  color: var(--ink-4);
  font-size: 11px;
  font-family: var(--font-mono);
}
.debug-checkpoint-desc {
  margin: 0;
  padding: 0 16px 16px;
  color: var(--ink-4);
  font-size: 12px;
  line-height: 1.5;
}
.workspace-switcher {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
}
.workspace-switcher button {
  height: 34px;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--ink-3);
  font-size: 13px;
}
.workspace-switcher button:hover { background: var(--bg-soft); color: var(--ink); }
.workspace-switcher button.active {
  background: var(--ink);
  color: white;
}
.new-project-shell { display: grid; gap: 14px; }
.new-project-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding: 0 2px;
}
.new-project-head h2 { font-size: 18px; }
.task-list-card { overflow: hidden; }
.task-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}
.task-grid.compact { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.task-card {
  min-height: 128px;
  display: grid;
  align-content: space-between;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
  text-align: left;
  box-shadow: var(--shadow-sm);
}
.task-card:hover { border-color: var(--brand); box-shadow: var(--shadow-md); }
.task-card.running { background: var(--brand-tint); border-color: var(--brand-soft); }
.task-title { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { color: var(--ink-4); font-size: 11px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-foot { display: grid; gap: 8px; }
.task-empty { padding: 24px; border: 1px dashed var(--line); border-radius: var(--r-sm); }
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}
.project-tile {
  display: grid;
  gap: 8px;
  align-content: space-between;
  min-height: 142px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
.project-tile:hover { border-color: var(--brand); background: var(--bg); box-shadow: var(--shadow-sm); }
.project-title { font-weight: 700; }
.project-meta { color: var(--ink-4); font-size: 11px; }
.project-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.project-tile-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 22px;
}
.crumb-link {
  color: var(--ink-3);
  padding: 0;
}
.crumb-link:hover { color: var(--brand); }
.project-detail { display: grid; gap: 18px; }
.project-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}
.summary-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}
.summary-label {
  color: var(--ink-4);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
}
.summary-value {
  min-width: 0;
  margin-top: 4px;
  color: var(--ink-2);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.episode-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}
.episode-card {
  min-width: 0;
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  box-shadow: var(--shadow-sm);
}
.episode-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.episode-card h3 {
  margin-top: 2px;
  font-size: 15px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.episode-key { color: var(--ink-4); font-size: 11px; }
.episode-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--ink-3);
  font-size: 12px;
}
.file-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.file-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--line-2);
}
.file-dot.ok { background: var(--accent-mint); }
.file-dot.missing { background: var(--accent-coral); }
.asset-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.asset-stat {
  min-width: 0;
  padding: 8px 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
  text-align: center;
}
.asset-stat span {
  display: block;
  color: var(--ink-4);
  font-size: 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.asset-stat strong {
  display: block;
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 13px;
}
.episode-path {
  min-width: 0;
  color: var(--ink-4);
  font-size: 10.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: 4px; padding: 2px 6px; color: var(--ink-4);
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent-coral));
  color: white; display: grid; place-items: center;
  font-size: 12px; font-weight: 600;
}

/* SIDEBAR */
.side {
  grid-area: side;
  background: white;
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.side-label {
  font-size: 10px; color: var(--ink-4);
  letter-spacing: .14em; text-transform: uppercase;
  padding: 0 10px; margin: 18px 0 6px;
  font-family: var(--font-mono);
}
.side-label:first-child { margin-top: 0; }
.side-step {
  display: grid; grid-template-columns: 22px 1fr auto;
  align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--ink-2); cursor: pointer;
  transition: background .15s; position: relative;
  text-align: left;
}
.side-step:hover { background: var(--bg-soft); }
.side-step:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; background: var(--brand-soft); }
.side-step .num {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--line-2); background: white;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10.5px; color: var(--ink-4);
}
.side-step.done .num { background: var(--brand); border-color: var(--brand); color: white; }
.side-step.done .num span { display: none; }
.side-step.done .num::after { content: "✓"; }
.side-step .label { font-size: 13px; font-weight: 500; }
.side-step .sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; font-family: var(--font-mono); }
.side-step.active { background: var(--brand-tint); color: var(--brand-ink); }
.side-step.active::before {
  content: ""; position: absolute;
  left: -14px; top: 8px; bottom: 8px;
  width: 3px; background: var(--brand); border-radius: 0 3px 3px 0;
}
.side-step.active .num { border-color: var(--brand); color: var(--brand); }
.side-step.active .label { font-weight: 600; }
.side-step .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.side-step.done .dot { background: var(--accent-mint); }
.side-step.active .dot { background: var(--brand); animation: pulse 1.4s infinite; }
.side-divider { height: 1px; background: var(--line); margin: 14px 8px; }
.side-mini {
  padding: 10px 12px; border-radius: var(--r-sm);
  font-size: 13px; color: var(--ink-3);
  display: flex; align-items: center; gap: 10px; cursor: pointer;
}
.side-mini:hover { background: var(--bg-soft); color: var(--ink); }
.side-mini .ico { width: 18px; height: 18px; display: grid; place-items: center; color: var(--ink-4); }
.side-card {
  margin: 14px 4px 0; padding: 14px;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--brand-tint), white);
  font-size: 12px;
}
.side-card h5 { font-family: var(--font-display); font-size: 14px; }
.side-card p { color: var(--ink-3); margin-top: 6px; line-height: 1.5; }
.side-card .btn { margin-top: 10px; width: 100%; justify-content: center; }

/* MAIN */
.main { grid-area: main; overflow-y: auto; padding: 28px 32px 60px; min-width: 0; }

.crumb {
  display: flex; gap: 6px; align-items: center;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-4); letter-spacing: .04em; margin-bottom: 14px;
}
.crumb .sep { color: var(--ink-5); }
.crumb .here { color: var(--brand); }

/* Compact workspace header — chip + title + sub on one row, optional
   single-line description below. Was ~180 px tall, now ~60 px. */
.workspace-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px; margin-bottom: 18px;
}
.workspace-head .ws-title { min-width: 0; flex: 1; }
.workspace-head .ws-title-row {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
}
.workspace-head h1 {
  font-family: var(--font-display);
  font-size: 22px; letter-spacing: -0.01em; line-height: 1.2;
  margin: 0;
}
.workspace-head .step-chip {
  display: inline-flex; align-items: center;
  background: var(--brand); color: white;
  padding: 4px 12px; border-radius: var(--r-xs);
  font-family: var(--font-mono); font-size: 11px;
  font-weight: 700; letter-spacing: .06em;
  flex-shrink: 0;
}
.workspace-head .ws-sub {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-4); letter-spacing: .08em;
  text-transform: uppercase;
}
.workspace-head .ws-desc {
  color: var(--ink-3); font-size: 12px;
  margin-top: 4px; line-height: 1.45;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  max-width: 80ch;
}
.ws-actions { display: flex; gap: 8px; }

/* HEALTH */
.health {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px; background: white;
  border: 1px solid var(--line); border-radius: var(--r-md);
  margin-bottom: 22px; box-shadow: var(--shadow-sm);
}
.health .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand); animation: pulse 1.4s infinite; flex: 0 0 auto;
}
.health .dot.ok { background: var(--accent-mint); animation: none; }
.health .label { font-size: 13px; color: var(--ink); font-weight: 500; }
.health .detail { font-size: 13px; color: var(--ink-3); }
.health .spacer { flex: 1; }
.health .age { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-4); }

/* CARD */
.card {
  background: white; border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 18px 20px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
}
/* Design B: card-head h2 is a section label, not a page title.
   workspace-head already names the current step; repeating it here at 20px
   was the duplicate chrome chat4 flagged. 16px + weight 600 keeps it
   scannable without competing. */
.card-head h2 { font-family: var(--font-display); font-size: 16px; font-weight: 600; letter-spacing: -0.005em; color: var(--ink-2); }
.card-head .sub { font-size: 11.5px; color: var(--ink-4); margin-top: 3px; font-family: var(--font-mono); }
.card-head .right { display: flex; align-items: center; gap: 10px; }
.card-body { padding: 20px; }

/* STATS */
.stats {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 0;
  margin-bottom: 22px; background: white;
  border: 1px solid var(--line); border-radius: var(--r-md);
  overflow: hidden; box-shadow: var(--shadow-sm);
}
.stat { padding: 18px 20px; border-right: 1px solid var(--line); position: relative; }
.stat:last-child { border-right: 0; }
.stat .k {
  font-size: 11px; color: var(--ink-4);
  letter-spacing: .08em; text-transform: uppercase; font-family: var(--font-mono);
}
.stat .v {
  font-family: var(--font-display); font-size: 32px;
  letter-spacing: -0.02em; margin-top: 6px;
  display: flex; align-items: baseline; gap: 4px;
}
.stat .v .unit { font-size: 14px; color: var(--ink-4); font-family: var(--font-sans); }
.stat.alert .v { color: var(--accent-coral); }
.stat.ok .v { color: #009E70; }
.stat.brand .v { color: var(--brand); }

/* TABS */
.tabs {
  display: flex; gap: 4px;
  background: var(--bg-soft); border: 1px solid var(--line);
  border-radius: var(--r-pill); padding: 3px;
}
.tab {
  padding: 6px 14px; border-radius: var(--r-pill);
  font-size: 12.5px; color: var(--ink-3); cursor: pointer;
}
.tab.active {
  background: white; color: var(--ink);
  font-weight: 500; box-shadow: var(--shadow-sm);
}

/* STEP ACTIONS */
.step-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 22px; padding: 18px 22px;
  background: white; border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
}
.step-actions .left { display: flex; align-items: center; gap: 14px; }
.step-actions .meta { font-size: 12.5px; color: var(--ink-3); }
.step-actions .meta b { color: var(--ink); font-family: var(--font-mono); }
.step-actions .actions { display: flex; gap: 10px; }

/* LOG */
.log {
  margin-top: 22px; background: white;
  border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden;
}
.log-head {
  padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer; border-bottom: 1px solid var(--line);
}
.log-head h3 { font-family: var(--font-display); font-size: 15px; }
.log-head .meta { color: var(--ink-4); font-size: 12px; font-family: var(--font-mono); }
.log-body { padding: 8px 18px 18px; max-height: 240px; overflow-y: auto; }
.log-row {
  display: grid; grid-template-columns: 64px 100px 1fr;
  gap: 12px; padding: 6px 0;
  font-size: 12px; border-bottom: 1px dashed var(--line);
}
.log-row:last-child { border-bottom: 0; }
.log-row .ts { color: var(--ink-4); font-family: var(--font-mono); }
.log-row .stage { font-family: var(--font-mono); color: var(--brand); font-size: 11px; }
.log-row .msg { color: var(--ink-2); }
.log-row.ok .msg::before { content: "✓ "; color: var(--accent-mint); }
.log-row.warn .msg::before { content: "⚠ "; color: #B57400; }
/* ===== Step 02 · 剧本改写 specific ===== */
.script-grid { display: grid; grid-template-columns: 1.7fr 1fr; gap: 22px; }

/* Split editor */
.editor-card { display: flex; flex-direction: column; }
.editor-split {
  display: grid; grid-template-columns: 1fr 1fr;
  height: 720px; min-height: 720px;
}
.editor-pane {
  display: flex; flex-direction: column;
  min-width: 0; min-height: 0;
}
.editor-pane.left { border-right: 1px solid var(--line); }
.editor-pane-head {
  padding: 12px 18px;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.editor-pane-head .name {
  font-family: var(--font-mono);
  color: var(--ink-3);
  letter-spacing: .04em;
}
.editor-pane.right .editor-pane-head .name { color: var(--brand); font-weight: 600; }
.editor-pane-head .small { color: var(--ink-4); font-size: 11px; font-family: var(--font-mono); }

.editor-body {
  flex: 1; overflow-y: auto;
  padding: 22px 24px;
  font-family: "PingFang SC", "Noto Serif SC", system-ui, serif;
  font-size: 14.5px;
  line-height: 1.85;
  color: var(--ink-2);
}
.editor-body p { margin-bottom: 14px; }
.editor-body .speaker {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 13px;
  color: var(--brand);
  margin-right: 8px;
  letter-spacing: -0.01em;
}
.editor-body .nar { color: var(--ink-3); font-style: italic; }
.editor-body .keep { background: rgba(0,229,160,.14); padding: 0 3px; border-radius: 2px; }
.editor-body .cut { color: var(--ink-4); text-decoration: line-through; }
.editor-body .add { background: rgba(91,60,255,.12); padding: 0 3px; border-radius: 2px; color: var(--brand-ink); }
.editor-body .scene-head {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 14px 0 6px;
  border-top: 1px dashed var(--line);
  margin: 18px 0 8px;
}
.editor-body .scene-head:first-of-type { border-top: 0; margin-top: 0; padding-top: 0; }

/* Right column */
.rail { display: flex; flex-direction: column; gap: 20px; }

.bible-card .card-body { padding: 0; }
.bible-tabs {
  display: flex; border-bottom: 1px solid var(--line);
  padding: 0 16px;
}
.bible-tab {
  padding: 12px 14px;
  font-size: 12.5px;
  color: var(--ink-4);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.bible-tab.active { color: var(--brand); border-color: var(--brand); font-weight: 600; }

.bible-body { padding: 18px; }

.char-row {
  display: grid; grid-template-columns: 36px 1fr auto;
  gap: 12px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}
.char-row:last-child { border-bottom: 0; }
.char-row .av {
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: 14px;
  color: white;
}
.char-row.r1 .av { background: linear-gradient(135deg, #E89F7C, #C56F4E); }
.char-row.r2 .av { background: linear-gradient(135deg, #6E8FBE, #2F3F66); }
.char-row.r3 .av { background: linear-gradient(135deg, #C09250, #5E3416); }
.char-row.r4 .av { background: linear-gradient(135deg, #8D78B8, #3B2C5E); }
.char-row.r5 .av { background: linear-gradient(135deg, #708A6B, #2F4530); }
.char-row.r6 .av { background: linear-gradient(135deg, #B57A5F, #4E281A); }
.char-row .name { font-family: var(--font-display); font-size: 15px; }
.char-row .role { font-size: 11px; color: var(--ink-4); margin-top: 2px; }
.char-row .lines {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
}

.spec-list { display: grid; gap: 10px; }
.spec-row {
  display: grid; grid-template-columns: 1fr auto;
  gap: 10px; align-items: center;
  padding: 10px 14px;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  font-size: 13px;
}
.spec-row .k { color: var(--ink-3); }
.spec-row .v { font-family: var(--font-mono); font-weight: 600; color: var(--ink); }

.beats-card .card-body { padding: 12px 16px; }
.beat {
  display: grid; grid-template-columns: 28px 1fr;
  gap: 12px; padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
}
.beat:last-child { border-bottom: 0; }
.beat .b-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--brand);
  font-weight: 600;
}
.beat .b-text { color: var(--ink-2); line-height: 1.6; }
.beat .b-time {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-4);
  margin-top: 2px;
}

/* Dialog chunks (bottom strip) */
.chunks-card .card-body { padding: 0; }
.chunks-table {
  width: 100%;
  border-collapse: collapse;
}
.chunks-table th {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-4);
  letter-spacing: .12em;
  text-transform: uppercase;
  text-align: left;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.chunks-table td {
  padding: 12px 18px;
  font-size: 13px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.chunks-table tr:last-child td { border-bottom: 0; }
.chunks-table .c-id { font-family: var(--font-mono); color: var(--brand); font-weight: 600; width: 60px; }
.chunks-table .c-time { font-family: var(--font-mono); color: var(--ink-4); width: 80px; }
.chunks-table .c-spk { font-family: var(--font-display); font-size: 14px; width: 100px; }
.chunks-table .c-text { font-family: "PingFang SC", serif; line-height: 1.65; color: var(--ink-2); }
.chunks-table .c-text.nar { color: var(--ink-4); font-style: italic; }
.chunks-table .c-tts { width: 130px; }
.chunks-table .pill {
  display: inline-block; padding: 2px 8px;
  font-size: 11px; font-family: var(--font-mono);
  border-radius: var(--r-pill);
  background: var(--brand-soft); color: var(--brand);
}
.chunks-table .pill.warn { background: #FFE9D0; color: #B57400; }
.chunks-table tr:hover td { background: var(--bg-soft); }
/* ===== Step 04 · 角色与场景 ===== */

/* Sub-stage strip */
.substages {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0; margin-bottom: 22px;
  background: white; border: 1px solid var(--line);
  border-radius: var(--r-md); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.substage {
  padding: 20px 24px;
  border-right: 1px solid var(--line);
  display: grid; grid-template-columns: 40px 1fr;
  gap: 14px; align-items: center;
  position: relative;
}
.substage:last-child { border-right: 0; }
.substage::after {
  content: ""; position: absolute;
  right: -8px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; background: white;
  border-top: 1px solid var(--line); border-right: 1px solid var(--line);
  transform: translateY(-50%) rotate(45deg);
  z-index: 1;
}
.substage:last-child::after { display: none; }
.substage .num {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--bg-soft);
  border: 1.5px solid var(--line-2);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-weight: 600;
  color: var(--ink-4); font-size: 13px;
}
.substage.done .num { background: var(--brand); border-color: var(--brand); color: white; }
.substage.done .num::after { content: "✓"; }
.substage.done .num span { display: none; }
.substage.active .num { border-color: var(--brand); color: var(--brand); background: white; }
.substage .label { font-family: var(--font-display); font-size: 17px; letter-spacing: -0.01em; }
.substage .sub { font-size: 12px; color: var(--ink-4); margin-top: 2px; font-family: var(--font-mono); }
.substage.active { background: linear-gradient(180deg, var(--brand-tint), white); }

/* Character grid */
.anchor-section { margin-bottom: 22px; }
.char-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
  padding: 20px;
}
.char-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.char-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow-md); }
.char-card.selected { border: 2px solid var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

.char-img {
  aspect-ratio: 3/4;
  position: relative;
  overflow: hidden;
}
.char-img::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, rgba(11,11,20,.04) 0 6px, transparent 6px 12px);
}
.char-img.p1 { background: linear-gradient(160deg, #F4D3C5 0%, #E89F7C 50%, #6E3B1F 100%); }
.char-img.p2 { background: linear-gradient(160deg, #C7D8F3 0%, #7A8DBF 50%, #2F3F66 100%); }
.char-img.p3 { background: linear-gradient(160deg, #E2D4B0 0%, #B69050 50%, #5E3416 100%); }
.char-img.p4 { background: linear-gradient(160deg, #D8C5DE 0%, #8D78B8 50%, #3B2C5E 100%); }
.char-img.p5 { background: linear-gradient(160deg, #BFCBB9 0%, #6E8576 50%, #2F4530 100%); }
.char-img.p6 { background: linear-gradient(160deg, #F0C5B8 0%, #C58A7A 50%, #5C2F22 100%); }

.char-img .qc-badge {
  position: absolute; top: 10px; right: 10px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono); font-size: 10.5px;
  color: white;
  backdrop-filter: blur(8px);
  background: rgba(0,158,112,.85);
}
.char-img .qc-badge.warn { background: rgba(245,166,35,.9); }
.char-img .qc-badge.fail { background: rgba(255,90,122,.9); }
.char-img .seed {
  position: absolute; bottom: 10px; left: 10px;
  padding: 3px 8px;
  border-radius: 4px;
  font-family: var(--font-mono); font-size: 10px;
  color: white;
  background: rgba(0,0,0,.45); backdrop-filter: blur(6px);
}
.char-img .variants {
  position: absolute; bottom: 10px; right: 10px;
  display: flex; gap: 3px;
}
.char-img .variants span {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.6);
  border: 1px solid rgba(255,255,255,.85);
}
.char-img .variants span.active { background: white; }

.char-meta { padding: 14px 16px; }
.char-meta .name {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: -0.01em;
}
.char-meta .role {
  font-size: 12px; color: var(--ink-4); margin-top: 3px;
}
.char-meta .stats {
  display: flex; gap: 8px; margin-top: 10px;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-4); flex-wrap: wrap;
}
.char-meta .stats .pill {
  padding: 2px 8px; border-radius: var(--r-pill);
  background: var(--bg-soft);
}
.char-meta .stats .pill.ok { background: rgba(0,229,160,.16); color: #009E70; }
.char-meta .stats .pill.brand { background: var(--brand-soft); color: var(--brand); }

/* Scene grid */
.scene-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  padding: 20px;
}
.scene-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  transition: transform .2s, border-color .2s, box-shadow .2s;
}
.scene-card:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow-md); }

.scene-img {
  aspect-ratio: 16/10;
  position: relative;
  overflow: hidden;
}
.scene-img::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, rgba(11,11,20,.04) 0 6px, transparent 6px 12px);
}
.scene-img.s1 { background: linear-gradient(180deg, #C7D8F3 0%, #6E8FBE 60%, #2F3F66 100%); }
.scene-img.s2 { background: linear-gradient(180deg, #F4D3C5 0%, #C56F4E 60%, #4F2515 100%); }
.scene-img.s3 { background: linear-gradient(180deg, #F1E2B6 0%, #C09250 60%, #5E3416 100%); }
.scene-img.s4 { background: linear-gradient(180deg, #FCE0CC 0%, #DD9268 60%, #6B3315 100%); }
.scene-img.s5 { background: linear-gradient(180deg, #2A2A3C 0%, #4C3D80 60%, #1B1136 100%); }
.scene-img.s6 { background: linear-gradient(180deg, #BFCBB9 0%, #708A6B 60%, #2F4530 100%); }
.scene-img.s7 { background: linear-gradient(180deg, #ECDFC0 0%, #BC9248 60%, #543109 100%); }
.scene-img.s8 { background: linear-gradient(180deg, #C2D4EC 0%, #708FB9 60%, #2E4366 100%); }

.scene-img .scene-tag {
  position: absolute; top: 10px; left: 10px;
  padding: 4px 10px;
  border-radius: 4px;
  font-family: var(--font-mono); font-size: 10.5px;
  color: white;
  background: rgba(0,0,0,.45); backdrop-filter: blur(6px);
}
.scene-img .ok-dot {
  position: absolute; top: 10px; right: 10px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-mint);
  display: grid; place-items: center;
  color: white; font-size: 11px;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.scene-meta { padding: 12px 14px; }
.scene-meta .name { font-family: var(--font-display); font-size: 15px; letter-spacing: -0.01em; }
.scene-meta .desc { font-size: 11.5px; color: var(--ink-4); margin-top: 4px; font-family: var(--font-mono); }
.scene-meta .stats {
  margin-top: 8px; font-size: 11px;
  color: var(--ink-4); display: flex; gap: 10px;
  font-family: var(--font-mono);
}

/* Right rail */
.anchor-layout { display: grid; grid-template-columns: 1.7fr 1fr; gap: 22px; align-items: start; }
.rail { display: flex; flex-direction: column; gap: 20px; position: sticky; top: 20px; }

/* QC report card */
.qc-card .qc-list { padding: 16px; display: grid; gap: 8px; }
.qc-row {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center; gap: 10px;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.qc-row .k { font-size: 13px; color: var(--ink-2); }
.qc-row .k .sub { font-size: 11px; color: var(--ink-4); margin-top: 2px; }
.qc-row .v {
  font-family: var(--font-mono); font-size: 12px;
  font-weight: 600;
}
.qc-row .v.ok { color: #009E70; }
.qc-row .v.ok::before { content: "✓ "; }
.qc-row .v.warn { color: #B57400; }
.qc-row .v.warn::before { content: "⚠ "; }
.qc-row .v.fail { color: var(--accent-coral); }
.qc-row .v.fail::before { content: "✕ "; }

/* Consistency matrix */
.matrix-card .card-body { padding: 18px; }
.matrix {
  display: grid;
  grid-template-columns: 60px repeat(6, 1fr);
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
}
.matrix .col-label, .matrix .row-label {
  color: var(--ink-4);
  display: grid; place-items: center;
  height: 32px;
}
.matrix .cell {
  height: 32px;
  border-radius: 4px;
  display: grid; place-items: center;
  font-weight: 600;
  color: white;
}
.matrix .cell.self { background: var(--ink-5); color: rgba(255,255,255,.5); }
.matrix .cell.h { background: #00B576; }
.matrix .cell.m { background: #5BB8AA; }
.matrix .cell.l { background: #E78A30; }

.matrix-legend {
  margin-top: 14px; display: flex; gap: 14px;
  font-size: 11px; color: var(--ink-4); font-family: var(--font-mono);
}
.matrix-legend .lg { display: flex; align-items: center; gap: 5px; }
.matrix-legend .swatch { width: 14px; height: 14px; border-radius: 3px; }
/* ===================================================================
   WORKSTATION
=================================================================== */
body { background: var(--bg-soft); }
.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  grid-template-rows: 60px 1fr;
  grid-template-areas:
    "head head"
    "side main";
  min-height: 100vh;
}

/* ============== HEADER ============== */
.head {
  grid-area: head;
  display: grid;
  grid-template-columns: 248px 1fr auto;
  align-items: center;
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  padding-right: 20px;
  z-index: 5;
}
.brand-cell {
  padding: 0 20px;
  display: flex; align-items: center; gap: 10px;
  border-right: 1px solid var(--line);
  height: 100%;
  text-decoration: none; color: inherit;
}
.brand-cell:hover { background: var(--bg-soft); }
.logout-btn {
  display: inline-flex; align-items: center;
  padding: 6px 12px; margin-left: 4px;
  border-radius: var(--r-pill);
  background: var(--bg-soft); color: var(--ink-3);
  font-size: 12px; text-decoration: none;
  border: 1px solid var(--line);
  transition: background .15s, color .15s;
}
.logout-btn:hover { background: var(--brand-soft); color: var(--brand); }
.proj-cell {
  display: flex; align-items: center; gap: 14px;
  padding: 0 22px;
  min-width: 0;
}
.proj-cell .name {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: -0.01em;
}
.proj-cell .meta {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
}
.proj-cell .chev { color: var(--ink-4); }
.proj-cell .switch {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  font-size: 12px;
  color: var(--ink-3);
}
.proj-cell .switch:hover { background: var(--bg-tint); }
.proj-cell .status-pill {
  display: inline-flex; gap: 6px; align-items: center;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 11px;
  font-family: var(--font-mono);
}
.proj-cell .status-pill .pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--brand); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

.head-actions { display: flex; align-items: center; gap: 8px; }
.kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  color: var(--ink-4);
}
.avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand), var(--accent-coral));
  color: white;
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 600;
}

/* ============== SIDEBAR ============== */
.side {
  grid-area: side;
  background: white;
  border-right: 1px solid var(--line);
  padding: 22px 14px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.side-label {
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 0 10px;
  margin: 18px 0 6px;
  font-family: var(--font-mono);
}
.side-label:first-child { margin-top: 0; }

.side-step {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  cursor: pointer;
  transition: background .15s;
  position: relative;
  text-align: left;
}
.side-step:hover { background: var(--bg-soft); }
.side-step:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; background: var(--brand-soft); }
.side-step .num {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: white;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-4);
}
.side-step.done .num { background: var(--brand); border-color: var(--brand); color: white; }
.side-step.done .num span { display: none; }
.side-step.done .num::after { content: "✓"; }
.side-step .label { font-size: 13px; font-weight: 500; }
.side-step .sub {
  font-size: 11px;
  color: var(--ink-4);
  margin-top: 2px;
  font-family: var(--font-mono);
}
.side-step.active {
  background: var(--brand-tint);
  color: var(--brand-ink);
}
.side-step.active::before {
  content: ""; position: absolute;
  left: -14px; top: 8px; bottom: 8px;
  width: 3px; background: var(--brand);
  border-radius: 0 3px 3px 0;
}
.side-step.active .num { border-color: var(--brand); color: var(--brand); }
.side-step.active .label { font-weight: 600; }
.side-step .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.side-step.done .dot { background: var(--accent-mint); }
.side-step.active .dot { background: var(--brand); animation: pulse 1.4s infinite; }

.side-divider { height: 1px; background: var(--line); margin: 14px 8px; }
.side-mini {
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  color: var(--ink-3);
  display: flex; align-items: center; gap: 10px;
  cursor: pointer;
}
.side-mini:hover { background: var(--bg-soft); color: var(--ink); }
.side-mini .ico { width: 18px; height: 18px; display: grid; place-items: center; color: var(--ink-4); }

.side-card {
  margin: 14px 4px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, var(--brand-tint), white);
  font-size: 12px;
}
.side-card h5 { font-family: var(--font-display); font-size: 14px; }
.side-card p { color: var(--ink-3); margin-top: 6px; line-height: 1.5; }
.side-card .btn { margin-top: 10px; width: 100%; justify-content: center; }

/* ============== MAIN ============== */
.main {
  grid-area: main;
  overflow-y: auto;
  padding: 28px 32px 60px;
  min-width: 0;
}

/* Top workspace title + breadcrumb */
.crumb {
  display: flex; gap: 6px; align-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: .04em;
  margin-bottom: 14px;
}
.crumb .sep { color: var(--ink-5); }
.crumb .here { color: var(--brand); }

.workspace-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 32px;
  margin-bottom: 28px;
}
.workspace-head h1 {
  font-family: var(--font-display);
  font-size: 38px;
  letter-spacing: -0.02em;
  line-height: 1.05;
}
.workspace-head .ws-eyebrow {
  display: inline-flex; gap: 8px; align-items: center;
  font-family: var(--font-mono); font-size: 11px;
  color: var(--brand);
  letter-spacing: .12em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.workspace-head p {
  color: var(--ink-3);
  font-size: 14px;
  max-width: 56ch;
  margin-top: 10px;
  line-height: 1.65;
}
.ws-actions { display: flex; gap: 8px; }

/* Health bar */
.health {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  margin-bottom: 22px;
  box-shadow: var(--shadow-sm);
}
.health .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--brand);
  animation: pulse 1.4s infinite;
  flex: 0 0 auto;
}
.health .label { font-size: 13px; color: var(--ink); font-weight: 500; }
.health .detail { font-size: 13px; color: var(--ink-3); }
.health .spacer { flex: 1; }
.health .age { font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-4); }
.health .progress {
  flex: 1; max-width: 280px;
  height: 6px; border-radius: var(--r-pill);
  background: var(--line); overflow: hidden;
  position: relative;
}
.health .progress::after {
  content: ""; position: absolute; inset: 0;
  width: 68%;
  background: linear-gradient(90deg, var(--brand), var(--accent-coral));
  border-radius: var(--r-pill);
}
.health .pct { font-family: var(--font-mono); font-size: 12px; font-weight: 600; color: var(--brand); }

/* Card */
.card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.card-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 16px;
}
.card-head h2 {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink-2);
}
.card-head .sub { font-size: 11.5px; color: var(--ink-4); margin-top: 3px; font-family: var(--font-mono); }
.card-head .right { display: flex; align-items: center; gap: 10px; }
.card-body { padding: 20px; }

/* Stats strip */
.stats {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  margin-bottom: 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.stat {
  padding: 18px 20px;
  border-right: 1px solid var(--line);
  position: relative;
}
.stat:last-child { border-right: 0; }
.stat .k {
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: .08em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.stat .v {
  font-family: var(--font-display);
  font-size: 32px;
  letter-spacing: -0.02em;
  margin-top: 6px;
  display: flex; align-items: baseline; gap: 4px;
}
.stat .v .unit { font-size: 14px; color: var(--ink-4); font-family: var(--font-sans); }
.stat.alert .v { color: var(--accent-coral); }
.stat.ok .v { color: #009E70; }
.stat.brand .v { color: var(--brand); }

/* Layout grid */
.grid-2 { display: grid; grid-template-columns: 1.7fr 1fr; gap: 22px; }

/* Filmstrip — frame grid */
.frame-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}
.frame {
  position: relative;
  aspect-ratio: 9/16;
  border-radius: var(--r-sm);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-soft);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s, border-color .2s;
}
.frame:hover { transform: translateY(-3px); border-color: var(--brand); box-shadow: var(--shadow-md); }
.frame .img {
  position: absolute; inset: 0;
}
.frame.active { border: 2px solid var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }

/* Gradient fills representing frames */
.frame .img.g1 { background: linear-gradient(160deg, #F4D3C5, #E89F7C 60%, #6E3B1F); }
.frame .img.g2 { background: linear-gradient(160deg, #C7D8F3, #6E8FBE 60%, #2F3F66); }
.frame .img.g3 { background: linear-gradient(160deg, #2A2A3C, #4C3D80 60%, #1B1136); }
.frame .img.g4 { background: linear-gradient(160deg, #F1E2B6, #C09250 60%, #5E3416); }
.frame .img.g5 { background: linear-gradient(160deg, #BFCBB9, #6E8576 60%, #324036); }
.frame .img.g6 { background: linear-gradient(160deg, #F0C5B8, #C58A7A 60%, #5C2F22); }
.frame .img.g7 { background: linear-gradient(160deg, #E0D5F0, #8D78B8 60%, #3B2C5E); }
.frame .img.g8 { background: linear-gradient(160deg, #FAE2D5, #DD9268 60%, #6B2F18); }
.frame .img.g9 { background: linear-gradient(160deg, #C2C9DA, #687793 60%, #2A3147); }
.frame .img.g10 { background: linear-gradient(160deg, #ECD5C7, #B57A5F 60%, #4E281A); }
.frame .img.g11 { background: linear-gradient(160deg, #F5D7C1, #C77A4D 60%, #5E2A0E); }
.frame .img.g12 { background: linear-gradient(160deg, #D8E3D0, #708A6B 60%, #2F4530); }
.frame .img.g13 { background: linear-gradient(160deg, #383545, #5A4E80 60%, #1F1936); }
.frame .img.g14 { background: linear-gradient(160deg, #F3DCB8, #C29849 60%, #5C3814); }
.frame .img.g15 { background: linear-gradient(160deg, #FCE0CC, #E69D6B 60%, #6B3315); }
.frame .img.g16 { background: linear-gradient(160deg, #C2D4EC, #708FB9 60%, #2E4366); }
.frame .img.g17 { background: linear-gradient(160deg, #2C2C40, #574680 60%, #1A1130); }
.frame .img.g18 { background: linear-gradient(160deg, #ECDFC0, #BC9248 60%, #543109); }

.frame .img::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, rgba(11,11,20,.04) 0 6px, transparent 6px 12px);
}
.frame .label {
  position: absolute; top: 7px; left: 7px;
  background: rgba(0,0,0,.5); backdrop-filter: blur(6px);
  padding: 3px 7px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: white;
}
.frame .qc {
  position: absolute; top: 7px; right: 7px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: 10px;
  color: white;
}
.frame .qc.ok { background: var(--accent-mint); }
.frame .qc.warn { background: #F5A623; }
.frame .qc.fail { background: var(--accent-coral); }
.frame .qc.run { background: var(--brand); }
.frame .action {
  position: absolute; bottom: 7px; left: 7px; right: 7px;
  background: rgba(0,0,0,.55); backdrop-filter: blur(6px);
  border-radius: 4px;
  padding: 5px 7px;
  font-size: 10px;
  color: white;
  line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.frame.placeholder .img { background: var(--bg-soft); }
.frame.placeholder .img::after { background: repeating-linear-gradient(135deg, var(--bg-soft) 0 6px, white 6px 12px); }
.frame.placeholder .placeholder-text {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-4);
}
.frame.running .img::before {
  content: "";
  position: absolute; inset: 0;
  background: rgba(91,60,255,.2);
  z-index: 1;
}
.frame.running::after {
  content: "生成中…";
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: white;
  background: var(--brand);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(91,60,255,.4);
}

/* Right rail (drawer-like inline) */
.rail {
  display: flex; flex-direction: column; gap: 20px;
}
.preview-card { padding: 0; overflow: hidden; }
.preview-9x16 {
  position: relative;
  aspect-ratio: 9/16;
  background: linear-gradient(160deg, #2A2A3C, #4C3D80 60%, #1B1136);
  overflow: hidden;
}
.preview-9x16::after {
  content: "";
  position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, rgba(11,11,20,.04) 0 6px, transparent 6px 12px);
}
.preview-controls {
  position: absolute; bottom: 12px; left: 12px; right: 12px;
  display: flex; align-items: center; gap: 10px;
  z-index: 2;
}
.play-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.4);
  display: grid; place-items: center;
  color: white;
}
.scrubber {
  flex: 1; height: 4px; border-radius: var(--r-pill);
  background: rgba(255,255,255,.25); position: relative;
}
.scrubber::after {
  content: ""; position: absolute; inset: 0;
  width: 42%;
  background: white;
  border-radius: var(--r-pill);
}
.time {
  font-family: var(--font-mono); font-size: 11px;
  color: white;
  background: rgba(0,0,0,.35);
  padding: 3px 8px;
  border-radius: 4px;
}
.caption {
  position: absolute; bottom: 60px; left: 14px; right: 14px;
  text-align: center;
  font-family: "PingFang SC", sans-serif;
  font-weight: 600;
  font-size: 14px;
  color: white;
  text-shadow: 0 1px 4px rgba(0,0,0,.7);
  z-index: 2;
}
.preview-label-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px;
  background: white;
  border-top: 1px solid var(--line);
}
.preview-label-row .id { font-family: var(--font-mono); color: var(--brand); font-weight: 600; }
.preview-label-row .name { font-family: var(--font-display); font-size: 15px; }

/* QC list */
.qc-list { display: grid; gap: 8px; padding: 16px; }
.qc-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.qc-row .k { font-size: 13px; color: var(--ink-2); }
.qc-row .v { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.qc-row .v.ok { color: #009E70; }
.qc-row .v.ok::before { content: "✓ "; }
.qc-row .v.warn { color: #B57400; }
.qc-row .v.warn::before { content: "⚠ "; }
.qc-row .v.fail { color: var(--accent-coral); }
.qc-row .v.fail::before { content: "✕ "; }

/* Storyboard inline */
.shot-info { padding: 16px; display: grid; gap: 14px; }
.shot-info dl { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.shot-info dl > div {
  padding: 10px 12px;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.shot-info dt {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.shot-info dd { margin: 0; font-size: 13px; margin-top: 4px; }

.line-box {
  padding: 14px 16px;
  background: var(--brand-tint);
  border-left: 3px solid var(--brand);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  font-family: "PingFang SC", "Noto Serif SC", serif;
  font-size: 14px;
  color: var(--brand-ink);
  line-height: 1.65;
}

/* Tabs */
.tabs {
  display: flex; gap: 4px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px;
}
.tab {
  padding: 6px 14px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  color: var(--ink-3);
  cursor: pointer;
}
.tab.active {
  background: white;
  color: var(--ink);
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

/* Repair queue */
.repair-row {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}
.repair-row:last-child { border-bottom: 0; }
.repair-thumb {
  width: 54px; height: 96px;
  border-radius: var(--r-xs);
  overflow: hidden;
  position: relative;
}
.repair-thumb .img { position: absolute; inset: 0; }
.repair-info .id { font-family: var(--font-mono); font-size: 12px; color: var(--brand); font-weight: 600; }
.repair-info .reason { font-size: 13px; color: var(--ink); margin-top: 2px; }
.repair-info .detail { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; font-family: var(--font-mono); }
.repair-actions { display: flex; gap: 6px; }

/* Log */
.log {
  margin-top: 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.log-head {
  padding: 14px 18px;
  display: flex; justify-content: space-between; align-items: center;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.log-head h3 {
  font-family: var(--font-display);
  font-size: 15px;
}
.log-head .meta { color: var(--ink-4); font-size: 12px; font-family: var(--font-mono); }
.log-body { padding: 8px 18px 18px; max-height: 240px; overflow-y: auto; }
.log-row {
  display: grid;
  grid-template-columns: 64px 100px 1fr;
  gap: 12px;
  padding: 6px 0;
  font-size: 12px;
  border-bottom: 1px dashed var(--line);
}
.log-row:last-child { border-bottom: 0; }
.log-row .ts { color: var(--ink-4); font-family: var(--font-mono); }
.log-row .stage {
  font-family: var(--font-mono);
  color: var(--brand);
  font-size: 11px;
}
.log-row .msg { color: var(--ink-2); }
.log-row.ok .msg::before { content: "✓ "; color: var(--accent-mint); }
.log-row.warn .msg::before { content: "⚠ "; color: #B57400; }

/* Step actions footer */
.step-actions {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 22px;
  padding: 18px 22px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.step-actions .left { display: flex; align-items: center; gap: 14px; }
.step-actions .meta { font-size: 12.5px; color: var(--ink-3); }
.step-actions .meta b { color: var(--ink); font-family: var(--font-mono); }
.step-actions .actions { display: flex; gap: 10px; }
/* ===== Step 07 · 成片交付 ===== */

.deliver-layout {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 22px;
  align-items: start;
}

/* Big preview card */
.preview-card { padding: 0; overflow: hidden; }
.preview-stage {
  background: #0B0B14;
  position: relative;
  display: grid; place-items: center;
  padding: 32px;
}
.preview-stage::before {
  content: ""; position: absolute; inset: 0;
  background: var(--aurora); opacity: .35;
  pointer-events: none;
}
.preview-9x16 {
  position: relative;
  aspect-ratio: 9/16;
  width: 340px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(170deg, #FFD2C2 0%, #C56F4E 60%, #4F2515 100%);
  box-shadow: 0 30px 80px -20px rgba(0,0,0,.5);
  z-index: 1;
}
.preview-9x16::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(135deg, rgba(11,11,20,.04) 0 6px, transparent 6px 12px);
}
.preview-caption {
  position: absolute; bottom: 80px; left: 18px; right: 18px;
  text-align: center;
  font-family: "PingFang SC", sans-serif;
  font-weight: 600; font-size: 18px;
  color: white;
  text-shadow: 0 2px 8px rgba(0,0,0,.7);
  z-index: 2;
}
.preview-play {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 64px; height: 64px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(255,255,255,.55);
  display: grid; place-items: center;
  color: white;
  z-index: 3;
  cursor: pointer;
}
.preview-overlay-meta {
  position: absolute; top: 14px; left: 14px;
  z-index: 3;
  display: flex; gap: 8px;
}
.preview-overlay-meta .badge {
  padding: 4px 10px;
  font-family: var(--font-mono); font-size: 10.5px;
  color: white;
  background: rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  border-radius: 4px;
}

/* Transport bar */
.transport {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  background: white;
  border-top: 1px solid var(--line);
}
.transport-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  color: var(--ink-3);
  background: white;
}
.transport-btn.primary {
  background: var(--brand); color: white;
  border-color: var(--brand);
}
.transport .time {
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--ink-3);
  width: 110px;
}
.transport .time .now { color: var(--ink); font-weight: 600; }

/* Timeline */
.timeline {
  background: white;
  border-top: 1px solid var(--line);
  padding: 16px 18px;
}
.timeline-label-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--ink-4);
  font-family: var(--font-mono);
  letter-spacing: .1em;
}
.timeline-ruler {
  position: relative;
  height: 18px;
  border-bottom: 1px dashed var(--line-2);
  margin-bottom: 10px;
}
.timeline-ruler .tick {
  position: absolute; bottom: 0;
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-4);
  transform: translateX(-50%);
}
.timeline-ruler .tick::before {
  content: "";
  position: absolute; bottom: -1px; left: 50%;
  width: 1px; height: 5px;
  background: var(--line-2);
}
.playhead {
  position: absolute;
  top: 0; bottom: -130px;
  width: 1.5px;
  background: var(--brand);
  z-index: 5;
}
.playhead::before {
  content: ""; position: absolute;
  top: -4px; left: 50%; transform: translateX(-50%);
  width: 11px; height: 11px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.track {
  position: relative;
  height: 32px;
  background: var(--bg-soft);
  border-radius: 6px;
  margin-bottom: 6px;
  overflow: hidden;
}
.track .label {
  position: absolute; left: 8px; top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono); font-size: 10px;
  color: var(--ink-4);
  z-index: 1;
  background: var(--bg-soft);
  padding: 2px 6px;
  border-radius: 3px;
}
.track .clip {
  position: absolute; top: 4px; bottom: 4px;
  border-radius: 4px;
  display: flex; align-items: center; padding: 0 6px;
  font-family: var(--font-mono); font-size: 10px;
  color: white;
  overflow: hidden; white-space: nowrap;
}
.track.video .clip { background: linear-gradient(90deg, #5B3CFF, #7A5DFF); }
.track.caption .clip { background: #0B0B14; }
.track.voice .clip { background: linear-gradient(90deg, #00C18C, #00E5A0); color: #0B0B14; }
.track.bgm .clip {
  background: repeating-linear-gradient(90deg, #FF5A7A 0 4px, #FF8AA4 4px 8px);
  color: white;
}

/* Right rail */
.rail { display: flex; flex-direction: column; gap: 20px; }

.deliver-qc {}
.deliver-qc .qc-list { padding: 16px; display: grid; gap: 8px; }
.deliver-qc .qc-row {
  display: grid; grid-template-columns: 1fr auto;
  align-items: center;
  padding: 12px 14px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.deliver-qc .qc-row .k { font-size: 13px; color: var(--ink-2); }
.deliver-qc .qc-row .v { font-family: var(--font-mono); font-size: 12px; font-weight: 600; }
.deliver-qc .qc-row .v.ok { color: #009E70; }
.deliver-qc .qc-row .v.ok::before { content: "✓ "; }
.deliver-qc .qc-row .v.warn { color: #B57400; }
.deliver-qc .qc-row .v.warn::before { content: "⚠ "; }

/* Export presets */
.export-card .presets {
  padding: 16px;
  display: grid; gap: 10px;
}
.preset {
  display: grid; grid-template-columns: 56px 1fr auto;
  align-items: center; gap: 14px;
  padding: 14px 16px;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: border-color .15s;
}
.preset:hover { border-color: var(--brand); }
.preset.active { border-color: var(--brand); background: var(--brand-tint); }
.preset .thumb {
  width: 56px; height: 32px;
  border-radius: 4px;
  display: grid; place-items: center;
  background: var(--ink);
  color: white;
  font-family: var(--font-mono); font-size: 11px;
}
.preset.active .thumb { background: var(--brand); }
.preset .info { min-width: 0; }
.preset .name { font-family: var(--font-display); font-size: 14px; }
.preset .spec { font-size: 11px; color: var(--ink-4); margin-top: 3px; font-family: var(--font-mono); }
.preset .size { font-family: var(--font-mono); font-size: 12px; color: var(--ink-3); }

/* Delivery files list */
.files-card .files-list { padding: 0; }
.file-row-d {
  display: grid;
  grid-template-columns: 32px 1fr auto auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.file-row-d:last-child { border-bottom: 0; }
.file-row-d:hover { background: var(--bg-soft); }
.file-row-d .ftype {
  width: 32px; height: 32px;
  border-radius: 6px;
  background: var(--brand-tint);
  color: var(--brand);
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 10px;
  font-weight: 600;
}
.file-row-d .ftype.video { background: #FFE9EE; color: var(--accent-coral); }
.file-row-d .ftype.zip { background: var(--bg-tint); color: var(--ink-3); }
.file-row-d .ftype.audio { background: rgba(0,229,160,.2); color: #009E70; }
.file-row-d .ftype.srt { background: #FFF4D6; color: #B57400; }
.file-row-d .name { font-family: var(--font-mono); font-size: 13px; color: var(--ink); }
.file-row-d .desc { font-size: 11.5px; color: var(--ink-4); margin-top: 2px; }
.file-row-d .size { font-family: var(--font-mono); font-size: 12px; color: var(--ink-4); }

/* Episode list (other episodes) */
.episode-list { padding: 0; }
.ep-row {
  display: grid;
  grid-template-columns: 90px 1fr 100px 140px;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}
.ep-row:last-child { border-bottom: 0; }
.ep-row:hover { background: var(--bg-soft); }
.ep-thumb {
  width: 90px;
  aspect-ratio: 9/16;
  height: auto;
  border-radius: 6px;
  background: linear-gradient(170deg, #FFD2C2, #C56F4E);
  position: relative;
  overflow: hidden;
}
.ep-thumb.t1 { background: linear-gradient(170deg, #FFD2C2, #C56F4E); }
.ep-thumb.t2 { background: linear-gradient(170deg, #BAD0F1, #4D74A8); }
.ep-thumb.t3 { background: linear-gradient(170deg, #F1E2B6, #B58647); }
.ep-thumb.t4 { background: linear-gradient(170deg, #BFCBB9, #708A6B); }
.ep-thumb .badge {
  position: absolute; top: 4px; left: 4px;
  background: rgba(0,0,0,.55);
  color: white;
  font-family: var(--font-mono);
  font-size: 9px;
  padding: 2px 5px;
  border-radius: 3px;
}
.ep-info .name { font-family: var(--font-display); font-size: 15px; letter-spacing: -0.01em; }
.ep-info .meta { font-size: 12px; color: var(--ink-4); margin-top: 4px; font-family: var(--font-mono); }
.ep-info .tags { display: flex; gap: 6px; margin-top: 8px; }
.ep-info .tags span {
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 2px 8px;
  background: var(--bg-soft);
  border-radius: var(--r-pill);
  color: var(--ink-4);
}
.ep-status { font-family: var(--font-mono); font-size: 12px; }
.ep-status.ok { color: #009E70; }
.ep-status.warn { color: #B57400; }
.ep-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ============================================
   Adds for FastAPI workbench (not in handoff)
   ============================================ */
.banner { padding: 10px 14px; border-radius: var(--r-sm); margin-bottom: 18px; font-size: 13px; }
.banner.err { background: #FFE7EC; color: var(--accent-coral); border: 1px solid #FFD1DA; }

/* Toaster — fixed top-right stack, click-to-dismiss. Replaces alert(). */
.toaster {
  position: fixed; top: 76px; right: 24px;
  display: flex; flex-direction: column; gap: 10px;
  z-index: 1000; max-width: min(420px, calc(100vw - 48px));
  pointer-events: none;
}
.toast {
  padding: 12px 36px 12px 16px; border-radius: var(--r-sm);
  font-size: 13px; line-height: 1.4;
  background: white; color: var(--ink);
  box-shadow: 0 14px 36px -16px rgba(11, 11, 20, .35);
  border: 1px solid var(--line);
  pointer-events: auto;
  animation: toast-in .18s ease-out;
  position: relative;
}
.toast-close {
  position: absolute; top: 8px; right: 8px;
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border: none; background: transparent;
  border-radius: var(--r-pill);
  font-size: 16px; line-height: 1;
  color: currentColor; opacity: .5;
  cursor: pointer;
}
.toast-close:hover { opacity: 1; background: rgba(0,0,0,.06); }
.toast-close:focus-visible { outline: 2px solid currentColor; outline-offset: 1px; opacity: 1; }
.toast-err { background: #FFE7EC; color: #B0264A; border-color: #FFD1DA; }
.toast-ok { background: #E8F7EE; color: #15703A; border-color: #C6E8D2; }
.toast-info { background: var(--brand-soft); color: var(--brand-deep); border-color: #DAD2FF; }
@keyframes toast-in {
  from { transform: translateY(-6px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* ---- Source panel ---- */
.panel-source { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(360px, .8fr); gap: 22px; }
@media (max-width: 1100px) { .panel-source { grid-template-columns: 1fr; } }

.drop {
  position: relative;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--r-lg);
  padding: 56px 24px;
  display: grid; place-items: center; gap: 12px;
  text-align: center;
  background: linear-gradient(180deg, var(--bg-soft), white);
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .15s;
}
.drop:hover, .drop.is-drag {
  border-color: var(--brand);
  background: linear-gradient(180deg, var(--brand-tint), white);
}
.drop-icon { color: var(--brand); }
.drop-title { font-family: var(--font-display); font-size: 18px; }
.drop-sub { font-size: 13px; color: var(--ink-4); }
.drop .progress-bar { width: 220px; margin-top: 6px; }

.progress-bar {
  position: relative; height: 6px; background: var(--line);
  border-radius: var(--r-pill); overflow: hidden;
}
.progress-bar > span {
  display: block; height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--accent-coral));
  border-radius: var(--r-pill); transition: width .3s;
}

.source-loaded { display: grid; gap: 16px; }
.file-card {
  display: grid; grid-template-columns: 48px 1fr auto;
  gap: 14px; align-items: center;
  padding: 14px; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--r-md);
}
.file-icon {
  width: 48px; height: 48px; border-radius: var(--r-sm);
  background: var(--brand); color: white;
  display: grid; place-items: center;
  font-family: var(--font-mono); font-size: 12px; font-weight: 700;
}
.file-info .file-name { font-weight: 600; }
.file-info .file-meta { font-size: 11px; color: var(--ink-4); margin-top: 4px; }
.excerpt {
  padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: white;
}
.excerpt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.excerpt-eyebrow {
  font-size: 11px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-4); font-family: var(--font-mono);
}
.excerpt p { font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.source-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(16, 18, 27, .42);
}
.source-modal {
  width: min(920px, 100%);
  max-height: min(82vh, 860px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.source-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.source-modal-head h2 {
  margin: 0;
  font-size: 18px;
}
.source-modal-state {
  margin: 18px 20px;
}
.source-full-text {
  margin: 0;
  padding: 18px 20px 24px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  color: var(--ink-2);
  background: var(--bg-soft);
}

/* ---- Form (Source panel + others) ---- */
.form { display: grid; gap: 14px; }
.form-row { display: grid; gap: 6px; }
.form-row label { font-size: 12.5px; color: var(--ink-2); font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 11px; color: var(--ink-4); }
input[type=text], input[type=number], input:not([type]), textarea, select {
  width: 100%;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  outline: none;
  color: var(--ink);
  font: inherit;
  transition: border-color .15s;
}
textarea { resize: vertical; min-height: 60px; }
input:focus, textarea:focus, select:focus { border-color: var(--brand); }

.seg {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px;
}
.seg-btn {
  border: 0; background: transparent;
  padding: 6px 14px; border-radius: var(--r-pill);
  font-size: 13px; color: var(--ink-3); cursor: pointer;
}
.seg-btn.active {
  background: white; color: var(--ink);
  font-weight: 500; box-shadow: var(--shadow-sm);
}

/* ---- Empty state ---- */
.empty-state {
  background: white; border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 80px 40px;
  text-align: center; display: grid; place-items: center; gap: 10px;
}
.empty-state .empty-illust { font-size: 38px; color: var(--brand); opacity: .6; }
.empty-state h2 { font-family: var(--font-display); font-size: 22px; }
.empty-state p { color: var(--ink-3); max-width: 50ch; }

/* ---- Running state ---- */
.run-state-card {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 18px;
  align-items: stretch;
}
.run-state-main, .run-step-list, .run-log-card {
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.run-state-main {
  padding: 34px;
  display: grid;
  gap: 20px;
  align-content: center;
  min-height: 280px;
}
.run-loader {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(3, 8px);
  place-content: center;
  gap: 6px;
  background: var(--bg-soft);
}
.run-loader span {
  width: 8px;
  height: 28px;
  border-radius: var(--r-pill);
  background: var(--brand);
  animation: run-bars 1s ease-in-out infinite;
}
.run-loader span:nth-child(2) { animation-delay: .12s; background: var(--accent-coral); }
.run-loader span:nth-child(3) { animation-delay: .24s; background: var(--accent-mint); }
.run-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .12em;
  color: var(--ink-4);
}
.run-state-main h2 {
  font-family: var(--font-display);
  font-size: 26px;
  margin-top: 6px;
}
.run-state-main p {
  color: var(--ink-3);
  max-width: 58ch;
  margin-top: 8px;
}
.run-track {
  height: 7px;
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--line);
}
.run-track span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), var(--accent-coral), var(--accent-mint));
  animation: run-track 1.45s ease-in-out infinite;
}
.run-step-list {
  padding: 18px;
  display: grid;
  gap: 12px;
}
.run-step {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  align-items: start;
  color: var(--ink-4);
}
.run-step-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: white;
}
.run-step strong {
  display: block;
  color: var(--ink-3);
  font-size: 13px;
}
.run-step span:last-child {
  display: block;
  font-size: 12px;
  line-height: 1.45;
  margin-top: 2px;
}
.run-step.done .run-step-dot { background: var(--accent-mint); border-color: var(--accent-mint); }
.run-step.done strong { color: var(--ink); }
.run-step.active .run-step-dot { background: var(--brand); border-color: var(--brand); animation: pulse 1.4s infinite; }
.run-step.active strong { color: var(--brand); }
.run-log-card {
  grid-column: 1 / -1;
  padding: 18px;
  display: grid;
  gap: 12px;
}
.run-log-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: baseline;
}
.run-log-head h3 { font-size: 14px; }
.run-log-head span { font-size: 12px; color: var(--ink-4); }
.run-log-list { display: grid; gap: 8px; }
.run-log-row {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 10px;
  align-items: start;
  padding: 9px 10px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.run-log-row span { color: var(--ink-4); font-size: 11px; }
.run-log-row p { color: var(--ink-3); font-size: 13px; line-height: 1.45; }
.run-log-empty {
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--ink-3);
  font-size: 13px;
}

/* Per-file progress card during script_running / storyboard_running.
   Reuses the same column-span as .run-log-card so it sits cleanly above
   the activity log without changing the .run-state-card grid. */
.codex-files-card {
  grid-column: 1 / -1;
  padding: 18px;
  display: grid;
  gap: 12px;
  background: var(--bg-soft);
  border-radius: var(--r-sm);
}
.codex-files-head {
  display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
}
.codex-files-head h3 { font-size: 14px; }
.codex-files-head .muted { font-size: 12px; }
.codex-files-list { display: grid; gap: 12px; }
.codex-files-group { display: grid; gap: 6px; }
.codex-files-group-head {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--ink-4); letter-spacing: .06em;
  text-transform: uppercase;
}
.codex-files-group ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.codex-files-group li {
  display: grid; grid-template-columns: 16px 1fr auto; gap: 8px;
  align-items: center; padding: 4px 8px;
  background: white; border-radius: var(--r-xs);
  font-size: 12px;
}
.codex-files-group .check { color: var(--accent-mint); font-weight: 700; }
.codex-file-path { font-family: var(--font-mono); color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.codex-file-kind {
  font-family: var(--font-mono); font-size: 10px;
  color: var(--brand); background: var(--brand-soft);
  padding: 1px 6px; border-radius: var(--r-xs);
  text-transform: uppercase;
}

@keyframes run-bars {
  0%, 100% { transform: scaleY(.45); opacity: .55; }
  50% { transform: scaleY(1); opacity: 1; }
}
@keyframes run-track {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(250%); }
}
@media (max-width: 900px) {
  .run-state-card { grid-template-columns: 1fr; }
  .run-state-main { padding: 24px; }
}

/* ---- Storyboard table (Review panel) ---- */
.sb-wrap { background: white; border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; box-shadow: var(--shadow-sm); }
.sb-head, .sb-row {
  display: grid;
  grid-template-columns: 48px 60px 1.2fr 1.2fr 1.4fr 2.2fr;
  gap: 12px; padding: 12px 18px;
  font-size: 13px; align-items: start;
}
.sb-wrap.with-ops .sb-head,
.sb-wrap.with-ops .sb-row {
  grid-template-columns: 48px 60px 1.2fr 1.2fr 1.4fr 2.2fr 132px;
}
.sb-col.c-ops { display: flex; gap: 4px; justify-content: flex-end; align-items: center; }
.sb-op-btn {
  width: 28px; height: 28px;
  display: inline-grid; place-items: center;
  border: 1px solid var(--line);
  background: white;
  border-radius: var(--r-sm);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 13px; line-height: 1;
  transition: background .12s, border-color .12s, color .12s;
}
.sb-op-btn:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.sb-op-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.sb-op-btn:disabled { opacity: .35; cursor: not-allowed; }
.sb-op-btn.danger:hover:not(:disabled) { background: #FFEDED; border-color: #E5484D; color: #C42026; }
.sb-head { border-bottom: 1px solid var(--line); font-size: 11px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .1em; font-family: var(--font-mono); background: var(--bg-soft); }
.sb-row { border-bottom: 1px solid var(--line); }
.sb-row:last-child { border-bottom: 0; }
.sb-row:hover { background: var(--bg-soft); }
.sb-row.editable { cursor: pointer; }
.sb-row.editable:hover { background: var(--brand-soft); }
.sb-row.editable:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; background: var(--brand-soft); }
.sb-col.c-id { color: var(--brand); font-weight: 600; font-family: var(--font-mono); }
.sb-col.c-dur { color: var(--ink-4); font-family: var(--font-mono); }
.sb-col.c-cast .cast-tag {
  display: inline-block; padding: 2px 8px; margin: 0 4px 4px 0;
  border-radius: var(--r-pill); background: var(--brand-tint); color: var(--brand-ink); font-size: 11px;
}
/* Tokens in character_anchors that aren't in manifest.characters —
   typically props the LLM mis-placed (LED灯珠, 病历, 书包). Render in
   neutral gray with a dashed border so the user sees the difference. */
.sb-col.c-cast .cast-tag.prop {
  background: var(--bg-soft);
  color: var(--ink-4);
  border: 1px dashed var(--line-2);
}

/* Camera column — split codex's free-form string into 4 token classes
   (景别/角度/运动/构图) so the table starts feeling like a 编导分镜表. */
.cam-row { display: flex; flex-wrap: wrap; gap: 4px; }
.cam-tag {
  display: inline-block;
  padding: 1px 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.4;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  color: var(--ink-3);
  background: white;
}
.cam-tag.k-size   { background: #EAF7FF; color: #0560A8; border-color: #C6E7FF; }
.cam-tag.k-angle  { background: #FFF6E6; color: #8A5A00; border-color: #FFE3B3; }
.cam-tag.k-motion { background: #EFEAFF; color: #3D1FE0; border-color: #D9CFFF; }
.cam-tag.k-comp   { background: #EBF6EE; color: #15703A; border-color: #C9E7D2; }
.cam-tag.k-other  { background: var(--bg-soft); color: var(--ink-4); }
.cam-line { font-size: 12.5px; }
.mtn { margin-top: 4px; }
.sb-col .line.narr { color: var(--ink-4); font-style: italic; font-size: 12.5px; }
.sb-col .line.dial { color: var(--ink); margin-top: 4px; font-size: 12.5px; }

/* ---- Misc utility ---- */
.muted { color: var(--ink-4); }
.small { font-size: 12px; }
.mono-block {
  font-family: var(--font-mono); font-size: 12px;
  padding: 12px 14px; background: var(--bg-soft);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  white-space: pre-wrap; line-height: 1.6;
  margin: 0; max-height: 380px; overflow: auto;
}
.bible-editor {
  min-height: 360px;
  max-height: none;
  resize: vertical;
}

/* ---- Files list (Review panel side) ---- */
.files-rail { display: flex; flex-direction: column; }
.file-list { padding: 8px; display: grid; gap: 2px; }
.file-row {
  display: grid; grid-template-columns: 22px 1fr auto;
  align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--r-sm);
  background: transparent; border: 0; color: var(--ink); text-align: left;
  cursor: pointer; font: inherit;
}
.file-row:hover { background: var(--bg-soft); }
.file-row.active { background: var(--brand-tint); color: var(--brand-ink); }
.file-row-icon { color: var(--brand); font-size: 14px; }
.file-row-label { font-size: 13px; font-weight: 500; }
.file-row-key { font-size: 10.5px; color: var(--ink-4); font-family: var(--font-mono); }

/* ---- Drawer (shot detail) ---- */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(11, 11, 20, .35);
  backdrop-filter: blur(2px);
  z-index: 90;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(720px, 100vw);
  background: white;
  border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(11,11,20,.18);
  z-index: 91;
  display: flex; flex-direction: column;
  animation: slidein .22s ease-out;
}
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.drawer-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 14px;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--line);
}
.drawer-head > div { min-width: 0; }
.drawer-eyebrow { font-size: 11px; color: var(--brand); letter-spacing: .14em; font-family: var(--font-mono); }
.drawer-title { font-family: var(--font-display); font-size: 22px; margin-top: 4px; overflow-wrap: anywhere; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px; display: grid; gap: 16px; }
.drawer-foot {
  display: flex; gap: 8px; padding: 14px 20px;
  border-top: 1px solid var(--line); background: var(--bg-soft);
}
.ai-chat-drawer { width: min(560px, 100vw); }
.ai-chat-body { display: flex; flex-direction: column; min-height: 0; gap: 12px; }
.ai-chat-context, .ai-chat-quick { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ai-chat-context { color: var(--ink-3); font-size: 12px; }
.ai-chat-context span {
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 4px 9px; background: var(--bg-soft);
  max-width: 100%; overflow-wrap: anywhere;
}
.ai-chip {
  border: 1px solid var(--line); background: white; color: var(--ink-2);
  border-radius: var(--r-pill); padding: 7px 10px;
  font: inherit; font-size: 12px; cursor: pointer;
}
.ai-chip:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-tint); }
.ai-chip:disabled { opacity: .55; cursor: not-allowed; }
.ai-chat-messages {
  flex: 1; min-height: 260px; overflow: auto;
  border: 1px solid var(--line); border-radius: var(--r-md);
  background: linear-gradient(180deg, white 0%, var(--bg-soft) 100%);
  padding: 12px; display: flex; flex-direction: column; gap: 10px;
}
.ai-chat-empty { margin: auto; color: var(--ink-4); font-size: 13px; }
.ai-msg {
  width: fit-content; max-width: min(92%, 460px);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 9px 11px; background: white;
  box-shadow: 0 8px 22px rgba(18,18,32,.06);
}
.ai-msg.user { align-self: flex-end; border-color: transparent; background: var(--brand); color: white; }
.ai-msg.assistant { align-self: flex-start; }
.ai-msg.pending { color: var(--ink-3); }
.ai-msg-meta {
  display: flex; gap: 8px; justify-content: space-between;
  color: inherit; opacity: .7; font-size: 11px; margin-bottom: 5px;
}
.ai-msg-content { white-space: pre-wrap; line-height: 1.6; overflow-wrap: anywhere; font-size: 13px; }
.ai-chat-input { display: grid; grid-template-columns: 1fr auto; align-items: end; }
.ai-chat-input textarea {
  min-height: 78px; max-height: 180px; resize: vertical; width: 100%;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 12px; font: inherit; line-height: 1.5; background: white;
}
.ai-chat-input textarea:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-tint);
}
@media (max-width: 640px) {
  .ai-chat-input { grid-template-columns: 1fr; }
  .ai-chat-input .btn { justify-content: center; }
}
.drawer-preview {
  position: relative; aspect-ratio: 9/16;
  border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--line); background: var(--bg-tint);
  max-height: 420px;
  width: min(100%, 360px);
}
.drawer-preview img, .drawer-preview video { width: 100%; height: 100%; object-fit: cover; display: block; background: #050510; }
.drawer-placeholder { display: grid; place-items: center; height: 100%; color: var(--ink-4); }
.drawer-status-line {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}
.drawer-issue {
  min-width: min(100%, 260px);
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid #FFD1DA;
  border-radius: var(--r-sm);
  background: #FFF7F8;
  color: var(--accent-coral);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-family: var(--font-mono);
  width: fit-content;
  max-width: 100%;
  white-space: normal;
}
.status-pill.s-ok { background: #DAFBEF; color: #009E70; }
.status-pill.s-review { background: #FFF1DA; color: #B57400; }
.status-pill.s-fail { background: #FFE7EC; color: var(--accent-coral); }
.status-pill.s-pending { background: var(--bg-tint); color: var(--ink-3); }
.drawer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; }
.drawer-grid > div { padding: 10px 12px; background: var(--bg-soft); border-radius: var(--r-sm); border: 1px solid var(--line); }
.drawer-grid dt { font-size: 11px; color: var(--ink-4); margin-bottom: 4px; }
.drawer-grid dd { font-size: 13px; margin: 0; overflow-wrap: anywhere; }
.drawer-section h3 {
  font-size: 11px; color: var(--ink-4); letter-spacing: .12em;
  text-transform: uppercase; margin-bottom: 8px; font-weight: 600;
}
.drawer-section p { font-size: 13px; line-height: 1.65; color: var(--ink-2); }
.drawer-section .quote {
  padding: 12px 14px; border-left: 3px solid var(--brand);
  background: var(--bg-soft); border-radius: 0 var(--r-sm) var(--r-sm) 0;
}
.blocking-map-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, .75fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.blocking-map-svg {
  width: 100%;
  min-height: 190px;
  display: block;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: white;
}
.blocking-room {
  fill: #F8FAFC;
  stroke: #C9D3E2;
  stroke-width: .7;
}
.blocking-axis {
  stroke: #DCE3EE;
  stroke-width: .45;
  stroke-dasharray: 2 2;
}
.blocking-slot circle { fill: #D8E0EA; stroke: #A9B8C9; stroke-width: .5; }
.blocking-slot text {
  fill: var(--ink-4);
  font: 3.1px var(--font-mono);
  letter-spacing: 0;
}
.blocking-node circle {
  fill: var(--brand);
  stroke: white;
  stroke-width: 1.4;
  filter: drop-shadow(0 1px 1px rgba(11,11,20,.22));
}
.blocking-node text {
  fill: white;
  text-anchor: middle;
  font: 4.3px var(--font-mono);
  font-weight: 700;
  letter-spacing: 0;
  pointer-events: none;
}
.blocking-facing,
.blocking-camera line,
.blocking-move {
  stroke: var(--accent-coral);
  stroke-width: 1;
  stroke-linecap: round;
}
.blocking-move {
  stroke: #2F80ED;
  stroke-dasharray: 2 1.5;
}
.blocking-camera path {
  fill: var(--ink);
  stroke: white;
  stroke-width: .5;
}
.blocking-camera text {
  fill: var(--ink-3);
  font: 3.2px var(--font-mono);
  letter-spacing: 0;
}
.blocking-meta {
  display: grid;
  align-content: start;
  gap: 8px;
}
.blocking-meta div {
  display: grid;
  gap: 3px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: white;
}
.blocking-meta span {
  color: var(--ink-4);
  font: 10.5px var(--font-mono);
}
.blocking-meta strong {
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 500;
  overflow-wrap: anywhere;
}
.audit-list { display: grid; gap: 10px; }
.audit-record {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.audit-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 12px;
  color: var(--ink-3);
}
.audit-head .mono { color: var(--ink); font-weight: 600; }
.audit-refs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.audit-refs img {
  aspect-ratio: 1 / 1;
  width: 100%;
  object-fit: cover;
  border-radius: var(--r-xs);
  border: 1px solid var(--line);
  background: white;
}
.audit-prompt {
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: white;
  color: var(--ink-2);
  font: 11px/1.55 var(--font-mono);
}
.audit-outputs { display: flex; flex-wrap: wrap; gap: 6px; }
.audit-outputs a {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: white;
  color: var(--brand);
  font-size: 12px;
}
.audit-error { color: var(--accent-coral); font-size: 12px; overflow-wrap: anywhere; }

/* ---- Buttons missing from base ---- */
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.full { width: 100%; justify-content: center; }
.icon-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: white; color: var(--ink-3);
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { color: var(--ink); border-color: var(--line-2); }

.stage-review-card { display: grid; overflow: hidden; }
.stage-review-body {
  display: grid;
  gap: 12px;
  padding: var(--pad-card);
  border-top: 1px solid var(--line);
}
.stage-review-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.stage-review-summary span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-soft);
  color: var(--ink-3);
  font-size: 12px;
}
.stage-review-summary b {
  color: var(--ink);
  font: 700 14px var(--font-mono);
}
.stage-review-callout {
  padding: 10px 12px;
  border: 1px solid #FFE1A8;
  border-radius: var(--r-sm);
  background: #FFF8EC;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.55;
}
.stage-review-error {
  margin: var(--pad-card);
  padding: 12px;
  border: 1px solid #FFD1DA;
  border-radius: var(--r-sm);
  background: #FFE7EC;
  color: var(--accent-coral);
  font-size: 13px;
}
.stage-review-list {
  display: grid;
  gap: 10px;
  max-height: 680px;
  overflow: auto;
  padding-right: 4px;
}
.stage-review-item {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
}
.stage-review-item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}
.stage-review-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 700;
  font-size: 13px;
}
.stage-review-meta {
  margin-top: 3px;
  color: var(--ink-4);
  font-size: 11px;
  overflow-wrap: anywhere;
}
.stage-review-speech {
  padding: 8px 10px;
  border-left: 3px solid var(--brand);
  background: var(--brand-soft);
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.5;
}
.stage-review-assets {
  display: grid;
  gap: 10px;
}
.stage-review-assets-title {
  margin-bottom: 6px;
  color: var(--ink-4);
  font: 11px var(--font-mono);
}
.stage-review-refs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
  gap: 8px;
}
.stage-review-ref {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--ink-3);
}
.stage-review-ref.missing { opacity: .55; }
.stage-review-ref img, .stage-review-ref > span {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: white;
}
.stage-review-ref img { object-fit: cover; }
.stage-review-ref > span {
  display: grid;
  place-items: center;
  color: var(--ink-4);
  font-size: 12px;
}
.stage-review-ref em, .stage-review-output-list em {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-4);
  font-style: normal;
  font-size: 10px;
}
.stage-review-output-list {
  display: grid;
  gap: 6px;
}
.stage-review-output-list span {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.stage-review-output-list span.ready b { color: #0B7A4B; }
.stage-review-output-list span.pending b { color: var(--ink-4); }
.stage-review-output-list b { font-size: 12px; }
.stage-review-prompt summary, .stage-review-meta-details summary {
  cursor: pointer;
  color: var(--brand);
  font-size: 12px;
}
.stage-review-prompt pre, .stage-review-meta-details pre {
  max-height: 260px;
  overflow: auto;
  margin: 8px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  background: var(--bg-soft);
  color: var(--ink-2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 11px/1.55 var(--font-mono);
}

/* ---- Production progress panels ---- */
.panel-wrap { display: grid; gap: var(--card-gap); min-width: 0; }
.panel-wrap.two { grid-template-columns: minmax(0, 1.1fr) minmax(360px, .9fr); }
.anchor-wrap, .kf-wrap, .assemble-wrap { grid-template-columns: 1fr; }
.card-head.split {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
}
.card-sub { font-size: 12px; color: var(--ink-4); margin-top: 4px; font-family: var(--font-mono); }
.card-actions { display: flex; align-items: flex-start; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.stage-action-wrap { display: inline-grid; gap: 4px; justify-items: end; }
.disabled-reason { max-width: 180px; font-size: 11px; color: var(--ink-4); text-align: right; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: fit-content;
  border-radius: var(--r-pill);
  padding: 4px 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  border: 1px solid var(--line);
  color: var(--ink-3);
  background: var(--bg-soft);
}
.pill.p-complete { color: #009E70; background: #DAFBEF; border-color: #BFEBD8; }
.pill.p-running { color: #B57400; background: #FFF1DA; border-color: #FFE1A8; }
.pill.p-review { color: #B57400; background: #FFF1DA; border-color: #FFE1A8; }
.pill.p-fail { color: var(--accent-coral); background: #FFE7EC; border-color: #FFD1DA; }
.pill.p-pending { color: var(--ink-4); }

.sub-stages {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 20px;
}
.sub-stage {
  position: relative;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-soft);
}
.sub-stage.st-complete { background: var(--brand-tint); border-color: var(--brand-soft); }
.sub-stage.st-running { background: #FFF1DA; border-color: #FFE1A8; }
.sub-stage-idx { font-family: var(--font-mono); font-size: 11px; color: var(--ink-4); }
.sub-stage-label { margin-top: 8px; font-family: var(--font-display); font-size: 16px; }
.sub-stage-state { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.sub-stage-link { display: none; }

.manifest-review-card, .anchor-progress-card { display: grid; }
.manifest-review-body, .anchor-progress-body {
  display: grid;
  gap: 12px;
  padding: var(--pad-card);
  border-top: 1px solid var(--line);
}
.manifest-review-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.manifest-review-stats > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.manifest-review-stats b { font-size: 20px; font-family: var(--font-mono); }
.manifest-review-stats span { font-size: 12px; color: var(--ink-4); }
.manifest-existing-callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.manifest-existing-callout.ok { border-color: #BFEBD8; background: #F1FCF7; }
.manifest-existing-callout.warn { border-color: #FFE1A8; background: #FFF8EC; }
.manifest-existing-callout strong {
  display: block;
  font-size: 13px;
}
.manifest-existing-callout span {
  display: block;
  margin-top: 3px;
  color: var(--ink-3);
  font-size: 12px;
}
.manifest-generation-mode {
  display: inline-flex;
  flex: 0 0 auto;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px;
}
.manifest-generation-mode button {
  padding: 6px 12px;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  font-size: 12px;
}
.manifest-generation-mode button.active {
  background: var(--ink);
  color: white;
}
.manifest-count-note {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.manifest-count-note span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: white;
  color: var(--ink-3);
  font-size: 12px;
}
.manifest-review-list { display: grid; gap: 6px; }
.manifest-review-row {
  display: grid;
  grid-template-columns: 52px minmax(0, 120px) minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg);
}
.manifest-review-kind { font-size: 11px; color: var(--ink-4); }
.manifest-review-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.manifest-review-desc { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); font-size: 12px; }
.manifest-json-details summary { cursor: pointer; color: var(--brand); font-size: 12px; }
.manifest-json-preview {
  max-height: 320px;
  overflow: auto;
  margin-top: 8px;
  padding: 12px;
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  border: 1px solid var(--line);
  white-space: pre-wrap;
}

.anchor-progress-num {
  font-size: 24px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.anchor-progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}
.anchor-progress-counts { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--ink-4); }
.anchor-progress-counts span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--bg-soft);
}
.anchor-progress-counts b { color: var(--ink); }
.anchor-progress-counts .danger, .anchor-progress-counts .danger b { color: var(--accent-coral); }
.anchor-task-block {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.anchor-task-block.error { border-color: #FFD1DA; background: #FFE7EC; }
.anchor-task-title { font-size: 12px; font-weight: 700; }
.anchor-task-list { display: grid; gap: 6px; }
.anchor-task-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
}
.anchor-task-row.failed { grid-template-columns: auto minmax(0, .8fr) minmax(0, 1.2fr); }
.anchor-task-name, .anchor-task-error {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.anchor-task-error { color: var(--accent-coral); }
.task-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.anchor-task-row.running .task-dot { background: #B57400; animation: pulse 1.4s infinite; }
.anchor-task-row.failed .task-dot { background: var(--accent-coral); }
.anchor-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
  gap: 10px;
}
.anchor-progress-item {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg);
}
.anchor-progress-thumb { aspect-ratio: 1 / 1; background: var(--bg-soft); overflow: hidden; }
.anchor-progress-thumb img { width: 100%; height: 100%; object-fit: cover; }
.anchor-progress-meta { display: grid; gap: 3px; padding: 8px 10px 10px; min-width: 0; }
.anchor-progress-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; }
.anchor-progress-empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}

.anchor-grid, .scene-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  padding: 20px;
}
.anchor-card, .scene-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--bg-soft);
}
.anchor-img, .scene-img {
  min-height: 128px;
  display: grid;
  place-items: center;
  background: linear-gradient(160deg, var(--brand-soft), var(--brand));
  color: white;
}
.anchor-thumb-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  padding: 8px;
  background: var(--bg);
}
.anchor-thumb-grid.kind-scene { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.anchor-thumb-grid.kind-prop { grid-template-columns: minmax(0, 1fr); }
.anchor-thumb {
  position: relative;
  min-width: 0;
  padding: 0;
  aspect-ratio: 1 / 1;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-soft);
  color: var(--ink-4);
  cursor: zoom-in;
}
.anchor-thumb-grid.kind-scene .anchor-thumb { aspect-ratio: 16 / 9; }
.anchor-thumb:disabled { cursor: default; opacity: 1; }
.anchor-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.anchor-thumb.pending {
  display: grid;
  place-items: center;
  font-size: 12px;
  border-style: dashed;
}
.anchor-thumb.empty {
  display: grid;
  place-items: center;
  padding: 8px;
  min-height: 96px;
  aspect-ratio: auto;
  font-size: 12px;
}
.anchor-empty-wide {
  grid-column: 1 / -1;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.anchor-thumb-label {
  position: absolute;
  left: 5px;
  bottom: 5px;
  max-width: calc(100% - 10px);
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .58);
  color: white;
  font-size: 10px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.anchor-img-button {
  width: 100%;
  border: 0;
  padding: 0;
  overflow: hidden;
  cursor: zoom-in;
}
.anchor-img-button:disabled { cursor: default; opacity: 1; }
.anchor-img img, .scene-img img {
  width: 100%;
  height: 100%;
  min-height: 128px;
  object-fit: cover;
}
.anchor-card.status-complete, .scene-card.status-complete { border-color: rgba(0, 180, 120, .35); }
.anchor-card.status-review, .scene-card.status-review { border-color: #FFE1A8; }
.anchor-card.status-pending, .scene-card.status-pending { opacity: .92; }
.anchor-placeholder { display: grid; place-items: center; color: var(--ink-4); }
.anchor-meta, .scene-meta { padding: 10px; }
.anchor-name, .scene-name { font-weight: 600; font-size: 13px; }
.anchor-role, .anchor-stats, .scene-stats { margin-top: 3px; color: var(--ink-4); font-size: 12px; }

.image-lightbox {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 28px;
  background: rgba(11, 11, 20, .78);
}
.image-lightbox figure {
  max-width: min(980px, 94vw);
  max-height: 92vh;
  display: grid;
  gap: 10px;
  margin: 0;
}
.image-lightbox img {
  max-width: 100%;
  max-height: 82vh;
  object-fit: contain;
  border-radius: var(--r-sm);
  background: var(--ink);
  box-shadow: var(--shadow-lg);
}
.image-lightbox-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  max-width: min(980px, 94vw);
}
.image-lightbox-strip button {
  width: 86px;
  flex: 0 0 auto;
  display: grid;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: var(--r-sm);
  background: rgba(255,255,255,.08);
  color: white;
  cursor: pointer;
}
.image-lightbox-strip button.active { border-color: white; background: rgba(255,255,255,.18); }
.image-lightbox-strip img {
  width: 100%;
  height: 54px;
  max-height: none;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: none;
}
.image-lightbox-strip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}
.image-lightbox figcaption {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  color: white;
  font-size: 13px;
}
.image-lightbox figcaption .mono { color: rgba(255,255,255,.68); font-size: 11px; }
.image-lightbox-close {
  position: fixed;
  top: 18px;
  right: 18px;
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  background: white;
  color: var(--ink);
  font-size: 24px;
}

.check-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.check-list li {
  display: grid;
  grid-template-columns: minmax(120px, .35fr) minmax(0, 1fr);
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-soft);
}
.check-list li.warn { border-color: #FFE1A8; background: #FFF1DA; }
.check-list .c-key { font-weight: 600; }
.check-list .c-val { min-width: 0; overflow-wrap: anywhere; color: var(--ink-3); }

.stat-strip {
  display: grid;
  grid-template-columns: repeat(4, auto) minmax(160px, 1fr);
  gap: 20px;
  padding: 14px 20px;
  align-items: center;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.stat { display: grid; gap: 4px; }
.stat-num { font-family: var(--font-mono); font-size: 22px; font-weight: 600; letter-spacing: 0; }
.stat-lab { font-size: 11px; color: var(--ink-4); display: flex; align-items: center; gap: 5px; }
.stat-lab .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); display: inline-block; }
.dot.s-ok { background: var(--accent-mint); }
.dot.s-review { background: #B57400; }
.dot.s-fail { background: var(--accent-coral); }
.dot.s-pending { background: var(--line-2); }
.dot.s-running { background: #B57400; animation: pulse 1.4s infinite; }
.stat-progress { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.review-queue { overflow: hidden; }
.queue-list { display: grid; }
.queue-row {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: stretch;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.queue-row.selected { background: var(--brand-soft); }
.queue-row:hover:not(.selected) { background: var(--bg-soft); }
.queue-row .queue-check {
  display: grid; place-items: center;
  padding: 0 8px 0 14px;
  cursor: pointer;
}
.queue-row .queue-check input { width: 18px; height: 18px; cursor: pointer; }
.queue-row .queue-row-body {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px 14px 10px 0;
  text-align: left;
  background: transparent;
  border: none;
  cursor: pointer;
}
.queue-thumb {
  position: relative;
  width: 58px;
  aspect-ratio: 9 / 16;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-soft);
}
.queue-thumb img { width: 100%; height: 100%; object-fit: cover; }
.queue-main { min-width: 0; display: grid; gap: 4px; }
.queue-id, .queue-issue { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-issue { color: var(--ink-3); font-size: 12px; }
.queue-actions { display: flex; align-items: center; gap: 10px; }
.link { color: var(--brand); font-size: 12px; }
.film-dot.s-ok { background: var(--accent-mint); }
.film-dot.s-review { background: #B57400; }
.film-dot.s-fail { background: var(--accent-coral); }
.film-dot.s-pending { background: var(--line-2); }
.film-dot.s-running { background: #B57400; animation: pulse 1.4s infinite; }

.preview-card { display: grid; grid-template-columns: minmax(280px, .55fr) 1fr; gap: 0; overflow: hidden; padding: 0; }
.preview-frame { padding: 20px; background: var(--bg-soft); }
.preview-9x16 {
  position: relative;
  aspect-ratio: 9 / 16;
  max-height: 560px;
  margin: 0 auto;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--ink);
}
.preview-9x16::after { pointer-events: none; }
.preview-9x16 video { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-overlay { position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; justify-content: space-between; color: white; pointer-events: none; z-index: 2; }
.play-icon, .time { padding: 4px 8px; border-radius: var(--r-pill); background: rgba(0,0,0,.45); }
.preview-play-toggle {
  color: white;
  border: 0;
  cursor: pointer;
  pointer-events: auto;
  font: inherit;
}
.preview-play-toggle:hover { background: rgba(0,0,0,.62); }
.preview-meta { padding: 24px; display: grid; gap: 16px; align-content: start; }
.eyebrow { font-size: 11px; color: var(--brand); letter-spacing: .12em; text-transform: uppercase; font-family: var(--font-mono); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); border-radius: var(--r-pill); padding: 5px 10px; font-size: 12px; color: var(--ink-3); background: var(--bg-soft); }
.chip.warn { border-color: #FFD6A3; color: #8A5200; background: #FFF7E8; }
.assemble-status {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.assemble-status .status-pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  background: #009E70;
}
.assemble-status.is-running .status-pulse { background: #B57400; animation: pulse 1.4s infinite; }
.assemble-status.has-warning .status-pulse { background: #B57400; }
.assemble-status strong { display: block; font-size: 13px; margin-bottom: 3px; }
.assemble-status span:not(.status-pulse) { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.5; }
.duration-warning {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid #FFD6A3;
  border-radius: var(--r-sm);
  background: #FFF7E8;
  color: #8A5200;
}
.duration-warning strong { font-size: 13px; }
.duration-warning span { font-size: 12px; line-height: 1.5; }
.deliver-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 0; }
.deliver-grid > div { padding: 10px 12px; background: var(--bg-soft); border-radius: var(--r-sm); border: 1px solid var(--line); }
.deliver-grid dt { font-size: 11px; color: var(--ink-4); margin-bottom: 4px; }
.deliver-grid dd { margin: 0; font-size: 13px; }
.deliver-grid dd.warn { color: #8A5200; font-weight: 700; }
.deliver-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.path { color: var(--ink-4); overflow-wrap: anywhere; }
.deliver-list { list-style: none; margin: 0; padding: 0; display: grid; }
.deliver-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 20px;
  border-top: 1px solid var(--line);
}
.deliver-file { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deliver-meta { color: var(--ink-4); font-size: 12px; }
.clip-edit-card, .delivery-config-card { overflow: hidden; }
.clip-timeline-list {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, white, var(--bg-soft));
}
.clip-trim-row {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: white;
  box-shadow: 0 8px 24px rgba(20, 20, 30, .04);
}
.clip-trim-row.disabled { opacity: .58; }
.clip-trim-media {
  display: grid;
  gap: 8px;
  align-content: start;
}
.clip-trim-media video,
.clip-trim-media img,
.clip-trim-placeholder {
  width: 100%;
  aspect-ratio: 9 / 16;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--bg-tint);
  overflow: hidden;
}
.clip-trim-media video { background: #050510; }
.clip-trim-placeholder {
  display: grid;
  place-items: center;
  padding: 8px;
  color: var(--ink-4);
  font-size: 12px;
  text-align: center;
}
.clip-play-btn {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}
.clip-play-btn:disabled { opacity: .45; cursor: not-allowed; }
.clip-trim-main { display: grid; gap: 10px; min-width: 0; }
.clip-trim-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
}
.clip-enable {
  display: inline-flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  min-width: 0;
  color: var(--ink) !important;
  font-size: 13px !important;
  font-weight: 700;
}
.clip-enable input { width: auto; }
.clip-trim-title { min-width: 0; display: grid; gap: 2px; }
.clip-trim-title strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}
.clip-trim-title span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-4);
  font-size: 12px;
}
.clip-trim-action {
  margin: 0;
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.55;
}
.clip-trim-timeline {
  position: relative;
  display: grid;
  gap: 7px;
  padding: 4px 0 14px;
}
.clip-trim-scale {
  display: flex;
  justify-content: space-between;
  color: var(--ink-4);
  font: 11px var(--font-mono);
}
.clip-trim-track {
  position: relative;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  overflow: hidden;
  background: var(--bg-tint);
}
.clip-trim-cut,
.clip-trim-keep {
  position: absolute;
  top: 0;
  bottom: 0;
}
.clip-trim-cut.before { left: 0; width: var(--trim-in); background: rgba(255, 103, 122, .18); }
.clip-trim-keep {
  left: var(--trim-in);
  width: calc(var(--trim-out) - var(--trim-in));
  background: linear-gradient(90deg, rgba(0, 180, 120, .2), rgba(91, 60, 255, .18));
  border-left: 2px solid var(--accent-mint);
  border-right: 2px solid var(--brand);
}
.clip-trim-cut.after { left: var(--trim-out); right: 0; background: rgba(255, 103, 122, .18); }
.clip-trim-range {
  position: absolute;
  left: 0;
  right: 0;
  top: 24px;
  width: 100%;
  height: 34px;
  margin: 0;
  pointer-events: none;
  appearance: none;
  background: transparent;
}
.clip-trim-range::-webkit-slider-runnable-track { height: 24px; background: transparent; }
.clip-trim-range::-moz-range-track { height: 24px; background: transparent; }
.clip-trim-range::-webkit-slider-thumb {
  pointer-events: auto;
  appearance: none;
  width: 16px;
  height: 32px;
  border-radius: 7px;
  border: 2px solid white;
  background: var(--brand);
  box-shadow: 0 2px 8px rgba(20,20,30,.22);
  cursor: ew-resize;
}
.clip-trim-range::-moz-range-thumb {
  pointer-events: auto;
  width: 16px;
  height: 32px;
  border-radius: 7px;
  border: 2px solid white;
  background: var(--brand);
  box-shadow: 0 2px 8px rgba(20,20,30,.22);
  cursor: ew-resize;
}
.clip-trim-range.trim-in::-webkit-slider-thumb { background: var(--accent-mint); }
.clip-trim-range.trim-in::-moz-range-thumb { background: var(--accent-mint); }
.clip-trim-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.clip-trim-fields label,
.clip-trim-advanced label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--ink-4);
  font-size: 11px;
}
.clip-trim-fields input,
.clip-trim-advanced input {
  height: 34px;
  min-width: 0;
}
.clip-trim-fields input[readonly] {
  background: var(--bg-soft);
  color: var(--ink-3);
}
.clip-trim-advanced {
  padding-top: 2px;
  color: var(--ink-4);
  font-size: 12px;
}
.clip-trim-advanced summary { cursor: pointer; width: fit-content; }
.clip-trim-advanced[open] {
  display: grid;
  gap: 10px;
}
.clip-trim-issue {
  padding: 8px 10px;
  border: 1px solid #FFD1DA;
  border-radius: var(--r-sm);
  background: #FFF7F8;
  color: var(--accent-coral);
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.clip-edit-table { display: grid; gap: 0; }
.clip-edit-row {
  display: grid;
  grid-template-columns: 96px 84px 92px 92px minmax(160px, 1fr);
  gap: 10px;
  align-items: end;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
}
.clip-edit-row label, .delivery-config-card label {
  display: grid;
  gap: 5px;
  min-width: 0;
  font-size: 11px;
  color: var(--ink-4);
}
.clip-edit-row input { height: 34px; }
.check-cell {
  grid-template-columns: auto 1fr;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
}
.check-cell input, .toggle-row input, .checkline input { width: auto; }
.replace-cell input { min-width: 0; }
.delivery-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--line);
}
.delivery-config-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-soft);
}
.toggle-row {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 8px !important;
  color: var(--ink) !important;
  font-weight: 600;
  font-size: 13px !important;
}
.form-grid.compact { gap: 8px; }
.form-grid.compact input, .form-grid.compact select { height: 34px; padding: 6px 9px; font-size: 12px; }
.full-input { height: 34px; font-size: 12px; }
.checkline {
  display: flex !important;
  flex-direction: row;
  align-items: center;
  gap: 8px !important;
  color: var(--ink-2) !important;
  font-size: 13px !important;
}
.version-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.version-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: white;
  color: var(--ink-2);
  font: 12px var(--font-mono);
  cursor: pointer;
}
.version-chip.active {
  border-color: var(--brand);
  background: var(--brand-tint);
  color: var(--ink);
}
.version-chip strong {
  font: 10px var(--font-mono);
  color: var(--brand);
  text-transform: uppercase;
}
.project-panel-card {
  display: grid;
  gap: 12px;
}
.delivery-config-grid.single {
  grid-template-columns: 1fr;
}
.project-asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
  padding: 16px;
}
.project-asset-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: white;
  padding: 12px;
}
.project-asset-card label {
  display: grid;
  gap: 5px;
  font-size: 11px;
  color: var(--ink-4);
}
.asset-thumb {
  aspect-ratio: 16/9;
  border-radius: var(--r-sm);
  overflow: hidden;
  background: var(--bg-soft);
  display: grid;
  place-items: center;
  color: var(--ink-5);
}
.asset-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.asset-version-row,
.episode-select-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 16px;
}
.episode-select-grid {
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

@media (max-width: 980px) {
  .sub-stages, .manifest-review-stats, .preview-card { grid-template-columns: 1fr; }
  .stat-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .queue-row { grid-template-columns: 52px minmax(0, 1fr); }
  .queue-actions { grid-column: 2; }
  .deliver-row { grid-template-columns: 1fr; }
  .clip-edit-row { grid-template-columns: 1fr 1fr; }
  .clip-trim-row { grid-template-columns: 1fr; }
  .clip-trim-media { grid-template-columns: 110px minmax(0, 1fr); align-items: center; }
  .clip-trim-head { grid-template-columns: minmax(0, 1fr) auto; }
  .clip-trim-title { grid-column: 1 / -1; }
  .clip-trim-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .replace-cell { grid-column: 1 / -1; }
  .delivery-config-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .drawer { width: 100vw; }
  .drawer-grid { grid-template-columns: 1fr; }
  .drawer-preview { width: 100%; }
  .blocking-map-card { grid-template-columns: 1fr; }
  .blocking-map-svg { min-height: 170px; }
  .clip-trim-media { grid-template-columns: 1fr; }
  .clip-trim-fields { grid-template-columns: 1fr; }
}

/* ──────────────────────────────────────────────────────────────────
   Shared mobile-friendly UI: BottomSheet, BulkActionBar, RowEditor.
   ────────────────────────────────────────────────────────────────── */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(15, 15, 25, 0.42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: 24px;
  animation: sheet-fade .15s ease-out;
}
@keyframes sheet-fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: white;
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-height: 88vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: sheet-pop .18s cubic-bezier(.2,.7,.3,1);
}
@keyframes sheet-pop {
  from { transform: translateY(12px) scale(.98); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}
.sheet-handle { display: none; }
.sheet-head {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--line);
}
.sheet-title { flex: 1; font-weight: 700; font-size: 15px; color: var(--ink); letter-spacing: -0.005em; }
.sheet-close {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border: none; background: transparent;
  border-radius: var(--r-pill);
  font-size: 20px; line-height: 1; color: var(--ink-3);
  cursor: pointer;
}
.sheet-close:hover { background: var(--bg-soft); color: var(--ink); }
.sheet-body {
  padding: 16px 20px;
  overflow-y: auto;
  flex: 1;
}
.sheet-actions {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg-soft);
}

.row-editor { display: grid; gap: 14px; }
.re-field { display: grid; gap: 6px; }
.re-label { font-size: 12px; color: var(--ink-3); font-weight: 600; }
.re-field input, .re-field textarea, .re-field select {
  width: 100%; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  font: inherit; font-size: 14px;
  background: white; color: var(--ink);
}
.re-field input:focus, .re-field textarea:focus, .re-field select:focus {
  outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft);
}
.re-field textarea { font-family: inherit; resize: vertical; min-height: 76px; }
.re-hint { font-size: 11px; color: var(--ink-4); }

.bulk-bar {
  position: sticky; bottom: 0; left: 0; right: 0;
  z-index: 50;
  margin: 12px 0 0;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px; justify-content: space-between;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
}
.bulk-count { display: flex; align-items: center; gap: 10px; }
.bulk-count-num {
  display: inline-grid; place-items: center;
  min-width: 24px; padding: 2px 8px;
  background: var(--brand); color: white;
  border-radius: var(--r-pill); font-weight: 700; font-size: 13px;
}
.bulk-count-label { color: var(--ink-3); font-size: 13px; }
.bulk-clear {
  border: none; background: transparent;
  color: var(--ink-3); font-size: 12px;
  cursor: pointer; padding: 4px 8px;
  border-radius: var(--r-pill);
}
.bulk-clear:hover { background: var(--bg-soft); color: var(--ink); }
.bulk-actions { display: flex; gap: 8px; flex-wrap: wrap; }

@media (max-width: 760px) {
  .sheet-backdrop {
    padding: 0;
    align-items: flex-end;
  }
  .sheet {
    max-width: 100vw !important;
    width: 100vw;
    max-height: 88vh;
    border-radius: 18px 18px 0 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    animation: sheet-slide .22s cubic-bezier(.2,.7,.3,1);
  }
  @keyframes sheet-slide {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }
  .sheet-handle {
    display: block; width: 40px; height: 4px;
    border-radius: 2px; background: var(--line);
    margin: 8px auto 0;
  }
  .sheet-head { padding-top: 8px; }
  .sheet-actions {
    padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px));
  }
  .sheet-actions .btn { flex: 1; min-height: 44px; }

  .bulk-bar {
    position: fixed; left: 0; right: 0; bottom: 0;
    margin: 0;
    border-radius: 0;
    border-left: none; border-right: none; border-bottom: none;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    flex-direction: row; flex-wrap: wrap;
  }
  .bulk-actions .btn { min-height: 44px; }
}

/* Per-anchor regenerate button (Phase B Step 4). */
.anchor-name, .scene-name { display: inline-flex; align-items: center; gap: 6px; }
.anchor-regen-btn {
  display: inline-grid; place-items: center;
  width: 22px; height: 22px;
  border: 1px solid var(--line);
  background: white;
  border-radius: var(--r-pill);
  color: var(--ink-3);
  cursor: pointer;
  font-size: 12px; line-height: 1;
  transition: background .12s, color .12s, transform .12s;
}
.anchor-regen-btn:hover:not(:disabled) { background: var(--brand-soft); color: var(--brand); border-color: var(--brand); }
.anchor-regen-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.anchor-regen-btn:disabled { opacity: .35; cursor: not-allowed; }
.anchor-regen-btn:active:not(:disabled) { transform: rotate(180deg); }

/* StatStrip "nothing yet" calm state (Claude Design chat4 cleanup). */
.stat-strip.empty {
  display: flex; padding: 14px 18px;
  border: 1px dashed var(--line-2);
  background: white;
  border-radius: var(--r-md);
  align-items: center;
}
.stat-empty-line {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--ink-3);
}
.stat-empty-line b { color: var(--ink-2); font-weight: 600; }
.stat-empty-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-5);
}

/* Design A: StepFooter — sticky bottom bar carrying the primary CTA.
   Sibling of BulkActionBar; the panel hides this when bulk-bar is up
   to avoid two stacked sticky strips. */
.step-footer {
  position: sticky;
  bottom: 0;
  margin: 24px -56px -16px;
  padding: 14px 56px calc(14px + env(safe-area-inset-bottom, 0px));
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  z-index: 40;
}
.step-footer-hint {
  flex: 1; min-width: 0;
  font-family: var(--font-mono); font-size: 12.5px;
  color: var(--ink-4);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.step-footer-hint b { color: var(--ink); font-weight: 600; }
.step-footer .btn { min-height: 40px; }
@media (max-width: 760px) {
  .step-footer {
    position: fixed; left: 0; right: 0; bottom: 0;
    margin: 0;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom, 0px));
  }
  .step-footer .btn { min-height: 44px; flex: 1; }
  .step-footer-hint { display: none; }
}
