/* ============================================================
   PROJECT WORKBENCH — light "paper" theme, consistent with styles.css
   Uses the app's design tokens: --paper --surface --line --ink --ink-soft
   --muted --coral --coral-soft --teal --teal-soft --yellow --yellow-soft
   ============================================================ */

#view-project-workbench { display: none; }
#view-project-workbench.active { display: flex; flex-direction: column; gap: 18px; }
#view-project-workbench [hidden] { display: none !important; }

/* ---------- header ---------- */
.workbench-header {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 22px 0;
}
.workbench-title-row { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.workbench-project-meta { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.workbench-project-meta h1 { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; color: var(--ink); }
.workbench-stats { display: flex; gap: 16px; font-size: 11px; color: var(--ink-soft); flex-wrap: wrap; }
.workbench-stats span { display: inline-flex; align-items: center; gap: 5px; }
.workbench-stats i { width: 13px; height: 13px; color: var(--muted); }
.workbench-stats strong { color: var(--ink); font-family: var(--mono); font-weight: 500; font-size: 12px; }

.workbench-tabs { display: flex; gap: 22px; overflow-x: auto; }
.workbench-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 0 0 12px; border: 0; background: transparent; position: relative;
  color: #89958e; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer;
}
.workbench-tab:hover { color: var(--ink); }
.workbench-tab.active { color: var(--ink); font-weight: 700; }
.workbench-tab.active::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--coral); }
.workbench-tab i { width: 14px; height: 14px; }
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--teal-soft); color: var(--teal); font-family: var(--mono); font-size: 9px; font-weight: 500;
}
.tab-badge:empty { display: none; }

/* ---------- body / tabs ---------- */
.workbench-body { display: flex; flex-direction: column; gap: 18px; }
.workbench-tab-content { display: none; }
.workbench-tab-content.active { display: block; }
.workbench-body .panel { padding: 18px 20px; }
.workbench-body .panel + .panel { margin-top: 18px; }
.workbench-body .panel-heading { margin-bottom: 14px; align-items: center; }
.workbench-body .panel-heading h2 { font-size: 15px; font-weight: 700; color: var(--ink); }
.workbench-grid-2col { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 18px; }
.workbench-grid-2col + .panel,
.workbench-body .panel + .workbench-grid-2col { margin-top: 18px; }

