/* Dark workspace in windowed mode; the surrounding shell follows only in fullscreen. */
.stlg-shell.stlg-state-detail{
    --stlg-ui-shell:#18222e;--stlg-ui-canvas:#202936;--stlg-ui-panel:#263444;
    --stlg-ui-field:#2d3d50;--stlg-ui-line:#425469;--stlg-ui-text:#f1f5f9;
    --stlg-ui-muted:#b8c5d5
}
.stlg-shell.stlg-state-detail[data-stlg-editor="3d"] .stlg-detail{background:var(--stlg-ui-canvas);color:var(--stlg-ui-text);border:1px solid var(--stlg-ui-line);border-radius:14px;backdrop-filter:none}
/* Rail geometry comes exclusively from model-navigation.css in both editor modes. */
.stlg-shell.is-maximized.stlg-state-detail{background:var(--stlg-ui-shell);color:var(--stlg-ui-text)}
.stlg-shell.is-maximized.stlg-state-detail .stlg-card{border-color:transparent;background:var(--stlg-ui-panel)}
.stlg-shell.is-maximized.stlg-state-detail .stlg-card-media{background:var(--stlg-ui-panel)}
.stlg-shell.is-maximized.stlg-state-detail .stlg-card-media:before{display:none}
.stlg-shell.is-maximized.stlg-state-detail .stlg-card-placeholder{background:var(--stlg-ui-field);color:var(--stlg-brand)}
.stlg-shell.is-maximized.stlg-state-detail .stlg-card:hover{background:var(--stlg-ui-field);border-color:var(--stlg-ui-line)}
.stlg-shell.is-maximized.stlg-state-detail .stlg-card.is-active{background:var(--stlg-ui-field);border-color:var(--stlg-brand);box-shadow:inset 3px 0 0 var(--stlg-brand)}
.stlg-shell.is-maximized.stlg-state-detail .stlg-card-grid{scrollbar-color:var(--stlg-ui-line) transparent}

