/* Studio owns its application geometry; public pages retain their navigation. */
html[data-theme] body[data-studio-shell]{--studio-rail-width:280px;overflow:hidden;height:100dvh;background:var(--brand-bg);color:var(--brand-text)}
html[data-theme] body[data-studio-shell] .studio-app-header{position:relative;display:flex;flex-wrap:wrap;height:auto;min-height:76px;padding:12px 20px;gap:12px;box-sizing:border-box;background:var(--brand-bg);border-bottom:1px solid var(--brand-line);z-index:50}
.studio-app-logo{display:flex;flex-direction:column;text-decoration:none;color:inherit;min-width:140px;line-height:1.05}.studio-app-logo strong{font:800 24px/1 var(--sans);letter-spacing:.04em}.studio-app-logo small{font:700 9px/1 var(--sans);letter-spacing:.4em;text-align:center;margin-top:7px}
.studio-home-link{color:inherit;text-decoration:none;min-height:44px;display:flex;align-items:center;font-size:13px;white-space:nowrap}
.studio-edit-actions{margin-left:auto;display:flex;gap:6px}.studio-edit-actions button{min-height:44px;border:1px solid var(--brand-line);border-radius:10px;background:transparent;color:inherit;padding:8px 12px;font-size:12px}.studio-edit-actions button:disabled{opacity:.35;cursor:default}
html[data-theme] body[data-studio-shell] .language-control{display:flex;border:0;background:none}.studio-app-header .header-icons{display:flex}.studio-app-header .theme-toggle{min-width:44px;min-height:44px}
html[data-theme] body[data-studio-shell] .studio-basket{background:var(--brand-action);color:var(--brand-action-text);border:0;border-radius:999px;white-space:nowrap;min-height:44px;font-size:13px}
html[data-theme] body[data-studio-shell] #studioBasketCount{background:transparent;color:inherit;padding:0;min-width:0;border-radius:0}
html[data-theme] body[data-studio-shell] .app{position:fixed;top:var(--studio-header-height,76px);bottom:var(--studio-toolbar-height,0px);left:0;right:0;height:auto;display:grid;grid-template-columns:var(--studio-rail-width) minmax(0,1fr);min-height:0}
html[data-theme] body[data-studio-shell] .rail{position:fixed;left:0;top:var(--studio-header-height,76px);bottom:0;width:var(--studio-rail-width);height:auto;max-height:none;box-sizing:border-box;overflow:auto;padding:18px 16px;background:var(--brand-bg);border-radius:0;border:0;border-right:1px solid var(--brand-line);transform:none;z-index:35}
html[data-theme] body[data-studio-shell] .rail .grid{display:block;min-height:0;overflow:visible}.model-audience{border:0;margin:0 0 16px}.model-audience summary{padding:12px 0;cursor:pointer;font-weight:700;font-size:14px;color:var(--brand-text)}.model-audience-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
html[data-theme] body[data-studio-shell] .rail .card{width:100%;margin:0;min-width:0;overflow:hidden;border-radius:10px;background:var(--brand-soft);border:1px solid var(--brand-line)}
html[data-theme] body[data-studio-shell] .rail .card img{height:auto;max-height:200px;aspect-ratio:3/4;object-fit:contain;width:100%}.rail .card .name{font-size:11px;line-height:1.5;padding:8px;white-space:normal}
html[data-theme] body[data-studio-shell] #studioAudiencePicker{display:none}.rail label:has(#studioAudiencePicker){display:none!important}
html[data-theme] body[data-studio-shell] .stage{grid-column:2;padding:12px 20px;height:100%;min-height:0;overflow:hidden;justify-content:center;align-items:center;box-sizing:border-box;gap:8px}
html[data-theme] body[data-studio-shell] .canvas-wrap{width:min(100%,calc(100dvh - var(--studio-header-height,76px) - var(--studio-toolbar-height,0px) - 104px));max-width:100%;min-height:0}
html[data-theme] body[data-studio-shell] #view{width:100%;height:auto;max-height:calc(100dvh - var(--studio-header-height,76px) - var(--studio-toolbar-height,0px) - 104px)}
html[data-theme] body[data-studio-shell] .studio-toolbar{position:fixed;left:var(--studio-rail-width);right:0;bottom:0;margin:0;border-radius:0;min-height:82px;box-sizing:border-box;display:flex;align-items:center;flex-wrap:wrap;gap:10px;padding:12px 16px;background:var(--brand-bg);border:0;border-top:1px solid var(--brand-line);box-shadow:none;z-index:40}
html[data-theme] body[data-studio-shell] .studio-toolbar>button{width:auto;min-height:44px;padding:10px 12px;flex-shrink:0;white-space:normal;font-size:12px}
html[data-theme] body[data-studio-shell] #toolbarColours{flex:1 1 150px;min-width:80px}.studio-toolbar #openPreview{margin-left:auto!important;min-width:110px}
html[data-theme] body[data-studio-shell][data-model-selected=false] .model-stepper,html[data-theme] body[data-studio-shell][data-model-selected=false] .studio-toolbar,html[data-theme] body[data-studio-shell][data-model-selected=false] .garment-side-tabs{display:none!important}
html[data-theme] body[data-studio-shell][data-model-selected=false] #view{visibility:hidden}
html[data-theme] body[data-studio-shell][data-model-selected=false] .canvas-wrap{width:100%;height:100%;background:transparent;border:0}
html[data-theme] body[data-studio-shell][data-model-selected=false] #pickPrompt{display:flex;align-items:center;justify-content:center;text-align:center;padding:24px;font-size:clamp(16px,2vw,24px);color:var(--brand-muted);box-sizing:border-box}
body[data-studio-shell] .ctrl{z-index:65}
/* The fixed app is a stacking context: the dismissal layer must live inside it,
   below the model/design panels, rather than intercepting their input outside. */
