/* 生产管线页 · 从 public/exact/pipeline.html 内联 <style> 忠实移植。
   Phase 1:chrome(自带顶栏+5阶段步进器)+ 视口锁定 + Stage 1(脚本)。
   Stage 2-5 / 各 modal 待后续补。整段 scope 进 .pipeline-page(= .app.pipeline-page)。 */
.pipeline-page {
  /* ─── 视口锁定 · 只让主内容区滚动(sidebar + topbar 固定)─── */
  height: 100vh; max-height: 100vh; overflow: hidden;
  & > .sidebar { height: 100vh; overflow-y: auto; }
  & > main { height: 100vh; max-height: 100vh; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
  & > main > .topbar { flex-shrink: 0; }
  & > main > .content { flex: 1 1 0; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; }

  /* ─── 顶栏:返回 + 标题 + 中部 stage-pill ─── */
  .topbar { position: relative; }
  .pipeline-topbar-left {
    display: inline-flex; align-items: center; gap: 12px;
    min-width: 0; max-width: min(36vw, 520px);
  }
  .pipeline-back { height: 34px; padding: 0 13px 0 11px; border-radius: var(--r-pill); flex: 0 0 auto; }
  .pipeline-back svg { width: 14px; height: 14px; }
  .pipeline-topbar-title {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 13.5px; font-weight: 500; color: var(--accent-black);
  }
  .pipeline-topbar-title .mono { margin-left: 8px; font-size: 10.5px; font-weight: 400; letter-spacing: .04em; color: var(--black-alpha-48); }
  @media (max-width: 1500px) { .pipeline-topbar-title { display: none; } }

  .stage-pill {
    position: absolute; left: 50%; top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex; align-items: center; gap: 0;
    padding: 6px 16px;
    background: var(--surface);
    border: 1px solid var(--border-faint);
    border-radius: var(--r-pill);
    z-index: 3;
  }
  .stage-pill .sp-dot {
    position: relative;
    display: inline-flex; align-items: center; gap: 6px;
    padding: 2px 8px;
    text-decoration: none; cursor: pointer;
    border-radius: var(--r-sm);
    transition: background var(--t-base);
  }
  .stage-pill .sp-dot:hover { background: var(--background-lighter); }
  .stage-pill .sp-dot .d {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--black-alpha-8);
    border: 1.5px solid transparent;
    transition: background var(--t-base), border-color var(--t-base), box-shadow var(--t-base);
  }
  .stage-pill .sp-dot .l {
    font-size: 12px; color: var(--black-alpha-56);
    font-weight: 500; letter-spacing: .01em;
    white-space: nowrap; transition: color var(--t-base);
  }
  .stage-pill .sp-dot:hover .l { color: var(--accent-black); }
  .stage-pill .sp-dot.done .d { background: var(--accent-forest); border-color: var(--accent-forest); }
  .stage-pill .sp-dot.done .l { color: var(--accent-black); }
  .stage-pill .sp-dot.active .d {
    background: var(--heat); border-color: var(--heat);
    box-shadow: 0 0 0 3px var(--heat-12);
    animation: prog-pulse 1.4s ease-in-out infinite;
  }
  .stage-pill .sp-dot.active .l { color: var(--heat); font-weight: 600; }
  .stage-pill .sp-dot.fail .d { background: var(--accent-crimson); border-color: var(--accent-crimson); }
  .stage-pill .sp-dot.fail .l { color: var(--accent-crimson); }
  .stage-pill .sp-line { width: 14px; height: 1.5px; background: var(--black-alpha-8); transition: background var(--t-base); }
  .stage-pill .sp-line.done { background: var(--accent-forest); }

  /* ─── Stage panes ─── */
  .stage { display: none; }
  .stage.active { display: block; }

  .pane { background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--r-md); }
  .pane-h { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border-faint); }
  .pane-h strong { font-size: 14px; font-weight: 600; }

  /* Stage foot */
  .stage-foot { display: flex; justify-content: space-between; align-items: center; padding: 18px 0 0; margin-top: 18px; border-top: 1px solid var(--border-faint); }
  .stage-foot .info { font-size: 12.5px; color: var(--black-alpha-56); }
  .stage-foot .info .mono { font-family: var(--font-mono); color: var(--black-alpha-48); font-size: 11.5px; letter-spacing: .02em; }
  .stage-foot .hstack { gap: 10px; align-items: center; }
  .stage-foot .btn { height: 40px; min-height: 40px; padding: 0 18px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-size: 13.5px; line-height: 1; white-space: nowrap; }
  .stage-foot .btn-primary { padding: 0 20px; font-weight: 600; }
  .stage-foot .btn svg { width: 14px; height: 14px; flex: 0 0 14px; }

  /* ─── 全高度布局 ─── */
  .content.content--fh { display: flex; flex-direction: column; overflow: hidden; padding: 24px 28px 20px; }
  .content.content--fh-flat { padding: 0; }
  .content--fh-flat .stage.active > .stage-script .pane { background: var(--surface); border: 0; border-radius: 0; }
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .pane.shot-list > .pane-h,
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .pane.shot-list > .shots-body { padding-left: 28px; }
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .pane.chat-pane > .pane-h,
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .pane.chat-pane > .chat-body,
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .pane.chat-pane > .chat-input { padding-left: 28px; padding-right: 28px; }
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .pane.shot-list > .pane-h,
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .pane.chat-pane > .pane-h { border-bottom: 0; }
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .pane.chat-pane > .chat-input { border-top: 0; }
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .stage-script-gutter::after { background: transparent; }
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .stage-script-gutter:hover::after,
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script > .stage-script-gutter.dragging::after { background: var(--heat); }
  .content--fh-flat .stage[data-stage-pane="1"].active > .stage-script { gap: 0; grid-template-columns: minmax(0, 1fr) 6px var(--chat-w, 520px); }

  .stage-script-gutter { position: relative; background: transparent; cursor: col-resize; transition: background var(--t-base); }
  .stage-script-gutter::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; width: 1px; transform: translateX(-50%); background: var(--border-faint); transition: background var(--t-base), width var(--t-base); }
  .stage-script-gutter:hover::after, .stage-script-gutter.dragging::after { background: var(--heat); width: 2px; }
  .stage-script-gutter.dragging { background: var(--heat-12); }
  .content--fh-flat .stage.active > .stage-foot { margin-top: 0; padding: 14px 28px; background: var(--surface); border-top: 1px solid var(--border-faint); }

  .content--fh .stage.active { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
  .content--fh .stage[data-stage-pane="1"].active > .stage-script { flex: 1 1 0; min-height: 0; overflow: hidden; }
  .content--fh .stage.active > .stage-foot { flex: 0 0 auto; }
  .content--fh .stage[data-stage-pane="1"].active > .stage-script > .shot-list,
  .content--fh .stage[data-stage-pane="1"].active > .stage-script > .chat-pane { min-height: 0; min-width: 0; }
  .content--fh .stage[data-stage-pane="1"].active .shots-body,
  .content--fh .stage[data-stage-pane="1"].active .chat-body { max-height: none; flex: 1 1 0; min-height: 0; overflow-y: auto; }

  /* === STAGE 1 · 脚本 === */
  .stage-script { display: grid; grid-template-columns: 7fr 3fr; gap: 16px; min-height: 560px; }
  .chat-pane { display: flex; flex-direction: column; }
  .chat-body { padding: 16px 18px; flex: 1; overflow-y: auto; max-height: 460px; display: flex; flex-direction: column; gap: 14px; }
  .msg .bubble { max-width: 90%; padding: 10px 14px; font-size: 13px; line-height: 1.6; border: 1px solid var(--border-faint); border-radius: var(--r-md); }
  .msg.ai .bubble { background: var(--surface); }
  .msg.user { display: flex; flex-direction: column; align-items: flex-end; }
  .msg.user .bubble { background: var(--heat-12); color: var(--accent-black); border-color: var(--heat-20); }
  .msg .time { font-family: var(--font-mono); font-size: 10.5px; color: var(--black-alpha-48); margin-top: 4px; letter-spacing: .02em; }
  .msg .actions { display: flex; gap: 6px; margin-top: 6px; }
  .ai-avatar { width: 26px; height: 26px; flex-shrink: 0; background: var(--heat); color: var(--accent-white); display: grid; place-items: center; font-size: 11px; font-weight: 700; border: 1px solid var(--heat); border-radius: 50%; }
  .del { text-decoration: line-through; color: var(--black-alpha-48); }
  .ins { background: var(--forest-bg); color: var(--accent-forest); padding: 0 3px; }
  .chat-input { padding: 14px 18px 18px; border-top: 1px solid var(--border-faint); }
  .chat-input-card { background: var(--background-base); border: 1px solid var(--border-faint); border-radius: var(--r-md); padding: 12px 14px 10px; transition: border-color var(--t-base), box-shadow var(--t-base); }
  .chat-input-card:focus-within { border-color: var(--accent-black); box-shadow: 0 0 0 3px rgba(0,0,0,.04); }
  .chat-input-area { width: 100%; border: none; outline: none; background: transparent; font-family: var(--font-sans); font-size: 13px; color: var(--accent-black); line-height: 1.55; resize: none; padding: 0; min-height: 42px; }
  .chat-input-area::placeholder { color: var(--black-alpha-40); }
  .chat-input-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
  .chat-input-foot .hint { font-family: var(--font-mono); font-size: 11px; color: var(--black-alpha-40); letter-spacing: .02em; }
  .chat-input-foot .spacer { flex: 1; }
  .chat-icon-btn { width: 28px; height: 28px; display: grid; place-items: center; background: transparent; border: 1px solid var(--border-faint); border-radius: 50%; color: var(--black-alpha-56); cursor: pointer; transition: border-color var(--t-base), color var(--t-base), background var(--t-base); }
  .chat-icon-btn:hover { border-color: var(--accent-black); color: var(--accent-black); }
  .chat-send-btn { width: 32px; height: 32px; display: grid; place-items: center; background: var(--accent-black); border: 1px solid var(--accent-black); border-radius: 50%; color: var(--accent-white); cursor: pointer; transition: background var(--t-base), border-color var(--t-base), transform var(--t-base); }
  .chat-send-btn:hover { background: var(--heat); border-color: var(--heat); }
  .chat-send-btn:active { transform: scale(.95); }
  .chat-send-btn:disabled { background: var(--black-alpha-12); border-color: var(--black-alpha-12); color: var(--black-alpha-40); cursor: not-allowed; transform: none; }
  .chat-attach-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }

  .shot-list { display: flex; flex-direction: column; }
  .shots-body { padding: 12px 16px; flex: 1; overflow-y: auto; max-height: 540px; display: flex; flex-direction: column; gap: 0; }

  .shot-list > .pane-h { flex-wrap: wrap; row-gap: 8px; }
  .shot-headline { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
  .script-brief-summary { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; min-width: 0; }
  .script-brief-pill { gap: 4px; padding: 3px 8px; font-size: 11px; }
  .script-brief-pill .k { font-family: var(--font-mono); font-size: 10px; color: var(--black-alpha-48); letter-spacing: .04em; }
  .script-brief-pill .v { color: var(--accent-black); max-width: 116px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .script-tags { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 14px; margin-left: 6px; }
  .script-tags .tag-group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .script-tags .tg-lbl { font-family: var(--font-mono); font-size: 10.5px; color: var(--black-alpha-48); letter-spacing: .04em; text-transform: uppercase; flex-shrink: 0; }
  .script-tags .tag-add { width: 20px; height: 20px; display: grid; place-items: center; background: transparent; border: 1px dashed var(--black-alpha-24); border-radius: 50%; color: var(--black-alpha-48); cursor: pointer; font-size: 13px; line-height: 1; padding: 0; transition: border-color var(--t-base), color var(--t-base), background var(--t-base); }
  .script-tags .tag-add:hover { border-style: solid; border-color: var(--heat); color: var(--heat); background: var(--heat-12); }

  /* 镜头脚本空缺省态 */
  .shots-empty { padding: 36px 24px; margin: auto; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--black-alpha-48); }
  .shots-empty .empty-ico { width: 56px; height: 56px; border: 1px dashed var(--border-faint); border-radius: var(--r-md); display: grid; place-items: center; color: var(--black-alpha-32); }
  .shots-empty .empty-title { font-size: 14px; font-weight: 500; color: var(--accent-black); }
  .shots-empty .empty-hint { font-size: 12px; color: var(--black-alpha-56); line-height: 1.55; max-width: 280px; font-family: var(--font-mono); letter-spacing: .02em; }

  /* 对话空态三胶囊 */
  .chat-empty { padding: 28px 18px 14px; margin: auto; display: flex; flex-direction: column; align-items: center; gap: 12px; }
  .chat-empty .ce-title { font-size: 13.5px; color: var(--accent-black); font-weight: 500; }
  .chat-empty .ce-hint { font-size: 11.5px; color: var(--black-alpha-56); font-family: var(--font-mono); letter-spacing: .02em; }
  .chat-modes { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
  .chat-mode { height: 30px; padding: 0 14px; background: var(--surface); border: 1px solid var(--border-faint); border-radius: 999px; font-size: 12.5px; color: var(--accent-black); display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-family: inherit; transition: background var(--t-base), border-color var(--t-base), color var(--t-base); }
  .chat-mode:hover { background: var(--heat-12); border-color: var(--heat); color: var(--heat); }
  .chat-mode.primary { background: var(--heat-12); border-color: var(--heat); color: var(--heat); }
  .chat-mode svg { width: 13px; height: 13px; }

  /* ============= STAGE 2 · 基础资产 ============= */
  .content--fh .stage[data-stage-pane="2"].active > .stage-assets { flex: 1 1 0; min-height: 0; overflow: hidden; }
  .content--fh-flat .stage[data-stage-pane="2"].active > .stage-assets { gap: 0; height: 100%; }
  .content--fh-flat .stage[data-stage-pane="2"].active > .stage-assets > .asset-side { position: static; align-self: stretch; padding: 18px 16px; background: var(--background-base); overflow-y: auto; }
  .content--fh-flat .stage[data-stage-pane="2"].active > .stage-assets > .asset-main { padding: 18px 28px; overflow-y: auto; background: var(--background-base); }
  .stage-assets { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 24px; }
  .stage-assets > div { min-width: 0; }
  .asset-side { position: sticky; top: 16px; align-self: start; }
  .asset-sec { min-width: 0; scroll-margin-top: 16px; }
  .asset-side .ttab { padding: 10px 12px; font-size: 13px; cursor: pointer; display: flex; align-items: center; gap: 8px; border: 1px solid transparent; border-radius: var(--r-md); }
  .asset-side .ttab:hover { background: var(--background-lighter); }
  .asset-side .ttab.active { background: var(--heat-12); color: var(--heat); border-color: var(--heat-20); font-weight: 600; }
  .asset-side .ttab .num { font-family: var(--font-mono); font-size: 11px; color: var(--black-alpha-48); margin-left: auto; }
  .asset-side .ttab.active .num { color: var(--heat); }
  .asset-side .info { font-size: 12px; color: var(--black-alpha-48); padding: 14px 12px; line-height: 1.6; margin-top: 14px; border-top: 1px solid var(--border-faint); }
  .asset-side .info strong { color: var(--black-alpha-56); display: block; }
  .asset-side .info .mono { font-family: var(--font-mono); }
  .asset-sec + .asset-sec { margin-top: 32px; }
  .asset-sec .sec-h { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
  .asset-sec .sec-h h3 { font-size: 15px; font-weight: 600; }

  .asset-grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
  .prod-row { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; }
  .prod-row > .asset-card-2 { flex: 0 0 auto; width: auto; max-width: none; min-width: 0; height: 360px; aspect-ratio: 3 / 5; }
  .prod-preview { flex: 0 0 360px; height: 360px; background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--r-md); padding: 12px; display: none; flex-direction: column; gap: 10px; }
  .prod-preview.show { display: flex; }
  .prod-preview-h { display: flex; align-items: center; gap: 8px; font-family: var(--font-mono); font-size: 10.5px; color: var(--black-alpha-56); letter-spacing: .04em; text-transform: uppercase; }
  .prod-preview-img { aspect-ratio: 16/9; }
  .prod-preview-foot { display: flex; align-items: center; gap: 8px; min-height: 30px; }
  .prod-preview-history { display: none; flex-direction: column; gap: 6px; }

  .asset-card-2 { background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--r-md); cursor: pointer; transition: border-color var(--t-base), box-shadow var(--t-base); overflow: hidden; display: flex; flex-direction: column; }
  .asset-card-2:hover { border-color: var(--heat-40); box-shadow: 0 1px 3px rgba(0,0,0,.04); }
  .asset-card-2 .thumb-2 { aspect-ratio: 1; }
  .asset-card-2 .body-2 { padding: 12px 14px; }
  .asset-card-2 .body-2 .btn:disabled, .asset-card-2 .body-2 .btn.disabled { background: transparent; border-color: transparent; color: var(--black-alpha-32); box-shadow: none; cursor: not-allowed; opacity: .72; transform: none; }
  .asset-card-2 .body-2 .btn:disabled:hover, .asset-card-2 .body-2 .btn.disabled:hover { background: transparent; border-color: transparent; color: var(--black-alpha-32); box-shadow: none; transform: none; }

  .asset-card-2.prod-lib-card:hover { background: var(--background-lighter); border-color: var(--black-alpha-48); }
  .asset-card-2.prod-lib-card .prod-thumb { flex: 1 1 0; min-height: 0; position: relative; aspect-ratio: auto; }
  .asset-card-2.prod-lib-card .prod-body { padding: 14px 14px 12px; flex: 0 0 auto; }
  .asset-card-2.prod-lib-card .prod-name { font-size: 14px; font-weight: 600; color: var(--accent-black); line-height: 1.3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .asset-card-2.prod-lib-card .prod-cat { display: inline-flex; align-items: center; margin-top: 8px; padding: 2px 8px; background: var(--background-lighter); color: var(--black-alpha-72); border-radius: var(--r-sm); font-size: 11.5px; }
  .asset-card-2.prod-lib-card .prod-date { font-family: var(--font-mono); font-size: 11px; color: var(--black-alpha-48); margin-top: 10px; letter-spacing: .02em; }
  .asset-card-2.prod-lib-card .prod-action { padding: 10px 12px; border-top: 1px solid var(--border-faint); background: var(--surface); }
  .asset-card-2.prod-lib-card .prod-action[hidden] { display: none; }
  .asset-card-2.prod-lib-card .prod-action .btn-aigen {
    width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px; background: var(--heat); color: var(--accent-white);
    border: 1px solid var(--heat); border-radius: var(--r-sm); font-size: 13px; font-weight: 500; cursor: pointer; font-family: inherit;
    box-shadow: inset 0 -2px 4px rgba(250,93,25,.20), 0 1px 1px rgba(250,93,25,.12), 0 2px 4px rgba(250,93,25,.10);
    transition: background var(--t-base), box-shadow var(--t-base), transform var(--t-base);
  }
  .asset-card-2.prod-lib-card .prod-action .btn-aigen:hover { background: #FB6E2E; box-shadow: inset 0 -2px 4px rgba(250,93,25,.24), 0 2px 4px rgba(250,93,25,.20), 0 4px 12px rgba(250,93,25,.18); transform: translateY(-1px); }
  .asset-card-2.prod-lib-card .prod-action .btn-aigen .ai-spark { width: 14px; height: 14px; flex-shrink: 0; }

  .prompt-box { background: var(--background-base); border: 1px solid var(--border-faint); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12px; color: var(--black-alpha-56); margin-top: 8px; line-height: 1.55; font-family: var(--font-mono); letter-spacing: .01em; transition: border-color var(--t-base), background var(--t-base); }
  .prompt-box[contenteditable="true"] { cursor: text; outline: none; }
  .prompt-box[contenteditable="true"]:hover { border-color: var(--heat-20); }
  .prompt-box[contenteditable="true"]:focus { border-color: var(--heat); background: var(--surface); color: var(--accent-black); box-shadow: 0 0 0 3px var(--heat-12); }
  .fail-icon { width: 28px; height: 28px; background: var(--accent-crimson); color: var(--accent-white); display: grid; place-items: center; font-weight: 700; font-size: 16px; border-radius: 50%; }

  /* ============= STAGE 3 · 故事板 ============= */
  .content--fh .stage[data-stage-pane="3"].active > .stage-storyboard { flex: 1 1 0; min-height: 0; overflow-y: auto; }
  .content--fh-flat .stage[data-stage-pane="3"].active > .stage-storyboard { gap: 0; }
  .content--fh-flat .stage[data-stage-pane="3"].active > .stage-storyboard > .sb-canvas { border: 0; border-radius: 0; background: var(--surface); padding: 18px 14px 18px 28px; align-items: center; }
  .content--fh-flat .stage[data-stage-pane="3"].active > .stage-storyboard > .sb-canvas > .sb-main-img { width: 100%; }
  .content--fh-flat .stage[data-stage-pane="3"].active > .stage-storyboard > .sb-side { display: flex; flex-direction: column; min-height: 0; }
  .content--fh-flat .stage[data-stage-pane="3"].active > .stage-storyboard > .sb-side > .pane { flex: 1 1 0; min-height: 0; overflow-y: auto; border: 0; border-radius: 0; background: var(--surface); padding: 18px 28px; }
  .content--fh-flat .stage[data-stage-pane="3"].active .sb-scenes-col { max-height: none; }

  .stage-storyboard { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 16px; align-items: stretch; }
  .sb-canvas { background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--r-md); padding: 14px; display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 14px; }
  .sb-scenes-col { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; overflow-x: hidden; max-height: 560px; padding-right: 6px; scrollbar-width: thin; }
  .sb-scenes-col::-webkit-scrollbar { width: 6px; }
  .sb-scenes-col::-webkit-scrollbar-thumb { background: var(--border-faint); border-radius: 4px; }
  .sb-scene-thumb { flex: 0 0 auto; cursor: pointer; display: flex; flex-direction: column; gap: 6px; padding: 6px; border: 1px solid var(--border-faint); border-radius: var(--r-md); background: var(--surface); transition: border-color var(--t-base), background var(--t-base); }
  .sb-scene-thumb:hover { background: var(--background-lighter); }
  .sb-scene-thumb.selected { border-color: var(--heat); background: var(--heat-12); }
  .sb-scene-thumb .placeholder { aspect-ratio: 1; }
  .sb-scene-thumb .nm { font-size: 11.5px; font-weight: 500; color: var(--accent-black); }
  .sb-scene-thumb .sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--black-alpha-48); }
  .sb-main-img { aspect-ratio: 16/9; min-height: 0; }

  .sb-rerun-note { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; margin-bottom: 14px; background: rgba(180,83,9,.08); border: 1px solid rgba(180,83,9,.20); border-radius: var(--r-md); color: #7C3A05; line-height: 1.55; }
  .sb-rerun-note .warn-ic { width: 22px; height: 22px; border-radius: var(--r-sm); background: rgba(180,83,9,.12); color: #B45309; display: grid; place-items: center; flex: 0 0 22px; }
  .sb-rerun-note .warn-ic svg { width: 14px; height: 14px; }
  .sb-rerun-note .note-copy { min-width: 0; font-size: 11.5px; }
  .sb-rerun-note strong { color: #B45309; }
  .sb-rerun-note a { color: #B45309; text-decoration: underline; text-underline-offset: 2px; }

  .sb-stage-actions { display: flex; gap: 8px; margin-top: 14px; margin-bottom: 12px; }
  .sb-history { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border-faint); }
  .sb-history-h { font-family: var(--font-mono); font-size: 10.5px; color: var(--black-alpha-48); letter-spacing: .06em; text-transform: uppercase; margin-bottom: 10px; }
  .sb-history-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: thin; }
  .sb-history-thumb { flex: 0 0 80px; min-width: 80px; display: flex; flex-direction: column; gap: 4px; padding: 4px; border: 1px solid var(--border-faint); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; transition: border-color var(--t-base); }
  .sb-history-thumb:hover { border-color: var(--heat); }
  .sb-history-thumb.current { border-color: var(--heat); background: var(--heat-12); }
  .sb-history-thumb .placeholder { aspect-ratio: 1; }
  .sb-history-thumb .ts { font-family: var(--font-mono); font-size: 9.5px; color: var(--black-alpha-48); text-align: center; }
  .sb-history-thumb.current .ts { color: var(--heat); font-weight: 600; }

  .pill-cta { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 14px; border-radius: 999px; font-size: 12.5px; cursor: pointer; font-family: inherit; transition: background var(--t-base), border-color var(--t-base), color var(--t-base); }
  .pill-cta.heat { background: var(--heat); color: var(--accent-white); border: 1px solid var(--heat); }
  .pill-cta.heat:hover { box-shadow: var(--shadow-cta-hover); }
  .pill-cta.ghost { background: var(--surface); color: var(--accent-black); border: 1px solid var(--border-faint); }
  .pill-cta.ghost:hover { background: var(--background-lighter); border-color: var(--heat-20); color: var(--heat); }
  .pill-cta svg { width: 13px; height: 13px; }

  .sb-side .pane { padding: 18px; }
  .prompt-edit { background: var(--background-base); border: 1px solid var(--border-faint); border-radius: var(--r-md); padding: 12px 14px; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.7; color: var(--accent-black); white-space: pre-wrap; min-height: 200px; outline: none; letter-spacing: .01em; cursor: text; transition: border-color var(--t-base), background var(--t-base), box-shadow var(--t-base); }
  .prompt-edit:hover { border-color: var(--heat-20); }
  .prompt-edit:focus { border-color: var(--heat); background: var(--surface); box-shadow: 0 0 0 3px var(--heat-12); }
  .asset-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; background: var(--background-lighter); border: 1px solid var(--border-faint); border-radius: var(--r-pill); font-size: 11.5px; }
  .asset-tag .dotc { width: 14px; height: 14px; background: var(--surface); border: 1px solid var(--border-faint); border-radius: 50%; }

  /* ============= STAGE 4 · 视频 ============= */
  .content--fh .stage[data-stage-pane="4"].active > .video-grid { flex: 1 1 0; min-height: 0; overflow-y: auto; }
  .content--fh-flat .stage[data-stage-pane="4"].active > .queue-bar { border: 0; border-radius: 0; border-bottom: 1px solid var(--border-faint); margin: 0; padding: 14px 28px; }
  .content--fh-flat .stage[data-stage-pane="4"].active > .video-grid { padding: 18px 28px; background: var(--background-base); }
  .queue-bar { display: flex; align-items: center; gap: 16px; padding: 14px 18px; background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--r-md); margin-bottom: 18px; }
  .queue-bar .bar-wrap { flex: 1; height: 6px; background: var(--background-lighter); overflow: hidden; }
  .queue-bar .bar-wrap > span { display: block; height: 100%; background: var(--heat); }
  .video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(196px, 216px)); gap: 14px; align-content: start; align-items: start; justify-content: start; }
  .video-card { background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--r-md); cursor: pointer; transition: border-color var(--t-base), background var(--t-base); overflow: hidden; display: flex; flex-direction: column; min-height: 0; }
  .video-card:hover { border-color: var(--heat-40); background: var(--background-lighter); }
  .video-thumb { width: 100%; aspect-ratio: 9/16; position: relative; border-radius: var(--r-md) var(--r-md) 0 0; overflow: hidden; }
  .video-thumb .play { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,0.05); cursor: pointer; opacity: 0; transition: opacity .15s; }
  .video-thumb:hover .play { opacity: 1; }
  .video-thumb .btn-play { width: 36px; height: 36px; background: rgba(0,0,0,.7); color: var(--accent-white); border-radius: 50%; display: grid; place-items: center; }
  .video-card .body { padding: 12px 12px 14px; flex: 1 1 auto; min-height: 118px; display: flex; flex-direction: column; }
  .video-card-head { display: flex; align-items: flex-start; gap: 8px; }
  .video-card-title { min-width: 0; flex: 1 1 auto; font-size: 13px; line-height: 1.4; font-weight: 600; color: var(--accent-black); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .video-card-head .pill { flex: 0 0 auto; }
  .video-meta { font-family: var(--font-mono); font-size: 11px; color: var(--black-alpha-48); letter-spacing: .02em; margin-top: 5px; }
  .video-actions { margin-top: auto; padding-top: 12px; display: flex; align-items: center; gap: 10px; }

  /* ============= STAGE 5 · 拼接编辑器 ============= */
  .content--fh .stage[data-stage-pane="5"].active > .editor { flex: 1 1 0; min-height: 0; overflow-y: auto; height: auto; }
  .content--fh-flat .stage[data-stage-pane="5"].active > .editor { border: 0; border-radius: 0; }
  .content--fh-flat .stage[data-stage-pane="5"].active > .editor > .editor-preview { padding-left: 28px; }
  .content--fh-flat .stage[data-stage-pane="5"].active > .editor > .editor-props { padding-right: 28px; }
  .content--fh-flat .stage[data-stage-pane="5"].active > .editor > .timeline { padding-left: 28px; padding-right: 28px; }

  .editor { display: grid; grid-template-columns: 1fr 280px; grid-template-rows: 1fr auto; gap: 0; height: 580px; background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--r-md); }
  .editor-preview { padding: 16px; border-right: 1px solid var(--border-faint); border-bottom: 1px solid var(--border-faint); display: flex; flex-direction: column; gap: 12px; }
  .editor-preview .canvas { flex: 1 1 0; min-height: 0; aspect-ratio: 9/16; margin: 0 auto; background: repeating-linear-gradient(135deg, rgba(0,0,0,0.03) 0 1px, transparent 1px 12px), var(--background-lighter); border: 1px solid var(--border-faint); border-radius: var(--r-md); display: grid; place-items: center; color: var(--black-alpha-48); font-family: var(--font-mono); font-size: 12px; }
  .editor-preview .controls { display: flex; align-items: center; gap: 8px; justify-content: center; }
  .ctl-btn { width: 36px; height: 36px; border: 1px solid var(--border-faint); background: var(--surface); color: var(--black-alpha-56); border-radius: var(--r-md); display: grid; place-items: center; cursor: pointer; transition: background var(--t-base), border-color var(--t-base), color var(--t-base); }
  .ctl-btn:hover { color: var(--heat); border-color: var(--heat-40); background: var(--heat-12); }

  .editor-props { padding: 16px; border-bottom: 1px solid var(--border-faint); overflow-y: auto; }
  .props-tabs { display: flex; gap: 0; margin-bottom: 14px; border-bottom: 1px solid var(--border-faint); }
  .props-tabs > div { padding: 8px 12px; font-size: 12.5px; color: var(--black-alpha-56); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
  .props-tabs > div.active { color: var(--heat); border-bottom-color: var(--heat); font-weight: 600; }
  .style-swatch { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .swatch-card { padding: 10px; border: 1px solid var(--border-faint); border-radius: var(--r-md); cursor: pointer; }
  .swatch-card:hover { background: var(--background-lighter); }
  .swatch-card.selected { border-color: var(--heat); background: var(--heat-12); }
  .swatch-card .demo { font-size: 12px; padding: 6px 8px; background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--r-sm); margin-bottom: 4px; text-align: center; }
  .swatch-card .demo.b { background: var(--accent-black); color: var(--accent-white); font-family: serif; }
  .swatch-card .demo.c { color: var(--heat); -webkit-text-stroke: 0.5px var(--accent-black); }
  .swatch-card .demo.d { background: var(--accent-honey, #f5c451); color: var(--accent-black); font-weight: 700; }
  .swatch-card .nm { font-size: 11px; color: var(--black-alpha-48); font-family: var(--font-mono); letter-spacing: .02em; }
  .props-row { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border-faint); font-size: 12.5px; }
  .props-row:last-child { border-bottom: 0; }
  .props-row .k { color: var(--black-alpha-48); flex: 1; font-family: var(--font-mono); font-size: 11px; letter-spacing: .02em; }
  .input-mini { width: 90px; padding: 0 10px; height: 28px; font-size: 12px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--black-alpha-12); }

  .timeline { position: relative; grid-column: 1 / -1; padding: 14px 16px; background: var(--background-base); }
  .tl-toolbar { display: flex; align-items: center; gap: 4px; margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--border-faint); }
  .tl-toolbar .tl-action { display: inline-flex; align-items: center; gap: 5px; height: 28px; padding: 0 10px; background: transparent; border: 1px solid transparent; border-radius: var(--r-sm); color: var(--black-alpha-72); font-size: 12px; font-family: inherit; cursor: pointer; transition: background var(--t-base), border-color var(--t-base), color var(--t-base); }
  .tl-toolbar .tl-action:hover { background: var(--surface); border-color: var(--border-faint); color: var(--accent-black); }
  .tl-toolbar .tl-action.danger:hover { color: var(--accent-crimson); border-color: var(--accent-crimson); }
  .tl-toolbar .tl-action svg { width: 13px; height: 13px; }
  .tl-toolbar .tl-sep { width: 1px; height: 16px; background: var(--border-faint); margin: 0 4px; }
  .tl-toolbar .tl-zoom { display: inline-flex; align-items: center; gap: 8px; }
  .tl-toolbar .tl-zoom .lbl { font-family: var(--font-mono); font-size: 10.5px; color: var(--black-alpha-48); letter-spacing: .04em; }
  .tl-toolbar .tl-zoom input[type="range"] { width: 120px; accent-color: var(--heat); }
  .tl-ruler { display: grid; grid-template-columns: 80px 1fr; align-items: end; padding: 0; margin-bottom: 4px; }
  .tl-ruler .l { font-family: var(--font-mono); color: var(--black-alpha-48); padding: 0 4px 4px; font-size: 10.5px; letter-spacing: .04em; align-self: end; }
  .tl-ruler .rule-track { position: relative; height: 22px; border-bottom: 1px solid var(--border-faint); cursor: pointer; }
  .tl-ruler .rule-track .tick { position: absolute; bottom: 0; width: 1px; background: var(--black-alpha-24); }
  .tl-ruler .rule-track .tick.major { height: 8px; background: var(--black-alpha-48); }
  .tl-ruler .rule-track .tick.minor { height: 4px; }
  .tl-ruler .rule-track .t { position: absolute; bottom: 10px; transform: translateX(-50%); font-family: var(--font-mono); font-size: 10px; color: var(--black-alpha-56); letter-spacing: .02em; white-space: nowrap; }
  .tl-track { display: grid; grid-template-columns: 80px 1fr; align-items: center; padding: 3px 0; }
  .tl-track .label { display: flex; align-items: center; gap: 6px; padding-left: 4px; font-size: 11.5px; color: var(--black-alpha-72); font-weight: 500; }
  .tl-track .label .ico { width: 18px; height: 18px; display: grid; place-items: center; border-radius: var(--r-sm); flex-shrink: 0; }
  .tl-track .label .ico svg { width: 12px; height: 12px; }
  .tl-track .label.video .ico { background: var(--heat-12); color: var(--heat); }
  .tl-track .label.subtitle .ico { background: var(--forest-bg); color: var(--accent-forest); }
  .tl-track .label.bgm .ico { background: rgba(144, 97, 255, .10); color: var(--accent-amethyst, #9061ff); }
  .tl-track .lane { position: relative; background: var(--surface); border: 1px solid var(--border-faint); border-radius: var(--r-sm); cursor: pointer; }
  .tl-track.video-track .lane { height: 46px; }
  .tl-track.subtitle-track .lane { height: 28px; }
  .tl-track.bgm-track .lane { height: 34px; }
  .tl-track .lane::before { content: ""; position: absolute; inset: 0; background-image: repeating-linear-gradient(to right, var(--border-faint) 0, var(--border-faint) 1px, transparent 1px, transparent calc(100% / 15)); pointer-events: none; opacity: .55; border-radius: inherit; }

  .clip { position: absolute; top: 3px; bottom: 3px; display: flex; align-items: center; gap: 6px; padding: 0 8px; font-size: 11px; border: 1px solid transparent; border-radius: 4px; cursor: grab; overflow: hidden; white-space: nowrap; user-select: none; box-sizing: border-box; }
  .clip:hover { filter: brightness(1.04); }
  .clip .num { font-family: var(--font-mono); font-weight: 700; opacity: .85; flex-shrink: 0; }
  .clip .lbl { overflow: hidden; text-overflow: ellipsis; }
  .clip.video { background: var(--heat-12); border-color: var(--heat-40); color: var(--heat); }
  .clip.video .frames { position: absolute; top: 0; bottom: 0; left: 0; width: var(--src-width, 100%); transform: translateX(var(--src-offset, 0%)); display: flex; gap: 0; pointer-events: none; z-index: 0; border-radius: inherit; overflow: hidden; }
  .clip.video .frames .fr { flex: 1; min-width: 0; background: repeating-linear-gradient(45deg, transparent 0, transparent 4px, rgba(38,38,38,.06) 4px, rgba(38,38,38,.06) 5px), rgba(250,93,25,.10); }
  .clip.video .frames .fr + .fr { border-left: 1px solid rgba(255,255,255,.55); }
  .clip.video .num, .clip.video .lbl { position: relative; z-index: 1; }
  .clip.subtitle { background: var(--forest-bg); border-color: var(--forest-bd); color: var(--accent-forest); font-size: 11px; }
  .clip.subtitle .lbl::before { content: "\201C"; font-family: serif; font-size: 14px; opacity: .55; margin-right: 2px; }
  .clip.subtitle:hover { background: rgba(31, 138, 81, .14); }
  .clip.bgm { background: rgba(144,97,255,.10); border-color: rgba(144,97,255,.30); color: var(--accent-amethyst, #9061ff); }
  .clip.bgm .wave { position: absolute; inset: 6px 10px; pointer-events: none; opacity: .5; display: block; z-index: 0; }
  .clip.bgm .wave svg { width: 100%; height: 100%; display: block; }
  .clip.bgm .lbl, .clip.bgm .num { position: relative; z-index: 1; }
  .playhead { position: absolute; top: -90px; bottom: -44px; width: 18px; transform: translateX(-50%); background: transparent; z-index: 10; pointer-events: auto; cursor: ew-resize; touch-action: none; }
  .playhead::after { content: ''; position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); width: 1.5px; background: var(--heat); pointer-events: none; }
  .playhead::before { content: ''; position: absolute; top: -4px; left: 50%; transform: translateX(-50%) rotate(45deg); width: 10px; height: 10px; background: var(--heat); box-shadow: 0 0 0 1.5px var(--surface); border-radius: 1px; pointer-events: none; }
  .playhead .ph-grab { position: absolute; top: -10px; left: 50%; transform: translateX(-50%); width: 24px; height: 24px; cursor: ew-resize; pointer-events: auto; border-radius: 50%; }
}