.stlg-shell[data-stlg-editor="3d"] .stlg-scene{border-radius:14px}
.stlg-shell[data-stlg-editor="3d"] .stlg-scene.is-entering{animation:stlg-workspace-darken .55s ease-out}
/* The transparent WebGL canvas lets CSS fade the actual viewing background. */
@keyframes stlg-workspace-darken{from{background-color:#fffdf9}to{background-color:#202936}}
.stlg-shell[data-stlg-editor="3d"] .stlg-scene-toolbar{top:12px;gap:8px}
.stlg-shell[data-stlg-editor="3d"] .stlg-scene-toolbar strong{color:var(--stlg-ui-text);font-size:16px;font-weight:650}
.stlg-shell[data-stlg-editor="3d"] .stlg-scene-toolbar button,
.stlg-shell[data-stlg-editor="3d"] .stlg-face-select,
.stlg-shell[data-stlg-editor="3d"] .stlg-maximize{background:var(--stlg-ui-panel);color:var(--stlg-ui-text);border:1px solid var(--stlg-ui-line);border-radius:10px;box-shadow:none;min-height:38px}
.stlg-shell[data-stlg-editor="3d"] .stlg-scene-toolbar button:hover,
.stlg-shell[data-stlg-editor="3d"] .stlg-maximize:hover{background:var(--stlg-ui-field);border-color:var(--stlg-brand);color:var(--stlg-ui-text)}
.stlg-shell[data-stlg-editor="3d"] .stlg-maximize{width:42px;height:42px}
.stlg-shell[data-stlg-editor="3d"] .stlg-scene-hint{color:var(--stlg-ui-muted)}
.stlg-shell[data-stlg-editor="3d"] .stlg-axis-compass{background:transparent;border:0;box-shadow:none;width:108px;height:108px}
.stlg-shell[data-stlg-editor="3d"] .stlg-axis-compass g[data-axis^="-"] circle{fill:var(--stlg-ui-panel)}

/* Common panel language for controls and direct numeric editing. */
.stlg-shell[data-stlg-editor="3d"] .stlg-model-settings,
.stlg-shell[data-stlg-editor="3d"] .stlg-dimension.is-editing,
.stlg-shell[data-stlg-editor="3d"] .stlg-cutout-toolbar,
.stlg-shell[data-stlg-editor="3d"] .stlg-cutout-cursor{background:var(--stlg-ui-panel)!important;color:var(--stlg-ui-text);border-color:var(--stlg-ui-line)!important;border-radius:10px;box-shadow:0 4px 18px #0002}
.stlg-shell[data-stlg-editor="3d"] .stlg-model-settings{max-height:calc(100% - 106px - var(--stlg-actions-height,100px) - var(--stlg-scene-footer-height,36px) - 12px);scrollbar-color:var(--stlg-ui-line) transparent}
.stlg-shell[data-stlg-editor="3d"] .stlg-dimension.is-editing:focus-within{outline-color:var(--stlg-brand)}
/* Site form styles must not separate the light text from its dark field. */
.stlg-shell[data-stlg-editor="3d"] .stlg-dimension input[type="number"],
.stlg-shell[data-stlg-editor="3d"] .stlg-dimension input[type="text"]{background:var(--stlg-ui-field)!important;color:var(--stlg-ui-text)!important;-webkit-text-fill-color:var(--stlg-ui-text)!important;caret-color:var(--stlg-ui-text);border-bottom-color:var(--stlg-ui-line)}
.stlg-shell[data-stlg-editor="3d"] .stlg-model-setting select,
.stlg-shell[data-stlg-editor="3d"] .stlg-model-setting input[type="text"]{background:var(--stlg-ui-field);color:var(--stlg-ui-text);border-color:var(--stlg-ui-line);border-radius:6px}
.stlg-shell[data-stlg-editor="3d"] .stlg-scene input[type="number"],
.stlg-shell[data-stlg-editor="3d"] .stlg-scene select{color-scheme:dark}
.stlg-shell[data-stlg-editor="3d"] .stlg-font-trigger,
.stlg-shell[data-stlg-editor="3d"] .stlg-font-option,
.stlg-shell[data-stlg-editor="3d"] .stlg-font-list,
.stlg-shell[data-stlg-editor="3d"] .stlg-scene button.stlg-workspace-upload-replace{background:var(--stlg-ui-field);border-color:var(--stlg-ui-line);color:var(--stlg-ui-text);border-radius:6px}
.stlg-shell[data-stlg-editor="3d"] .stlg-font-trigger:after{color:var(--stlg-ui-muted)}
.stlg-shell[data-stlg-editor="3d"] .stlg-font-picker img{background:#fff;border-radius:4px;padding:3px}
.stlg-shell[data-stlg-editor="3d"] .stlg-font-option.is-selected{border-color:var(--stlg-brand);background:var(--stlg-ui-panel)}
.stlg-shell[data-stlg-editor="3d"] .stlg-scene button.stlg-workspace-upload-replace:hover{background:var(--stlg-ui-panel);border-color:var(--stlg-brand)}
.stlg-shell[data-stlg-editor="3d"] .stlg-cutout-toolbar{scrollbar-color:var(--stlg-ui-line) transparent}
.stlg-shell[data-stlg-editor="3d"] .stlg-cutout-toolbar button{color:var(--stlg-ui-muted);border-radius:6px}
.stlg-shell[data-stlg-editor="3d"] .stlg-cutout-toolbar button:not(:disabled):hover{background:var(--stlg-ui-field);border-color:var(--stlg-ui-line)}
.stlg-shell[data-stlg-editor="3d"] .stlg-cutout-toolbar button.is-active,
.stlg-shell[data-stlg-editor="3d"] .stlg-cutout-toolbar button.is-active:hover{background:var(--stlg-brand);border-color:var(--stlg-brand);color:#fff;box-shadow:none}
.stlg-shell[data-stlg-editor="3d"] .stlg-cutout-toolbar button[data-cutout-tool="pointer"]{border-top-color:var(--stlg-ui-line)}
.stlg-shell[data-stlg-editor="3d"] .stlg-workspace-upload-choose{border-radius:8px;box-shadow:none}

/* Status content flows together; its measured height also reserves canvas space. */
.stlg-scene-footer{position:absolute;left:0;right:0;bottom:var(--stlg-actions-height,100px);z-index:6;display:flex;flex-wrap:wrap;align-items:center;gap:6px 20px;padding:10px 16px;box-sizing:border-box;border-top:1px solid var(--stlg-ui-line,#425469);background:#1d2835;color:var(--stlg-ui-muted,#b8c5d5);font-size:12px;line-height:1.5;pointer-events:none}
.stlg-shell .stlg-scene-footer .stlg-grid-legend,
.stlg-shell .stlg-scene-footer .stlg-cutout-note{position:static;bottom:auto;left:auto;max-width:none;margin:0;padding:0;background:transparent;color:inherit;border:0;border-radius:0}
.stlg-shell .stlg-scene-footer .stlg-grid-legend{flex:0 0 auto;font-size:12px;white-space:nowrap}
.stlg-shell .stlg-scene-footer .stlg-cutout-note{flex:1 1 320px;font-size:12px;min-width:0;overflow-wrap:anywhere}

/* Actions and render progress belong to a single integrated dock. */
.stlg-shell.stlg-state-detail[data-stlg-editor="3d"] .stlg-detail-actions{background:var(--stlg-ui-panel);border:0;border-top:1px solid var(--stlg-ui-line);border-radius:0;box-shadow:none;backdrop-filter:none;padding:12px 16px;gap:8px;color:var(--stlg-ui-text);scrollbar-color:var(--stlg-ui-line) transparent}
.stlg-shell.stlg-state-detail[data-stlg-editor="3d"] .stlg-detail-actions-row{gap:10px}
.stlg-form.stlg-shell.stlg-state-detail[data-stlg-editor="3d"] .stlg-detail-actions-row .stlg-submit.button.button-primary{min-height:44px;border-radius:8px;background:var(--stlg-brand)!important;background-image:none!important;border-color:var(--stlg-brand)!important;box-shadow:none;padding:0 20px}
.stlg-form.stlg-shell.stlg-state-detail[data-stlg-editor="3d"] .stlg-detail-actions-row .stlg-submit.button.button-primary:hover{background:var(--stlg-brand-hover)!important;border-color:var(--stlg-brand-hover)!important}
.stlg-form.stlg-shell.stlg-state-detail[data-stlg-editor="3d"] .stlg-detail-actions-row .stlg-download-trigger.button{min-height:44px;border-radius:8px;background:var(--stlg-ui-field)!important;border-color:var(--stlg-ui-line)!important;color:var(--stlg-ui-text)!important;box-shadow:none;padding:0 20px}
.stlg-form.stlg-shell.stlg-state-detail[data-stlg-editor="3d"] .stlg-detail-actions-row .stlg-download-trigger.button:hover{background:var(--stlg-ui-field)!important;border-color:var(--stlg-brand)!important;color:var(--stlg-ui-text)!important}
.stlg-shell[data-stlg-editor="3d"] .stlg-detail-actions .stlg-queue-panel{margin:0;padding:10px 0 0;background:transparent;border:0;border-top:1px solid var(--stlg-ui-line);border-radius:0;min-width:0;gap:8px}
.stlg-shell[data-stlg-editor="3d"] .stlg-queue-title{color:var(--stlg-ui-text);font-size:13px}
.stlg-shell[data-stlg-editor="3d"] .stlg-queue-status-text,
.stlg-shell[data-stlg-editor="3d"] .stlg-queue-meta,
.stlg-shell[data-stlg-editor="3d"] .stlg-processing-note,
.stlg-shell[data-stlg-editor="3d"] .stlg-preview-note{color:var(--stlg-ui-muted)}
.stlg-shell[data-stlg-editor="3d"] .stlg-preview-note.is-error{color:#ff9f95}
.stlg-shell[data-stlg-editor="3d"] .stlg-queue-progress{height:6px;background:var(--stlg-ui-field)}
.stlg-shell[data-stlg-editor="3d"] .stlg-queue-progress-bar{background:var(--stlg-brand)}
.stlg-shell[data-stlg-editor="3d"] .stlg-queue-cancel{background:var(--stlg-ui-field);border:1px solid var(--stlg-ui-line);color:var(--stlg-ui-text);border-radius:6px}

/* Fullscreen frame/navigation stay dark independently of the editor mode. */
.stlg-shell.is-maximized.stlg-state-detail{padding:env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);border-radius:0;box-shadow:none}
.stlg-shell.is-maximized.stlg-state-detail .stlg-workspace{grid-template-columns:96px minmax(0,1fr);gap:0}
.stlg-shell.is-maximized.stlg-state-detail .stlg-selection{border:1px solid transparent;border-right-color:var(--stlg-ui-line);border-radius:0;background:var(--stlg-ui-shell)}
.stlg-shell.is-maximized.stlg-state-detail .stlg-detail,
.stlg-shell.is-maximized.stlg-state-detail .stlg-scene{border:0;border-radius:0}

.stlg-form.stlg-shell[data-stlg-editor="3d"] .stlg-detail-actions-row .button:focus-visible{outline:2px solid var(--stlg-brand);outline-offset:3px;box-shadow:none}
.stlg-shell[data-stlg-editor="3d"] .stlg-model-setting{color:var(--stlg-ui-text)}
.stlg-shell[data-stlg-editor="3d"] .stlg-model-setting input[type="checkbox"]{accent-color:var(--stlg-brand)}
/* Keep at least one scrollable tool visible when the progress dock is open. */
@media(max-height:650px){
    .stlg-shell[data-stlg-editor="3d"] .stlg-axis-compass{top:86px;width:76px;height:76px}
}

@media(max-height:450px){
    .stlg-shell[data-stlg-editor="3d"] .stlg-axis-compass{width:56px;height:56px}
}

/* Legacy owns a light content surface even inside the dark fullscreen frame. */
.stlg-shell[data-stlg-editor="legacy"] .stlg-field input[type="number"],
.stlg-shell[data-stlg-editor="legacy"] .stlg-field input[type="text"],
.stlg-shell[data-stlg-editor="legacy"] .stlg-field input[type="url"],
.stlg-shell[data-stlg-editor="legacy"] .stlg-field input[type="file"],
.stlg-shell[data-stlg-editor="legacy"] .stlg-field select,
.stlg-shell[data-stlg-editor="legacy"] .stlg-field textarea{background:#fff!important;color:var(--stlg-ink,#1f2933)!important;-webkit-text-fill-color:var(--stlg-ink,#1f2933)!important;caret-color:var(--stlg-ink,#1f2933)}
.stlg-shell.is-maximized.stlg-state-detail[data-stlg-editor="legacy"] .stlg-detail{background:#fffdf9;color:var(--stlg-ink)}
@media(max-width:820px){
    .stlg-shell.is-maximized.stlg-state-detail .stlg-workspace{grid-template-columns:minmax(0,1fr);gap:10px}
    .stlg-shell.is-maximized.stlg-state-detail .stlg-selection{border-right-color:transparent;border-bottom-color:var(--stlg-ui-line)}
    .stlg-shell.is-maximized.stlg-state-detail .stlg-card.is-active{box-shadow:inset 0 -3px 0 var(--stlg-brand)}
}