html[data-theme] body[data-studio-shell] .app>.sheet-backdrop:not([hidden]){z-index:10}
.mug-live-panel[hidden]{display:none}
html[data-theme] body[data-studio-shell][data-mug-editing=true] .stage{display:flex;flex-direction:column;align-items:center;gap:8px}
.mug-live-panel{display:grid;grid-template-rows:minmax(0,1fr) auto auto;flex:1;min-height:100px;width:min(100%,700px)}
.mug-live-panel .mug-3d-stage{height:100%;min-height:70px;background:transparent}
.mug-live-panel p{font-size:11px;text-align:center;margin:3px;color:var(--brand-muted)}
.mug-live-scale{display:flex;align-items:center;gap:10px;justify-content:center}
.mug-live-scale label{display:flex;align-items:center;gap:8px;font-size:12px}
.mug-live-scale input{width:clamp(70px,12vw,160px);accent-color:var(--brand-action)}
.mug-live-scale button{width:36px;height:36px;border:1px solid var(--brand-line);border-radius:50%;color:var(--brand-text);background:var(--brand-soft);font-size:20px}
.mug-live-scale output{font-size:12px;min-width:36px}.mug-live-scale :disabled{opacity:.4}
html[data-theme] body[data-studio-shell][data-mug-editing=true] .canvas-wrap{width:100%;flex:none;display:flex;justify-content:center}
html[data-theme] body[data-studio-shell][data-mug-editing=true] #view{width:auto;height:auto;max-width:100%;max-height:min(110px,16dvh)}
@media(max-width:1100px) and (min-width:761px){html[data-theme] body[data-studio-shell]{--studio-rail-width:260px}.studio-app-logo{min-width:110px}.studio-app-logo strong{font-size:20px}.studio-edit-actions button{padding:8px}.studio-home-link{font-size:12px}}
@media(max-width:760px){
 html[data-theme] body[data-studio-shell] .studio-app-header{padding:8px 10px;gap:6px;min-height:60px}.studio-app-logo{min-width:100px}.studio-app-logo strong{font-size:18px}.studio-app-logo small{font-size:7px}.studio-home-link{font-size:11px;margin-right:auto}
 .studio-edit-actions{margin-left:0}.studio-edit-actions button{padding:6px 10px}.studio-app-header .studio-basket{margin-left:auto}.studio-app-header .language-control button{padding:8px;min-width:36px}
 html[data-theme] body[data-studio-shell] .app{grid-template-columns:minmax(0,1fr)}
 html[data-theme] body[data-studio-shell] .stage{grid-column:1;padding:8px}
 html[data-theme] body[data-studio-shell] .rail{width:100%;right:0;bottom:var(--studio-toolbar-height,0px);border:0;padding:14px 16px}
 html[data-theme] body[data-studio-shell] .rail:not(.sheet-open){visibility:hidden;pointer-events:none}
 html[data-theme] body[data-studio-shell].choosing-model .rail{bottom:0}
 html[data-theme] body[data-studio-shell] .studio-toolbar{left:0;padding:8px;gap:6px;min-height:0}
 html[data-theme] body[data-studio-shell] #toolbarColours{flex:1 1 calc(100% - 60px)}
 html[data-theme] body[data-studio-shell] .studio-toolbar>button{padding:8px;flex:1 1 auto;font-size:11px}
 html[data-theme] body[data-studio-shell] #openModels{display:block}
 html[data-theme] body[data-studio-shell].choosing-model .studio-toolbar{display:none!important}
 html[data-theme] body[data-studio-shell] .canvas-wrap{width:min(100%,calc(100dvh - var(--studio-header-height,110px) - var(--studio-toolbar-height,0px) - 96px))}
}
@media(max-width:760px){
 html[data-theme] body[data-studio-shell] .studio-app-header{column-gap:6px;row-gap:6px}
 .studio-app-header .studio-app-logo{order:1;min-width:90px}.studio-app-header .studio-home-link{order:2;flex:1;min-width:0;font-size:10px;margin:0}
 html[data-theme] body[data-studio-shell] .studio-basket{order:3;margin-left:0;padding:0 10px;font-size:11px;gap:3px}
 .studio-app-header .studio-edit-actions{order:4;flex:1}.studio-app-header .language-control{order:5}.studio-app-header .header-icons{order:6}
 #studioUndo,#studioRedo{font-size:0;width:44px;padding:0}#studioUndo::before{content:'↶';font-size:23px}#studioRedo::before{content:'↷';font-size:23px}
 html[data-theme] body[data-studio-shell] .stage{justify-content:flex-start}
 html[data-theme] body[data-studio-shell] .model-stepper,html[data-theme] body[data-studio-shell] .garment-side-tabs{flex-shrink:0;min-height:44px}
 html[data-theme] body[data-studio-shell] .canvas-wrap{max-height:calc(100dvh - var(--studio-header-height,110px) - var(--studio-toolbar-height,0px) - 140px);width:min(100%,calc(100dvh - var(--studio-header-height,110px) - var(--studio-toolbar-height,0px) - 140px))}
 html[data-theme] body[data-studio-shell] #view{max-height:calc(100dvh - var(--studio-header-height,110px) - var(--studio-toolbar-height,0px) - 140px)}
 html[data-theme] body[data-studio-shell][data-model-selected=false] .canvas-wrap{width:100%;max-height:none}
}
@media(max-width:760px){
 html[data-theme] body[data-studio-shell] .studio-app-header{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}
 .studio-app-header .studio-app-logo{grid-column:1/span 2;grid-row:1;min-width:0}
 .studio-app-header .studio-home-link{grid-column:3/span 2;grid-row:1;justify-content:center;min-width:0;font-size:10px}
 html[data-theme] body[data-studio-shell] .studio-basket{grid-column:5/span 2;grid-row:1;justify-content:center;padding:0 6px;min-width:0}
 .studio-app-header .studio-edit-actions{grid-column:1/span 3;grid-row:2;min-width:0;gap:4px}
 .studio-app-header .studio-edit-actions #resetAll{padding:6px;font-size:10px;letter-spacing:0;flex:1;min-width:0}
 .studio-app-header .language-control{grid-column:4/span 2;grid-row:2;justify-content:center;min-width:0}
 .studio-app-header .header-icons{grid-column:6;grid-row:2;justify-content:center;min-width:0}
}
@media(max-width:760px){
 html[data-theme] body[data-studio-shell] .studio-app-header>.language-control{grid-column:4/span 2;grid-row:2}
 html[data-theme] body[data-studio-shell] .studio-app-header>.header-icons{grid-column:6;grid-row:2;justify-self:stretch}
}

