#viewSettings .settings-primary-row{grid-template-columns:repeat(3,minmax(0,1fr))}
.script-history-view{padding-bottom:48px}.script-history-page-head{align-items:flex-end}.script-history-page-actions{display:flex;gap:10px;flex-wrap:wrap}.script-history-overview{display:flex;justify-content:space-between;margin-bottom:14px;padding:16px 18px}.script-history-overview>div{display:flex;gap:10px;align-items:baseline}.script-history-list{display:grid;gap:12px}.script-history-record{border:1px solid #dfe3eb;border-radius:16px;background:#fff;overflow:hidden;box-shadow:0 8px 24px rgba(15,23,42,.05)}.script-history-record__summary{display:grid;grid-template-columns:28px minmax(260px,1.4fr) minmax(360px,1fr) 120px;gap:14px;align-items:center;padding:18px 20px;cursor:pointer;list-style:none}.script-history-record__summary::-webkit-details-marker{display:none}.script-history-record__summary:hover{background:#f8fafc}.script-history-record__chevron{font-size:30px;color:#596174;transition:transform .2s}.script-history-record[open] .script-history-record__chevron{transform:rotate(90deg)}.script-history-record__identity{display:grid;gap:5px;min-width:0}.script-history-record__identity strong{font-size:18px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.script-history-record__identity small{color:#778092}.script-history-record__counts{display:flex;gap:7px;flex-wrap:wrap}.script-history-record__counts em{font-style:normal;font-size:12px;color:#586174;background:#f0f2f6;border-radius:999px;padding:5px 9px}.script-history-record__state{display:grid;text-align:right;gap:4px}.script-history-record__state b{color:#15945c}.script-history-record__state small{font-size:18px;color:#5d4de8;font-weight:800}.script-history-record__body{border-top:1px solid #272b32;background:#111316}.script-history-loading,.script-history-error{display:flex;min-height:140px;align-items:center;justify-content:center;gap:10px;color:#8d96a7}.script-history-loading i{width:18px;height:18px;border:2px solid #5550d9;border-right-color:transparent;border-radius:50%;animation:script-history-spin .8s linear infinite}@keyframes script-history-spin{to{transform:rotate(360deg)}}.script-history-error{flex-direction:column;padding:28px}.script-history-snapshot{color:#f4f5f7;background:#111316}.script-history-flow{background:#111316;border-bottom:1px solid #2b2f36}.script-history-flow>header{display:flex;justify-content:space-between;gap:20px;align-items:center;padding:15px 20px;border-bottom:1px solid #292d34}.script-history-flow>header>div{display:flex;gap:9px;align-items:baseline}.script-history-flow>header strong{font-size:16px}.script-history-flow>header small{color:#9299a6}.script-history-flow>header span{color:#bac0cc;font-size:12px}.script-history-flow>header b{font-size:22px;color:#7566ff}.script-history-steps{display:flex;align-items:center;padding:12px 16px}.script-history-steps>i{height:1px;background:#3a3f48;flex:1;min-width:24px}.script-history-step{display:flex;align-items:center;gap:9px;padding:10px 12px;border-radius:10px;min-width:160px;color:#8d95a3}.script-history-step>b{display:grid;place-items:center;width:30px;height:30px;border:3px solid #414650;border-radius:50%;font-size:14px}.script-history-step>span{display:grid;gap:2px}.script-history-step small{font-size:11px;color:#717988}.script-history-step.is-done>b{background:#148d53;border-color:#35b975;color:white}.script-history-step.is-done strong{color:#fff}.script-history-step.is-active{background:#25282e}.script-history-step.is-active>b{background:#5a49e6;border-color:#8173ff;color:white}.script-history-stage{padding:18px 16px;border-bottom:1px solid #292d34}.script-history-stage__head{display:grid;grid-template-columns:auto 1fr auto;align-items:end;column-gap:9px;margin-bottom:14px}.script-history-stage__head span{grid-column:1/-1;color:#8173ff;font-size:12px;font-weight:800}.script-history-stage__head span b{display:inline-grid;place-items:center;background:#5a49e6;color:white;border-radius:5px;width:20px;height:20px;margin-right:5px}.script-history-stage__head h3{margin:5px 0 0;font-size:18px}.script-history-stage__head small{color:#8d95a3}.script-history-shot-table{overflow:auto;border:1px solid #2d3138;border-radius:10px;max-height:min(70vh,900px)}.script-history-shot-table table{border-collapse:collapse;min-width:2000px;width:100%;table-layout:fixed}.script-history-shot-table th,.script-history-shot-table td{border-right:1px solid #2d3138;border-bottom:1px solid #2d3138;text-align:left;vertical-align:top;padding:11px;color:#cdd2dc;font-size:12px;line-height:1.55;overflow-wrap:anywhere}.script-history-shot-table th{position:sticky;top:0;background:#292d34;color:#aeb6c6;z-index:1}.script-history-shot-table th:nth-child(1),.script-history-shot-table td:nth-child(1){width:52px}.script-history-shot-table th:nth-child(2),.script-history-shot-table td:nth-child(2){width:55px}.script-history-shot-table th:nth-child(3),.script-history-shot-table td:nth-child(3){width:240px}.script-history-shot-table th:nth-child(4),.script-history-shot-table td:nth-child(4){width:120px}.script-history-shot-table th:nth-child(5),.script-history-shot-table td:nth-child(5){width:300px}.script-history-shot-table td>p{margin:0 0 9px}.script-history-tag{display:inline-block;background:#333067;color:#e6e2ff;border-radius:6px;padding:3px 7px;margin:0 4px 4px 0}.script-history-asset-group{border:1px solid #2b2f36;border-radius:12px;padding:12px;margin-top:10px}.script-history-asset-group>h4{margin:0 0 10px}.script-history-asset-group>h4 span{margin-left:7px;background:#342d79;color:#bbb2ff;padding:2px 7px;border-radius:999px;font-size:12px}.script-history-asset-group>div{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:10px}.script-history-asset{position:relative;display:grid;grid-template-columns:100px 1fr;gap:12px;border:1px solid #343943;background:#1a1d22;border-radius:10px;padding:10px;min-height:120px}.script-history-asset>img,.script-history-media-empty{width:100px;height:100px;border-radius:8px;object-fit:contain;background:#272b33}.script-history-asset>div{min-width:0}.script-history-asset strong,.script-history-asset small{display:block}.script-history-asset small,.script-history-asset p{color:#929aaa}.script-history-asset p{font-size:12px;line-height:1.5;display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden}.script-history-asset>span{position:absolute;right:10px;top:10px;color:#22b76d;font-size:11px}.script-history-storyboards,.script-history-videos{display:grid;grid-template-columns:repeat(auto-fit,minmax(320px,1fr));gap:12px}.script-history-storyboards>article,.script-history-videos>article{background:#191c21;border:1px solid #30343c;border-radius:12px;overflow:hidden;padding:12px}.script-history-storyboards header,.script-history-videos header{display:flex;justify-content:space-between}.script-history-storyboards header span,.script-history-videos header span{color:#32bd77;font-size:12px}.script-history-storyboards article>p{color:#b5bdca;font-size:13px;min-height:40px}.script-history-references{display:flex;gap:7px;overflow-x:auto;margin:9px 0}.script-history-references figure{margin:0;min-width:90px}.script-history-references img{width:90px;height:72px;object-fit:contain;background:#282c33;border-radius:7px}.script-history-references figcaption{font-size:10px;color:#929aaa;margin-top:3px;max-width:90px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.script-history-storyboard-output{width:100%;aspect-ratio:16/9;object-fit:contain;background:#08090a;border-radius:9px}.script-history-storyboards details,.script-history-videos details{margin-top:10px;border:1px solid #333841;border-radius:8px;padding:8px;color:#aeb5c1}.script-history-storyboards details p,.script-history-videos details p{white-space:pre-wrap;max-height:240px;overflow:auto;font-size:12px;line-height:1.6}.script-history-videos video{width:100%;aspect-ratio:16/9;background:#050607;border-radius:8px}.script-history-video-meta{display:flex;gap:6px;flex-wrap:wrap;margin-top:8px}.script-history-video-meta span{background:#2a2e35;color:#9da5b3;border-radius:999px;padding:3px 7px;font-size:10px}.script-history-delivery{display:grid;grid-template-columns:minmax(320px,680px) 1fr;gap:18px;align-items:center}.script-history-delivery video{width:100%;aspect-ratio:16/9;background:#050607;border-radius:10px}.script-history-delivery>div{display:grid;gap:9px}.script-history-delivery span{color:#9aa2af}.script-history-delivery a{justify-self:start}.script-history-messages{padding:16px 20px;border-bottom:1px solid #292d34}.script-history-messages>summary{cursor:pointer;font-weight:800}.script-history-messages>summary b{background:#5b4ce5;padding:2px 7px;border-radius:999px}.script-history-messages>div{display:grid;gap:8px;margin-top:12px}.script-history-messages article{border-left:3px solid #6253ec;background:#1a1d22;padding:10px 12px;border-radius:7px}.script-history-messages article p{margin:4px 0 0;color:#bdc4d0;white-space:pre-wrap}.script-history-media-empty{display:grid;place-items:center;color:#727a88;font-size:12px;min-height:100px}[data-history-image]{cursor:zoom-in}
@media(max-width:1100px){#viewSettings .settings-primary-row{grid-template-columns:1fr}.script-history-record__summary{grid-template-columns:24px 1fr 110px}.script-history-record__counts{grid-column:2/-1}.script-history-steps{overflow-x:auto}.script-history-delivery{grid-template-columns:1fr}.script-history-page-head{align-items:flex-start}}
@media(max-width:680px){.script-history-record__summary{grid-template-columns:22px 1fr}.script-history-record__state{grid-column:2;text-align:left}.script-history-record__counts{grid-column:2}.script-history-page-actions{width:100%}.script-history-stage{padding:14px 8px}.script-history-storyboards,.script-history-videos{grid-template-columns:1fr}}

/* History records mirror the production workbench: status header + five-step flow. */
.script-history-list{gap:18px}
.script-history-record{border:1px solid #2c3037;border-radius:15px;background:#101114;box-shadow:0 14px 36px rgba(15,23,42,.14);color:#f4f5f7}
.script-history-record__summary{display:block;padding:0;background:#101114;color:#f4f5f7}
.script-history-record__summary:hover{background:#101114}
.script-history-record__headline{display:grid;grid-template-columns:minmax(260px,1fr) auto auto auto 30px;gap:16px;align-items:center;min-height:70px;padding:12px 16px;border-bottom:1px solid #292d34}
.script-history-record__identity{display:grid;gap:4px;min-width:0}
.script-history-record__identity strong{font-size:16px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.script-history-record__identity small{font-size:12px;color:#8f97a5;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.script-history-record__date{color:#89919f;font-size:12px;white-space:nowrap}
.script-history-record__messages{border:1px solid #30343c;background:#22252b;border-radius:9px;color:#d6dae2;font-size:12px;font-weight:700;padding:8px 10px;white-space:nowrap}
.script-history-record__state{display:block;text-align:right}
.script-history-record__state b{color:#796aff;font-size:22px}
.script-history-record__chevron{display:grid;place-items:center;width:28px;height:28px;border-radius:50%;background:#25282e;color:#b9c0cb;font-size:18px;transition:transform .2s}
.script-history-record[open] .script-history-record__chevron{transform:rotate(180deg)}
.script-history-record__flow{display:flex;align-items:center;padding:10px 12px;min-height:66px}
.script-history-record__flow>i{height:1px;background:#3a3f48;flex:1;min-width:24px}
.script-history-record__flow .script-history-step{min-width:160px}
.script-history-record__body{border-top:1px solid #292d34}
.script-history-record[open]{box-shadow:0 18px 46px rgba(15,23,42,.22)}
.script-history-more{justify-self:center;margin:4px auto 0}
@media(max-width:1150px){.script-history-record__headline{grid-template-columns:minmax(240px,1fr) auto auto 28px}.script-history-record__date{grid-column:1}.script-history-record__messages{grid-column:2}.script-history-record__state{grid-column:3;grid-row:1/3}.script-history-record__chevron{grid-column:4;grid-row:1/3}.script-history-record__flow{overflow-x:auto}.script-history-record__flow .script-history-step{flex:0 0 170px}}
@media(max-width:700px){.script-history-record__headline{grid-template-columns:1fr auto 28px}.script-history-record__identity{grid-column:1/-1}.script-history-record__date{grid-column:1}.script-history-record__messages{display:none}.script-history-record__state{grid-column:2;grid-row:2}.script-history-record__chevron{grid-column:3;grid-row:2}.script-history-record__flow{padding:8px}.script-history-record__flow .script-history-step{flex-basis:155px}}

/* V3: the white screenplay row is the accordion; its entire black workflow is inside. */
.script-history-inline-meta{display:flex;align-items:baseline;gap:10px;margin:0 4px 12px;color:#111827}
.script-history-inline-meta strong{font-size:14px}.script-history-inline-meta span{font-size:12px}
.script-history-record{border:1px solid #dfe3eb;background:#fff;color:#111827;box-shadow:0 8px 24px rgba(15,23,42,.06)}
.script-history-record__summary{display:grid;grid-template-columns:minmax(280px,1.35fr) auto minmax(300px,1fr) auto 76px 30px;gap:14px;align-items:center;min-height:68px;padding:12px 16px;background:#fff;color:#111827}
.script-history-record__summary:hover{background:#f8fafc}
.script-history-record__identity{display:grid;gap:3px;min-width:0}
.script-history-record__identity strong{font-size:18px;color:#111827}
.script-history-record__identity small{font-size:12px;color:#697386;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.script-history-record__date{color:#7b8493;font-size:12px;white-space:nowrap}
.script-history-record__counts{display:flex;justify-content:flex-end;gap:6px;flex-wrap:wrap}
.script-history-record__counts em{font-style:normal;font-size:11px;color:#596274;background:#eef1f5;border-radius:999px;padding:4px 8px}
.script-history-record__state{display:block;text-align:right}
.script-history-record__state b{font-size:18px;color:#6555ed}
.script-history-record__resume{min-width:88px;white-space:nowrap;position:relative;z-index:1}
.script-history-record__chevron{background:#eff1f5;color:#596274}
.script-history-record[open] .script-history-record__summary{border-bottom:1px solid #292d34}
.script-history-record__body{background:#101114;color:#f4f5f7}
.script-history-record__body .script-history-flow{border-radius:0}
@media(max-width:1050px){.script-history-record__summary{grid-template-columns:minmax(240px,1fr) auto auto 70px 28px}.script-history-record__counts{grid-column:1/-1;justify-content:flex-start}.script-history-record__date{grid-column:2}.script-history-record__resume{grid-column:3}.script-history-record__state{grid-column:4;grid-row:1}.script-history-record__chevron{grid-column:5;grid-row:1}}
@media(max-width:650px){.script-history-inline-meta{align-items:flex-start;flex-direction:column}.script-history-record__summary{grid-template-columns:1fr auto 28px}.script-history-record__identity{grid-column:1/-1}.script-history-record__date{grid-column:1}.script-history-record__resume{grid-column:1;grid-row:3;justify-self:start}.script-history-record__state{grid-column:2;grid-row:2}.script-history-record__chevron{grid-column:3;grid-row:2}.script-history-record__counts{grid-column:1/-1}}

/* V4: keep long asset names readable without colliding with connection state. */
.script-history-asset-group>div{grid-template-columns:repeat(auto-fill,minmax(320px,1fr))}
.script-history-asset{grid-template-columns:120px minmax(0,1fr);gap:14px;min-height:142px;padding:12px}
.script-history-asset>img,.script-history-asset>.script-history-media-empty{width:120px;height:118px}
.script-history-asset__copy{display:grid;grid-template-rows:auto auto 1fr;align-content:start;gap:5px;min-width:0}
.script-history-asset__heading{display:grid;grid-template-columns:minmax(0,1fr) auto;align-items:start;gap:8px;min-width:0}
.script-history-asset__heading strong{display:-webkit-box;min-width:0;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:1.35;overflow-wrap:anywhere}
.script-history-asset__heading span{position:static;color:#22b76d;font-size:11px;line-height:1.5;white-space:nowrap}
.script-history-asset__copy>small{display:-webkit-box;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:1.4;overflow-wrap:anywhere}
.script-history-asset__copy>p{margin:6px 0 0;-webkit-line-clamp:2;overflow-wrap:anywhere}
@media(max-width:520px){.script-history-asset-group>div{grid-template-columns:1fr}.script-history-asset{grid-template-columns:92px minmax(0,1fr)}.script-history-asset>img,.script-history-asset>.script-history-media-empty{width:92px;height:110px}}

/* V5: a single storyboard or video must not stretch across the full archive width. */
.script-history-storyboards,
.script-history-videos {
  grid-template-columns: repeat(auto-fill, 400px);
  justify-content: start;
  align-items: start;
}
@media (max-width: 680px) {
  .script-history-storyboards,
  .script-history-videos { grid-template-columns: minmax(0, 1fr); }
}

/* V6: explicit, confirmation-gated history deletion. */
.script-history-record__actions{display:flex;align-items:center;justify-content:flex-end;gap:8px;position:relative;z-index:1}
.script-history-record__delete{min-width:58px;white-space:nowrap;color:#d92d3b;border-color:#f2b8bd;background:#fff}
.script-history-record__delete:hover{color:#fff;border-color:#c92532;background:#c92532}
.script-history-record__delete:disabled{opacity:.55;cursor:wait}
@media(max-width:1050px){.script-history-record__actions{grid-column:3;grid-row:1}.script-history-record__resume{grid-column:auto;grid-row:auto}}
@media(max-width:650px){.script-history-record__actions{grid-column:1;grid-row:3;justify-content:flex-start}.script-history-record__resume{grid-column:auto;grid-row:auto}}
