/* Scoped to the postproduction workspace; existing media galleries keep their layout. */
.post-production { grid-column:1 / -1; min-width:0; display:flex; flex-direction:column; gap:18px; font-family:var(--font-sans); font-size:var(--ui-font-body); font-weight:var(--ui-font-weight); font-style:var(--ui-font-style); }
.post-production__toolbar,.post-production__actions,.post-production__row-heading,.post-production__task { display:flex; flex-wrap:wrap; align-items:center; gap:10px; }
.post-production__toolbar { justify-content:flex-start; }
.post-production__scope { display:flex; align-items:center; gap:10px; flex-shrink:0; }
.post-production__scope > span { white-space:nowrap; }
.post-production__scope select { min-width:145px; width:auto; }
.post-production__tabs { display:flex; flex-wrap:wrap; gap:8px; padding-bottom:12px; border-bottom:1px solid var(--line,#d9dce3); }
.post-production__tab.active { color:var(--accent,#d65331); border-color:var(--accent,#d65331); background:color-mix(in srgb,var(--accent,#d65331) 10%,transparent); }
.post-production__section { min-width:0; display:flex; flex-direction:column; gap:16px; }
.post-production h2,.post-production h3,.post-production p { margin:0; }
.post-production h2 { font-size:var(--ui-font-section); font-weight:var(--ui-font-weight); }
.post-production h3 { font-size:var(--ui-font-section); font-weight:var(--ui-font-weight); }
.post-production__row-heading { justify-content:space-between; align-items:flex-start; }
.post-production__message { color:var(--muted,#727580); font-size:var(--ui-font-meta); line-height:1.6; white-space:pre-wrap; }
.post-production__empty { color:var(--muted,#727580); padding:24px; border:1px dashed var(--line,#d9dce3); border-radius:12px; }
.post-production__artifacts { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr)); gap:16px; }
.post-production__artifacts:empty { display:none; }
.post-production__artifact { display:flex; flex-direction:column; gap:12px; min-width:0; max-width:900px; }
.post-production__artifact strong { overflow-wrap:anywhere; font-size:var(--ui-font-card); font-weight:var(--ui-font-weight); }
.post-production__artifact audio { width:100%; }
.post-production__artifact video { width:100%; max-height:440px; object-fit:contain; background:#101115; border-radius:10px; }
.post-production__artifact button { align-self:flex-start; }
.post-production__row,.post-production__config,.post-production__candidate { border:1px solid var(--line,#d9dce3); border-radius:12px; padding:16px; display:flex; flex-direction:column; gap:12px; min-width:0; }
.post-production__candidates { display:flex; flex-direction:column; gap:14px; }
.post-production__form { display:grid; grid-template-columns:repeat(auto-fit,minmax(min(100%,260px),1fr)); gap:14px 20px; }
.post-production__field { display:flex; flex-direction:column; gap:7px; min-width:0; font-size:var(--ui-font-label); }
.post-production__field input:not([type=checkbox]),.post-production__field textarea,.post-production__field select { width:100%; box-sizing:border-box; }
.post-production__field input[type=checkbox] { align-self:flex-start; width:18px; height:18px; }
.post-production__field textarea { min-height:80px; resize:vertical; }
.post-production__form > .post-production__actions { grid-column:1 / -1; }
.post-production__dirty { font-size:var(--ui-font-meta); color:var(--accent,#d65331); }
.post-production__state { flex:none; border-radius:16px; padding:4px 9px; background:var(--surface-alt,#e9ecf1); font-size:var(--ui-font-meta); line-height:1.4; }
.post-production__state[data-state=failed],.post-production__state[data-state=blocked],.post-production__state[data-state=stale] { background:#fff0db; color:#8a4b0d; }
.post-production__state[data-state=confirmed],.post-production__state[data-state=postflight_passed],.post-production__state[data-state=adopted] { background:#e5f5e9; color:#245833; }
.post-production__tasks { display:flex; flex-direction:column; gap:12px; }
.post-production__tasks:empty,.post-production__notice:empty { display:none; }
.post-production__error { color:var(--danger,#b53030); margin-bottom:8px!important; }
.post-production details { min-width:0; max-width:100%; font-size:13px; }
.post-production summary { cursor:pointer; font-size:var(--ui-font-button); }
.post-production pre { max-height:340px; overflow:auto; white-space:pre-wrap; overflow-wrap:anywhere; padding:12px; background:var(--surface-alt,#f3f4f7); border-radius:8px; }
.post-production__section-actions { padding-top:12px; border-top:1px solid var(--line,#d9dce3); }
@media(max-width:700px) {
 .post-production__toolbar { align-items:stretch; }
 .post-production__scope { width:100%; }
 .post-production__scope select { flex:1; }
 .post-production__tabs { flex-wrap:nowrap; overflow-x:auto; }
 .post-production__tab { flex:none; }
 .post-production__row,.post-production__config,.post-production__candidate { padding:12px; }
}

/* Sound stages use the same compact cards and tab shape as upstream review. */
.sound-workspace { gap:12px; }
.sound-workspace__panel { display:flex; flex-direction:column; gap:12px; }
.sound-workspace__grid { grid-template-columns:repeat(auto-fill,minmax(225px,1fr)); align-items:start; }
.sound-workspace__card { min-width:0; }
.sound-workspace__placeholder { display:flex; align-items:center; justify-content:center; aspect-ratio:16/9; background:#181b21; color:#b9c0ce; font-size:24px; }
.sound-workspace__card .review-card-state { position:absolute; border-radius:999px; }
.sound-workspace__card .review-card-info { padding:10px; gap:7px; }
.sound-workspace__card .sound-workspace__source { font-size:var(--ui-font-caption); }
.sound-workspace__card .sound-workspace__note { white-space:normal; line-height:1.45; }
.sound-workspace__card .review-card-actions button { font-size:var(--ui-font-button); min-height:32px; padding:6px; }
.sound-workspace .post-production__state[data-state=running],
.sound-workspace .post-production__state[data-state=queued],
.sound-workspace__running { background:var(--mj-button)!important; color:#fff!important; -webkit-text-fill-color:#fff!important; opacity:1!important; }
.post-production__sound-detail,.post-production__detail { display:flex; flex-direction:column; gap:16px; min-width:0; }
.post-production__artifact img { width:100%; max-height:440px; object-fit:contain; }
.post-production__placeholder { font-size:16px; padding:16px; overflow-wrap:anywhere; color:#b9c0ce!important; -webkit-text-fill-color:#b9c0ce!important; }
.post-production__card strong { overflow-wrap:anywhere; }
.postproduction-workspace-toolbar .post-production__section-actions { padding:0; border:0; flex-wrap:nowrap; }
@media(max-width:700px) { .sound-workspace__grid { grid-template-columns:repeat(auto-fill,minmax(180px,1fr)); } }

/* The existing review header owns a separate stage row and current-episode action row. */
body:is([data-review-media-type="sound"],[data-review-media-type="editing"],[data-review-media-type="episode_video"],[data-review-media-type="postfx"],[data-review-media-type="season_video"],[data-review-media-type="acceptance"]) [data-page="edit"] { overflow:hidden!important; padding-bottom:0!important; }
body:is([data-review-media-type="sound"],[data-review-media-type="editing"],[data-review-media-type="episode_video"],[data-review-media-type="postfx"],[data-review-media-type="season_video"],[data-review-media-type="acceptance"]) [data-page="edit"] .review-panel { height:100%; min-height:0; display:flex; flex-direction:column; overflow:hidden; }
body:is([data-review-media-type="sound"],[data-review-media-type="editing"],[data-review-media-type="episode_video"],[data-review-media-type="postfx"],[data-review-media-type="season_video"],[data-review-media-type="acceptance"]) [data-page="edit"] .review-head { flex:0 0 auto; }
body:is([data-review-media-type="sound"],[data-review-media-type="editing"],[data-review-media-type="episode_video"],[data-review-media-type="postfx"],[data-review-media-type="season_video"],[data-review-media-type="acceptance"]) #reviewGalleryGrid { flex:1 1 auto; min-height:0; overflow:auto; align-content:start; }
:is(#soundWorkspaceTabs,#postproductionWorkspaceTabs)[hidden] { display:none!important; }
body:is([data-review-media-type="sound"],[data-review-media-type="editing"],[data-review-media-type="episode_video"],[data-review-media-type="postfx"],[data-review-media-type="season_video"],[data-review-media-type="acceptance"]) :is(#soundWorkspaceTabs,#postproductionWorkspaceTabs) { flex-wrap:nowrap!important; overflow-x:auto!important; overflow-y:hidden!important; min-width:0; box-sizing:border-box; }
/* Match the review-result-tabs button rules in styles.css without attaching top-level routing attributes. */
[data-page="edit"] :is(#soundWorkspaceTabs,#postproductionWorkspaceTabs) button { flex:none; min-height:34px!important; min-width:78px!important; border:1px solid #d0d5dd!important; border-bottom:0!important; border-radius:9px 9px 0 0!important; background:#f2f4f7!important; color:#182230!important; font-size:var(--ui-font-tab)!important; font-weight:var(--ui-font-weight)!important; line-height:1.4!important; }
[data-page="edit"] :is(#soundWorkspaceTabs,#postproductionWorkspaceTabs) button.active,[data-page="edit"] :is(#soundWorkspaceTabs,#postproductionWorkspaceTabs) button[aria-selected="true"] { position:relative!important; top:1px!important; background:#fff!important; border-color:#d0d5dd!important; border-bottom-color:#fff!important; color:#182230!important; }

body:is([data-review-media-type="sound"],[data-review-media-type="editing"],[data-review-media-type="episode_video"],[data-review-media-type="postfx"],[data-review-media-type="season_video"],[data-review-media-type="acceptance"]) [data-page="edit"] .review-toolbar {
  min-width:0!important; grid-template-columns:minmax(0,1fr)!important;
}
body:is([data-review-media-type="sound"],[data-review-media-type="editing"],[data-review-media-type="episode_video"],[data-review-media-type="postfx"],[data-review-media-type="season_video"],[data-review-media-type="acceptance"]) [data-page="edit"] .review-tab-actionbar {
  min-width:0!important; max-width:100%; box-sizing:border-box;
  flex-wrap:nowrap!important; justify-content:flex-start!important; gap:12px!important;
  overflow:visible;
}
body:is([data-review-media-type="sound"],[data-review-media-type="editing"],[data-review-media-type="episode_video"],[data-review-media-type="postfx"],[data-review-media-type="season_video"],[data-review-media-type="acceptance"]) [data-page="edit"] .review-selected {
  flex:1 1 0!important; min-width:0!important; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
body:is([data-review-media-type="sound"],[data-review-media-type="editing"],[data-review-media-type="episode_video"],[data-review-media-type="postfx"],[data-review-media-type="season_video"],[data-review-media-type="acceptance"]) [data-page="edit"] .review-tab-actions {
  flex-wrap:nowrap!important; gap:10px!important;
}
.sound-workspace-toolbar:not([hidden]) { display:flex; flex:0 0 auto; align-items:center; gap:8px; white-space:nowrap; }
.sound-workspace-toolbar > * { flex:0 0 auto; }
.sound-workspace-toolbar button { white-space:nowrap; }

body:is([data-review-media-type="sound"],[data-review-media-type="editing"],[data-review-media-type="episode_video"],[data-review-media-type="postfx"],[data-review-media-type="season_video"],[data-review-media-type="acceptance"]) [data-page="edit"] .review-toolbar .sound-workspace__running {
  background:var(--mj-button)!important; color:#fff!important; -webkit-text-fill-color:#fff!important;
}
.post-production__music-preview { grid-column:1 / -1; min-width:0; }
.post-production__music-preview:empty { display:none; }

.post-production__dialogue-lines { display:flex; flex-direction:column; gap:12px; }
.post-production__dialogue-lines p { white-space:pre-wrap; margin:6px 0 0; }

[data-ui-appearance="dark"] [data-page="edit"] :is(#soundWorkspaceTabs,#postproductionWorkspaceTabs) button { background:#252526!important; background-color:#252526!important; border-color:#3c3c3c!important; border-bottom-color:#3c3c3c!important; color:#ccc!important; -webkit-text-fill-color:#ccc!important; box-shadow:none!important; }
[data-ui-appearance="dark"] [data-page="edit"] :is(#soundWorkspaceTabs,#postproductionWorkspaceTabs) button.active,[data-ui-appearance="dark"] [data-page="edit"] :is(#soundWorkspaceTabs,#postproductionWorkspaceTabs) button[aria-selected="true"] { background:#2a2d2e!important; background-color:#2a2d2e!important; border-color:#3c3c3c!important; border-bottom-color:#2a2d2e!important; color:#d4d4d4!important; -webkit-text-fill-color:#d4d4d4!important; }

.postproduction-workspace-toolbar .post-production__state { white-space:nowrap; }

.evidence-modal--workspace .evidence-modal__body--workspace { display:block; min-height:0; overflow:auto; }
.evidence-modal--workspace .evidence-modal__footer--workspace { display:flex; flex-direction:column; align-items:stretch; gap:8px; }
.evidence-modal__body--workspace .post-production__form,.evidence-modal__body--workspace .post-production__config { min-width:0; }
.evidence-modal__body--workspace .post-production__artifact img,.evidence-modal__body--workspace .post-production__artifact video { max-height:55vh; }

/* Only the read-only final-episode view owns this viewport. Other postproduction pages are unchanged. */
body [data-page="edit"] .review-tab-actionbar[data-episode-final-hidden="true"] { display:none!important; }
html:has(body[data-review-media-type="episode_video"] .page.active[data-page="edit"] .episode-final),
body[data-review-media-type="episode_video"]:has(.page.active[data-page="edit"] .episode-final) { height:100dvh; min-height:0; overflow:hidden; }
body[data-review-media-type="episode_video"]:has(.page.active[data-page="edit"] .episode-final) .mainstage { height:100dvh!important; min-height:0!important; overflow:hidden!important; }
body[data-review-media-type="episode_video"] .page.active[data-page="edit"]:has(.episode-final) { height:100%; min-height:0; overflow:hidden!important; padding-bottom:0!important; }
body[data-review-media-type="episode_video"] #reviewGalleryGrid:has(>.episode-final) { display:flex; flex:1 1 0; min-width:0; min-height:0; padding:0!important; overflow:hidden!important; }
.episode-final { display:grid; grid-template-rows:auto auto minmax(0,1fr); flex:1 1 0; width:100%; height:100%; min-width:0; min-height:0; padding:clamp(10px,1.8dvh,22px); gap:clamp(8px,1.4dvh,16px); box-sizing:border-box; overflow:hidden; background:#f8faff; color:#172b4d; font-family:var(--font-sans); font-size:var(--ui-font-body); font-weight:var(--ui-font-weight); font-style:var(--ui-font-style); }
.episode-final [hidden] { display:none!important; }
.episode-final__heading { display:flex; justify-content:space-between; align-items:center; gap:16px; min-width:0; }
.episode-final__heading h1 { font-size:var(--ui-font-page); font-weight:var(--ui-font-weight); margin:0; line-height:1.25; }
.episode-final__notice { margin:0; color:#b53030; font-size:var(--ui-font-meta); }
.episode-final__notice:empty { display:none; }
.episode-final__main { grid-row:3; display:grid; grid-template-columns:minmax(0,1fr) minmax(245px,23%); gap:clamp(12px,1.6vw,24px); min-height:0; min-width:0; overflow:hidden; }
.episode-final__screen { position:relative; display:flex; align-items:center; justify-content:center; min-width:0; min-height:0; height:100%; border-radius:10px; overflow:hidden; background:#0d1015; }
.episode-final__video { display:block; width:100%; height:100%; min-width:0; min-height:0; object-fit:contain; background:#0d1015; accent-color:#ff4f2a; }
.episode-final__empty { text-align:center; max-width:36em; padding:24px; line-height:1.6; color:#d1d9e6!important; -webkit-text-fill-color:#d1d9e6!important; font-size:var(--ui-font-body); }
.episode-final__info { display:flex; flex-direction:column; gap:clamp(10px,2.3dvh,24px); min-width:0; min-height:0; padding:clamp(12px,2dvh,24px); box-sizing:border-box; border:1px solid #dfe5ef; border-radius:12px; background:#fff; overflow:hidden; }
.episode-final__info h2 { font-size:var(--ui-font-section); font-weight:var(--ui-font-weight); line-height:1.3; margin:0; }
.episode-final__facts { display:grid; gap:clamp(6px,1.7dvh,20px); margin:0; min-width:0; }
.episode-final__fact { display:grid; grid-template-columns:5em minmax(0,1fr); gap:8px; font-size:var(--ui-font-meta); line-height:1.5; min-width:0; }
.episode-final__fact dt { color:#76839b; }
.episode-final__fact dd { margin:0; min-width:0; overflow-wrap:anywhere; font-variant-numeric:tabular-nums; }
.episode-final__actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:auto; padding-top:10px; min-width:0; }
body .episode-final__download,body .episode-final button { display:inline-flex; align-items:center; justify-content:center; height:auto!important; min-height:34px!important; padding:7px 12px!important; border:1px solid #d8e1ee!important; border-radius:7px!important; background:#fff!important; color:#17304f!important; -webkit-text-fill-color:#17304f!important; font:inherit; font-size:var(--ui-font-button)!important; line-height:1.4!important; text-decoration:none; cursor:pointer; }
body .episode-final__download { background:#ff4f2a!important; border-color:#ff4f2a!important; color:#fff!important; -webkit-text-fill-color:#fff!important; }
body .episode-final button:disabled,body .episode-final__download[aria-disabled="true"] { cursor:default; opacity:.55; }
.episode-final :is(button,a,video):focus-visible { outline:2px solid #ff4f2a; outline-offset:2px; }
@media(max-width:800px) {
 .episode-final__main { grid-template-columns:minmax(0,1fr) minmax(210px,30%); gap:10px; }
 .episode-final__fact { grid-template-columns:1fr; gap:1px; }
 .episode-final__info { padding:10px; gap:8px; }
 .episode-final__facts { gap:5px; }
}
@media(max-width:550px) {
 .episode-final__main { grid-template-columns:1fr; grid-template-rows:minmax(0,1fr) auto; }
 .episode-final__info { gap:6px; }
 .episode-final__facts { grid-template-columns:repeat(2,minmax(0,1fr)); gap:5px 12px; }
 .episode-final__fact { grid-template-columns:auto minmax(0,1fr); font-size:var(--ui-font-meta); gap:5px; }
 .episode-final__actions { margin:0; padding-top:2px; }
 .episode-final__info h2 { font-size:var(--ui-font-section); }
}

.post-production__row-heading > strong { font-size:var(--ui-font-card); font-weight:var(--ui-font-weight); }