/* The 11 oz blank is white; its live workspace needs no garment colour tray. */
html[data-theme] body[data-studio-shell][data-mug-editing=true] #toolbarColours{display:none}
html[data-theme] body[data-studio-shell][data-mug-editing=true] #view{max-height:min(110px,12dvh)}
.mug-live-panel{min-height:124px}
@media(max-width:760px){
 html[data-theme] body[data-studio-shell][data-mug-editing=true] .studio-toolbar #openModels{flex:0 0 48px}
 html[data-theme] body[data-studio-shell][data-mug-editing=true] .studio-toolbar #openPreview{min-width:80px}
}

/* Upload starts the task; Continue leads to review and order options. */
html[data-theme] body[data-studio-shell] .stage{position:relative}
html[data-theme] body[data-studio-shell] .studio-canvas-info{position:absolute;right:16px;top:112px;z-index:2;width:auto;min-height:44px;padding:8px 14px;border:1px solid var(--brand-line);border-radius:999px;background:var(--brand-bg);color:var(--brand-muted);font-size:12px}
html[data-theme] body[data-studio-shell][data-model-selected=false] .studio-canvas-info{display:none}
html[data-theme] body[data-studio-shell] #quickUpload{border:1px solid var(--brand-action);background:color-mix(in srgb,var(--brand-action) 14%,var(--brand-bg));color:var(--brand-text);font-weight:700}
.studio-next-step{display:flex;flex-direction:column;align-items:stretch;gap:4px;margin-left:auto;flex-shrink:0}
html[data-theme] body[data-studio-shell] .studio-next-step #openPreview{margin:0!important;min-width:150px;min-height:46px;padding:10px 20px;border:0;border-radius:999px;background:var(--brand-action);color:var(--brand-action-text);font-size:13px;font-weight:800;white-space:nowrap}
.studio-next-step span{font-size:10px;line-height:1.3;text-align:center;color:var(--brand-muted)}
@media(max-width:760px){
 .studio-next-step{flex:1 1 140px}
 html[data-theme] body[data-studio-shell] .studio-next-step #openPreview{min-width:0;min-height:44px;padding:8px 16px;font-size:12px}
 html[data-theme] body[data-studio-shell] .studio-canvas-info{right:8px;top:112px;padding:8px 10px;font-size:11px}
 .studio-next-step span{font-size:9px}
}

