/* Scoped to the story workspace; navigation typography is inherited. */
body.story-authoring-active #reviewTabActionbar { display:none; }
#reviewGalleryGrid.story-authoring-host:has(.story-authoring-workspace) { display:block; min-height:0; height:100%; padding:12px; }
.story-authoring-workspace { display:grid; grid-template-columns:minmax(0,1fr) clamp(250px,25%,380px); gap:14px; height:100%; min-height:380px; color:inherit; font-family:inherit; }
.story-authoring-main,.story-authoring-sidebar { background:#fff; border:1px solid #dbe4f0; border-radius:16px; min-width:0; min-height:0; overflow:hidden; }
.story-authoring-main { display:flex; flex-direction:column; }
.story-authoring-header { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 20px; border-bottom:1px solid #edf1f6; }
.story-authoring-workspace h2 { margin:0; font-size:clamp(20px,1.4vw,26px); font-weight:650; }
.story-authoring-workspace h3 { margin:0 0 12px; font-size:16px; font-weight:600; }
.story-authoring-workspace button,.story-authoring-workspace textarea { font-family:inherit; font-size:14px; }
.story-authoring-workspace button { border:1px solid #dbe4f0; border-radius:9px; background:#fff; padding:9px 13px; cursor:pointer; color:inherit; }
.story-authoring-workspace button:hover { background:#fff6f2; }
.story-authoring-workspace button:disabled { opacity:.45; cursor:default; }
.story-authoring-workspace button.active { border-color:#ff5a3c; background:#fff3ed; color:#e94524; }
.story-authoring-workspace .story-authoring-primary { background:#ff542e; color:#fff; border-color:#ff542e; }
.story-authoring-feed { flex:1; min-height:0; overflow:auto; padding:20px; }
.story-authoring-document { margin:0; white-space:pre-wrap; overflow-wrap:anywhere; font:inherit; font-size:15px; line-height:1.85; }
.story-authoring-user { margin:0 0 18px auto; padding:12px 16px; border-radius:14px; max-width:85%; background:#f2f5f9; }
.story-authoring-hint { font-size:13px; color:#70829c; line-height:1.65; }
.story-authoring-notice { color:#217254; background:#f0fbf5; padding:12px; border-radius:8px; font-size:14px; }
.story-authoring-error { color:#ad361c; background:#fff3ed; padding:12px; border-radius:8px; font-size:14px; overflow-wrap:anywhere; }
.story-authoring-composer { display:flex; align-items:flex-end; gap:10px; margin:12px 16px 16px; padding:9px 12px 9px 18px; border:1px solid #dbe4f0; border-radius:28px; }
.story-authoring-composer textarea { flex:1; resize:none; min-width:0; min-height:30px; max-height:120px; border:0; outline:none; padding:5px 0; line-height:22px; background:transparent; }
.story-authoring-workspace .story-authoring-send { border:0; border-radius:50%; height:38px; width:38px; padding:0; font-size:24px; background:#ff542e; color:white; flex-shrink:0; }
.story-authoring-sidebar { display:flex; flex-direction:column; }
.story-authoring-tabs { display:flex; padding:9px; gap:6px; border-bottom:1px solid #edf1f6; }
.story-authoring-tabs button { flex:1; border:0; }
.story-authoring-panel { flex:1; padding:16px; overflow:auto; }
.story-authoring-panel>button { width:100%; text-align:left; margin-bottom:8px; }
.story-authoring-actions { padding:16px; border-top:1px solid #edf1f6; }
.story-authoring-actions button { width:100%; }
.story-authoring-actions p { font-size:13px; line-height:1.6; }
.story-authoring-empty { height:100%; display:grid; place-content:center; text-align:center; color:#70829c; }
@media(max-width:850px){ .story-authoring-workspace {grid-template-columns:minmax(0,1fr) 230px;gap:8px}.story-authoring-header,.story-authoring-feed {padding:12px}.story-authoring-header{flex-wrap:wrap} }

/* Director and dialogue first-level documents live inside the selected production tab. */
body.story-inline-active [data-page="edit"] { overflow:hidden; padding-bottom:0!important; }
body.story-inline-active [data-page="edit"] .review-panel { display:flex; flex-direction:column; height:100%; min-height:0!important; }
body.story-inline-active [data-page="edit"] .review-head { flex-shrink:0; }
body.story-inline-active #reviewTabActionbar { display:none!important; }
body.story-inline-active #reviewGalleryGrid.authoring-detail-host { display:block!important; flex:1; min-height:0!important; width:100%; overflow:hidden; }
.authoring-detail-page { display:flex; flex-direction:column; height:100%; min-height:0; min-width:0; background:var(--panel,#fff); color:inherit; font-family:inherit; }
.authoring-detail-page > .authoring-detail-header { display:flex; flex:0 0 auto; align-items:center; justify-content:space-between; flex-wrap:nowrap; height:auto; min-height:45px; max-height:none; gap:12px; padding:6px 16px; border-bottom:1px solid var(--line,#e5ebf3); line-height:1.3; }
.authoring-detail-heading { display:flex; flex:1 1 auto; align-items:center; flex-wrap:nowrap; gap:10px; min-width:0; overflow-x:auto; overflow-y:hidden; white-space:nowrap; }
.authoring-detail-page .authoring-detail-heading h3 { order:0; flex:0 0 auto; margin:0; font-size:clamp(18px,1.3vw,22px); line-height:28px; font-weight:600; }
.authoring-detail-subtitle { order:2; flex:0 0 auto; margin:0; color:var(--muted,#71809a); font-size:13px; line-height:24px; }
.authoring-detail-status { order:1; flex:0 0 auto; color:#087b82; background:#edf8f8; border-radius:12px; font-size:12px; line-height:20px; padding:2px 8px; }
.authoring-detail-tools { display:flex; flex:0 0 auto; align-items:center; gap:4px; flex-wrap:nowrap; }
.authoring-detail-page button { font-family:inherit; font-size:14px; }
.authoring-detail-content { flex:1; min-height:0; height:auto; max-height:none; overflow:auto; padding:16px 22px; font-family:inherit; font-size:var(--authoring-font-size,16px); line-height:1.8; overscroll-behavior:contain; }
.authoring-detail-content h4 { font-size:1em; }
.authoring-detail-content .dialogue-ui-text { font-size:inherit; }
.authoring-detail-page > .authoring-detail-actions { display:flex; flex:0 0 auto; align-items:center; flex-wrap:nowrap; justify-content:flex-start; height:auto; min-height:42px; max-height:none; gap:6px; padding:4px 12px; overflow-x:auto; overflow-y:hidden; border-top:1px solid var(--line,#e5ebf3); line-height:1.25; }
.authoring-detail-actions > button:first-child { margin-left:auto; }
.authoring-detail-page :is(.authoring-detail-tools,.authoring-detail-actions) > button { flex:0 0 auto; height:32px!important; min-height:32px!important; max-height:32px; margin-block:0; padding:4px 10px!important; line-height:24px; white-space:nowrap!important; }
.authoring-detail-page.is-fullscreen { position:fixed; inset:0; z-index:10040; height:100dvh; }
[data-ui-appearance="dark"] .authoring-detail-page { background:#1e1e1e; }
@media(max-width:800px){.authoring-detail-page > .authoring-detail-header{gap:8px;padding-inline:10px}.authoring-detail-heading{gap:6px}.authoring-detail-tools{gap:2px}.authoring-detail-content{padding:12px}.authoring-detail-page :is(.authoring-detail-tools,.authoring-detail-actions) > button{padding-inline:7px!important;font-size:13px}}

/* Episode script uses the shared compact document and repair shell. */
.episode-script-ui-item { margin:8px 0; white-space:pre-wrap; overflow-wrap:anywhere; }
.episode-script-document { white-space:pre-wrap; overflow-wrap:anywhere; line-height:1.85; }
.episode-script-batch { border:1px solid var(--line,#dbe4f0); border-radius:12px; padding:14px; margin-top:20px; }
.episode-script-batch-table { overflow-x:auto; }
.episode-script-batch-row { display:grid; grid-template-columns:60px minmax(180px,1fr) minmax(180px,1fr); gap:12px; align-items:center; padding:8px 0; border-bottom:1px solid var(--line,#e5ebf3); }
.episode-script-batch-row select { font:inherit; min-width:0; max-width:100%; }
.production-placeholder { grid-column:1 / -1; min-width:0; padding:24px; }
.production-placeholder h3 { font-size:clamp(20px,1.5vw,25px); }
.production-placeholder-actions { display:flex; flex-wrap:wrap; gap:10px; }
.production-placeholder-action { display:flex; flex-direction:column; gap:4px; max-width:320px; }
.production-placeholder-action small { color:var(--muted,#71809a); font-size:13px; }

/* Only the episode owner fills the unused left side of the existing footer. */
[data-authoring-owner="episode-script"] .episode-script-version-controls { display:flex; align-items:center; gap:6px; min-width:0; max-width:100%; flex:0 1 auto; }
[data-authoring-owner="episode-script"] .episode-script-version-controls select { font:inherit; font-weight:400; width:auto; padding-right:40px; min-width:0; max-width:100%; flex:0 1 auto; text-overflow:ellipsis; }
[data-authoring-owner="episode-script"] .episode-script-version-controls button { flex:0 0 auto; white-space:nowrap; font-weight:400; }
[data-authoring-owner="episode-script"] .episode-script-primary-actions { margin-left:auto; }
[data-authoring-owner="episode-script"] .episode-script-notices { flex:0 0 auto; font-size:14px; font-weight:400; }
[data-authoring-owner="episode-script"] .episode-script-notice-body { position:absolute; inset:auto 12px 48px; max-height:65vh; overflow:auto; padding:12px; background:var(--panel,#fff); border:1px solid var(--line,#e5ebf3); border-radius:8px; z-index:2; }
[data-authoring-owner="episode-script"] { position:relative; }