/* ---------- overview: info ---------- */
.workbench-info-grid { display: grid; gap: 14px; }
.info-row { display: grid; gap: 4px; }
.info-row label { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.info-row strong { font-size: 13px; color: var(--ink); }
.info-row p, .info-row div { font-size: 12px; line-height: 1.65; color: var(--ink-soft); }

/* ---------- overview: chat (light overrides) ---------- */
.workbench-chat-thread { min-height: 160px; max-height: 280px; overflow-y: auto; display: grid; gap: 14px; align-content: start; padding: 4px 0 10px; }
.workbench-chat-thread .chat-avatar { background: var(--teal-soft); color: var(--teal); }
.workbench-chat-thread .chat-row.user .chat-avatar { background: var(--coral-soft); color: var(--coral); }
.workbench-chat-thread .chat-bubble { color: var(--ink-soft); }
.workbench-chat-thread .chat-row.user .chat-bubble { color: var(--ink); }
.workbench-chat-thread .chat-meta { color: var(--muted); }
.workbench-chat-thread .chat-meta span { color: #aab5af; }
.workbench-suggestion-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.workbench-suggestion-row button {
  border: 1px solid #cfe3dc; background: var(--teal-soft); color: var(--teal);
  border-radius: 999px; padding: 6px 11px; font-size: 11px; font-weight: 600; cursor: pointer;
}
.workbench-suggestion-row button:hover { background: #cfe8df; }
.workbench-chat-composer { display: grid; gap: 8px; }
.workbench-chat-composer textarea {
  width: 100%; resize: vertical; min-height: 60px; padding: 9px 10px;
  border: 1px solid var(--line); border-radius: 7px; background: #fbfcfb; color: var(--ink);
  font: inherit; font-size: 12px; line-height: 1.6; outline: 0;
}
.workbench-chat-composer textarea:focus { border-color: #9bc8bb; box-shadow: 0 0 0 3px rgba(44,130,115,.1); }
.workbench-chat-composer > div { display: flex; justify-content: space-between; align-items: center; }
.workbench-chat-composer > div > span { font-size: 10px; color: var(--muted); display: inline-flex; gap: 4px; align-items: center; }
.workbench-chat-composer kbd { font-family: var(--mono); font-size: 9px; border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; background: #fff; color: var(--ink-soft); }

/* ---------- overview: quick actions ---------- */
.creation-progress-guide { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0; }
.creation-progress-step { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: #f8faf7; padding: 13px 15px; color: var(--ink-soft); text-align: left; cursor: pointer; }
.creation-progress-step > span { flex: 0 0 27px; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: #e9eee8; font: 11px var(--mono); }
.creation-progress-step strong { font-size: 12px; }
.creation-progress-step small { margin-left: auto; color: var(--muted); font-size: 9px; }
.creation-progress-step.is-current { background: #fff9f5; border-color: #efc4b5; }
.creation-progress-step.is-current > span { background: var(--coral-soft); color: #a64b36; }
.creation-progress-step.is-done > span { color: var(--teal); background: var(--teal-soft); }
.overview-source-column, .overview-writing-column { min-width: 0; }
.overview-project-info .workbench-info-grid { grid-template-columns: 1fr 1fr; }
.overview-project-info .info-row:nth-child(3) { grid-column: 1 / -1; }
.overview-references .references-list { max-height: 260px; overflow-y: auto; }
.overview-references .reference-item { padding: 10px 0; }
.overview-analysis-details { margin: 12px 0; border-top: 1px solid var(--line); padding-top: 12px; }
.overview-analysis-details > summary { color: var(--teal); font-size: 12px; font-weight: 700; cursor: pointer; }
.overview-analysis-details .reference-analysis-card { max-height: 520px; overflow-y: auto; }
.overview-writing-column .workbench-chat-thread { min-height: 250px; max-height: 400px; }
.creation-muted { color: var(--ink-soft); font-size: 12px; line-height: 1.8; margin: 0 0 14px; }

.reference-storyboards-panel { min-height: 180px; }
.reference-storyboards-head-actions { display: flex; align-items: center; gap: 10px; }
.reference-storyboards-head-actions .creation-muted { margin: 0; }
.reference-storyboards-list { display: flex; flex-direction: column; gap: 10px; }
.reference-storyboard-item { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px 16px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.reference-storyboard-main { min-width: 0; flex: 1; }
.reference-storyboard-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reference-storyboard-title strong { color: var(--ink); font-size: 13px; }
.reference-storyboard-main p { margin: 6px 0 9px; color: var(--ink-soft); font-size: 12px; line-height: 1.6; }
.reference-storyboard-status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; border-radius: 999px; background: var(--muted); color: var(--ink-soft); font-size: 10px; white-space: nowrap; }
.reference-storyboard-status .status-dot { width: 6px; height: 6px; }
.reference-storyboard-status.is-ready { color: #287c56; background: #edf8f1; }
.reference-storyboard-status.is-reused { color: #2a6b8a; background: #edf7fb; }
.reference-storyboard-status.is-running { color: #87651b; background: #fff8e4; }
.reference-storyboard-status.is-error { color: #a24242; background: #fff0f0; }
.reference-storyboard-meta { display: flex; flex-wrap: wrap; gap: 10px 14px; color: var(--muted); font-size: 11px; }
.reference-storyboard-meta span { display: inline-flex; align-items: center; gap: 5px; }
.reference-storyboard-meta svg { width: 13px; height: 13px; }
.reference-storyboard-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.reference-storyboard-actions [aria-busy="true"] { opacity: .65; pointer-events: none; }
.reference-storyboard-reused { display: inline-flex; align-items: center; gap: 5px; color: #2a6b8a; font-size: 12px; white-space: nowrap; }
.reference-storyboard-reused svg { width: 15px; height: 15px; }
.reference-storyboards-empty { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px 2px 8px; color: var(--ink-soft); }
.reference-storyboards-empty > svg { width: 20px; height: 20px; color: var(--teal); }
.reference-storyboards-empty strong { color: var(--ink); font-size: 13px; }
.reference-storyboards-empty p { max-width: 700px; margin: 0; font-size: 12px; line-height: 1.7; }
.reference-storyboards-empty.is-error > svg { color: #b84e4e; }
.reference-storyboard-card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; max-height: 58vh; overflow-y: auto; }
.reference-storyboard-card-grid article { border: 1px solid var(--line); border-radius: 7px; padding: 12px; background: var(--surface); }
.reference-storyboard-card-no { display: block; color: var(--teal); font: 11px var(--mono); margin-bottom: 8px; }
.reference-storyboard-card-grid strong { display: block; color: var(--ink); font-size: 12px; line-height: 1.4; }
.reference-storyboard-card-grid p { margin: 7px 0 0; color: var(--ink-soft); font-size: 11px; line-height: 1.6; }

@media (max-width: 720px) {
  .reference-storyboard-item { align-items: flex-start; flex-direction: column; }
  .reference-storyboard-actions { width: 100%; justify-content: flex-end; }
  .reference-storyboards-head-actions .creation-muted { display: none; }
}
.creation-status-label { display: inline-flex; align-items: center; padding: 5px 9px; background: #f0f3ee; border-radius: 6px; color: var(--ink-soft); font-size: 11px; font-weight: 600; }
.creation-status-label.is-confirmed { background: var(--teal-soft); color: var(--teal); }
.creation-script-summary { margin-bottom: 12px; }
.creation-script-summary > p { color: var(--ink); font-size: 13px; line-height: 1.9; white-space: pre-wrap; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 5; overflow: hidden; margin-top: 10px; }
#workbenchStoryWorkspace { display: grid; gap: 18px; }
.workbench-body #workbenchStoryWorkspace > .panel { margin-top: 0; }
.creation-editor-fields, .creation-plan-controls, .creation-candidates, .creation-card-fields { border: 0; padding: 0; margin: 0; min-width: 0; }
.creation-editor-fields textarea, .creation-card-fields textarea, .creation-card-fields input:not([type=range]), .creation-card-fields select, .creation-plan-controls input, .creation-plan-controls select { width: 100%; padding: 10px 12px; border: 1px solid #dbe3da; border-radius: 7px; font: inherit; font-size: 13px; color: var(--ink); background: #fff; }
.creation-editor-fields textarea:focus, .creation-card-fields textarea:focus, .creation-card-fields input:focus, .creation-card-fields select:focus { outline: 2px solid #b9dace; outline-offset: 1px; }
.creation-editor-fields .field-label, .creation-card-fields .field-label, .creation-plan-controls .field-label { display: grid; gap: 7px; font-size: 11px; color: var(--ink-soft); }
#creationScriptText { min-height: 260px; max-height: 65vh; resize: vertical; font-size: 14px; line-height: 1.9; background: #fdfefc; }
.creation-editor-actions, .creation-adopt-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-top: 16px; }
.creation-editor-actions > span, .creation-adopt-actions > span { flex: 1 1 220px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.creation-plan-controls { display: grid; grid-template-columns: 120px minmax(140px, 230px) auto; gap: 12px; align-items: end; margin: 18px 0; }
.creation-plan-controls > button { justify-self: start; }
.creation-step-hint { padding: 11px 14px; border-radius: 7px; background: #f1f5ee; font-size: 12px; color: var(--ink-soft); }
.creation-step-hint.is-warning { background: var(--yellow-soft); color: #815d1c; }
.creation-plan-empty { display: grid; justify-items: center; gap: 10px; padding: 42px 20px; color: var(--muted); text-align: center; border: 1px dashed #d4ded3; border-radius: 10px; margin-top: 16px; }
.creation-plan-empty > .icon { width: 28px; height: 28px; color: #87a899; }
.creation-plan-empty strong { color: var(--ink-soft); font-size: 15px; }
.creation-plan-empty p { font-size: 12px; }
.creation-operation { display: flex; align-items: flex-start; gap: 10px; padding: 12px 16px; border: 1px solid #bedacc; border-radius: 9px; background: #edf7f1; color: var(--teal); }
.creation-operation > div { min-width: 0; }
.creation-operation strong { font-size: 13px; }
.creation-operation p { font-size: 12px; line-height: 1.5; margin: 4px 0 0; }
.creation-operation.is-running { align-items: center; gap: 14px; border-color: #8bb9a5; border-left: 4px solid #20765d; background: #e5f2ec; color: #184f3e; }
.creation-operation.is-running strong { font-size: 15px; }
.creation-operation.is-running p { color: #386452; }
.creation-operation-elapsed { margin-left: auto; flex-shrink: 0; font-size: 12px; font-variant-numeric: tabular-nums; }
.creation-wait-spinner { display: inline-block; width: 24px; height: 24px; flex: 0 0 auto; border: 3px solid #b5d6c7; border-top-color: #1c7659; border-radius: 50%; animation: creation-wait-spin 1s linear infinite; }
.creation-generation { display: flex; align-items: center; gap: 22px; padding: 28px; border: 1px solid #99c6b1; border-radius: 12px; background: #edf7f1; color: #174c39; text-align: left; }
.creation-generation > .creation-wait-spinner { width: 46px; height: 46px; border-width: 4px; }
.creation-generation-copy { min-width: 0; }
.creation-generation-copy > strong { display: block; margin: 10px 0 8px; font-size: 21px; line-height: 1.4; color: #174c39; }
.creation-generation-copy > p { margin: 0; font-size: 13px; line-height: 1.8; color: #406653; }
.creation-running-label { display: inline-block; padding: 4px 9px; border-radius: 5px; background: #246c52; color: #fff; font-size: 11px; font-weight: 600; line-height: 1.5; vertical-align: middle; }
.creation-generation-meta { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-top: 16px; font-size: 12px; color: #406653; }
.creation-generation-meta > [data-creation-elapsed] { font-weight: 700; color: #174c39; font-variant-numeric: tabular-nums; }
.creation-plan-editor > .creation-generation { margin-top: 16px; }
@keyframes creation-wait-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .creation-wait-spinner { animation: none; } }
@media (max-width: 600px) {
  .creation-generation { align-items: flex-start; gap: 14px; padding: 20px 16px; }
  .creation-generation > .creation-wait-spinner { width: 30px; height: 30px; margin-top: 4px; }
  .creation-generation-copy > strong { font-size: 18px; }
  .creation-operation.is-running { flex-wrap: wrap; }
  .creation-operation.is-running > div { flex: 1; }
  .creation-operation-elapsed { flex-basis: 100%; margin-left: 38px; }
}
.creation-operation.is-error { display: block; border-color: #e9b8a7; color: #954c36; background: #fff5ef; }
.creation-operation.is-error > div { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.creation-saved-note { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 0 4px; font-size: 12px; color: var(--teal); }
.creation-curve-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 22px; }
.creation-curve-heading strong { font-size: 12px; }
.creation-curve-heading small { font-size: 11px; color: var(--muted); }
.creation-emotion-curve { display: block; width: 100%; max-height: 150px; margin: 4px 0 18px; overflow: visible; }
.creation-curve-grid { fill: none; stroke: #e5eae3; stroke-width: 1; }
.creation-curve-line { fill: none; stroke: var(--teal); stroke-width: 2.5; stroke-linejoin: round; }
.creation-emotion-curve circle { fill: var(--teal); stroke: #fff; stroke-width: 2; }
.creation-emotion-curve text { font: 10px var(--mono); fill: var(--muted); }
.creation-candidates { display: grid; gap: 12px; }
.creation-story-card { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.creation-story-card > summary { display: flex; align-items: center; gap: 12px; cursor: pointer; padding: 16px; background: #f7faf5; list-style: none; }
.creation-card-number { color: #7d9988; font: 16px var(--mono); }
.creation-story-card > summary > span:nth-child(2) { display: grid; gap: 4px; flex: 1; }
.creation-story-card summary strong { font-size: 13px; color: var(--ink); }
.creation-story-card summary small { font-size: 11px; color: var(--muted); }
.creation-emotion-chip { font-size: 10px; color: var(--teal); background: #e5f0e8; border-radius: 5px; padding: 5px 8px; }
.creation-card-fields { display: grid; gap: 13px; padding: 16px; }
.creation-form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.creation-card-fields input[type=range] { width: 100%; accent-color: var(--teal); }
.creation-card-shots { display: grid; gap: 8px; }
.creation-shot-candidate { border: 1px solid #e5e9e2; border-radius: 7px; }
.creation-shot-candidate > summary { display: flex; align-items: center; gap: 10px; padding: 12px; cursor: pointer; list-style: none; }
.creation-shot-candidate > summary > span { font-size: 10px; color: var(--muted); }
.creation-shot-candidate > summary > strong { flex: 1; }
.creation-shot-fields { display: grid; gap: 10px; padding: 0 12px 14px; }
.creation-legacy > summary { font-size: 13px; font-weight: 700; color: var(--ink-soft); cursor: pointer; }
.creation-legacy > summary span { font-size: 11px; color: var(--muted); font-weight: 400; margin-left: 10px; }
.creation-legacy > p { margin-top: 14px; }
.creation-legacy details { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.creation-legacy details summary { cursor: pointer; font-size: 12px; color: var(--teal); }
.creation-legacy p, .creation-legacy li { font-size: 12px; line-height: 1.8; white-space: pre-wrap; }
.creation-legacy-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.creation-legacy-item small { color: var(--muted); }
.creation-legacy-message { padding: 10px 0; }
.creation-legacy-message strong { display: block; }
.creation-legacy pre { white-space: pre-wrap; overflow-wrap: anywhere; font: 11px/1.7 var(--mono); max-height: 300px; overflow-y: auto; }
.creation-empty { display: grid; gap: 14px; color: var(--ink-soft); }
.creation-editor-fields:disabled, .creation-candidates:disabled, .creation-plan-controls:disabled { opacity: .65; }
.workbench-action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.workbench-action-card {
  display: grid; gap: 6px; justify-items: start; text-align: left; cursor: pointer;
  padding: 14px 15px; background: #fff; border: 1px solid var(--line); border-radius: 9px;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.workbench-action-card:hover { border-color: #b9d3c9; box-shadow: 0 10px 24px rgba(32,73,61,.08); transform: translateY(-1px); }
.workbench-action-card i { width: 20px; height: 20px; color: var(--teal); }
.workbench-action-card strong { font-size: 12px; color: var(--ink); }
.workbench-action-card span { font-size: 10px; color: var(--muted); }

/* ---------- shots tab ---------- */
.workbench-shots-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.workbench-view-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
.view-switch-btn {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border: 0; border-radius: 6px;
  background: transparent; color: #89958e; font-size: 11px; font-weight: 600; cursor: pointer;
}
.view-switch-btn i { width: 13px; height: 13px; }
.view-switch-btn:hover { color: var(--ink); }
.view-switch-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 4px rgba(20,36,31,.08); }
.workbench-shots-actions { display: flex; gap: 8px; }
.workbench-shots-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }

.wb-shot-card {
  display: grid; gap: 10px; padding: 15px 16px; cursor: pointer; text-align: left;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.wb-shot-card:hover { border-color: #b9d3c9; box-shadow: 0 14px 30px rgba(32,73,61,.09); transform: translateY(-1px); }
.wb-shot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wb-shot-no { font-family: var(--mono); font-size: 11px; color: var(--coral); font-weight: 500; }
.wb-shot-time { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.wb-shot-title { font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.4; }
.wb-shot-sub { font-size: 11px; color: var(--ink-soft); line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.wb-shot-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.wb-shot-route { font-size: 10px; color: var(--muted); display: inline-flex; gap: 5px; align-items: center; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-shot-route i { width: 12px; height: 12px; flex: 0 0 auto; }
.wb-shot-versions { font-family: var(--mono); font-size: 9px; color: var(--muted); }

/* status chip — shared by shots / production */
.wb-chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 12px;
  font-size: 9px; font-weight: 600; white-space: nowrap; letter-spacing: .01em;
}
.wb-chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.wb-chip.wait      { background: #f8ebe4; color: #8b644a; }
.wb-chip.progress  { background: var(--yellow-soft); color: #a06927; }
.wb-chip.review    { background: #e3eefa; color: #2f6db0; }
.wb-chip.done,
.wb-chip.approved  { background: var(--teal-soft); color: #287a68; }
.wb-chip.failed    { background: var(--coral-soft); color: #b6553e; }
.wb-chip.queued    { background: #eef1ed; color: #6f7c75; }
.wb-chip.generating{ background: #efe9fb; color: #6b4fbb; }
.wb-chip.needs_retake { background: var(--yellow-soft); color: #a06927; }
.wb-chip.is-stale   { background: #fff4d8; color: #a06927; }

/* ---------- assets tab ---------- */
.panel-hint { margin: -4px 0 14px; padding: 10px 12px; border-left: 3px solid var(--teal); background: #f6faf8; color: var(--ink-soft); font-size: 11px; line-height: 1.6; border-radius: 0 6px 6px 0; }
.workbench-bound-assets { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; width: 100%; }
.wb-bound-group { min-width: 0; width: 100%; }
.wb-bound-group-grid { display: grid; gap: 14px; width: 100%; }
.wb-bound-group--character .wb-bound-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wb-bound-group--scene .wb-bound-group-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wb-asset-card { background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.wb-asset-thumb {
  position: relative;
  width: 100%;
  height: 200px;
  min-height: 200px;
  padding: 8px;
  border: 0;
  background: #eef1ed;
  display: grid;
  place-items: center;
  color: #b3bdb7;
  cursor: default;
  overflow: hidden;
}
.wb-asset-thumb--zoom { cursor: zoom-in; }
.workbench-bound-assets .wb-asset-card .wb-asset-thumb img {
  position: absolute;
  inset: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  display: block;
}
.wb-asset-thumb i { width: 20px; height: 20px; }
.wb-asset-body { padding: 8px 10px 10px; display: grid; gap: 3px; }
.wb-asset-name { font-size: 11px; font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-asset-type { font-size: 9px; color: var(--muted); }
.wb-asset-preview-modal { display: grid; gap: 12px; justify-items: center; }
.wb-asset-preview-modal .turnaround-strip { width: 100%; }
.wb-asset-preview-modal img { display: block; width: auto; max-width: 100%; height: auto; max-height: 70vh; object-fit: contain; border-radius: 8px; }
.shot-detail-view .shot-version-preview { max-width: 100%; max-height: 280px; overflow: hidden; }
.shot-detail-view .shot-version-media { display: block; width: 100% !important; max-width: 100% !important; height: min(260px, 45vw) !important; max-height: 260px !important; object-fit: contain !important; }
.sd-source-panel, .sd-video-firstframe { min-width: 0; }
.sd-firstframe-preview, .sd-firstframe-thumb {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 260px;
  object-fit: contain;
  object-position: center;
  border-radius: 6px;
  background: #eef1ed;
  margin: 8px 0;
}
.sd-firstframe-thumb { height: 160px; }

@media (max-width: 820px) {
  .wb-bound-group--scene .wb-bound-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .wb-bound-group--character .wb-bound-group-grid,
  .wb-bound-group--scene .wb-bound-group-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- production tab ---------- */
.workbench-production-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; flex-wrap: wrap; margin-bottom: 16px; }
.workbench-production-header h2 { font-size: 15px; font-weight: 700; color: var(--ink); margin-bottom: 4px; }
.workbench-production-header p { font-size: 11px; color: var(--ink-soft); }
.workbench-production-stats { display: flex; gap: 20px; }
.prod-stat { display: grid; gap: 2px; font-size: 9px; color: var(--muted); letter-spacing: .04em; }
.prod-stat strong { font-family: var(--mono); font-size: 22px; font-weight: 500; color: var(--ink); line-height: 1; }
.workbench-production-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

.wb-prod-card {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.wb-prod-thumb { width: 84px; min-width: 84px; height: 56px; border-radius: 6px; overflow: hidden; background: #eef1ed; display: grid; place-items: center; color: #b3bdb7; }
.wb-prod-thumb img, .wb-prod-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.wb-prod-thumb i { width: 18px; height: 18px; }
.wb-prod-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.wb-prod-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.wb-prod-select { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; white-space: nowrap; }
.wb-prod-select input { accent-color: var(--teal); }
.wb-prod-title { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.wb-prod-title .wb-shot-no { flex: 0 0 auto; }
.wb-prod-title span { font-size: 12px; font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-prod-meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 10px; color: var(--muted); }
.wb-prod-meta .wb-chip { margin-left: auto; }
.wb-prod-error { font-size: 10px; color: #b6553e; background: var(--coral-soft); border-radius: 5px; padding: 5px 7px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-prod-actions { display: flex; gap: 8px; align-items: center; }
.wb-prod-actions .ok { font-size: 10px; color: #287a68; display: inline-flex; gap: 4px; align-items: center; }
.wb-prod-actions .ok i { width: 13px; height: 13px; }
.wb-prod-actions .muted { font-size: 10px; color: var(--muted); }

/* ---------- export tab ---------- */
.workbench-export-status { margin-bottom: 18px; }
.export-stat-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.export-stat { padding: 14px 16px; border: 1px solid var(--line); border-radius: 9px; background: #fbfcfb; display: grid; gap: 8px; }
.export-stat label { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.export-stat strong { font-family: var(--mono); font-size: 26px; font-weight: 500; line-height: 1; color: var(--ink); }
.export-stat.ready strong { color: var(--teal); }
.export-stat.missing strong { color: #a06927; }
.export-missing-list { display: grid; gap: 10px; margin-top: 12px; }
.wb-notice { border-radius: 8px; padding: 12px 14px; border: 1px solid transparent; }
.wb-notice strong { display: block; font-size: 11px; margin-bottom: 6px; }
.wb-notice ul { margin: 0; padding-left: 18px; font-size: 11px; line-height: 1.7; }
.wb-notice.warn { background: var(--yellow-soft); border-color: #f0dfb3; color: #7f5a1e; }
.wb-notice.info { background: #eaf3fb; border-color: #cfe1f3; color: #2f5f8f; }
.wb-notice.neutral { background: #f4f6f4; border-color: var(--line); color: var(--ink-soft); }
.wb-notice.ok { background: var(--teal-soft); border-color: #c4e2d8; color: #23675a; }
.wb-notice.error { background: var(--coral-soft); border-color: #f3cfc4; color: #9c4530; }
.wb-notice p { font-size: 11px; line-height: 1.6; margin: 0; }
.wb-notice p + p { margin-top: 4px; }
.wb-notice .wb-notice-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.wb-notice .wb-notice-head i { width: 16px; height: 16px; }
.wb-notice .wb-notice-head strong { margin: 0; font-size: 12px; }
.wb-notice.loading { display: grid; justify-items: center; gap: 8px; color: var(--muted); text-align: center; background: #fbfcfb; border-color: var(--line); }
.wb-notice.loading i { width: 20px; height: 20px; animation: wb-spin 1s linear infinite; }

.workbench-export-controls { display: grid; gap: 12px; }
.export-section h3 { font-size: 12px; font-weight: 700; color: var(--ink); margin-bottom: 8px; }
.export-section .field-label { max-width: 320px; }
.btn-large { min-height: 42px; font-size: 13px; }
#wbExportVideoBtn { width: auto !important; justify-self: start; margin-top: 4px !important; }
.export-result { margin-top: 4px !important; }

@keyframes wb-spin { to { transform: rotate(360deg); } }

/* ---------- project editor ---------- */
.editor-workspace {
  --editor-ink: #18251f;
  --editor-stage: #17211e;
  --editor-stage-soft: #25312d;
  --editor-grid: rgba(219, 232, 225, .1);
  --editor-track-label-width: 112px;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.editor-workspace-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px 16px;
  border-bottom: 1px solid var(--line);
}
.editor-workspace-head h2 {
  margin: 4px 0 5px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 800;
}
.editor-workspace-head p {
  max-width: 680px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}
.editor-head-actions,
.editor-preview-actions,
.editor-footer-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.editor-head-actions { justify-content: flex-end; flex: 0 0 auto; }
.editor-layout {
  display: grid;
  grid-template-columns: 220px minmax(480px, 1fr) 230px;
  min-height: 650px;
}
.editor-media-panel,
.editor-inspector-panel {
  min-width: 0;
  background: #fbfcfb;
}
.editor-media-panel { border-right: 1px solid var(--line); }
.editor-inspector-panel { border-left: 1px solid var(--line); }
.editor-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 43px;
  padding: 0 13px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
}
.editor-panel-heading > span {
  min-width: 20px;
  color: var(--muted);
  font: 10px var(--mono);
  text-align: right;
}
.editor-search {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 12px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--muted);
}
.editor-search:focus-within {
  border-color: #9bc8bb;
  box-shadow: 0 0 0 3px rgba(44,130,115,.1);
}
.editor-search i { width: 14px; height: 14px; flex: 0 0 auto; }
.editor-search input {
  width: 100%;
  min-width: 0;
  height: 31px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font: 11px var(--sans);
}
.editor-media-tabs {
  display: flex;
  gap: 3px;
  margin: 0 12px 10px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f3f6f4;
}
.editor-media-tab {
  flex: 1 1 0;
  min-width: 0;
  padding: 6px 5px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}
.editor-media-tab:hover { color: var(--ink); }
.editor-media-tab.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(20,36,31,.08);
}
.editor-media-bin {
  display: grid;
  align-content: start;
  gap: 6px;
  max-height: 545px;
  padding: 0 10px 14px;
  overflow-y: auto;
}
.editor-media-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) 14px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 6px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.editor-media-item:hover {
  border-color: #cfe0d8;
  background: #f2f8f5;
}
.editor-media-item > i { width: 14px; height: 14px; color: var(--muted); }
.editor-media-thumb {
  display: grid;
  place-items: center;
  width: 42px;
  height: 32px;
  overflow: hidden;
  border-radius: 5px;
  background: #e9efec;
  color: #84a096;
}
.editor-media-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.editor-media-thumb i { width: 16px; height: 16px; }
.editor-media-copy { display: grid; gap: 3px; min-width: 0; }
.editor-media-copy strong,
.editor-media-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.editor-media-copy strong { color: var(--ink); font-size: 10px; font-weight: 700; }
.editor-media-copy small { color: var(--muted); font: 9px var(--mono); }
.editor-empty,
.editor-inspector-empty {
  display: grid;
  justify-items: center;
  gap: 7px;
  padding: 32px 14px;
  color: var(--muted);
  text-align: center;
}
.editor-empty i,
.editor-inspector-empty i { width: 22px; height: 22px; color: #8fb4a8; }
.editor-empty strong,
.editor-inspector-empty strong { color: var(--ink-soft); font-size: 11px; }
.editor-empty span,
.editor-inspector-empty span { font-size: 10px; line-height: 1.6; }

.editor-stage-panel {
  display: flex;
  min-width: 0;
  flex-direction: column;
  background: #f3f6f4;
}
.editor-preview-toolbar,
.editor-transport {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 43px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.editor-preview-toolbar { justify-content: space-between; background: var(--surface); }
.editor-preview-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 10px;
}
.editor-preview-meta span:first-child {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 700;
}
.editor-preview-meta span + span { color: var(--muted); font-family: var(--mono); }
.editor-preview {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 330px;
  padding: 20px;
  overflow: hidden;
  background: var(--editor-stage);
  isolation: isolate;
}
.editor-preview::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: linear-gradient(to right, var(--editor-grid) 1px, transparent 1px), linear-gradient(to bottom, var(--editor-grid) 1px, transparent 1px);
  background-size: 32px 32px;
  content: "";
}
.editor-preview video {
  display: block;
  width: auto;
  max-width: 100%;
  height: min(46vh, 440px);
  max-height: 100%;
  aspect-ratio: 9 / 16;
  object-fit: contain;
  border-radius: 4px;
  background: #0d1412;
  box-shadow: 0 14px 34px rgba(0,0,0,.24);
}
.editor-preview.is-fit video {
  width: min(100%, 560px);
  height: auto;
  max-height: 100%;
}
.editor-preview:fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 0;
  padding: 32px;
  background: #101815;
}
.editor-preview:fullscreen video {
  height: min(86vh, 900px);
}
.editor-preview-empty {
  display: grid;
  justify-items: center;
  gap: 8px;
  max-width: 260px;
  color: #afc0b8;
  text-align: center;
}
.editor-preview-empty i { width: 28px; height: 28px; color: #8fa9a0; }
.editor-preview-empty strong { color: #e4eee8; font-size: 12px; }
.editor-preview-empty span { color: #9eb0a8; font-size: 10px; line-height: 1.6; }
.editor-preview-caption {
  position: absolute;
  bottom: 35px;
  left: 50%;
  max-width: 80%;
  padding: 5px 9px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: rgba(0,0,0,.62);
  color: #fff;
  font-size: 12px;
  line-height: 1.45;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.4);
}
.editor-transport {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 0;
}
.editor-transport-spacer { flex: 1; }
.editor-transport-time,
#editorZoomValue {
  color: var(--muted);
  font: 10px var(--mono);
}
.editor-speed-control { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.editor-speed-control select { height: 28px; padding: 0 5px; border: 1px solid var(--line); border-radius: 5px; background: #fff; color: var(--ink); font: 10px var(--sans); }
.editor-transport .icon-btn,
.editor-preview-actions .icon-btn {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink-soft);
  cursor: pointer;
}
.editor-transport .icon-btn:hover,
.editor-preview-actions .icon-btn:hover { border-color: #b9d3c9; color: var(--teal); }
.editor-transport .icon-btn i,
.editor-preview-actions .icon-btn i { width: 14px; height: 14px; }
.editor-timeline {
  position: relative;
  min-height: 224px;
  overflow: auto;
  background: #eef3f0;
  border-top: 1px solid var(--line);
  outline: 0;
}
.editor-ruler,
.editor-track-stack {
  position: relative;
  width: max(var(--editor-timeline-width, 720px), 100%);
  min-width: var(--editor-timeline-width, 720px);
}
.editor-ruler {
  height: 30px;
  margin-left: var(--editor-track-label-width);
  border-bottom: 1px solid #d4dfd9;
  background: repeating-linear-gradient(to right, transparent 0, transparent 39px, #dce6e1 40px);
}
.editor-ruler span {
  position: absolute;
  top: 8px;
  transform: translateX(-50%);
  color: var(--muted);
  font: 9px var(--mono);
  white-space: nowrap;
}
.editor-track-stack { padding-bottom: 10px; }
.editor-track-row {
  display: grid;
  grid-template-columns: var(--editor-track-label-width) 1fr;
  min-height: 58px;
  border-bottom: 1px solid #dbe4df;
}
.editor-track-label {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 3px;
  padding: 0 10px;
  border-right: 1px solid #d4dfd9;
  background: #f8faf8;
}
.editor-track-label-main { display: flex; align-items: center; justify-content: space-between; gap: 6px; min-width: 0; }
.editor-track-label-main strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-size: 10px; }
.editor-track-label-main span { flex: 0 0 auto; color: var(--muted); font: 9px var(--mono); }
.editor-track-controls { display: flex; align-items: center; gap: 2px; margin-top: 3px; }
.editor-track-controls button { display: inline-grid; place-items: center; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 4px; background: transparent; color: #82918a; cursor: pointer; }
.editor-track-controls button:hover { background: #e6eeea; color: var(--teal); }
.editor-track-controls button i { width: 11px; height: 11px; }
.editor-track-volume { display: flex; align-items: center; gap: 4px; margin-top: 2px; color: #82918a; }
.editor-track-volume i { width: 10px; height: 10px; flex: 0 0 auto; }
.editor-track-volume input { width: 70px; height: 10px; margin: 0; accent-color: var(--teal); }
.editor-track-row.is-hidden .editor-track-lane { opacity: .38; }
.editor-track-row.is-hidden .editor-track-label { background: #eef2ef; }
.editor-track-lane {
  position: relative;
  min-height: 58px;
  background-image: repeating-linear-gradient(to right, transparent 0, transparent 39px, rgba(193,210,201,.4) 40px);
}
.editor-clip {
  position: absolute;
  top: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 42px;
  height: 42px;
  padding: 0 8px;
  overflow: hidden;
  border: 1px solid transparent;
  border-radius: 5px;
  background: #8cb8aa;
  color: #12352c;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 1px rgba(255,255,255,.28);
}
.editor-clip:hover { border-color: #4d8e7d; filter: saturate(1.05); }
.editor-clip.selected { border-color: var(--coral); box-shadow: 0 0 0 2px rgba(231,114,88,.2), inset 0 1px rgba(255,255,255,.28); }
.editor-clip-video { background: #8db7aa; }
.editor-clip-audio { background: #b7a1d1; color: #352648; }
.editor-clip-caption { background: #e8c980; color: #513d16; }
.editor-clip-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 700;
}
.editor-clip-time { flex: 0 0 auto; font: 9px var(--mono); opacity: .72; }
.editor-clip > i { flex: 0 0 auto; width: 13px; height: 13px; margin-left: auto; opacity: .75; }
.editor-clip-handle { position: absolute; top: 0; bottom: 0; z-index: 2; width: 7px; cursor: ew-resize; opacity: 0; background: rgba(255,255,255,.65); transition: opacity .14s ease; }
.editor-clip-handle-left { left: 0; }
.editor-clip-handle-right { right: 0; }
.editor-clip:hover .editor-clip-handle,
.editor-clip.selected .editor-clip-handle { opacity: .85; }
.editor-clip.is-muted { opacity: .56; }
.editor-clip-waveform { display: inline-flex; align-items: center; gap: 1px; height: 22px; min-width: 24px; opacity: .65; }
.editor-clip-waveform b { display: block; width: 2px; min-height: 3px; border-radius: 2px; background: currentColor; }
.editor-timeline.is-dragging, .editor-timeline.is-dragging * { cursor: ew-resize !important; user-select: none; }
.editor-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 5;
  width: 1px;
  background: var(--coral);
  pointer-events: none;
}
.editor-playhead span {
  position: absolute;
  top: 0;
  left: -5px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 1px 4px rgba(0,0,0,.2);
}

.editor-inspector {
  padding: 14px 12px;
  overflow-y: auto;
}
.editor-inspector-form { display: grid; gap: 12px; }
.editor-inspector-form .field-label { display: grid; gap: 5px; min-width: 0; color: var(--ink-soft); font-size: 10px; }
.editor-inspector-form input:not([type="range"]),
.editor-inspector-form textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  outline: 0;
  background: #fff;
  color: var(--ink);
  font: 11px/1.45 var(--sans);
}
.editor-inspector-form input:not([type="range"]):focus,
.editor-inspector-form textarea:focus { border-color: #9bc8bb; box-shadow: 0 0 0 3px rgba(44,130,115,.1); }
.editor-inspector-form textarea { resize: vertical; min-height: 70px; }
.editor-inspector-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.editor-inspector-form input[type="range"] { width: 100%; accent-color: var(--teal); }
.editor-inspector-form output { margin-left: auto; color: var(--muted); font: 10px var(--mono); }
.editor-check { display: flex; align-items: center; gap: 7px; color: var(--ink-soft); font-size: 10px; }
.editor-check input { accent-color: var(--teal); }
.editor-inspector-actions { display: flex; justify-content: space-between; gap: 7px; padding-top: 3px; border-top: 1px solid var(--line); }
.editor-settings-mount { padding: 0 18px; border-top: 1px solid var(--line); background: #fbfcfb; }
.editor-settings-mount > .panel { margin: 18px 0 !important; }
.editor-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.editor-link-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
}
.editor-link-status i { width: 13px; height: 13px; color: var(--teal); }

@media (max-width: 1180px) {
  .editor-layout { grid-template-columns: 200px minmax(420px, 1fr) 210px; }
}
@media (max-width: 900px) {
  .editor-layout { grid-template-columns: 190px minmax(0, 1fr); }
  .editor-inspector-panel {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }
  .editor-inspector { max-height: 300px; }
  .editor-inspector-form { max-width: 560px; }
}
@media (max-width: 640px) {
  .creation-progress-guide { grid-template-columns: 1fr; gap: 7px; }
  .creation-progress-step { padding: 10px 12px; }
  .creation-plan-controls, .creation-form-row { grid-template-columns: 1fr; }
  .creation-plan-controls > button, .creation-adopt-actions .btn { width: 100%; }
  .creation-story-card > summary { flex-wrap: wrap; }
  .creation-emotion-chip { margin-left: 28px; }
  .editor-workspace-head,
  .editor-footer-actions { align-items: stretch; flex-direction: column; }
  .editor-head-actions,
  .editor-footer-buttons { justify-content: flex-start; }
  .editor-layout { display: flex; flex-direction: column; }
  .editor-media-panel,
  .editor-inspector-panel { border: 0; }
  .editor-media-panel { border-bottom: 1px solid var(--line); }
  .editor-media-bin {
    display: flex;
    max-height: 160px;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 10px;
  }
  .editor-media-item { flex: 0 0 190px; }
  .editor-stage-panel { min-height: 0; }
  .editor-preview { min-height: 300px; padding: 14px; }
  .editor-preview video { height: min(54vh, 380px); }
  .editor-preview-meta span:first-child { max-width: 150px; }
  .editor-transport { flex-wrap: wrap; padding: 7px 10px; }
  .editor-transport-spacer { display: none; }
  .editor-timeline { min-height: 210px; }
  .editor-footer-buttons .btn { flex: 1 1 auto; }
}

/* ---------- empty state (shared) ---------- */
.wb-empty { grid-column: 1 / -1; min-height: 150px; border: 1px dashed #d4ddd7; border-radius: 8px; background: #fbfcfb; color: #87928c; display: grid; place-items: center; align-content: center; gap: 6px; padding: 24px; text-align: center; }
.wb-empty i { width: 22px; height: 22px; color: #8fb4a8; }
.wb-empty strong { color: var(--ink); font-size: 12px; }
.wb-empty p { max-width: 360px; font-size: 11px; line-height: 1.6; color: #87928c; }

/* ---------- floating AI assistant (kept hidden until opened) ---------- */
.ai-assistant-panel { position: fixed; right: 24px; bottom: 24px; width: 340px; max-height: 480px; display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 44px rgba(20,36,31,.16); z-index: 1000; }
.ai-assistant-panel[hidden] { display: none !important; }
.ai-assistant-header { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.ai-assistant-header > div { display: flex; justify-content: space-between; align-items: center; }
.ai-assistant-messages { flex: 1; overflow-y: auto; padding: 12px 14px; display: grid; gap: 12px; }
.ai-assistant-composer { padding: 10px 12px; border-top: 1px solid var(--line); display: flex; gap: 8px; }
.ai-assistant-composer input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfb; color: var(--ink); font-size: 12px; outline: 0; }
.ai-assistant-composer button { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 7px; background: var(--coral); color: #fff; cursor: pointer; }
.ai-assistant-composer button:hover { background: #d9644b; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .workbench-grid-2col { grid-template-columns: 1fr; }
  .export-stat-row { grid-template-columns: 1fr; }
  .workbench-production-stats { gap: 14px; }
}
@media (max-width: 640px) {
  .workbench-header { padding: 14px 16px 0; }
  .workbench-body .panel { padding: 14px 16px; }
  .workbench-tabs { gap: 16px; }
  .workbench-action-grid { grid-template-columns: 1fr; }
  .ai-assistant-panel { right: 12px; bottom: 12px; width: calc(100% - 24px); }
}

/* ============================================================
   DESIGN RESTORE — character-asset.css (loaded earlier) redefines
   .btn / .btn-primary / .page-heading / .empty-state globally in a
   blue "Tailwind-ish" look. Re-assert the app's paper/coral design in
   the app's own regions with higher specificity. The wizard and other
   add-on components mount on <body> outside these roots, so they keep
   their own styling.
   ============================================================ */
.auth-screen .btn, .app-shell .btn, .modal-backdrop .btn, .toast-stack .btn {
  border: 1px solid var(--line); border-radius: 7px; min-height: 36px; padding: 0 13px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: #fff; color: var(--ink); font-size: 12px; font-weight: 700; white-space: nowrap;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease, background .18s ease;
}
.auth-screen .btn:hover, .app-shell .btn:hover, .modal-backdrop .btn:hover, .toast-stack .btn:hover {
  border-color: #c5d0ca; transform: translateY(-1px); box-shadow: 0 5px 13px rgba(20,36,31,.06);
}
.auth-screen .btn-primary, .app-shell .btn-primary, .modal-backdrop .btn-primary, .toast-stack .btn-primary {
  background: var(--coral); color: #fff; border-color: var(--coral); box-shadow: 0 6px 15px rgba(231,114,88,.2);
}
.auth-screen .btn-primary:hover:not(:disabled), .app-shell .btn-primary:hover:not(:disabled),
.modal-backdrop .btn-primary:hover:not(:disabled), .toast-stack .btn-primary:hover:not(:disabled) {
  background: #d9644b; border-color: #d9644b;
}
.app-shell .btn-quiet, .modal-backdrop .btn-quiet { background: transparent; }
.app-shell .btn-danger, .modal-backdrop .btn-danger { background: #fff4f1; border-color: #efc8bd; color: #a74f3e; }
.app-shell .btn-danger:hover, .modal-backdrop .btn-danger:hover { background: #fce7e1; border-color: #e7aa9b; }
.app-shell .btn-small, .modal-backdrop .btn-small { min-height: 30px; padding: 0 10px; font-size: 11px; }
.app-shell .btn:disabled, .modal-backdrop .btn:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.app-shell .btn-large { min-height: 42px; font-size: 13px; padding: 0 18px; }

.app-shell .page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.app-shell .page-heading.compact { align-items: center; }
.app-shell .page-heading h1 { margin: 0; font-size: 38px; line-height: 1.15; letter-spacing: 0; font-weight: 800; color: var(--ink); }
.app-shell .page-heading p { margin: 10px 0 0; color: var(--ink-soft); font-size: 13px; }

.app-shell .empty-state { padding: 24px; color: #87928c; text-align: center; }


/* ---- Rendered shot-detail controls ---- */
#shotDetailView .shot-detail-inner { width: 100%; max-width: 1180px; min-width: 0; margin: 0 auto; }
#shotDetailView .sd-nav { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; min-width: 0; margin-bottom: 12px; }
#shotDetailView .sd-shot-navigation { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; min-width: 0; }
#shotDetailView .sd-shot-switch { min-width: 0; flex: 1; }
#shotDetailView .sd-shot-switch select { max-width: 320px; width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 7px; background: var(--paper, #fff); color: var(--ink); }
#shotDetailView .sd-source-panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 14px 0; }
#shotDetailView .sd-source-panels figure { margin: 0; min-width: 0; }
#shotDetailView .sd-source-panels img { display: block; width: 100%; aspect-ratio: 16/9; object-fit: contain; border-radius: 6px; background: #252620; }
#shotDetailView .sd-source-panels figcaption { font-size: 12px; line-height: 1.6; margin-top: 6px; color: var(--muted); }
#shotDetailView .sd-source-notes { font-size: 13px; line-height: 1.7; margin-bottom: 14px; }
#shotDetailView .sd-source-notes p { margin: 4px 0; }
.sb-review-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.sb-review-heading h2 { margin:5px 0; font-size:20px; }
.sb-review-status { color:var(--muted); font-size:12px; }
.sb-review-summary { font-size:15px; line-height:1.7; margin:12px 0 16px; }
.sb-review-image { display:block; width:100%; max-height:570px; object-fit:contain; border-radius:10px; background:#242824; margin-bottom:14px; }
.sb-board-preview { display:block; position:relative; width:100%; padding:0; border:0; border-radius:10px; background:transparent; cursor:zoom-in; margin-bottom:14px; }
.sb-board-preview .sb-review-image { margin:0; }
.sb-board-preview-hint { position:absolute; right:12px; bottom:12px; padding:7px 11px; border-radius:6px; color:#fff; background:rgba(0,0,0,.7); font-size:12px; pointer-events:none; }
.sb-board-preview:focus-visible, .sb-panel-preview:focus-visible { outline:3px solid #438774; outline-offset:3px; }
.sb-review-empty { padding:38px 20px; text-align:center; border:1px dashed #c7d5ce; border-radius:10px; background:#f6f8f5; }
.sb-review-empty p { color:var(--muted); max-width:570px; line-height:1.8; margin:10px auto 0; }
.sb-review-help { color:var(--muted); font-size:12px; line-height:1.7; margin:10px 0; }
.sb-review-actions { display:flex; flex-wrap:wrap; gap:10px; margin:14px 0 18px; }
.sb-review-actions .btn { min-height:40px; }
.sb-review-error { padding:10px; color:#96372e; background:#fff0ed; border-radius:7px; line-height:1.6; }
.sb-legacy-notice { margin:0 0 12px; padding:10px 12px; border:1px solid #e8d8a9; border-radius:8px; background:#fff8df; color:#795b1c; font-size:12px; line-height:1.6; }
.sb-edit-disclosure { margin:12px 0 16px; }
.sb-edit-disclosure > summary { cursor:pointer; display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px 15px; border:1px solid var(--line); border-radius:9px; background:#f1f5f1; font-weight:700; line-height:1.4; }
.sb-edit-disclosure > summary small { color:var(--muted); font-weight:500; font-size:11px; text-align:right; }
.sb-edit-disclosure[open] > summary { margin-bottom:14px; }
.sb-edit-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; }
.sb-locks { display:grid; gap:9px; margin:14px 0; padding:12px; border:1px solid var(--line); border-radius:9px; background:#fbfcfb; }
.sb-locks > strong { font-size:12px; color:var(--ink-soft); }
.sb-lock-chip { display:grid; grid-template-columns:minmax(0,1fr); gap:8px; align-items:start; padding:12px; border:1px solid #dfe7df; border-radius:8px; background:#fff; }
.sb-lock-chip span { font-size:13px; font-weight:700; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.sb-lock-chip small { color:var(--muted); font-size:11px; line-height:1.4; }
.sb-lock-chip img { display:block; width:100%; max-width:800px; height:auto; max-height:360px; object-fit:contain; border-radius:6px; background:#eef1ed; }
.sb-panel-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:14px 0; }
.sb-panel-card { display:grid; align-content:start; gap:8px; min-width:0; padding:10px; border:1px solid var(--line); border-radius:8px; background:#fbfcfb; }
.sb-panel-prompt { margin-top:4px; }
.sb-panel-prompt textarea { min-height:112px; }
.sb-panel-prompt-actions { display:flex; flex-wrap:wrap; gap:8px; }
.sb-panel-card .sb-panel-prompt-help, .sb-panel-card .sb-panel-prompt-status { font:12px/1.5 var(--sans); }
.sb-panel-prompt-status:empty { display:none; }
.sb-panel-thumb { display:grid; place-items:center; min-height:180px; overflow:hidden; border-radius:7px; background:#20251f; color:#dfe7df; font-size:12px; }
.sb-panel-card.has-image .sb-panel-thumb { min-height:0; }
.sb-panel-preview { display:grid; place-items:center; width:100%; padding:0; border:0; background:transparent; cursor:zoom-in; }
.sb-panel-thumb img { display:block; width:100%; height:auto; max-height:430px; object-fit:contain; }
.modal.modal-image-viewer { width:min(1440px,100%); padding:16px; overflow:hidden; }
.sb-image-viewer { display:grid; gap:10px; min-width:0; }
.sb-image-toolbar { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.sb-image-toolbar output { min-width:54px; text-align:center; font-variant-numeric:tabular-nums; font-size:13px; }
.sb-image-viewport { height:calc(100dvh - 230px); max-height:900px; overflow:auto; overscroll-behavior:contain; background:#171b18; border-radius:8px; touch-action:none; }
.sb-image-stage { display:grid; place-items:center; min-width:100%; min-height:100%; }
.sb-image-stage img { display:block; max-width:none; max-height:none; flex-shrink:0; user-select:none; }
.sb-image-viewport.is-zoomed { cursor:grab; }
.sb-image-viewport.is-dragging { cursor:grabbing; }
.sb-image-hint { margin:0; color:var(--muted); font-size:12px; line-height:1.5; }
@media (max-width:600px) {
  .modal.modal-image-viewer { padding:12px; }
  .sb-image-toolbar { gap:5px; }
  .sb-image-toolbar .btn { padding:0 9px; }
  .sb-image-viewport { height:calc(100dvh - 270px); }
}
@media (max-width: 980px) { .sb-panel-grid { grid-template-columns:1fr; } }
.sb-panel-meta { display:flex; justify-content:space-between; gap:8px; align-items:center; min-width:0; font-size:12px; }
.sb-panel-meta strong { color:var(--ink); }
.sb-panel-meta span, .sb-panel-card small { color:var(--muted); font:10px/1.4 var(--mono); }
.sb-panel-card p { margin:0; min-height:42px; color:var(--ink-soft); font-size:12px; line-height:1.55; }
.sb-panel-card .btn { justify-self:start; }
.sb-panel-edit-list { display:grid; gap:10px; margin:12px 0; }
.sb-panel-edit { display:grid; grid-template-columns:110px minmax(0,1fr) minmax(0,1fr); gap:10px; align-items:start; padding:10px; border:1px solid #dfe7df; border-radius:8px; background:#fbfcfb; }
.sb-panel-edit-title { display:grid; gap:4px; color:var(--ink-soft); font-size:12px; }
.sb-panel-edit-title span { color:var(--muted); font:10px/1.4 var(--mono); overflow:hidden; text-overflow:ellipsis; }
.sb-review-beats { display:grid; grid-template-columns:repeat(auto-fit,minmax(170px,1fr)); gap:14px; list-style:none; padding:0; font-size:13px; line-height:1.6; }
.sb-review-beats strong { display:block; color:#35655b; margin-bottom:4px; }
.sb-review-history { margin-top:16px; }
.sb-review-history figure { display:inline-block; width:220px; margin:12px 10px 0 0; vertical-align:top; }
.sb-review-history img { width:100%; border-radius:7px; }
.sb-review-history figcaption { font-size:12px; margin-top:6px; }
.sd-production-settings, .sd-reference-disclosure { margin:16px 0; }
.sd-production-settings > summary, .sd-reference-disclosure > summary, .sb-review-history > summary { cursor:pointer; padding:15px 16px; background:#f1f5f1; border:1px solid var(--line); border-radius:9px; font-weight:600; line-height:1.6; }
.sd-production-settings[open] > summary, .sd-reference-disclosure[open] > summary { margin-bottom:16px; }
#workbenchShotsGrid[hidden], #shotDetailView[hidden], .workbench-shots-toolbar[hidden] { display: none !important; }
#shotDetailView .sd-shot-header { display: grid; grid-template-columns: auto minmax(180px, 1fr) auto auto; align-items: center; gap: 8px 10px; min-width: 0; }
#shotDetailView .sd-shot-title-edit, #shotDetailView .sd-shot-title { min-width: 0; }
#shotDetailView .sd-shot-title { width: 100%; min-height: 34px; padding: 6px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfb; color: var(--ink); font: 700 14px/1.35 var(--sans); }
#shotDetailView .sd-shot-title:focus, #shotDetailView .sd-field:focus, #shotDetailView .sd-desc-textarea:focus { outline: none; border-color: #9bc8bb; box-shadow: 0 0 0 3px rgba(44,130,115,.1); }
#shotDetailView .sd-shot-time, #shotDetailView .sd-route-line, #shotDetailView .sd-segment-line { min-width: 0; color: var(--muted); font: 10px/1.4 var(--mono); white-space: nowrap; }
#shotDetailView .sd-shot-meta-row { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; min-width: 0; }
#shotDetailView .sd-route-line, #shotDetailView .sd-segment-line { display: inline-flex; align-items: center; gap: 5px; }
#shotDetailView .sd-route-line i, #shotDetailView .sd-segment-line i { width: 13px; height: 13px; flex: 0 0 auto; }
#shotDetailView .sd-desc-textarea, #shotDetailView .sd-field { box-sizing: border-box; width: 100%; min-width: 0; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfb; color: var(--ink); font: 12px/1.55 var(--sans); }
#shotDetailView .sd-desc-textarea { resize: vertical; min-height: 76px; }
#shotDetailView .sd-firstframe-source-tabs { display: flex; flex-wrap: wrap; gap: 7px; }
#shotDetailView .sd-ref-images-row { display: grid; gap: 7px; min-width: 0; }
#shotDetailView .sd-ref-image-slots { display: flex; flex-direction: row; flex-wrap: wrap; align-items: flex-start; gap: 8px; min-width: 0; }
#shotDetailView .sd-ref-image-slot { width: 96px; height: 96px; flex: 0 0 96px; overflow: hidden; }
#shotDetailView .sd-ref-image-slot img { display: block; width: 100% !important; height: 100% !important; max-width: 100%; max-height: 100%; object-fit: contain !important; object-position: center; }
#shotDetailView .sd-palette-row, #shotDetailView .sd-video-firstframe { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 10px; min-width: 0; }
#shotDetailView .sd-video-firstframe { grid-template-columns: auto 110px minmax(0, 1fr); align-items: center; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfb; }
#shotDetailView .sd-video-firstframe .sd-firstframe-thumb { width: 110px !important; height: 110px !important; max-width: 110px; max-height: 110px; margin: 0; object-fit: contain !important; }
#shotDetailView .sd-gen-params, #shotDetailView .form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; min-width: 0; }
#shotDetailView .field-label { display: grid; gap: 5px; min-width: 0; color: var(--ink-soft); font-size: 11px; }
#shotDetailView .field-label-text, #shotDetailView .shot-workbench-kicker { color: var(--muted); font: 10px/1.3 var(--mono); letter-spacing: .04em; }
#shotDetailView .sd-bound-assets-row { display: flex; flex-wrap: wrap; gap: 8px; min-width: 0; }
#shotDetailView .sd-bound-asset-chip { display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; padding: 5px 7px; border: 1px solid var(--line); border-radius: 7px; background: #fbfcfb; color: var(--ink); font-size: 11px; }
#shotDetailView .sd-bound-asset-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#shotDetailView .sd-bound-asset-thumb { width: 36px !important; height: 36px !important; flex: 0 0 36px; object-fit: contain !important; object-position: center; border-radius: 5px; background: #eef1ed; }
#shotDetailView .sd-section--video .sd-ai-recommend-btn, #shotDetailView .sd-section--video .sd-generate-video-btn, #shotDetailView .sd-section--firstframe .sd-generate-image-btn { justify-self: start; max-width: 100%; }
#shotDetailView .sd-version-history, #shotDetailView .sd-review-card { min-width: 0; max-width: 100%; }
#shotDetailView .shot-version-preview { width: 100%; max-width: 100%; overflow: hidden; }
@media (max-width: 760px) {
  .sb-edit-grid, .sb-panel-edit { grid-template-columns:1fr; }
  .sb-edit-disclosure > summary { align-items:flex-start; flex-direction:column; }
  .sb-edit-disclosure > summary small { text-align:left; }
}
#shotDetailView .shot-version-media { max-width: 100% !important; height: auto !important; max-height: 260px !important; object-fit: contain !important; }

@media (max-width: 760px) {
  #shotDetailView { padding: 16px; }
  #shotDetailView .sd-shot-header { grid-template-columns: auto minmax(0, 1fr); }
  #shotDetailView .sd-shot-header .sd-shot-time, #shotDetailView .sd-shot-header .wb-chip { grid-column: 2; }
  #shotDetailView .sd-palette-row, #shotDetailView .sd-video-firstframe, #shotDetailView .sd-gen-params, #shotDetailView .form-row { grid-template-columns: 1fr; }
  #shotDetailView .sd-video-firstframe .sd-firstframe-thumb { width: min(180px, 100%) !important; max-width: min(180px, 100%); }
}

/* ---- Shot Detail View ---- */
#shotDetailView {
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  padding: 24px 32px;
  box-sizing: border-box;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
}

.sd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.sd-header-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sd-header-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.3;
}

.sd-header-sub {
  font-size: 13px;
  color: var(--muted);
  font-family: var(--mono);
}

.sd-header-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) - 2px);
  padding: 7px 14px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: var(--sans);
}

.sd-header-back:hover {
  background: var(--surface);
  border-color: var(--ink-soft);
  color: var(--ink);
}

.sd-header-back:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.sd-section {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: var(--shadow);
}

.sd-section + .sd-section {
  margin-top: 16px;
}

.sd-section-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  margin: 0 0 2px;
  line-height: 1;
}

.sd-frame-sources {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sd-frame-source-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: 999px;
  padding: 6px 16px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
  user-select: none;
  white-space: nowrap;
}

.sd-frame-source-btn:hover {
  background: var(--surface);
  border-color: var(--ink-soft);
  color: var(--ink);
}

.sd-frame-source-btn:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.sd-frame-source-btn.is-selected,
.sd-frame-source-btn[aria-pressed="true"] {
  background: var(--coral-soft);
  border-color: var(--coral);
  color: var(--coral);
}

.sd-ref-images {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.sd-ref-image-slot {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  background: var(--paper);
  border: 1.5px solid var(--line);
  flex-shrink: 0;
}

.sd-ref-image-slot.is-empty {
  border: 1.5px dashed var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.sd-ref-image-slot.is-empty:hover {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.sd-ref-image-slot.is-empty:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.sd-ref-image-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sd-ref-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(27, 36, 33, 0.65);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: background 140ms ease;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sd-ref-remove:hover {
  background: var(--coral);
}

.sd-ref-remove:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.sd-palette-slot {
  position: relative;
  width: 120px;
  height: 80px;
  border-radius: calc(var(--radius) - 2px);
  overflow: hidden;
  background: var(--paper);
  border: 1.5px solid var(--line);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sd-palette-slot.is-empty {
  border: 1.5px dashed var(--line);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.sd-palette-slot.is-empty:hover {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.sd-palette-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.sd-palette-swatches {
  display: flex;
  flex-direction: row;
  height: 20px;
  width: 100%;
  flex-shrink: 0;
}

.sd-palette-swatches span {
  flex: 1;
  display: block;
}

.sd-asset-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: calc(var(--radius) - 4px);
  transition: background 120ms ease;
}

.sd-asset-row:hover {
  background: var(--paper);
}

.sd-asset-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--paper);
  flex-shrink: 0;
  display: block;
}

.sd-asset-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.sd-asset-remove {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--muted);
  font-size: 14px;
  cursor: pointer;
  transition: background 130ms ease, color 130ms ease, border-color 130ms ease;
  padding: 0;
}

.sd-asset-remove:hover {
  background: var(--coral-soft);
  border-color: var(--coral);
  color: var(--coral);
}

.sd-asset-remove:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.sd-inline-picker {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  max-width: 320px;
  max-height: 240px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(20, 36, 31, 0.10);
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sd-inline-picker:focus {
  outline: none;
}

.sd-inline-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: calc(var(--radius) - 4px);
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background 120ms ease;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  font-family: var(--sans);
}

.sd-inline-picker-item:hover {
  background: var(--paper);
}

.sd-inline-picker-item:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: -2px;
}

.sd-inline-picker-item.is-selected {
  background: var(--coral-soft);
  color: var(--coral);
  font-weight: 600;
}

.sd-inline-picker-item-thumb {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}

.sd-gen-params {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  align-items: start;
}

@media (max-width: 600px) {
  .sd-gen-params {
    grid-template-columns: 1fr;
  }
}

.sd-gen-param {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sd-gen-param-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.sd-gen-param select,
.sd-gen-param input {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: calc(var(--radius) - 4px);
  padding: 7px 10px;
  width: 100%;
  box-sizing: border-box;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 140ms ease;
}

.sd-gen-param select:focus,
.sd-gen-param input:focus {
  outline: none;
  border-color: var(--coral);
}

.sd-first-frame-preview {
  width: 80px;
  height: 80px;
  border-radius: calc(var(--radius) - 2px);
  object-fit: cover;
  border: 1.5px solid var(--line);
  background: var(--paper);
  display: block;
  flex-shrink: 0;
}

.sd-version-history {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  margin-top: 16px;
}

.sd-version-history-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 24px;
  cursor: pointer;
  background: transparent;
  border: none;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  transition: background 130ms ease;
}

.sd-version-history-toggle:hover {
  background: var(--paper);
}

.sd-version-history-toggle:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: -2px;
}

.sd-version-history-label {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.sd-version-history-chevron {
  color: var(--muted);
  font-size: 12px;
  transition: transform 200ms ease;
  flex-shrink: 0;
}

.sd-version-history.is-open .sd-version-history-chevron {
  transform: rotate(180deg);
}

.sd-version-history-body {
  display: none;
  padding: 0 16px 16px;
  flex-direction: column;
  gap: 8px;
}

.sd-version-history.is-open .sd-version-history-body {
  display: flex;
}

.sd-version-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: calc(var(--radius) - 2px);
  border: 1px solid var(--line);
  background: var(--paper);
  transition: border-color 140ms ease, background 140ms ease;
  cursor: pointer;
}

.sd-version-card:hover {
  border-color: var(--coral);
  background: var(--coral-soft);
}

.sd-version-card:focus-visible {
  outline: 2px solid var(--coral);
  outline-offset: 2px;
}

.sd-version-card-thumb {
  width: 48px;
  height: 48px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--surface);
  flex-shrink: 0;
  display: block;
}

.sd-version-card-meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.sd-version-card-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sd-version-card-time {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}

.sd-version-card-chips {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.sd-version-card .wb-chip {
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  line-height: 1.5;
}

.sd-ai-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  color: var(--teal);
  background: transparent;
  border: 1.5px solid var(--teal);
  border-radius: calc(var(--radius) - 2px);
  padding: 7px 16px;
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
  white-space: nowrap;
}

.sd-ai-btn:hover {
  background: var(--teal-soft);
  border-color: var(--teal);
}

.sd-ai-btn:active {
  background: var(--teal-soft);
  border-color: var(--teal);
  opacity: 0.85;
}

.sd-ai-btn:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}

.sd-ai-btn-icon {
  color: var(--teal);
  font-size: 14px;
  flex-shrink: 0;
  line-height: 1;
}

/* ---------- workbench: asset bible bridge ---------- */
.wb-bible-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.wb-bible-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 8px; margin-top: 6px; background: #fbfcfb; font-size: 12px; color: var(--ink); }
.wb-bible-row img { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #eef1ed; }
.wb-bible-row span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wb-bible-row select { border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 11px; padding: 4px 6px; color: var(--ink); }
.wb-bible-row .wb-chip { flex: 0 0 auto; }
.wb-bible-row:has(input:checked) { border-color: var(--teal); background: var(--teal-soft, #edf6f2); }
.wb-bible-row input[type="checkbox"] { accent-color: var(--teal); }
.wb-bible-grid .sd-picker-search { width: 100%; box-sizing: border-box; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px; background: #fff; color: var(--ink); font: inherit; }

.reference-picker-form { gap: 12px; }
.reference-picker-form input[type="search"] { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
.reference-picker-summary { color: var(--muted); font-size: 12px; }
.reference-picker-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; max-height: 54dvh; overflow-y: auto; padding: 3px; align-content: start; }
.reference-picker-card { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 8px; border: 2px solid var(--line); border-radius: 10px; background: #fff; text-align: left; color: var(--ink); cursor: pointer; }
.reference-picker-card img { width: 100%; height: 132px; object-fit: contain; border-radius: 6px; background: #f0f3f0; }
.reference-picker-card span { font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.reference-picker-card small { margin-top: auto; color: var(--muted); font-size: 11px; }
.reference-picker-card:hover:not(:disabled), .reference-picker-card.is-selected { border-color: #2c8273; background: #edf8f3; }
.reference-picker-card:focus-visible { outline: 3px solid #84c7b5; outline-offset: 2px; }
.reference-picker-card:disabled { cursor: default; opacity: .6; }
.reference-picker-footer, .reference-picker-pagination { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.reference-picker-footer .modal-actions { margin: 0; }
.reference-picker-pagination span { min-width: 48px; text-align: center; font-size: 12px; color: var(--muted); }
.reference-picker-empty { grid-column: 1 / -1; padding: 36px 10px; text-align: center; color: var(--muted); }
@media (max-width: 640px) {
  .reference-picker-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .reference-picker-card img { height: 110px; }
  .reference-picker-footer { flex-wrap: wrap; }
}
.wb-bible-table { width: 100%; border-collapse: collapse; font-size: 12px; margin-top: 6px; }
.wb-bible-table th { text-align: left; font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.wb-bible-table td { padding: 8px; border-bottom: 1px solid #eef1ed; vertical-align: middle; color: var(--ink); }
.wb-bible-table select { border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 11px; padding: 4px 6px; color: var(--ink); max-width: 200px; }
.wb-inline-check { display: inline-flex; align-items: center; gap: 4px; margin-right: 10px; font-size: 11px; color: var(--ink-soft); }
/* Export timeline editing controls */
.export-edit-settings{border-top:1px solid var(--line);padding-top:1rem;margin-top:1rem}
.export-settings-head,.export-captions-head{display:flex;align-items:center;justify-content:space-between;gap:.75rem}
.export-settings-head h3,.export-captions-head strong{margin:0}
.export-settings-head p{margin:.25rem 0 0;color:var(--muted);font-size:.8rem}
.export-mix-grid{display:grid;grid-template-columns:minmax(180px,1.4fr) repeat(2,minmax(150px,1fr));gap:.75rem;margin-top:.85rem}
.export-mix-grid output{float:right;color:var(--ink);font-variant-numeric:tabular-nums}
.export-soundtrack-preview{display:flex;align-items:center;gap:.75rem;margin:.75rem 0;padding:.6rem .75rem;background:var(--muted-bg,#f5f6f4);border:1px solid var(--line);border-radius:6px}
.export-soundtrack-preview audio{width:min(360px,100%)}
.export-captions-head{margin-top:1rem}
.export-captions{display:grid;gap:.5rem;margin-top:.55rem}
.export-caption-row{display:grid;grid-template-columns:90px 90px minmax(160px,1fr) 32px;gap:.45rem;align-items:center}
.export-caption-row input{min-width:0}
.export-caption-row.is-invalid{padding:.35rem;border:1px solid #c85c52;border-radius:6px;background:rgba(200,92,82,.06)}
.export-captions-error{color:#a83d35;font-size:.8rem;padding:.35rem 0}
.export-result-video{display:block;width:min(360px,100%);max-height:520px;margin:.75rem 0;background:#111;border-radius:6px}
.project-soundtrack-panel{border-top:1px solid var(--line);border-bottom:1px solid var(--line);padding:1rem 0;margin:1rem 0}
.project-soundtrack-head{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}
.project-soundtrack-head h3{margin:.18rem 0 0;font-size:1rem;color:var(--ink)}
.project-soundtrack-head p{margin:.35rem 0 0;color:var(--muted);font-size:.8rem;max-width:680px}
.project-soundtrack-grid{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:1rem;align-items:end;margin-top:.9rem}
.project-soundtrack-meta{display:grid;grid-template-columns:repeat(4,minmax(100px,1fr));gap:.6rem}
.project-soundtrack-meta div{display:grid;gap:.2rem;padding:.55rem .65rem;background:var(--muted-bg,#f5f6f4);border:1px solid var(--line);border-radius:6px}
.project-soundtrack-meta span{font-size:.68rem;color:var(--muted)}
.project-soundtrack-meta strong{font-size:.8rem;color:var(--ink);font-weight:600}
.project-soundtrack-actions{display:flex;align-items:center;gap:.5rem;flex-wrap:wrap;justify-content:flex-end}
.project-soundtrack-actions .btn{white-space:nowrap}
.project-soundtrack-progress{margin-top:.8rem;padding:.65rem .75rem;background:var(--muted-bg,#f5f6f4);border-radius:6px}
.project-soundtrack-progress-bar{height:4px;background:#dfe5df;border-radius:2px;overflow:hidden}
.project-soundtrack-progress-bar span{display:block;height:100%;background:var(--teal);transition:width .25s ease}
.project-soundtrack-progress p{margin:.45rem 0 0;font-size:.76rem;color:var(--muted)}
.project-soundtrack-preview{display:flex;align-items:center;justify-content:space-between;gap:.75rem;margin-top:.75rem;padding:.65rem .75rem;background:var(--muted-bg,#f5f6f4);border:1px solid var(--line);border-radius:6px}
.project-soundtrack-preview div{display:grid;gap:.2rem;min-width:0}
.project-soundtrack-preview strong{font-size:.8rem;color:var(--ink);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.project-soundtrack-preview span{font-size:.7rem;color:var(--muted)}
.project-soundtrack-preview audio{width:min(360px,50%);min-width:180px}
.project-soundtrack-source-row{display:flex;align-items:center;gap:.45rem;margin-top:.75rem;color:var(--muted);font-size:.75rem;flex-wrap:wrap}
.project-soundtrack-source-row svg{width:14px;height:14px;color:var(--teal);vertical-align:-2px}
.project-soundtrack-source-row strong{color:var(--ink)}
.project-soundtrack-source-note{flex-basis:100%;padding-left:1.2rem}
.project-soundtrack-description-label{display:grid;gap:.35rem;margin-top:.85rem}
.project-soundtrack-description-label textarea{width:100%;box-sizing:border-box;min-height:64px;resize:vertical;border:1px solid var(--line);border-radius:6px;background:var(--surface);color:var(--ink);padding:.55rem .65rem;font:inherit;font-size:.8rem}
.project-soundtrack-description-actions{display:flex;justify-content:flex-end;margin-top:.5rem}
.soundtrack-status-chip.is-running{color:#8c6a1c;background:#fff6d9;border-color:#e8cf83}
.soundtrack-status-chip.is-complete{color:#247a58;background:#e8f6ee;border-color:#a8d8bc}
.soundtrack-status-chip.is-failed{color:#9a4039;background:#fbeceb;border-color:#e1aaa5}
.chatcut-fullcut-panel{border-top:1px solid var(--line);padding-top:1rem;margin-top:1rem}
.chatcut-fullcut-head{display:flex;align-items:flex-start;justify-content:space-between;gap:1rem}
.chatcut-fullcut-head h3{margin:.18rem 0 0;font-size:1rem;color:var(--ink)}
.chatcut-fullcut-head p{margin:.35rem 0 0;color:var(--muted);font-size:.8rem;max-width:680px}
.chatcut-fullcut-actions{display:flex;gap:.5rem;flex-wrap:wrap;margin-top:.85rem}
.chatcut-fullcut-actions .btn,
.chatcut-fullcut-actions a.btn{white-space:nowrap}
.chatcut-fullcut-progress{margin-top:.75rem;padding:.65rem .75rem;background:var(--muted-bg,#f5f6f4);border-radius:6px}
.chatcut-fullcut-progress-bar{height:4px;background:#dfe5df;border-radius:2px;overflow:hidden}
.chatcut-fullcut-progress-bar span{display:block;height:100%;background:var(--teal);transition:width .25s ease}
.chatcut-fullcut-progress p{margin:.45rem 0 0;font-size:.76rem;color:var(--muted)}
.chatcut-fullcut-result{margin-top:.75rem}
.chatcut-embedded-hint{margin:.75rem 0 .65rem;color:var(--muted);font-size:.78rem;line-height:1.6}
.chatcut-embedded-editor{border-top:1px solid var(--line);padding-top:1rem;margin-top:1rem}
.chatcut-embedded-frame-wrap{height:min(78vh,920px);min-height:560px;margin-top:.85rem;border:1px solid var(--line);border-radius:8px;overflow:hidden;background:#101614;box-shadow:0 8px 24px rgba(24,36,31,.12)}
.chatcut-embedded-frame-wrap iframe{display:block;width:100%;height:100%;border:0;background:#fff}
@media (max-width:720px){.chatcut-embedded-frame-wrap{height:70vh;min-height:480px}}
.wb-timeline-editor{overflow:hidden;border:1px solid var(--line);border-radius:8px;background:var(--surface);padding:16px}
.wb-timeline-ruler{position:relative;width:var(--timeline-width);min-width:var(--timeline-width);height:32px;border-bottom:1px solid var(--line);color:var(--muted);font-size:11px}
.wb-timeline-ruler-label{position:absolute;left:0;top:0;color:var(--ink);font-weight:600}
.wb-timeline-tick{position:absolute;top:14px;transform:translateX(-50%);height:18px}
.wb-timeline-tick:first-of-type{transform:none}
.wb-timeline-tick i{display:block;width:1px;height:8px;margin:auto;background:var(--line-strong,var(--line))}
.wb-timeline-tick b{display:block;margin-top:2px;font-weight:500;white-space:nowrap}
.wb-timeline-scroll{overflow-x:auto;overflow-y:hidden;padding:12px 0 4px}
.wb-timeline-track-wide{position:relative;width:var(--timeline-width);min-width:var(--timeline-width);height:96px;border-radius:6px;background:repeating-linear-gradient(90deg,rgba(100,110,105,.06) 0,rgba(100,110,105,.06) 1px,transparent 1px,transparent 120px)}
.wb-timeline-blocks{position:absolute;inset:0}
.wb-timeline-block{position:absolute;top:0;height:96px;min-width:34px;display:flex;align-items:flex-end;gap:6px;padding:6px;border:1px solid rgba(255,255,255,.5);border-radius:5px;background:#879b91;color:#fff;text-align:left;overflow:hidden;cursor:pointer;box-shadow:0 1px 2px rgba(0,0,0,.08)}
.wb-timeline-block:hover{filter:brightness(1.05);z-index:2}
.wb-timeline-block.done{background:#4f8972}.wb-timeline-block.frame-ready{background:#b58a4a}.wb-timeline-block.review{background:#9d6a72}.wb-timeline-block.progress{background:#6b8497}.wb-timeline-block.failed{background:#a24f47}.wb-timeline-block.wait{background:#7f8a85}
.wb-timeline-thumb{position:absolute;inset:0 0 auto 0;height:58px;background:rgba(0,0,0,.15);display:flex;align-items:center;justify-content:center}
.wb-timeline-thumb img{width:100%;height:100%;object-fit:cover}
.wb-timeline-thumb svg{width:22px;height:22px;opacity:.75}
.wb-timeline-block-copy{position:relative;z-index:1;display:grid;grid-template-columns:auto auto;gap:0 5px;align-items:end;width:100%;min-width:0;text-shadow:0 1px 2px rgba(0,0,0,.35)}
.wb-timeline-block-copy strong,.wb-timeline-block-copy span{font-size:11px;line-height:14px}
.wb-timeline-block-copy small{grid-column:1/-1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;font-size:10px;line-height:13px}
.wb-timeline-legend{display:flex;gap:14px;flex-wrap:wrap;margin-top:10px;color:var(--muted);font-size:11px}
.wb-legend-dot{display:inline-block;width:8px;height:8px;margin-right:4px;border-radius:50%;background:#7f8a85}.wb-legend-dot.done{background:#4f8972}.wb-legend-dot.frame-ready{background:#b58a4a}.wb-legend-dot.wait{background:#7f8a85}
@media (max-width:720px){.export-mix-grid{grid-template-columns:1fr}.export-caption-row{grid-template-columns:72px 72px minmax(0,1fr) 32px}}
@media (max-width:720px){.project-soundtrack-head,.project-soundtrack-grid{display:grid;grid-template-columns:1fr}.project-soundtrack-meta{grid-template-columns:repeat(2,minmax(0,1fr))}.project-soundtrack-actions{justify-content:flex-start}.project-soundtrack-preview{align-items:flex-start;flex-direction:column}.project-soundtrack-preview audio{width:100%;min-width:0}}
@media (max-width:720px){.chatcut-fullcut-head{display:grid;grid-template-columns:1fr}.project-soundtrack-description-actions{justify-content:flex-start}}
.shot-dialogue-editor{margin-top:.75rem;padding:.75rem;border:1px solid var(--line);border-radius:6px;background:var(--muted-bg,#f5f6f4)}
.shot-dialogue-head{display:flex;align-items:flex-start;justify-content:space-between;gap:.75rem;margin-bottom:.6rem}
.shot-dialogue-head strong{display:block;font-size:.82rem;color:var(--ink)}
.shot-dialogue-head small{display:block;margin-top:.2rem;color:var(--muted);font-size:.7rem}
.shot-dialogue-row{display:grid;grid-template-columns:minmax(120px,.35fr) minmax(0,1fr) minmax(150px,.65fr) 30px;gap:.45rem;align-items:start;margin-top:.45rem}
.shot-dialogue-row select,.shot-dialogue-row textarea,.shot-dialogue-row input{width:100%;box-sizing:border-box;min-width:0}
.shot-dialogue-row textarea{min-height:34px;resize:vertical}
.shot-dialogue-row .icon-btn{margin-top:2px}
.shot-dialogue-empty{padding:.6rem;color:var(--muted);font-size:.75rem;text-align:center;border:1px dashed var(--line-strong,var(--line));border-radius:5px}
.sd-section--dialogue .modal-actions{justify-content:flex-end}

/* Adjacent-shot planning: keep the transition legible without turning the
   detail view into another dense storyboard. */
.sd-section--transition { border-color: rgba(219, 170, 82, .35); }
.sd-transition-heading { display:flex; justify-content:space-between; align-items:flex-start; gap:16px; }
.sd-transition-heading > div { display:grid; gap:4px; }
.sd-transition-heading small { color:var(--muted, #8f98a8); line-height:1.5; }
.sd-transition-neighbors { display:grid; grid-template-columns:1fr auto 1fr auto 1fr; align-items:center; gap:10px; margin:16px 0; }
.sd-transition-neighbors > svg { color:#d9aa52; width:16px; height:16px; }
.sd-transition-node { min-width:0; padding:10px 12px; border:1px solid rgba(255,255,255,.1); border-radius:10px; background:rgba(255,255,255,.025); }
.sd-transition-node.is-current { border-color:rgba(219,170,82,.6); background:rgba(219,170,82,.08); }
.sd-transition-node span { display:block; color:var(--muted, #8f98a8); font-size:11px; margin-bottom:4px; }
.sd-transition-node strong { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
.sd-transition-plan { border-top:1px solid rgba(255,255,255,.08); padding-top:14px; }
.sd-transition-plan-meta { display:flex; flex-wrap:wrap; gap:8px; align-items:center; color:var(--muted, #8f98a8); font-size:12px; }
.sd-transition-plan > p { margin:12px 0; line-height:1.6; }
.sd-transition-columns { display:grid; grid-template-columns:repeat(3, minmax(0, 1fr)); gap:10px; }
.sd-transition-columns > div { padding:10px; border-radius:8px; background:rgba(255,255,255,.035); }
.sd-transition-columns b { display:block; font-size:12px; color:#e6c37a; margin-bottom:5px; }
.sd-transition-columns p { margin:0; color:var(--muted, #aeb6c4); font-size:12px; line-height:1.5; }
.sd-transition-plan ul { margin:12px 0; padding-left:20px; color:var(--muted, #aeb6c4); font-size:12px; line-height:1.7; }
.sd-transition-prompt { width:100%; resize:vertical; margin-top:8px; }
/* Edge card: cut vs transition, seam frame shared by both shots. */
.sd-transition-incoming { display:flex; flex-wrap:wrap; align-items:center; gap:8px 12px; margin:0 0 14px; padding:10px 12px; border:1px dashed rgba(219,170,82,.45); border-radius:10px; font-size:12px; }
.sd-transition-incoming span { color:var(--muted, #8f98a8); }
.sd-transition-incoming small { flex-basis:100%; color:var(--muted, #8f98a8); line-height:1.5; }
.sd-transition-seam { margin:10px 0; padding:10px 12px; border-left:3px solid #d9aa52; border-radius:6px; background:rgba(219,170,82,.08); }
.sd-transition-seam b { display:block; font-size:12px; color:#c8963a; margin-bottom:4px; }
.sd-transition-seam p { margin:0 0 4px; line-height:1.5; }
.sd-transition-seam small { color:var(--muted, #8f98a8); }
.sd-transition-seam-status { margin:8px 0; font-size:12px; line-height:1.5; }
.sd-transition-seam-status.is-ready { color:#2f8a5c; }
.sd-transition-seam-status.is-missing { color:#b7791f; }
.sd-transition-warnings { margin:8px 0; padding-left:20px; color:#b7791f; font-size:12px; line-height:1.6; }
.sd-transition-note { margin:8px 0; color:var(--muted, #8f98a8); font-size:12px; line-height:1.6; }
.sd-transition-editor { margin-top:14px; border-top:1px solid var(--line, rgba(255,255,255,.08)); padding-top:10px; }
.sd-transition-editor > summary { cursor:pointer; font-weight:600; font-size:13px; }
.sd-transition-form { display:grid; gap:10px; margin-top:10px; }
.sd-transition-form .transition-desc { margin:-4px 0 0; color:var(--muted, #8f98a8); font-size:12px; line-height:1.5; }
.sd-transition-grid { display:grid; grid-template-columns:repeat(2, minmax(0, 1fr)); gap:10px; }
.sd-transition-card-fields { display:grid; gap:10px; margin:0; padding:10px 12px; border:1px solid rgba(219,170,82,.35); border-radius:10px; }
.sd-transition-card-fields[hidden] { display:none; }
.sd-transition-card-fields legend { padding:0 6px; font-size:12px; color:#c8963a; }
.sd-transition-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.sb-panel-role { display:inline-flex; align-items:center; min-height:20px; padding:0 7px; border-radius:999px; font-size:11px; font-weight:600; background:rgba(219,170,82,.16); color:#a8741c; }
.sb-panel-role.is-seam { background:#d9aa52; color:#1f1a10; }
.editor-seam-note { margin:6px 0 0; font-size:12px; color:var(--muted, #8f98a8); }
.editor-seam-note.is-aligned { color:#2f8a5c; }
.editor-seam-note.is-partial, .editor-seam-note.is-missing { color:#b7791f; }
@media (max-width: 760px) {
  .sd-transition-grid { grid-template-columns:1fr; }
}
.wb-shot-transition-summary { display:flex; align-items:center; gap:6px; margin-top:9px; color:var(--muted, #8f98a8); font-size:11px; }
.wb-shot-transition-summary svg { width:13px; height:13px; color:#d9aa52; }
@media (max-width: 760px) {
  .sd-transition-neighbors { grid-template-columns:1fr; }
  .sd-transition-neighbors > svg { transform:rotate(90deg); justify-self:center; }
  .sd-transition-columns { grid-template-columns:1fr; }
  .sd-transition-heading { flex-direction:column; }
}
.sd-voice-status-row{display:flex;flex-wrap:wrap;gap:.4rem;margin:.45rem 0 .65rem}
.sd-voice-chip{display:inline-flex;align-items:center;min-height:24px;padding:0 .55rem;border:1px solid var(--line);border-radius:6px;background:var(--surface);font-size:.72rem;color:var(--muted)}
.sd-voice-chip.is-ready{border-color:#a8d8bc;background:#e8f6ee;color:#247a58}
.sd-voice-chip.is-missing{border-color:#e1aaa5;background:#fbeceb;color:#9a4039}
.sd-dialogue-lines{display:grid;gap:.45rem;margin-bottom:.65rem}
.sd-dialogue-row{grid-template-columns:minmax(140px,.32fr) minmax(200px,1fr) 100px 30px;gap:12px;padding:14px;border:1px solid var(--line);border-radius:8px;background:var(--surface)}
.sd-dialogue-row > label:nth-of-type(1){grid-column:1;grid-row:1}
.sd-dialogue-row > label:nth-of-type(2){grid-column:2;grid-row:1}
.sd-dialogue-row > details{grid-column:1/-1;grid-row:2}
.sd-dialogue-row > button[data-sd-dialogue-generate]{grid-column:3;grid-row:1}
.sd-dialogue-row > button[data-sd-dialogue-remove]{grid-column:4;grid-row:1}
.sd-dialogue-performance{grid-column:1/-1;min-width:0;padding-top:2px}
.sd-dialogue-performance summary{cursor:pointer;color:var(--muted);font-size:12px}
.sd-dialogue-performance .field-label{margin-top:8px}
.sd-dialogue-row > button{margin-top:25px;white-space:nowrap}
.sd-dialogue-row .icon-btn{margin-top:25px}
.sd-dialogue-row .field-label{margin:0}
.sd-dialogue-result{grid-column:1/-1;display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:16px;min-width:0;color:var(--muted)}
.sd-dialogue-row > .sd-dialogue-result{grid-row:3}
.sd-dialogue-result small{font-size:12px;overflow-wrap:anywhere}
.sd-dialogue-result .is-error{color:var(--danger,#b44343)}
.sd-dialogue-result audio{width:320px;max-width:55%;height:34px;flex-shrink:0}
.sd-speech-direction{grid-column:1/-1;min-width:0;margin-top:6px;padding:7px 9px;border:1px solid var(--line);border-radius:6px;background:var(--muted-bg,#f5f6f4)}
.sd-speech-direction--compact{flex:1 0 100%}
.sd-speech-direction summary{cursor:pointer;color:var(--ink);font-size:12px}
.sd-speech-direction small{display:block;margin-top:5px;color:var(--muted);font-size:11px;line-height:1.5;overflow-wrap:anywhere}
.sd-speech-direction-title{display:flex;align-items:center;gap:5px;color:var(--ink);font-size:12px}
.sd-speech-direction-title svg{width:14px;height:14px}
.sd-speech-direction-line{display:grid;gap:3px;margin-top:7px}
.sd-dialogue-description{margin:12px 0;padding:12px 14px;border:1px solid var(--line);border-radius:8px;font-size:13px}
.sd-dialogue-description p{white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.7;margin:6px 0 0;color:var(--muted)}
.creation-dialogue-list{display:grid;gap:8px;margin-top:12px}
.creation-dialogue-row{display:grid;grid-template-columns:42px minmax(0,1fr) minmax(150px,.5fr) auto;align-items:center;gap:10px;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--surface)}
.creation-dialogue-row strong,.creation-dialogue-row small{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.creation-dialogue-row span{font-variant-numeric:tabular-nums;color:var(--muted)}
@media (max-width:720px){.shot-dialogue-row{grid-template-columns:1fr 30px}.shot-dialogue-row textarea{grid-column:1/-1;grid-row:2}.shot-dialogue-row input{grid-column:1/-1;grid-row:3}.shot-dialogue-row .icon-btn{grid-column:2;grid-row:1}}
@media (max-width:720px){
  .sd-dialogue-row{grid-template-columns:minmax(0,1fr) auto auto}
  .sd-dialogue-row > label:nth-of-type(1){grid-column:1;grid-row:1}
  .sd-dialogue-row > label:nth-of-type(2){grid-column:1/-1;grid-row:2}
  .sd-dialogue-row > details{grid-column:1/-1;grid-row:3}
  .sd-dialogue-row > button[data-sd-dialogue-generate]{grid-column:2;grid-row:1;margin-top:25px}
  .sd-dialogue-row > button[data-sd-dialogue-remove]{grid-column:3;grid-row:1;margin-top:25px}
  .sd-dialogue-row > .sd-dialogue-result{grid-column:1/-1;grid-row:4}
}
.sd-pipeline-hint {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: center;
  margin: 10px 0;
  padding: 8px 10px;
  border: 1px solid var(--line, #d9ded8);
  border-radius: 6px;
  background: var(--surface-subtle, #f6f8f5);
  color: var(--muted, #66736b);
  font-size: 12px;
}
.sd-pipeline-hint strong { color: var(--ink, #1e2a24); }
.sd-pipeline-hint span { white-space: nowrap; }
@media (max-width: 640px) {
  .sd-pipeline-hint span { white-space: normal; }
}
/* Desktop workflow: concise shot form and searchable asset references. */
body:has(#modalBackdrop:not([hidden])) { overflow: hidden; }
.new-shot-form .shot-advanced { border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.new-shot-form .shot-advanced > summary { cursor: pointer; font-weight: 650; padding: 4px; }
.new-shot-form .shot-advanced[open] > summary { margin-bottom: 14px; }
.new-shot-form .shot-advanced .field-label { margin-top: 10px; }
.new-shot-form .modal-actions { position: sticky; bottom: -1px; z-index: 2; background: var(--paper, #fff); padding: 16px 0 4px; box-shadow: 0 -10px 18px var(--paper, #fff); }
.shot-picker-toolbar { display: grid; grid-template-columns: 2fr 1fr 1.5fr; gap: 10px; }
.shot-picker-toolbar input, .shot-picker-toolbar select { min-width: 0; width: 100%; }
.shot-asset-list { max-height: 280px; overflow: auto; display: grid; gap: 8px; }
.shot-asset-option { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.shot-asset-option > input { width: 18px; flex: 0 0 18px; }
.shot-asset-option img, .shot-asset-placeholder { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.shot-asset-placeholder { display: grid; place-items: center; font-size: 11px; background: var(--paper-warm, #f1f4ef); }
.shot-asset-option > span:last-child { min-width: 0; }
.shot-asset-option strong { display: block; overflow-wrap: anywhere; font-size: 13px; }
.shot-asset-option small { display: block; color: var(--ink-soft); margin-top: 4px; }
.shot-picker-empty { padding: 20px; color: var(--ink-soft); }
.project-delivery-video { display: block; width: 100%; max-height: 65vh; background: #111; }
.creation-draft-list { display: grid; gap: 10px; margin-top: 16px; }
.creation-draft-row { display: flex; align-items: center; gap: 20px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; }
.creation-draft-row > div { min-width: 0; flex: 1; }
.creation-draft-row strong { display: block; font-size: 13px; overflow-wrap: anywhere; }
.creation-draft-row p { margin: 6px 0; color: var(--muted); font-size: 12px; line-height: 1.6; white-space: pre-wrap; }
.creation-draft-row small { color: var(--muted); }
.creation-draft-row > button { flex: 0 0 auto; }
.reference-live-region { display: grid; gap: 12px; margin: 18px 0; }
.reference-live-region[hidden], #referenceUploadProgress[hidden] { display: none; }
.reference-live-progress { padding: 22px 24px; border: 1px solid #99bfb4; border-left: 4px solid #378676; border-radius: 12px; background: #eef7f2; color: #244b40; }
.reference-live-heading { display: flex; align-items: center; gap: 12px; }
.reference-live-heading > svg { width: 24px; height: 24px; flex: 0 0 24px; }
.reference-live-heading > div { min-width: 0; flex: 1; }
.reference-live-heading strong { font-size: 17px; font-weight: 700; }
.reference-live-heading p { margin: 5px 0 0; font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.reference-live-heading > span { font-size: 17px; font-weight: 700; flex-shrink: 0; }
.reference-live-track { height: 10px; margin: 16px 0 12px; overflow: hidden; border-radius: 6px; background: #d4e7df; }
.reference-live-track > span { display: block; height: 100%; background: #378676; border-radius: inherit; transition: width .3s ease; }
.reference-live-track.is-indeterminate > span { animation: reference-progress-slide 1.6s ease-in-out infinite; }
.reference-live-steps { display: flex; justify-content: space-between; gap: 8px; color: #677b71; font-size: 12px; }
.reference-live-steps .current, .reference-live-steps .complete { color: #245f50; font-weight: 650; }
.reference-live-foot { display: flex; align-items: center; gap: 16px; margin-top: 12px; }
.reference-live-foot p { flex: 1; margin: 0; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.reference-live-foot button { flex-shrink: 0; }
.reference-live-progress.is-error { background: #fff1e9; border-color: #d7a88a; color: #8c432c; }
.reference-live-progress.is-error .reference-live-track > span { background: #bc7652; }
#referenceUploadProgress .reference-live-progress { padding: 16px; }
@keyframes reference-progress-slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(290%); } }
@media (max-width: 640px) { .reference-live-progress { padding: 16px; } .reference-live-heading { gap: 8px; } .reference-live-heading strong, .reference-live-heading > span { font-size: 15px; } .reference-live-steps { font-size: 10px; } }
@media (prefers-reduced-motion: reduce) { .reference-live-track.is-indeterminate > span { animation: none; } }
.storyboard-draft-form { gap: 20px; }
.storyboard-draft-context { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px 24px; padding: 14px 18px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
.storyboard-draft-context strong { font-size: 15px; overflow-wrap: anywhere; }
.storyboard-draft-context span { color: var(--ink-soft); font-size: 13px; }
.storyboard-draft-intro { margin: 0; color: var(--ink-soft); font-size: 13px; line-height: 1.7; }
.storyboard-draft-inputs { display: grid; gap: 20px; min-width: 0; margin: 0; padding: 0; border: 0; }
.storyboard-draft-inputs textarea { min-height: 240px; padding: 16px; font-size: 14px; line-height: 1.8; resize: vertical; }
.storyboard-draft-options { display: grid; grid-template-columns: minmax(0, 2fr) minmax(140px, 1fr); gap: 20px; }
.storyboard-draft-options small { color: var(--ink-soft); font-size: 12px; font-weight: 400; }
.storyboard-draft-status { display: flex; align-items: flex-start; gap: 12px; padding: 16px 18px; border: 1px solid #a8cfc3; border-radius: 10px; background: var(--teal-soft); color: var(--teal); }
.storyboard-draft-status[hidden] { display: none; }
.storyboard-draft-status > svg { flex: 0 0 20px; width: 20px; height: 20px; }
.storyboard-draft-status strong { display: block; font-size: 14px; }
.storyboard-draft-status p { margin: 5px 0 0; font-size: 12px; line-height: 1.6; overflow-wrap: anywhere; }
.storyboard-draft-status.is-error { border-color: #e1aaa5; background: #fbeceb; color: #9a4039; }
.storyboard-draft-form .modal-actions { margin-top: 0; padding-top: 18px; border-top: 1px solid var(--line); }
@media (max-width: 640px) {
  .storyboard-draft-options { grid-template-columns: 1fr; gap: 14px; }
  .storyboard-draft-inputs textarea { min-height: 200px; }
  .storyboard-draft-context { flex-direction: column; }
}
