/* Scene-first editor. Existing Rio tokens and typography remain the source of truth. */
/* Fit the preview to its media; the editor receives the reclaimed space. */
.concert-workspace{--preview-height:calc(clamp(400px,calc(100svh - 230px),620px) - 2px);grid-template-columns:calc(var(--preview-height) * 9 / 16) minmax(0,1fr);align-items:start}
.concert-workspace:has(.stage-screen[data-preview-aspect='16:9']){grid-template-columns:minmax(0,1.1fr) minmax(360px,1fr)}
.concert-stage{padding:0;background:none;border:0;border-radius:0;box-shadow:none}
.concert-stage .studio-heading{display:none}
.concert-stage .stage-screen{height:var(--preview-height);min-height:0;flex:none;border:0;background:none;border-radius:12px}
.concert-stage .stage-screen[data-preview-aspect='16:9']{height:auto;aspect-ratio:16/9}
.concert-stage .stage-backdrop{display:none}
.concert-stage .stage-photo-frame{width:100%;height:100%;max-width:100%;max-height:100%;aspect-ratio:auto;box-shadow:none}
.concert-stage .stage-photo-frame[data-aspect='16:9']{width:100%;height:100%;max-width:100%;max-height:100%;aspect-ratio:16/9}
.concert-stage .stage-controls{position:static;display:flex;justify-content:flex-end;flex-wrap:wrap;align-self:stretch;gap:8px;margin-top:12px;padding:0;background:none;border:0;border-radius:0}
.concert-stage .stage-controls[hidden]{display:none}
.concert-stage .stage-controls button,.concert-stage .stage-view-toggle{min-height:44px}
.concert-stage .stage-bottom{margin-top:10px}
.concert-stage .stage-thumbnails{display:flex;flex-wrap:wrap;gap:8px}
.concert-stage .stage-thumbnails[hidden]{display:none}
@media(max-width:850px){
 .concert-workspace,.concert-workspace:has(.stage-screen[data-preview-aspect='16:9']){--preview-height:458px;grid-template-columns:minmax(0,1fr)}
 .concert-stage{width:min(100%,calc(var(--preview-height) * 9 / 16));justify-self:center}
 .concert-stage:has(.stage-screen[data-preview-aspect='16:9']){width:100%}
}
@media(max-width:639px){.concert-workspace{--preview-height:388px}}
@media(max-width:370px){.concert-workspace{--preview-height:338px}}
.template-editor-flow .scene-picker{min-width:0;padding:0;margin:0 0 24px;border:0}
.template-editor-flow .scene-picker legend{font:600 12px/1.6 var(--body);margin-bottom:11px;color:var(--text-primary)}
.template-editor-flow .scene-picker legend::before{content:'1';display:inline-grid;place-items:center;width:20px;height:20px;margin-right:7px;border-radius:50%;background:var(--brand-primary);color:var(--action-ink);font:400 10px/1 var(--mono)}
.template-editor-flow .selected-scene{position:relative;display:grid;grid-template-columns:116px minmax(0,1fr);gap:14px;border:1px solid var(--border-strong);border-radius:12px;padding:10px;background:var(--bg-elevated);overflow:hidden}
.template-editor-flow .selected-scene-image{position:relative;grid-row:span 2;border-radius:8px;overflow:hidden;min-height:144px;background:var(--bg-dark-section)}
.template-editor-flow .selected-scene-image img{display:block;width:100%;height:100%;object-fit:cover;object-position:50% 35%;position:absolute;inset:0}
.template-editor-flow .selected-scene-copy{align-self:center;padding:2px 0 0;min-width:0}
.template-editor-flow .scene-kicker{display:block;font:400 8px/1.5 var(--mono);letter-spacing:.12em;text-transform:uppercase;color:var(--text-secondary);margin-bottom:5px}
.template-editor-flow #selected-template-name{display:block;font:600 19px/1.15 var(--display);color:var(--text-primary);letter-spacing:-.025em}
.template-editor-flow #selected-template-description{font-size:10px;line-height:1.65;color:var(--text-secondary);margin:7px 0}
.scene-photo-range{font:400 9px/1.4 var(--mono);color:var(--brand-accent);white-space:nowrap}
.template-editor-flow #change-template{display:flex;align-items:center;justify-content:space-between;gap:10px;align-self:end;min-height:44px;width:100%;padding:7px 10px;border:1px solid var(--brand-primary);border-radius:7px;background:var(--brand-primary);color:var(--action-ink);font:600 10px/1.4 var(--body);cursor:pointer}
.template-editor-flow #change-template:hover{border-color:var(--brand-primary-hover);background:var(--brand-primary-hover)}
#template-dialog #close-template-dialog:focus-visible{outline:2px solid var(--brand-primary);outline-offset:3px}
.template-editor-flow .people-picker{margin:0 0 14px}
.template-editor-flow .clone-choice{display:flex;align-items:center;gap:8px;margin:10px 0 0;padding:0;font-size:10px;line-height:1.5;color:var(--text-secondary);cursor:pointer}
.template-editor-flow .clone-choice input{margin:0;width:14px;height:14px;accent-color:var(--brand-primary)}
.template-editor-flow .clone-choice[hidden]{display:none}
.template-editor-flow .cast-photo-grid{gap:10px;grid-template-columns:repeat(2,minmax(0,1fr))}
.template-editor-flow .cast-photo-grid[data-photo-count='1']{grid-template-columns:minmax(0,1fr)}
.template-editor-flow .cast-photo-grid[data-photo-count='3']{grid-template-columns:repeat(3,minmax(0,1fr))}
.template-editor-flow .cast-photo-grid[data-photo-count='5']{grid-template-columns:repeat(3,minmax(0,1fr))}
.template-editor-flow .cast-photo-grid .lead-slot{grid-row:auto;display:block}
.template-editor-flow .cast-photo-grid .slot-heading{min-height:34px;gap:5px;margin-bottom:6px}
.template-editor-flow .cast-photo-grid .upload-box,.template-editor-flow .cast-photo-grid .lead-slot .upload-box{height:130px;min-height:0;flex:none}
.template-editor-flow .cast-photo-grid[data-photo-count='1'] .upload-box{height:150px}
.template-editor-flow .cast-photo-grid[data-photo-count='3'] .upload-box,.template-editor-flow .cast-photo-grid[data-photo-count='5'] .upload-box{height:108px}
.template-editor-flow .cast-photo-grid .slot-label{font-size:10px;line-height:1.5}
.template-editor-flow .cast-photo-grid .photo-slot[hidden]{display:none}
.template-editor-flow .cast-photo-grid[data-photo-count='1'] .upload-box img{object-fit:contain;background:var(--bg-surface)}
#template-dialog{box-sizing:border-box;width:min(1010px,calc(100vw - 40px));max-width:none;max-height:calc(100dvh - 48px);padding:26px;border:1px solid var(--border-strong);border-radius:16px;background:var(--bg-canvas);color:var(--text-primary);overflow:auto;box-shadow:var(--shadow-lg)}
#template-dialog::backdrop{background:color-mix(in srgb,var(--bg-dark-section) 68%,transparent);backdrop-filter:blur(7px)}
#template-dialog .scene-dialog-heading{display:flex;justify-content:space-between;gap:20px;margin-bottom:22px;align-items:flex-start;position:relative}
#template-dialog .eyebrow{font:400 9px/1.4 var(--mono);text-transform:uppercase;letter-spacing:.14em;color:var(--brand-primary);margin:0 0 8px}
#template-dialog h2{font:600 clamp(24px,3vw,32px)/1.15 var(--display);letter-spacing:-.035em;margin:0;color:var(--text-primary)}
#template-dialog #template-dialog-description{font:400 12px/1.65 var(--body);color:var(--text-secondary);margin:10px 0 0}
#close-template-dialog{display:grid;place-items:center;flex:none;width:44px;height:44px;padding:0;border:1px solid var(--border-subtle);border-radius:8px;background:var(--bg-surface);color:var(--text-primary);font:400 24px/1 var(--body);cursor:pointer}
#template-dialog .scene-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px}
#template-dialog .scene-card{position:relative;display:flex;flex-direction:column;min-width:0;border:1px solid var(--border-subtle);border-radius:11px;background:var(--bg-elevated);overflow:hidden;transition:border-color .16s}
#template-dialog .scene-card[data-selected=true]{border-color:var(--brand-primary);box-shadow:0 0 0 1px var(--brand-primary)}
#template-dialog .scene-card-media{position:relative;aspect-ratio:4/3;overflow:hidden;background:var(--bg-dark-section)}
#template-dialog .scene-card-media img,#template-dialog .scene-card-media video{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;object-position:50% 34%}
#template-dialog .scene-card-media video{opacity:0;transition:opacity .16s}
#template-dialog .scene-card-media video[data-playing=true]{opacity:1}
#template-dialog .scene-card-check{display:none;position:absolute;right:10px;top:10px;width:24px;height:24px;place-items:center;border-radius:50%;background:var(--brand-primary);color:var(--action-ink);font-size:12px;z-index:1}
#template-dialog .scene-card[data-selected=true] .scene-card-check{display:grid}
#template-dialog .scene-card-media-label{position:absolute;bottom:9px;left:9px;padding:4px 6px;background:var(--bg-dark-section);color:var(--action-ink);border-radius:4px;font:400 7px/1.4 var(--mono);letter-spacing:.05em;text-transform:uppercase}
#template-dialog .scene-card-copy{padding:14px;display:flex;flex-direction:column;flex:1;gap:10px}
#template-dialog .scene-card-title{display:flex;justify-content:space-between;align-items:baseline;gap:8px;flex-wrap:wrap}
#template-dialog h3{font:600 19px/1.2 var(--display);letter-spacing:-.025em;margin:0;color:var(--text-primary)}
#template-dialog .scene-card-copy p{margin:0 0 3px;font:400 11px/1.7 var(--body);color:var(--text-secondary)}
#template-dialog [data-apply-template]{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:auto;min-height:44px;padding:9px 12px;background:var(--bg-surface);border:1px solid var(--border-strong);border-radius:8px;color:var(--text-primary);font:600 11px/1.5 var(--body);cursor:pointer}
#template-dialog [data-apply-template]:hover{background:var(--primary-soft);border-color:var(--brand-primary)}
#template-dialog [data-apply-template][aria-pressed=true]{background:var(--brand-primary);border-color:var(--brand-primary);color:var(--action-ink)}
/* Expand each existing native button across its card, retaining one keyboard stop. */
.template-editor-flow #change-template,#template-dialog [data-apply-template]{position:static}
.template-editor-flow #change-template::after,#template-dialog [data-apply-template]::after{content:'';position:absolute;inset:0;z-index:2;cursor:inherit}
.template-editor-flow .selected-scene:has(#change-template:enabled:hover),#template-dialog .scene-card:has([data-apply-template]:enabled:hover){border-color:var(--brand-primary)}
.template-editor-flow .selected-scene:has(#change-template:focus-visible),#template-dialog .scene-card:has([data-apply-template]:focus-visible){outline:2px solid var(--brand-primary);outline-offset:3px}
.template-editor-flow #change-template:focus-visible,#template-dialog [data-apply-template]:focus-visible{outline:none}
#template-dialog .scene-dialog-note{margin:18px 0 0;font:400 10px/1.6 var(--body);color:var(--text-secondary)}
@media(max-width:760px){
 #template-dialog{width:calc(100vw - 28px);max-height:calc(100dvh - 28px);padding:20px}
 #template-dialog .scene-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
 #template-dialog .scene-card-title{gap:6px}
 #template-dialog .scene-card-copy{padding:12px}
 #template-dialog h3{font-size:18px}
}
@media(max-width:430px){
 .template-editor-flow .selected-scene{grid-template-columns:98px minmax(0,1fr);gap:10px;padding:9px}
 .template-editor-flow .selected-scene-image{min-height:145px}
 .template-editor-flow #selected-template-name{font-size:18px}
 .template-editor-flow .cast-photo-grid{gap:8px}
 .template-editor-flow .cast-photo-grid .slot-heading{min-height:38px}
 .template-editor-flow .cast-photo-grid[data-photo-count='5']{grid-template-columns:repeat(2,minmax(0,1fr))}
 .template-editor-flow .cast-photo-grid[data-photo-count='3']{grid-template-columns:repeat(3,minmax(0,1fr))}
 .template-editor-flow .cast-photo-grid[data-photo-count='3'] .upload-box{height:102px}
 .template-editor-flow .cast-photo-grid[data-photo-count='5'] .upload-box{height:114px}
 #template-dialog .scene-dialog-heading{gap:12px;margin-bottom:18px}
 #template-dialog h2{font-size:26px}
 #template-dialog .scene-grid{grid-template-columns:1fr}
 #template-dialog .scene-card{display:grid;grid-template-columns:112px minmax(0,1fr)}
 #template-dialog .scene-card-media{aspect-ratio:auto;min-height:192px;height:100%}
 #template-dialog .scene-card-copy{min-width:0;gap:9px}
 #template-dialog h3{font-size:18px}
 #template-dialog .scene-card-copy p{font-size:10px}
 #template-dialog .scene-card-media-label{font-size:6px;padding:3px 4px;left:5px;bottom:5px}
 #template-dialog [data-apply-template]{font-size:10px;padding:7px 9px}
}
@media(prefers-reduced-motion:reduce){#template-dialog .scene-card,#template-dialog .scene-card-media video{transition:none}}

/* Keep the original centered .wrap width and native scale on every screen. */

/* Quality shares the shape control's native radio behavior and selected treatment. */
.concert-editor .quality-field{min-width:0;padding:0;border:0}
.quality-picker{grid-template-columns:repeat(2,minmax(0,1fr))}
.quality-picker label{min-width:0}
.quality-picker label>span{display:flex;flex-wrap:wrap;justify-content:center;align-items:baseline;gap:3px 7px}
.quality-picker small{font-size:10px;font-weight:400;white-space:nowrap}
.quality-picker .quality-legacy{grid-column:1 / -1}
.quality-picker label:has(input:disabled){cursor:not-allowed;opacity:.65}
.quality-picker input:disabled{cursor:not-allowed}
.template-editor-flow #photo-placement-hint{font-size:11px;line-height:1.6;color:var(--text-secondary);margin:0}
