body.creation-mode {
  --bg:#f6fafb; --bg-soft:#f3f8fa; --surface:#ffffff; --surface-2:#f0f6f8; --surface-3:#e7f0f3;
  --line:#c9dce1; --line-soft:#deeaed; --text:#243b46; --muted:#536b76; --faint:#657f8b;
  --teal:#137b78; --teal-strong:#116e6d; --amber:#936d24; --red:#b94c49; --blue:#3a75a8;
  --green-bg:#e3f4ec; --amber-bg:#fff4d9; --red-bg:#fff0ef; --shadow:0 12px 32px #32495d12;
  color-scheme:light; background:linear-gradient(120deg,#e8f6ff 0%,#f3fcfa 48%,#fff3f6 86%,#fff8ee 100%);
}
.cw-assistant-tools{display:flex;align-items:center;flex-wrap:wrap;gap:8px;padding-top:16px;margin-top:12px;border-top:1px solid #dce8ed}.cw-assistant-tools button{font-size:12px!important;min-height:32px!important;padding:6px 9px!important;background:#eef8f4!important;color:#2d786f!important}.cw-assistant-tools span{margin-left:auto;font-size:11px;color:#7b939c}
.creation-mode .assistant-consent-check{background:#edf7f3;color:#37645b;border-color:#c0ded4}
.creation-mode:has(.studio-assistant-panel:not([hidden])) .cw-controls{flex-wrap:wrap}
.creation-mode:has(.studio-assistant-panel:not([hidden])) .cw-settings{flex-basis:100%;grid-template-columns:minmax(170px,1.4fr) minmax(270px,1.4fr) minmax(130px,1fr)}
.creation-mode:has(.studio-assistant-panel:not([hidden])) .cw-settings .cw-more{grid-column:1/-1;padding-top:0}
.creation-mode:has(.studio-assistant-panel:not([hidden])) .cw-submit-row{width:100%}
@media(max-width:1050px){.creation-mode:has(.studio-assistant-panel:not([hidden])) .cw-settings{grid-template-columns:minmax(0,1fr)}.creation-mode:has(.studio-assistant-panel:not([hidden])) .cw-settings>*{grid-column:1/-1}}
/* The legacy shell remains as a mount target for the workflow modules. Keep
   it out of the first paint so refresh cannot expose the old dark interface. */
body.creation-boot { background:#f6fafb; }
body.creation-boot .studio-shell { visibility:hidden; }
body.creation-boot .studio-assistant-panel { visibility:hidden; }
html:has(body.creation-mode) { background:#f6fafb; }
.creation-mode input,.creation-mode select,.creation-mode textarea { color:var(--text); background:#fff; border-color:var(--line); }
.creation-mode dialog { box-shadow:0 24px 80px #52687d30; border-color:var(--line); }
.creation-mode dialog::backdrop { background:#31465745; }
.creation-mode :is(.notice-band,.file-drop,.writer-stack-status,.repair-run-panel,.idea-development-panel,.idea-timing-row,.creative-addition-review,.repair-attempt,.repair-dimension,.repair-issue,.stat-item,.structure-review-overview,.source-mode,.project-library-item,.assistant-panel-head) { background:#f0f7f9; color:var(--text); border-color:var(--line); }
.creation-mode :is(.source-mode.active,.project-library-item.current,.idea-development-panel.confirmed) { background:#e4f3ec; border-color:#8bbbae; }
.creation-mode .notice-band.warning { background:var(--amber-bg); color:#785b2a; }
.creation-mode .notice-band.error { background:var(--red-bg); color:#9d4439; }
.creation-mode .studio-assistant-panel { background:#f8fcfd; box-shadow:-12px 0 40px #4255671a; border-color:var(--line); }
.creation-mode .episode-prompt-editor-dialog textarea { color:var(--text); background:#fff; }
.creation-mode .side-nav,.creation-mode .topbar { display:none; }
.creation-mode .studio-main { width:100%; min-width:0; background:transparent; }
.creation-workbench { --cw-line:#c9dce1; --cw-muted:#536b76; max-width:1680px; margin:0 auto; color:#243b46; }
.creation-mode .assistant-composer { background:#f0f7f9; }
.creation-mode .studio-assistant-panel [hidden] { display:none !important; }
.creation-mode .assistant-message { background:#edf4f8; border-color:#c8dce5; }
.creation-mode .assistant-message.user { background:#e2f3ed; border-color:#b5d8cb; }
.creation-mode .assistant-message.local { background:#f2f6f7; }
.creation-mode .assistant-message-content { color:var(--text); }
.creation-mode .assistant-message-label,.creation-mode .assistant-message.user .assistant-message-label { color:#247069; }
.creation-mode .assistant-error-state { color:#943a3a; background:#fff1ef; border-color:#e5bdb9; }
.creation-mode .assistant-availability { margin:12px 14px; padding:10px 11px; background:#edf5fb; border:1px solid #c5dce8; border-radius:4px; color:#355b70; font-size:12px; line-height:1.7; }
.creation-mode .assistant-connection-state { color:#526d78; }
.creation-workbench [hidden] { display:none !important; }
.creation-workbench svg { width:18px; height:18px; flex:none; }
.creation-workbench button,.creation-workbench a { display:inline-flex; align-items:center; justify-content:center; gap:8px; color:inherit; }
.creation-workbench button { min-height:36px; border:1px solid var(--cw-line); background:#ffffffb8; border-radius:6px; padding:8px 12px; }
.creation-workbench button:hover:not(:disabled) { background:#eaf6f2; border-color:#82b4ac; }
.creation-workbench button:disabled { cursor:not-allowed; }
.cw-header { display:flex; align-items:center; justify-content:space-between; gap:20px; min-height:76px; padding:16px 32px; border-bottom:1px solid #d3e2e780; background:#ffffff45; }
.cw-brand { font-size:25px; font-weight:750; white-space:nowrap; }
.cw-brand span { padding-left:16px; margin-left:8px; border-left:1px solid var(--cw-line); color:var(--cw-muted); font-size:14px; font-weight:400; }
.cw-header-actions { display:flex; align-items:center; gap:8px; min-width:0; }
.cw-header-actions #cwProjectName { max-width:230px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cw-layout { display:block; }
.cw-composer { padding:24px 32px; border-bottom:1px solid var(--cw-line); min-width:0; background:#ffffff42; }
.cw-output { display:grid; grid-template-columns:minmax(0,1fr) 260px; min-width:0; }
.cw-section-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; min-height:36px; margin-bottom:20px; }
.cw-section-heading h1,.cw-section-heading h2 { margin:0; font-size:20px; font-weight:650; }
.cw-section-heading #cwSave { font-size:12px; color:#467365; }
.cw-modes { display:flex; gap:4px; }
.creation-workbench .cw-modes button { border:0; border-bottom:2px solid transparent; border-radius:0; background:transparent; color:var(--cw-muted); padding:8px 12px; font-size:12px; }
.creation-workbench .cw-modes button[aria-pressed="true"] { color:#126b66; border-color:#268e82; }
.creation-workbench label,.cw-field-label { display:flex; flex-direction:column; gap:8px; font-size:12px; color:#536b76; min-width:0; }
.cw-field-label { margin-bottom:9px; }
.creation-workbench input:not([type="checkbox"]):not([type="file"]),.creation-workbench select,.creation-workbench textarea,.creation-workbench output { width:100%; min-width:0; color:#243b46; background:#ffffffcf; border:1px solid var(--cw-line); border-radius:5px; padding:10px 12px; font-size:13px; }
.creation-workbench select,.creation-workbench output { height:40px; }
.creation-workbench output { color:var(--cw-muted); display:block; }
.creation-workbench textarea { min-height:110px; line-height:1.75; resize:vertical; max-height:360px; }
.creation-workbench textarea::placeholder { color:#687f89; }
.cw-input-footer { display:flex; align-items:center; justify-content:space-between; gap:10px; margin:6px 0 10px; color:var(--cw-muted); font-size:11px; }
.cw-input-footer button { min-height:28px; padding:4px 0; border:0; background:transparent; font-size:12px; }
.cw-material-heading,.cw-history-heading { display:flex; justify-content:space-between; align-items:center; gap:10px; margin:0 0 10px; }
.cw-material-heading h2,.cw-history-heading h2 { margin:0; font-size:13px; font-weight:600; }
.cw-material-heading span,.cw-history-heading span { font-size:11px; color:var(--cw-muted); }
.cw-upload-tools { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; }
.cw-upload-tools button { padding:10px 8px; min-height:46px; gap:6px; }
.cw-upload-tools small { color:var(--cw-muted); font-size:10px; margin-left:auto; }
.cw-upload-tools button:nth-of-type(1) svg { color:#247f69; }
.cw-upload-tools button:nth-of-type(2) svg { color:#377ca9; }
.cw-upload-tools button:nth-of-type(3) svg { color:#a87a31; }
.cw-references { display:flex; flex-wrap:wrap; gap:8px; margin:12px 0 18px; }
.cw-reference { position:relative; width:92px; border:1px solid var(--cw-line); border-radius:5px; overflow:hidden; }
.cw-reference > button:first-child { width:100%; height:96px; padding:0; border:0; display:flex; flex-direction:column; gap:3px; font-size:10px; }
.cw-reference img { width:90px; height:70px; object-fit:contain; background:#edf4f6; }
.cw-reference > button:first-child > svg { height:55px; }
.cw-reference > button[data-remove] { position:absolute; right:2px; top:2px; width:23px; min-height:23px; padding:2px; background:#fffffff0; }
.cw-reference button[data-remove] svg { width:13px; height:13px; }
.cw-settings { flex:1; display:grid; grid-template-columns:minmax(150px,1.6fr) minmax(210px,1.3fr) minmax(130px,1fr) 105px; gap:14px; align-items:start; min-width:0; }
.cw-grid { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:12px; }
.cw-story-fields { display:grid; grid-template-columns:1fr 1fr; gap:12px; margin-bottom:16px; }
.cw-more { position:relative; padding-top:22px; }
.cw-more summary { cursor:pointer; font-size:12px; color:var(--cw-muted); padding:10px 0; }
.cw-more .cw-grid { position:absolute; right:0; top:60px; width:270px; padding:16px; background:#ffffff; border:1px solid #c0d6dc; border-radius:5px; z-index:3; grid-template-columns:1fr 1fr; }
.creation-workbench .cw-check { flex-direction:row; align-items:center; font-size:12px; }
.creation-workbench input[type="checkbox"] { accent-color:#268e82; width:16px; height:16px; }
.cw-submit-row { display:flex; gap:18px; align-items:center; justify-content:flex-end; flex:none; }
.cw-submit-row > div { display:flex; flex-direction:column; gap:6px; }
.cw-submit-row span#cwPriceLabel { color:var(--cw-muted); font-size:11px; }
.cw-submit-row strong { font-size:20px; color:#366959; }
.creation-workbench button.cw-primary { background:linear-gradient(115deg,#167c78,#216e92); color:#fff; border-color:#187681; font-weight:650; min-height:42px; padding:10px 22px; box-shadow:0 4px 10px #247b8b20; }
.creation-workbench button.cw-primary:hover:not(:disabled) { background:linear-gradient(115deg,#126d68,#1d6083); }
.creation-workbench button.cw-primary:disabled { background:#dfebee; color:#73878e; border-color:#dfebee; box-shadow:none; opacity:1; }
.cw-error { margin-top:15px; border-left:3px solid #c47560; padding:9px 12px; background:#fff0e9; color:#9d4439; line-height:1.6; font-size:12px; overflow-wrap:anywhere; }
.cw-output-actions { display:flex; gap:6px; }
.cw-output-actions button,.cw-output-actions a { width:36px; height:36px; padding:6px; border:1px solid var(--cw-line); border-radius:5px; }
.cw-player { position:relative; width:100%; height:440px; min-height:280px; background:linear-gradient(135deg,#f1f7fa,#f9fcfd); border:1px solid #ccdce380; border-radius:6px; overflow:hidden; box-shadow:0 8px 26px #496d7a09; }
.cw-player video { display:block; width:100%; height:100%; object-fit:contain; }
.cw-empty { height:100%; display:flex; flex-direction:column; align-items:center; justify-content:center; color:#647f8d; gap:18px; }
.cw-empty svg { width:38px; height:38px; stroke-width:1; }
.cw-empty strong { font-size:14px; font-weight:400; }
.cw-progress { display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:8px; min-height:56px; margin-bottom:14px; font-size:12px; color:var(--cw-muted); }
.cw-progress #cwStatus { overflow-wrap:anywhere; flex:1; min-width:120px; }
.cw-progress button { font-size:12px; padding:6px 10px; }
.cw-history { display:grid; grid-template-columns:minmax(0,1fr); align-content:start; gap:8px; max-height:490px; overflow:auto; }
.cw-take-row { display:grid; grid-template-columns:minmax(0,1fr) 32px; gap:4px; align-items:center; min-width:0; }
.creation-workbench button.cw-delete-take { width:32px; min-height:32px; height:32px; padding:6px; border-color:transparent; background:transparent; color:var(--cw-muted); }
.creation-workbench button.cw-delete-take:hover:not(:disabled) { color:#a8403b; border-color:#e5bdb9; background:#fff0ef; }
.creation-workbench button.cw-delete-take:disabled { opacity:.4; }
.creation-workbench button.cw-take { display:grid; grid-template-columns:30px minmax(0,1fr); column-gap:7px; text-align:left; padding:10px; min-height:66px; }
.cw-take > span { grid-row:span 2; display:grid; place-items:center; color:#69878a; }
.cw-take strong { font-size:12px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cw-take small { font-size:11px; color:var(--cw-muted); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.creation-workbench button.cw-take.selected { border-color:#73b3a3; background:#e6f5ef; }
.cw-history-empty { font-size:12px; color:#647f8d; }
.cw-details { border-top:1px solid var(--cw-line); margin:0 32px 32px; }
.cw-details > summary { display:flex; align-items:center; gap:18px; padding:21px 0; cursor:pointer; list-style:none; }
.cw-details > summary > span:first-child { display:flex; align-items:center; gap:9px; font-size:14px; }
.cw-details > summary > span:nth-child(2) { font-size:12px; color:var(--cw-muted); }
.cw-details > summary > svg { margin-left:auto; }
.cw-details[open] > summary > svg { transform:rotate(180deg); }
.creation-mode .global-pipeline { display:none; }
.cw-detail-tabs { display:flex; flex-wrap:wrap; gap:6px; padding:0 0 15px; border-bottom:1px solid var(--cw-line); }
.cw-detail-tabs button { font-size:12px; }
.cw-details #viewRoot { padding:20px 0; }
.cw-dialog-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:22px; }
#cwConfirm,#cwDeleteConfirm { width:calc(100% - 32px); max-width:440px; border-radius:8px; border:1px solid #c9dce1; color:#243b46; background:#ffffff; padding:24px; }
#cwConfirm h2,#cwDeleteConfirm h2 { font-size:19px; margin:0 0 14px; }
#cwConfirm p,#cwDeleteConfirm p { line-height:1.7; font-size:14px; overflow-wrap:anywhere; }
.creation-workbench button.cw-delete-confirm { color:#fff; background:#aa413d; border-color:#aa413d; }
.creation-workbench button.cw-delete-confirm:hover { background:#913834; border-color:#913834; }
.creation-workbench { --cw-line:#c9dce1; --cw-muted:#536b76; letter-spacing:0; }
.creation-workbench button { background:#ffffffb8; }
.creation-workbench select,.creation-workbench textarea,.creation-workbench output { background:#ffffffcf; }
.creation-workbench :focus-visible { outline:2px solid #268e82; outline-offset:3px; }
.cw-brand::before { content:""; display:block; width:5px; height:23px; background:#268e82; margin-right:4px; }
.cw-heading-title { display:flex; align-items:center; gap:24px; }
.cw-section-heading h1,.cw-section-heading h2 { font-size:18px; }
.cw-brief { display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:28px; }
.cw-writing,.cw-materials { min-width:0; }
.cw-materials { border-left:1px solid var(--cw-line); padding-left:24px; }
.cw-upload-tools button { display:grid; grid-template-columns:18px auto; padding:10px 6px; gap:5px; font-size:12px; }
.cw-upload-tools small { grid-column:1/-1; margin:0; text-align:center; }
.cw-references { max-height:220px; overflow:auto; }
.cw-controls { display:flex; align-items:flex-end; gap:24px; padding-top:12px; }
.cw-submit-row strong { font-size:18px; color:#816122; white-space:nowrap; }
.cw-submit-row { flex-wrap:wrap; }
#cwBatchLabel { flex:0 0 84px; }
@media(max-width:580px) { #cwGenerate { flex:1 0 100%; } }
.cw-screen { padding:20px 32px 12px; min-width:0; }
.cw-screen .cw-section-heading { margin-bottom:12px; }
.cw-reel { padding:28px 20px; border-left:1px solid var(--cw-line); min-width:0; background:#ffffff35; }
.creation-workbench select,.creation-workbench textarea { box-shadow:0 2px 4px #52758a05; }
.creation-workbench textarea:focus { border-color:#6caaa9; box-shadow:0 0 0 3px #439d8e0d; }
.cw-reference,.cw-take { box-shadow:0 2px 6px #31495d07; }
.creation-workbench button { transition:background-color .15s,border-color .15s,box-shadow .15s; }
.cw-header-actions button[aria-label],.cw-output-actions button { box-shadow:0 2px 5px #34526b05; }
@media(prefers-reduced-motion:reduce) { .creation-workbench button { transition:none; } }
.cw-detail-tabs button[aria-current="page"] { color:#126b66; border-color:#268e82; }
@media(max-width:1250px) { .cw-controls { flex-wrap:wrap; gap:14px; } .cw-settings { flex-basis:100%; } .cw-submit-row { width:100%; } .cw-player { height:390px; } }
@media(max-width:800px) { .cw-header,.cw-composer { padding:18px 20px; } .cw-brand span { display:none; } .cw-brief { grid-template-columns:minmax(0,1fr) 235px; gap:18px; } .cw-materials { padding-left:18px; } .cw-settings { grid-template-columns:1fr 1fr; } .cw-output { grid-template-columns:minmax(0,1fr) 210px; } .cw-screen { padding:18px 20px; } .cw-reel { padding:24px 12px; } .cw-player { height:360px; } }
@media(max-width:580px) { .cw-header { padding:14px 16px; gap:10px; min-height:64px; } .cw-brand { font-size:21px; } .cw-header-actions { gap:4px; } .cw-header-actions button { padding:7px; } .cw-header-actions span { display:none; } .cw-composer { padding:18px 16px; } .cw-heading-title { gap:14px; flex-wrap:wrap; } .cw-section-heading { align-items:flex-start; } .cw-section-heading h1 { padding-top:8px; } .creation-workbench .cw-modes button { padding:8px; gap:5px; } .cw-section-heading #cwSave { padding-top:12px; white-space:nowrap; } .cw-brief { grid-template-columns:minmax(0,1fr); gap:8px; } .cw-materials { border-left:0; padding-left:0; } .cw-material-heading { margin-bottom:9px; } .cw-upload-tools button { display:flex; gap:8px; padding:8px; } .cw-upload-tools small { margin-left:auto; } .cw-references { margin:8px 0; } .cw-settings { gap:12px; } .cw-settings > label:first-child { grid-column:1/-1; } .cw-settings > .cw-grid { grid-column:1/-1; } .cw-submit-row { justify-content:space-between; } .cw-output { grid-template-columns:minmax(0,1fr); } .cw-screen { padding:18px 16px 0; } .cw-player { height:370px; } .cw-reel { padding:14px 16px 20px; border-left:0; } .cw-history { grid-template-columns:repeat(2,minmax(0,1fr)); max-height:240px; } .cw-details { margin:0 16px 20px; } .cw-details > summary > span:nth-child(2) { display:none; } }
@media(max-width:420px) { .cw-history { grid-template-columns:minmax(0,1fr); } }
