/* Only Atlas chrome is themed. Preview documents, images, canvases and website
   content keep their own colours. Null preserves the original appearance. */
html[data-interface-themed=true] { --muted:var(--ui-muted); --line:var(--ui-border); color-scheme:dark; }
html[data-interface-themed=true] body { color:var(--ui-text); }
html[data-interface-themed=true] body[data-atlas-shell=index] { --workspace-surface:var(--ui-base)!important; }
.colourPreview { background:var(--preview-interface,#07111d); }
html[data-interface-themed=true] body.focus:not(.fullscreen):not(.companion) #app { background:radial-gradient(ellipse at 50% 35%,var(--ui-base),var(--ui-deep) 75%); border-color:var(--ui-border); }
html[data-interface-themed=true] :is(.topbar,.glass,.overlay,#settingsPanel,.composer,.chatPanel,.richDialog,.recallDialog,#atlasSetup,#outputGallery,#galleryPreview,#backgroundManager,#newWorkspacePanel,#brainWispChat,#usageCard,#atlasBrainLauncher,#agentBar,.artifactCard,#approvalPanel,.toast) {
 background:linear-gradient(135deg,var(--ui-edge),var(--ui-base) 28%,var(--ui-deep) 80%,var(--ui-raised)) var(--ui-base)!important; border-color:var(--ui-border)!important; color:var(--ui-text);
}
html[data-interface-themed=true] :is(.panelHeading,.settingsSearchBar,.settingsNav,.richHeader,.richToolbar,.galleryToolbar,.galleryHeader,#setupNav,.wispMessage,.richWispChat,.bw-heading,#brainWispForm,#brainWispReference,.usageHeading,.usageFoot) {
 background:var(--ui-deep)!important; border-color:var(--ui-border)!important; color:var(--ui-text);
}
html[data-interface-themed=true] :is(.workspaceChoice,.workspaceAdd,.historyItem,.historyNew,.attachmentChip,.atlasResultCard,.richCard,.richDraft,.galleryCard,.galleryCardInfo,.aiCard,.aiAutoCard,.settingsConnection,.settingsAdvanced,.settingsShortcut,.settingsSearchResult,.setupTip,.setupGroup,.setupDetail,.setupTestResult) {
 background:linear-gradient(145deg,var(--ui-raised),var(--ui-base)) var(--ui-raised)!important; border-color:var(--ui-border)!important; color:var(--ui-text);
}
html[data-interface-themed=true] :is(.workspaceChoice[aria-pressed=true],.settingsNavButton[aria-current=page],.galleryTab[aria-selected=true],.aiAutoCard.selected) {
 background:linear-gradient(145deg,var(--ui-hover),var(--ui-raised)) var(--ui-hover)!important; color:var(--ui-text)!important;
}
html[data-interface-themed=true] :is(.workspaceName,.settingHint,.settingsPageHeading p,.settingsConnection small,.settingsNavButton,.modelStatus,.quietHint,.version,.galleryEyebrow,.richSubtitle,.richSource,.richNote,.richStatus,.setupLead,.setupTip,.setupHelp,.setupDisclosure) { color:var(--ui-muted); }
html[data-interface-themed=true] :is(button:not(#brainWispLight):not(#orbHelloBtn),.smallButton,.iconButton,.pill,.modeChip,.settingsPage .smallButton,.polish-bar button) {
 background:linear-gradient(145deg,var(--ui-raised),var(--ui-base)) var(--ui-raised); color:var(--ui-text); border-color:var(--ui-border);
}
html[data-interface-themed=true] :is(button,.smallButton,.iconButton,.pill,.modeChip):hover:not(:disabled) { background:linear-gradient(145deg,var(--ui-hover),var(--ui-raised)) var(--ui-hover); }
html[data-interface-themed=true] :is(input:not([type=color]):not([type=checkbox]):not([type=radio]):not([type=range]),textarea,select,.settingsSearchBar #settingsSearch,.richSubjectInput,.richTitleInput,.richDraft[contenteditable]) {
 background:var(--ui-deep)!important; color:var(--ui-text)!important; border-color:var(--ui-border)!important;
}
html[data-interface-themed=true] :is(input,textarea)::placeholder { color:var(--ui-subtle)!important; opacity:1; }
html[data-interface-themed=true] #composer textarea#input { background:transparent!important; box-shadow:none; }
/* Preserve the original material depth. The opaque dark underlay keeps bright
   wallpaper from bleaching the glass; its reflections and inset rim stay soft. */
html[data-interface-themed=true] .composer {
 background:linear-gradient(120deg,var(--ui-edge),var(--ui-base) 25%,var(--ui-deep) 74%,var(--ui-raised)) var(--ui-base)!important;
 box-shadow:inset 0 1px 1px #ffffff14,inset 0 -1px 1px #0005,0 6px 24px #0008,0 0 24px rgba(var(--workspace-rgb),.12);
 backdrop-filter:blur(24px);
}
html[data-interface-themed=true] .chatPanel { background:linear-gradient(135deg,var(--ui-base),var(--ui-deep) 75%) var(--ui-base)!important; }
html[data-interface-themed=true] :is(.topbar,.pill,.modeChip) { box-shadow:inset 0 1px 1px #ffffff0a,0 3px 10px #0003; }
html[data-interface-themed=true] .sendButton svg { stroke:var(--ui-text)!important; }
html[data-interface-themed=true] #allowAction { color:var(--ui-text); }
html[data-interface-themed=true] :is(.message.user,.bw-user,.wispMessage.user) { background:var(--ui-raised); color:var(--ui-text); }
html[data-interface-themed=true] .colourPreview { background:var(--preview-interface,var(--ui-base)); }
/* Primary/accent remain independent highlights and status colours remain semantic. */
html[data-interface-themed=true] :is(.workspaceChoice[aria-pressed=true],button[aria-pressed=true],.settingsNavButton[aria-current=page],button.primary) { border-color:var(--workspace-accent,var(--accent,var(--ui-border))); }
html[data-interface-themed=true] :is(button,input,textarea,select):focus-visible { outline:2px solid var(--ui-text); outline-offset:2px; }
/* The composer already has a rounded glass frame; do not draw a second,
   rectangular frame around its inner typing area. Other controls keep focus. */
html[data-interface-themed=true] #composer textarea#input:focus-visible { outline:none; outline-offset:0; }
html[data-interface-themed=true] :is(.danger,.error,button.danger) { color:#ffc4ca; }
/* Brain's graph and animated galaxy remain independently coloured. */
html[data-interface-themed=true] body[data-atlas-shell=brain] { background:var(--ui-deep); }
html[data-interface-themed=true] :is(.brain-titlebar,.subhead,#brainLibraryPane,#filters,.graph-footer,#details,#status,dialog,.library-head,.sidebar-foot,#selectionBar) { background:linear-gradient(135deg,var(--ui-base),var(--ui-deep)) var(--ui-base)!important; border-color:var(--ui-border); }
html[data-interface-themed=true] .universe { background:var(--ui-deep)!important; }
html[data-interface-themed=true] :is(.item,.library-item,#importList>div,.bw-heading) { background:var(--ui-raised); }
html[data-interface-themed=true] :is(.fine,.capacity,.sidebar-foot p,.subhead,.graph-footer,#workspaceName,#selectionHint,.bw-status) { color:var(--ui-muted); }
/* Studio shell only: #viewport is the separate, sandboxed website view. */
html[data-interface-themed=true]:has(body[data-atlas-shell=website]),html[data-interface-themed=true] body[data-atlas-shell=website] { background:var(--ui-deep); }
html[data-interface-themed=true] body[data-atlas-shell=website] :is(.titlebar,.heading,.toolbar,.polish-bar,#wispRail,footer) { background:linear-gradient(135deg,var(--ui-base),var(--ui-deep)) var(--ui-base)!important; border-color:var(--ui-border); }
html[data-interface-themed=true] body[data-atlas-shell=website] .stage { background:var(--ui-deep); }
html[data-interface-themed=true] body[data-atlas-shell=website] :is(.polish-bar small,.website-revision-ai small) { color:var(--ui-muted); }
html[data-interface-themed=true] body:is([data-atlas-shell=todo-window],[data-atlas-shell=reminder-window]) { background:var(--ui-deep); border-color:var(--ui-border); }
html[data-interface-themed=true] body:is([data-atlas-shell=todo-window],[data-atlas-shell=reminder-window]) :is(header,footer,form,.reminderEditor) { background:linear-gradient(135deg,var(--ui-base),var(--ui-deep)) var(--ui-base); border-color:var(--ui-border); }
html[data-interface-themed=true] body:is([data-atlas-shell=todo-window],[data-atlas-shell=reminder-window]) :is(article,.reminderTime) { background:var(--ui-raised); border-color:var(--ui-border); }
html[data-interface-themed=true] body:is([data-atlas-shell=todo-window],[data-atlas-shell=reminder-window]) :is(article p,.empty,footer,.drag b,.workspace small,.reminderIntro) { color:var(--ui-muted); }
/* Inspector's capture area must remain transparent, even with a themed frame. */
html[data-interface-themed=true] body[data-atlas-shell=inspector] :is(header,nav,footer,#paused) { background:linear-gradient(135deg,var(--ui-base),var(--ui-deep)) var(--ui-base); border-color:var(--ui-border); }
@media (prefers-reduced-motion:reduce) { html[data-interface-themed=true] * { transition-duration:0s!important; } }
