/* Shared light/dark theme. Light leaves the existing SITU palette intact. */
:root { --ui-surface:#fbf6e8; --ui-surface-raised:#fffaf0; --ui-control:#f6efdc; --ui-text:#2d1d10; --ui-muted:#6e573a; --ui-border:rgba(70,50,30,.2); }
html[data-situ-theme="light"] { color-scheme:light; }
html[data-situ-theme="dark"] {
 color-scheme:dark;
 --ui-surface:#22252b; --ui-surface-raised:#2a2e35; --ui-control:#191c21; --ui-text:#f0f1f3; --ui-muted:#b2b8c2; --ui-border:#454b56;
 --parchment:#15171b; --parchment-warm:#1c1f24; --parchment-deep:#242831;
 --paper:var(--ui-surface); --paper-2:var(--ui-control);
 --ink-0:var(--ui-text); --ink-1:#dce0e6; --ink-2:var(--ui-muted); --ink-3:#a4acb8;
 --rule:#343a44; --rule-strong:var(--ui-border);
 --aura:#ff895c; --aura-bright:#ffa17d; --aura-deep:#ff895c; --aura-soft:rgba(255,137,92,.16); --aura-rgb:255,137,92;
 --shadow-card:0 8px 24px #0004,0 1px 3px #0003; --shadow-pop:0 18px 48px #0008;
}
.situ-theme-toggle { display:inline-flex; align-items:center; justify-content:center; gap:6px; flex-shrink:0; min-height:30px; padding:0 10px; border:1px solid var(--ui-border); border-radius:999px; background:var(--ui-surface); color:var(--ui-text); font:500 12px var(--f-body,system-ui); cursor:pointer; }
.design-tools .situ-theme-toggle { width:auto; padding:0 10px; color:var(--ui-text); }
.situ-theme-toggle:focus-visible { outline:2px solid var(--aura); outline-offset:3px; }
.situ-theme-toggle svg { width:15px; height:15px; flex-shrink:0; }
html[data-situ-theme="dark"] body { background:#15171b; color:var(--ui-text); }
html[data-situ-theme="dark"] .canvas-stage::before { background-image:radial-gradient(circle at 1px 1px,#61697955 1px,transparent 0); }
html[data-situ-theme="dark"] :is(.node,.node[data-type="actor"]) { background:var(--ui-surface); border-color:var(--ui-border); box-shadow:var(--shadow-card); }
html[data-situ-theme="dark"] .node.is-selected { border-color:var(--aura); box-shadow:0 0 0 1px var(--aura),var(--shadow-card); }
html[data-situ-theme="dark"] :is(.brand-pill,.rail,.drawer,.ctx-menu,.minimap,.agent,.tb-btn,.design-tools,.tripo-settings-panel,.situ-modal,.situ-image-viewer,.prompt-api-dialog) { background:var(--ui-surface); color:var(--ui-text); border-color:var(--ui-border); }
html[data-situ-theme="dark"] :is(.node textarea,.node input:not([type="checkbox"]):not([type="range"]):not([type="file"]),.node select,.agent textarea,.situ-modal input,.tripo-settings-panel select,.tripo-settings-panel input:not([type="checkbox"]):not([type="range"])) { background:var(--ui-control); color:var(--ui-text); border-color:var(--ui-border); }
html[data-situ-theme="dark"] :is(input,textarea)::placeholder { color:#a4acb8; }
html[data-situ-theme="dark"] :is(input,textarea,select):focus-visible { outline:2px solid var(--aura); outline-offset:2px; }
html[data-situ-theme="dark"] :is(.ig-model,.ig-size,.tripo-quality .tq-btn,.tripo-settings-open,.tripo-model-row select,.tripo-topology-buttons button,.situ-image-viewer button,.situ-modal button,.prompt-model-strip button) { background:var(--ui-surface-raised); color:var(--ui-text); border-color:var(--ui-border); }
html[data-situ-theme="dark"] :is(.tripo-quality .tq-btn.is-on,.tripo-topology-buttons button[aria-pressed="true"]) { color:var(--aura); border-color:var(--aura); background:var(--aura-soft); }
html[data-situ-theme="dark"] :is(.ig-gen,.tripo-gen,.marble-gen) { background:#101216; color:#f0f1f3; border:1px solid #59616e; }
html[data-situ-theme="dark"] :is(.ig-gen,.tripo-gen,.marble-gen):not(:disabled):hover { background:#31363e; border-color:var(--aura); }
html[data-situ-theme="dark"] .canvas-language-toggle { background:var(--ui-control); border-color:var(--ui-border); }
html[data-situ-theme="dark"] .design-tools .canvas-language-toggle button { color:var(--ui-muted); }
html[data-situ-theme="dark"] .design-tools .canvas-language-toggle button.is-active { background:#e1e5eb; color:#202329; }
html[data-situ-theme="dark"] :is(.agent-header,.agent-input-wrap,.agent-compose,.agent-msg,.agent-welcome,.tripo-short-note,.tripo-summary-row,.tripo-settings-panel header,.tripo-settings-panel footer,.situ-image-viewer header) { color:var(--ui-muted); border-color:var(--ui-border); }
html[data-situ-theme="dark"] .situ-toast { background:#2a2e35; color:#f0f1f3; border-color:var(--ui-border); }
html[data-situ-theme="dark"] :is(.situ-image-viewer,.prompt-api-dialog)::backdrop { background:#000b; }
html[data-situ-theme="dark"] :is(.sf-progress,.sf-skel) { background-color:var(--ui-control); }
html[data-situ-theme="dark"] .sf-progress-bar { background:var(--aura); }
html[data-situ-theme="dark"] :is(.field-error,[aria-invalid="true"]) { border-color:#ff9a8d; }
html[data-situ-theme="dark"] .field-error { color:#ff9a8d; }
/* No filters on media: original images, textures and model rendering retain their colors. */
@media(max-width:700px) { .situ-theme-toggle .situ-theme-label { display:none; } .design-tools .situ-theme-toggle { padding:0 7px; } }
html[data-situ-theme="dark"] :is(.pending-user,.hud-bc) { background:var(--ui-surface); color:var(--ui-text); border-color:var(--ui-border); }
/* The existing 3D extension declares the generate button with !important. */
html[data-situ-theme="dark"] .node [data-tripo-gen] { background:#101216!important; color:#f0f1f3!important; }
/* Primary actions: light fill stands out against the dark workspace. */
html[data-situ-theme="dark"] :is(.ig-gen,.tripo-gen,.marble-gen,.agent-send:not(.is-stop),.situ-modal-btn.primary,.btn--primary) {
 background:#e7e9ed!important;
 color:#20242b!important;
 border:1px solid #f0f1f3;
 box-shadow:0 1px 3px #0003;
}
html[data-situ-theme="dark"] :is(.ig-gen,.tripo-gen,.marble-gen,.agent-send:not(.is-stop),.situ-modal-btn.primary,.btn--primary):not(:disabled):hover {
 background:#ffffff!important;
 color:#171a20!important;
 border-color:#fff;
}
html[data-situ-theme="dark"] :is(.ig-gen,.tripo-gen,.marble-gen,.agent-send:not(.is-stop),.situ-modal-btn.primary,.btn--primary):focus-visible {
 outline:2px solid var(--aura);
 outline-offset:3px;
}
html[data-situ-theme="dark"] :is(.ig-gen,.tripo-gen,.marble-gen,.agent-send:not(.is-stop),.situ-modal-btn.primary,.btn--primary) i { color:inherit; }/* Palette switches are atomic; ordinary hover transitions resume on the next frame.
   Do not disable animations: active spinners and task indicators must keep running. */
html.situ-theme-switching,
html.situ-theme-switching *,
html.situ-theme-switching *::before,
html.situ-theme-switching *::after { transition:none!important; }
.situ-theme-toggle .situ-theme-label { display:inline-block; inline-size:3em; text-align:center; }
.design-tools .situ-theme-toggle:active { transform:none!important; }
@media(max-width:700px) { .situ-theme-toggle .situ-theme-label { display:none; } }
/* Split summary inherits the theme instead of the light-only brown text. */
html[data-situ-theme="dark"] .node .split-task-name { color:var(--ui-text); }
html[data-situ-theme="dark"] .node .split-task-date { color:var(--ui-muted); }