/* Two deliberate rows keep colour browsing separate from the design workflow. */
html[data-theme] body[data-studio-shell] .studio-toolbar{display:grid;grid-template-columns:minmax(0,1fr);gap:10px;padding:10px 16px}
.studio-colour-row{display:flex;align-items:center;gap:12px;min-width:0}
html[data-theme] body[data-studio-shell] #toolbarColours{flex:1;min-width:0}
html[data-theme] body[data-studio-shell] #toolbarColours .swatch{width:32px;height:32px;min-width:32px}
.studio-action-row{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);align-items:start;gap:10px;min-width:0}
html[data-theme] body[data-studio-shell] :is(.studio-action-row,.studio-colour-row)>button{width:auto;min-width:0;flex:0 0 auto;min-height:48px;padding:10px 12px;border:1px solid var(--brand-line);background:transparent;color:var(--brand-text);font-size:12px;font-weight:600;white-space:normal}
html[data-theme] body[data-studio-shell] .studio-action-row .studio-canvas-info{position:static;z-index:auto;color:var(--brand-muted)}
html[data-theme] body[data-studio-shell] #quickUpload{background:var(--site-button-fill,var(--brand-action));border-color:var(--site-button-colour,var(--brand-action));color:var(--site-button-ink,var(--brand-action-text));font-weight:700}
.studio-next-step{margin-left:0;flex:0 0 auto;min-width:0}
html[data-theme] body[data-studio-shell] .studio-next-step #openPreview{width:100%;min-width:0;min-height:48px;border:1px solid var(--brand-action);background:var(--brand-action);color:var(--brand-action-text)}
html[data-theme] body[data-studio-shell][data-mug-editing=true] .studio-colour-row{display:none}
@media(max-width:760px){
 html[data-theme] body[data-studio-shell] .studio-toolbar{padding:8px;gap:8px}
 .studio-action-row{display:grid;grid-auto-flow:row;grid-template-columns:repeat(6,minmax(0,1fr));gap:6px}
 html[data-theme] body[data-studio-shell] .studio-action-row>button{width:100%;min-width:0;padding:8px 4px;font-size:11px;min-height:44px;white-space:normal}
 .studio-action-row #quickUpload{grid-column:1/span 3;grid-row:1}
 .studio-action-row .studio-next-step{grid-column:4/span 3;grid-row:1;min-width:0}
 .studio-action-row #openModels{grid-column:1/span 2;grid-row:2}
 .studio-action-row #openTools{grid-column:3/span 2;grid-row:2}
 .studio-action-row #openGarmentInfo{grid-column:5/span 2;grid-row:2}
 html[data-theme] body[data-studio-shell] .studio-next-step #openPreview{width:100%;min-width:0;min-height:44px}
 .studio-next-step span{display:none}
 html[data-theme] body[data-studio-shell] #openColour{display:block;min-height:36px;padding:6px 10px;font-size:11px}
}
