:root{font-family:system-ui,"Microsoft YaHei",sans-serif;color:#233145;background:#f4f6fa;font-size:15px}*{box-sizing:border-box}body{margin:0}header{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:20px 32px;border-bottom:1px solid #dce2eb;background:white}header div{display:flex;gap:18px;align-items:center}header strong{font-size:20px}main{max-width:1200px;margin:32px auto;padding:0 24px}.muted{color:#657287;font-size:14px;line-height:1.6}h1{font-size:23px;margin-top:0}h2{font-size:21px}h3{font-size:17px}.panel{background:white;border:1px solid #dce2eb;border-radius:12px;padding:26px}.compact{max-width:440px;margin:70px auto}.columns{display:grid;grid-template-columns:360px 1fr;gap:24px}nav{display:flex;gap:22px;flex-wrap:wrap;padding:18px 0;border-bottom:1px solid #dce2eb}nav span{color:#738097}nav strong{color:#245dd4}form{display:grid;gap:16px;margin-bottom:24px}label{display:grid;gap:8px}input,select{width:100%;border:1px solid #bac5d5;background:white;border-radius:6px;padding:11px;font:inherit}button{border:1px solid #c5cfdf;border-radius:6px;background:white;color:#263b59;padding:9px 14px;font:inherit;cursor:pointer}button:hover{background:#edf3ff}button:disabled{opacity:.55;cursor:default}.primary{background:#245dd4;color:white;border-color:#245dd4}.primary:hover{background:#194ebc}.text-button{border:0;color:#245dd4}.project-button{width:100%;text-align:left;display:grid;gap:8px;margin-top:12px;overflow-wrap:anywhere}.project-button[aria-current=true]{background:#edf3ff;border-color:#245dd4}.project-button small{color:#657287}#current-project h2{overflow-wrap:anywhere}dl{display:grid;grid-template-columns:95px 1fr;gap:14px;font-size:14px}dd{margin:0;overflow-wrap:anywhere}dt{color:#657287}[role=alert]{padding:12px;background:#fff1ef;border:1px solid #ebbbb5;color:#a52f25;border-radius:7px}dialog{width:min(660px,92vw);max-height:85vh;border:1px solid #c5cfdf;border-radius:12px;padding:26px}dialog::backdrop{background:#1c2e4a66}.dialog-header{display:flex;align-items:center;justify-content:space-between}.provider{border-top:1px solid #dce2eb;padding:12px 0}.provider form{margin:15px 0}.saved{color:#237146}[hidden]{display:none!important}@media(max-width:760px){header,header div{flex-wrap:wrap}header{padding:18px}.columns{grid-template-columns:1fr}main{padding:0 16px}nav{gap:14px}.compact{margin:35px auto}}
:root #executor-panel{margin-top:24px}#diagnostic-form{display:flex;align-items:center;gap:18px;margin:20px 0}.inline-label{display:flex;align-items:center;gap:8px}.inline-label input{width:auto}#diagnostic-detail{overflow-wrap:anywhere}#pairing-display{padding:12px;background:#edf3ff}
#media-panel{margin-top:24px}.table-scroll{overflow-x:auto}table{width:100%;border-collapse:collapse;margin:20px 0}td,th{padding:10px;border-bottom:1px solid #dce2eb;text-align:left}td input[type=number]{width:95px}td input[type=checkbox]{width:auto}td button{margin:3px}#media-video{width:100%;max-height:560px;background:#111}#media-shots{display:grid;grid-template-columns:repeat(auto-fill,minmax(145px,1fr));gap:12px;margin-top:20px}.shot-card{display:grid;gap:7px;text-align:left;padding:8px}.shot-card img{width:100%;aspect-ratio:9/16;object-fit:contain;background:#111}.shot-card small{color:#a06605}.play-actions{display:flex;gap:12px;align-items:center;flex-wrap:wrap}
nav button[aria-current=true]{color:#245dd4;border-color:#245dd4;background:#edf3ff}#source-review-panel,#source-assets-panel{margin-top:24px}.review-toolbar,.review-actions,.issue-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap;margin:12px 0}.review-toolbar select{width:auto}.review-columns{display:grid;grid-template-columns:minmax(230px,36%) 1fr;gap:20px;align-items:start}#source-player{position:sticky;top:12px}#source-timeline{max-height:780px;overflow:auto;padding:3px}.review-card{border:1px solid #e1bd63;border-radius:8px;background:#fff8df;margin:0 0 12px;padding:14px;overflow-wrap:anywhere}.review-card.confirmed,.asset-card.confirmed{background:#edf8ef;border-color:#81ba8a}.review-card summary{cursor:pointer;font-weight:600;line-height:1.6}.review-card p{line-height:1.6}.review-frame{max-width:150px;max-height:230px;object-fit:contain;cursor:pointer;margin-top:12px}.warning{color:#916104}.asset-card,.role-card{border:1px solid #dce2eb;border-radius:8px;padding:16px;margin:16px 0}.asset-card.pending{background:#fff8df;border-color:#e1bd63}.asset-card img,.stage-card img{max-width:230px;max-height:260px;object-fit:contain;display:block;margin:10px 0}.asset-card button,.role-card button{margin:4px}.stage-card{border-top:1px solid #dce2eb;padding:12px 0;margin-top:12px}.stage-card audio{max-width:100%;display:block}.stage-card input{max-width:440px}.review-card details a{margin-right:12px}#analysis-summary,#source-candidate-content{white-space:pre-wrap;overflow-wrap:anywhere;max-height:400px;overflow:auto}#source-editor-fields{display:grid;gap:15px}textarea{min-height:90px;width:100%;font:inherit;padding:10px;border:1px solid #bac5d5;border-radius:6px}fieldset{border:1px solid #c5cfdf;border-radius:6px;display:grid;gap:12px}#source-issues:empty,#analysis-summary:empty{display:none}@media(max-width:760px){.review-columns{grid-template-columns:1fr}#source-player{position:static}#source-player video{max-height:330px}#source-timeline{max-height:650px}}
/* Task G: reuse existing controls and typography; wrap cards at available width. */
.delivery-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,330px),1fr));gap:16px;align-items:start}
.delivery-card{border:1px solid #d1d8df;border-radius:10px;padding:16px;min-width:0;background:#fff}
.delivery-card input:not([type=checkbox]),.delivery-card textarea,.delivery-card select{width:100%;box-sizing:border-box}
.delivery-card label{margin-bottom:10px}.delivery-card audio{width:100%}
.delivery-images{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin:10px 0}
.delivery-images img{width:100%;height:230px;object-fit:contain;background:#edf0f4}
.delivery-thumbnails{display:flex;flex-wrap:wrap;gap:6px}.delivery-thumbnails img{width:70px;height:100px;object-fit:contain}
.delivery-pending{border-top:5px solid #e7bd57}.delivery-confirmed{border-top:5px solid #48a46f}
.delivery-warning{color:#805719;background:#fff4cf;padding:8px;border-radius:5px}
.delivery-prompt{white-space:pre-wrap;overflow-wrap:anywhere;max-height:550px;overflow:auto;font:inherit;line-height:1.65}
.delivery-export{grid-template-columns:1fr 1fr}.delivery-export>section:nth-child(n+3){grid-column:1/-1}
#delivery-editor{width:min(900px,92vw);max-height:90vh;overflow:auto}#delivery-editor textarea{width:100%;min-height:90px;box-sizing:border-box}#delivery-editor fieldset{margin:14px 0;border:1px solid #ccd5df;border-radius:8px}
@media(max-width:750px){.delivery-export{grid-template-columns:1fr}}

/* H: accepted sidebar, project header, review panes and asset cards. */
.topbar{height:68px;padding:0 28px;position:sticky;top:0;z-index:4}.topbar .brand{display:flex;gap:11px}.topbar .brand>div{display:block}.topbar .brand strong{font-size:16px}.top-status{display:flex;gap:10px}.top-project-select{width:auto;max-width:240px;padding:6px 8px;font-size:12px}.topbar button{padding:6px 10px;font-size:12px}.topbar #user-label{font-size:12px;color:var(--muted)}
main.main{max-width:none;margin:0;padding:28px 32px 50px;flex:1;min-width:0}.application>#error{margin:15px 28px}.layout{display:flex;min-height:calc(100vh - 68px)}.sidebar{flex:0 0 245px;position:sticky;top:68px;height:calc(100vh - 68px);overflow:auto}
nav.steps{display:block;gap:0;padding:18px 0 8px;border:0}nav.steps button{border:0}nav.steps .step[aria-current=true]{background:var(--blue-soft);color:#1d4ed8;font-weight:700}.step[aria-current=true] .step-num{background:var(--blue);color:#fff;border-color:var(--blue)}
#episode-nav{display:block}.episode-link{border:0}.page-head{margin-bottom:20px}.page-head h1{font-size:25px}.panel{padding:20px;box-shadow:var(--shadow)}#media-panel,#source-review-panel,#source-assets-panel{margin-top:0}.panel>h2{font-size:16px;margin-top:0}
#source-review-panel{background:transparent;border:0;padding:0;box-shadow:none}.review-columns{gap:16px}
#source-review-panel .review-workbench{grid-template-columns:var(--review-player-width,260px) minmax(0,1fr);align-items:start;height:var(--review-height,65vh);min-height:0}
#source-review-panel .review-pane{height:100%}
#source-player{position:sticky;top:var(--review-sticky-top,80px);align-self:start;padding:10px;min-width:0;overflow:hidden}
#source-player #media-video{width:var(--review-video-width,auto);height:var(--review-video-height,auto);max-width:100%;max-height:none;min-height:0;flex-shrink:0;align-self:center;object-fit:contain;aspect-ratio:auto}
#source-player #media-play-status{font-size:12px;line-height:18px;margin:8px 0}
#source-review-panel .review-workbench.review-stacked{grid-template-columns:minmax(0,1fr);height:auto}
#source-review-panel .review-stacked #source-player{position:static;width:100%}
#source-review-panel .review-stacked .review-pane{height:60vh}
@media(min-width:751px){
  .review-mode main.main{padding-top:16px}
  .review-mode .page-head{margin-bottom:8px}
  .review-mode .page-head>div{display:flex;align-items:baseline;flex-wrap:wrap;gap:6px 12px}
  .review-mode .page-head>div>*{margin:0}
  #source-review-panel>.review-toolbar{margin:4px 0;min-height:0}
  #source-review-panel>.review-toolbar button{padding:5px 10px}
  #source-review-panel>#source-provenance,#source-review-panel>#source-media-state{margin:5px 0;font-size:12px;line-height:18px}
  #source-review-panel #source-status details{margin:0}
  #source-review-panel>.review-actions{margin:6px 0}
  #source-review-panel>details{margin:6px 0}
}
#source-player .play-actions{font-size:12px;gap:6px;flex-shrink:0}#source-player .play-actions button{font-size:12px;padding:5px}
#source-timeline{max-height:none;min-height:0;overflow:auto;overscroll-behavior:contain;scroll-behavior:auto;padding:12px;flex:1}.review-card{background:#fffaf0;border-color:#ebd596}.review-card.confirmed{background:#edf8f0;border-color:#a2c9af}.review-card.play-selected{outline:2px solid #386ca6;outline-offset:1px}.review-card .review-actions button{font-size:12px;padding:6px 9px}.review-frame{max-height:120px;width:76px;float:right;margin:8px 0 8px 10px}
.review-actions{margin:10px 0}.review-actions button{font-size:12px;padding:7px 10px}.analysis-options>summary{font-size:13px}#source-status{display:flex;align-items:baseline;gap:18px;flex-wrap:wrap}#source-status p{margin:3px 0}
#source-roles.role-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}#source-people.character-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
#source-roles .role-card,#source-people .asset-card{margin:10px 0;min-width:0}#source-roles h3{font-size:15px}.stage-card{display:grid;grid-template-columns:1fr;min-width:0}.stage-card img{height:160px;max-width:100%;object-fit:contain}.asset-card img{height:160px;max-width:100%}.asset-card button,.stage-card input,.role-card button{font-size:12px}.role-card label{margin:0}
#media-analysis-message{white-space:pre-wrap}#analysis-diagnostics{margin-bottom:18px}#media-sources details{margin:6px 0}#analysis-summary{white-space:pre-wrap;overflow-wrap:anywhere}.shot-play{padding:0;border:0;width:100%;display:grid;gap:5px;text-align:left}.shot-edit-actions{display:flex;flex-direction:column;gap:5px;margin-top:8px}.shot-edit-actions button{font-size:12px}.review-mode .shot-edit-actions{display:none}.frame-edit-preview{max-width:100%;max-height:320px;object-fit:contain}.shot-plan{white-space:pre-wrap}.shot-card{min-width:0}#delivery-episode-label{display:none}#source-assets-panel>h2,#delivery-title{font-size:16px}#management-dialog{width:min(960px,95vw)}#management-dialog .columns{grid-template-columns:1fr 1fr}#project-dialog{width:min(560px,94vw)}#project-empty{max-width:800px}#demo-notice{margin-bottom:16px}
@media(max-width:1000px){.sidebar{flex-basis:215px}main.main{padding:22px 18px}.review-columns{grid-template-columns:minmax(230px,.9fr) minmax(280px,1.1fr)}#source-people.character-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:750px){.topbar{height:auto;min-height:68px;padding:10px 14px;flex-wrap:wrap}.topbar .top-status{flex-wrap:wrap}.layout{display:block}.sidebar{position:static;width:100%;height:auto;padding:10px}.project-mini,.sidebar-foot{display:none}nav.steps{display:flex;overflow:auto;flex-wrap:nowrap}nav.steps .step{min-width:155px}#episode-nav{display:flex;overflow:auto}.episode-link{min-width:110px}.episodes-panel{display:block;padding:6px}.review-columns{grid-template-columns:1fr;height:auto}#source-player{position:static}#source-player video{height:28vh}.review-pane{height:60vh}#source-roles.role-grid,#source-people.character-grid{grid-template-columns:1fr}}
#settings-dialog{width:min(1160px,96vw);max-width:1160px;padding:24px}#settings-dialog .provider-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:20px}#settings-dialog .provider{min-width:0;border:1px solid #dce2eb;border-radius:10px;padding:20px;display:flex;flex-direction:column}#settings-dialog .provider h3{margin:0 0 8px}#settings-dialog .provider form{display:flex;flex-direction:column;flex:1;margin:8px 0 0;gap:14px}#settings-dialog .provider-actions{display:flex;gap:10px;margin-top:auto;flex-wrap:wrap}#settings-dialog .provider-result{min-height:24px;overflow-wrap:anywhere;margin:0}#settings-dialog .provider-result[data-state=failed]{color:#a22a22}#settings-dialog .provider-result[data-state=testing]{color:#245dd4}#settings-dialog .provider-result[data-state=saved]{color:#21734e}#settings-dialog .provider-result[data-state=partial]{color:#855500}#settings-dialog .provider-other{margin:20px 0}#settings-dialog .provider-other summary{cursor:pointer;font-weight:600;padding:12px 0}@media(max-width:760px){#settings-dialog{width:96vw;padding:16px}#settings-dialog .provider-grid{grid-template-columns:minmax(0,1fr)}}

/* Source-image decisions reuse the approved review workbench. */
.frame-review{padding:8px 0;border-bottom:1px solid #e1e6ee}.frame-review>small{display:block;margin:5px 0}.frame-person-row,.frame-text-row{display:flex;align-items:center;gap:7px;flex-wrap:wrap;margin:7px 0}.frame-person-row .person-avatar{width:36px;height:46px;object-fit:contain;border-radius:4px}.frame-person-row select{max-width:160px}.frame-person-row small{font-size:12px;color:#566477}.frame-text-row input{max-width:180px}.import-frame img{max-width:100%;max-height:235px;object-fit:contain;display:block;margin:auto}.import-frame>small{display:block}.import-frame button{font-size:12px;margin:5px 3px}.review-diagnostics{font-size:12px;margin-bottom:6px}#source-review-panel .review-frame{cursor:zoom-in}#media-step-reason:empty{display:none}

.review-prompt{white-space:pre-wrap;line-height:1.75;overflow-wrap:anywhere;margin:8px 0 14px}.prompt-image-row,.prompt-references,.person-tag,.person-list-row{display:flex;align-items:center;gap:10px;flex-wrap:wrap}.person-list-row{justify-content:space-between;padding:10px 0;border-bottom:1px solid #ddd}.person-avatar{width:36px;height:46px;object-fit:contain}.person-tag{background:#fff9;border:1px solid #ddd;border-radius:6px;padding:4px 8px}.prompt-references{margin:12px 0}.field-error,.card-save-status.error{color:#b32320}.episode-confirmed{background:#d7efd9;color:#176f32;border-color:#77b987}.frame-review textarea{width:100%;box-sizing:border-box}.frame-review fieldset label{display:inline-flex;margin-right:12px}#source-confirm-feedback{white-space:pre-wrap}#source-review-panel .frame-review{padding-top:0}
/* Replacement: original, ordered references, result; no source-review form duplication. */
.delivery-grid.replacement-cards{grid-template-columns:repeat(auto-fit,minmax(min(100%,600px),1fr))}
.replacement-zones{display:grid;grid-template-columns:minmax(0,1fr) minmax(135px,.75fr) minmax(0,1fr);gap:12px;margin:12px 0;align-items:start}
.replacement-zone{min-width:0;display:grid;gap:8px}.replacement-zone>a{display:block}.replacement-zone>a>img,.replacement-placeholder{width:100%;height:290px;object-fit:contain;background:#edf0f4;border-radius:6px}.replacement-placeholder{display:grid;place-items:center;color:#6b778b}
.replacement-ref-list{display:grid;grid-template-columns:repeat(auto-fit,minmax(65px,1fr));gap:8px;max-height:290px;overflow:auto}.replacement-ref{display:grid;gap:4px;min-width:0}.replacement-ref img{width:100%;height:108px;object-fit:contain;background:#edf0f4}.replacement-ref small{overflow-wrap:anywhere}.replacement-ref button{padding:3px 6px;font-size:12px}.replacement-references>button,.replacement-result-tools button{font-size:12px;padding:5px 7px}.replacement-result-tools{display:grid;gap:8px}.replacement-result-tools summary{font-size:13px;cursor:pointer}.replacement-history{display:flex;gap:5px;align-items:center;font-size:12px;padding:5px 0}
.replacement-card textarea{padding:10px;line-height:1.7;border:1px solid #bac5d5;border-radius:6px;resize:vertical;min-height:160px;font:inherit}.replacement-card>.delivery-warning{font-size:13px;overflow-wrap:anywhere}.replacement-card .replacement-confirmed{color:#176b37;background:#e7f6eb;border-color:#60b879}.replacement-card label:has(input[type=checkbox]){display:flex;align-items:center;gap:8px}.replacement-card input[type=checkbox]{width:auto}.replacement-card>select{margin:10px 0}
@media(max-width:650px){.replacement-zones{grid-template-columns:1fr 1fr}.replacement-references{grid-column:1/-1;grid-row:2}.replacement-ref-list{grid-template-columns:repeat(auto-fill,minmax(75px,1fr));max-height:175px}.replacement-zone>a>img,.replacement-placeholder{height:260px}}
/* One package page reuses the existing cards, dialogs and permissioned downloads. */
.delivery-grid.package-episodes{display:block}.package-episode{margin:20px 0 30px}.package-task-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,440px),1fr));gap:16px;align-items:start}.package-task-card label:has(input[type=checkbox]),.package-episode-select label,.package-bed label:has(input[type=checkbox]){display:flex;align-items:center;gap:7px}.package-task-card input[type=checkbox],.package-episode-select input[type=checkbox],.package-bed input[type=checkbox]{width:auto}.package-task-card h4{margin:14px 0 8px}.package-task-card .delivery-thumbnails{gap:10px}.package-task-card .delivery-thumbnails>div{display:grid;gap:4px;max-width:105px}.package-task-card .delivery-thumbnails img{width:96px;height:144px;object-fit:contain}.package-task-card small{overflow-wrap:anywhere}.package-assets,.package-bed{border:1px solid #dce2eb;border-radius:7px;padding:10px;margin:14px 0}.package-assets summary,.package-bed summary{font-size:13px}.package-person{display:grid;grid-template-columns:1fr 110px;gap:10px;align-items:start;margin:12px 0}.package-person>a{grid-column:2;grid-row:1/3}.package-person img{max-width:110px;height:150px;object-fit:contain}.package-person audio{grid-column:1;max-width:100%;height:36px}.package-line{border-top:1px solid #e5e9ef;padding:8px 0}.package-line p{margin:5px 0;white-space:pre-wrap;line-height:1.6}.package-task-feedback,.package-overview-status{white-space:pre-wrap;line-height:1.6}.package-task-feedback.error,.package-overview-status.error{color:#a22a22}.package-episode-select{margin:0;min-width:180px}.package-episode-select label{margin:8px 0}.package-overview-status{flex-basis:100%;margin:0}.package-record{padding:10px 0;border-bottom:1px solid #e1e6ec}.package-records{margin:20px 0}.package-bed audio{display:block;max-width:100%;margin:12px 0}.package-history button{display:block;margin:7px 0}.replacement-sync button{margin-right:8px}.package-speech-segment{display:grid;grid-template-columns:1fr 1fr 1fr;gap:8px}#delivery-panel #delivery-episode-label:not([hidden]){display:grid}#source-version{font-size:11px}
@media(max-width:650px){.package-task-grid{grid-template-columns:1fr}.package-person{grid-template-columns:1fr 90px}.package-person img{max-width:90px}.package-speech-segment{grid-template-columns:1fr}}
.replacement-ref-placeholder{min-height:108px;padding:12px 4px;display:grid;place-items:center;text-align:center;background:#f0f3f7;border:1px dashed #c3cbd7;border-radius:6px;font-size:12px;color:#586477}.package-shot-list,.package-asset-numbers{line-height:1.7;overflow-wrap:anywhere}.review-card>h3{margin:0 0 10px;font-size:15px}.review-card textarea{width:100%;box-sizing:border-box;font:inherit;line-height:1.65;resize:vertical}
.review-card>.review-card-title{margin:0 0 10px;font-size:15px;line-height:1.6}#source-timeline textarea{width:100%;box-sizing:border-box;resize:vertical}
#settings-dialog .provider-key{display:flex;gap:8px;align-items:center}#settings-dialog .provider-key input{min-width:0;flex:1}#settings-dialog .provider-key button{flex-shrink:0}#settings-worker-label{margin:12px 0 18px}@media(max-width:480px){#settings-dialog .provider-key{flex-wrap:wrap}}
 .local-device-panel{margin:16px 24px;padding:14px 20px;border:1px solid #d6e0f3;border-radius:12px;background:#fff;display:flex;gap:20px;align-items:center;justify-content:space-between}.local-device-panel[hidden]{display:none}.local-device-panel p{margin:6px 0}.local-device-actions{display:flex;gap:8px;flex-wrap:wrap}.local-device-panel .muted{overflow-wrap:anywhere}@media(max-width:900px){.local-device-panel{flex-direction:column;align-items:flex-start;margin:12px}}
