@import url("/assets/design-tokens.css");
/* Night Depth: the approved home scene colors shared by all application surfaces. */
:root[data-theme="dark"] {
  --bg: var(--at-color-bg);
  --panel: var(--at-color-panel);
  --panel-2: var(--at-color-panel-2);
  --panel-strong: var(--at-color-panel-strong);
  --text: var(--at-color-text);
  --muted: var(--at-color-muted);
  --line: var(--at-color-line);
  --accent: var(--at-color-accent);
  --accent-strong: var(--at-color-accent-strong);
  --shadow: var(--at-color-shadow);
  color-scheme: dark;
}
html[data-theme="dark"] body { background: #07121e; color: var(--text); }
html[data-theme="dark"] body.dashboard-active,
html[data-theme="dark"] body.dashboard-active .depth-dashboard {
  background: radial-gradient(ellipse at 77% 25%, rgba(36, 102, 155, .35), transparent 36%),
    radial-gradient(ellipse at 25% 61%, rgba(23, 81, 121, .29), transparent 46%), #07121e;
  color: #f5faff;
}
html[data-theme="dark"] .depth-dashboard::before { box-shadow: inset 0 0 130px rgba(0, 5, 13, .24); }
html[data-theme="dark"] .depth-dashboard-scene {
  background: rgba(8, 25, 40, .22);
  box-shadow: inset 0 1px rgba(255,255,255,.2), inset 0 0 80px rgba(132,198,238,.05), 0 30px 90px rgba(0,7,20,.4);
}
html[data-theme="dark"] .depth-dashboard-scene::before { background: rgba(35, 104, 151, .18); }
html[data-theme="dark"] .depth-dashboard-scene::after { background: rgba(54, 94, 131, .17); }
html[data-theme="dark"] .depth-service-card {
  --card-tint: rgba(28, 58, 80, .46);
  --material-shadow: rgba(0, 10, 22, .3);
  background: linear-gradient(145deg, rgba(67,111,145,.4), rgba(18,42,60,.52));
  color: #f5faff;
  box-shadow: inset 0 1px rgba(255,255,255,.23), 0 18px 40px rgba(1,10,24,.26);
}
html[data-theme="dark"] .depth-service-card-title {
  background: rgba(9, 27, 43, .65); color: #f5faff; text-shadow: none;
}
html[data-theme="dark"] .depth-service-card :is(.depth-service-card-index,.depth-service-card-meta) { color: #d0e1ed; }
html[data-theme="dark"] .depth-service-card-action { background: rgba(81, 131, 164, .38); color: #d8edff; }
html[data-theme="dark"] .depth-dashboard-nav :is(a,button),
html[data-theme="dark"] .depth-dashboard-brand { color: #c1d4e4; }
html[data-theme="dark"] .depth-dashboard-nav :is(a,button):hover { color: #fff; }
html[data-theme="dark"] .depth-dashboard-services-menu {
  background: rgba(19, 43, 61, .9); border-color: var(--line); box-shadow: 0 18px 44px rgba(0,8,18,.4);
}
html[data-theme="dark"] .depth-dashboard-services-menu :is(a,strong) { color: #e1eff9; }
html[data-theme="dark"] .depth-dashboard-services-menu a:hover { background: rgba(115,188,229,.18); }
/* The switch and profile move as one pair into the home scene. */
html body.dashboard-active .depth-dashboard-profile-host .topbar-account-actions {
  position: static; display: flex; align-items: center; gap: 10px;
}
html body.dashboard-active .depth-dashboard-profile-host .topbar-polza-organization-billing { display: none; }
html[data-theme="dark"] body:is(.admin-active,.account-active,.data-active,.support-active) {
  --bg: #07121e; --panel: rgba(29,57,78,.48); --panel-2: rgba(34,66,88,.5);
  --panel-strong: rgba(39,75,99,.64); --text: #f5faff; --muted: #c1d4e4;
  --line: rgba(185,219,243,.27); --accent: #8ec8ff; --accent-strong: #b4dcff;
  --shadow: 0 22px 60px rgba(1,8,20,.3);
  background: #07121e;
}
html[data-theme="dark"] body:is(.admin-active,.account-active,.data-active,.support-active) .admin-depth-scene {
  background: radial-gradient(ellipse at 77% 25%, rgba(36,102,155,.35), transparent 36%), #07121e;
}
/* Expense summaries and table rows sit on the blue surface, not the page backdrop. */
html[data-theme="dark"] body:is(.admin-active,.account-active) .expense-summary-grid .expense-stat {
  background: var(--panel);
}
html[data-theme="dark"] body:is(.admin-active,.account-active)
:is(.expense-tools-row,.expense-user-row,.expense-key-service-table article) {
  background: transparent;
}
html[data-theme="dark"] body:is(.admin-active,.account-active) .expense-user-row:is(:hover,.selected) {
  background: color-mix(in srgb, var(--accent) 13%, var(--panel));
}
html[data-theme="dark"] body:is(.admin-active,.account-active,.data-active) :is(.admin-surface,.admin-panel,.account-panel,.data-panel),
html[data-theme="dark"] body.support-active .support-workspace {
  background: rgba(8,25,40,.32); border-color: rgba(185,219,243,.27);
  box-shadow: inset 0 1px rgba(255,255,255,.14), 0 24px 64px rgba(0,8,20,.25);
  backdrop-filter: blur(22px) saturate(1.2);
}
html[data-theme="dark"] body.support-active {
  --support-ink:#f5faff; --support-muted:#c1d4e4;
  --support-line:rgba(185,219,243,.27); --support-surface:rgba(29,57,78,.48);
  --support-field:rgba(5,24,40,.47); --support-control:rgba(78,121,150,.24); --support-accent:#8ec8ff;
}
html[data-theme="dark"] body.serov-tool-shell-active {
  --tool-shell-ink: #f5faff; --tool-shell-muted: #c1d4e4;
  background: #07121e;
}
html[data-theme="dark"] body.serov-tool-shell-active > .serov-tool-depth-scene {
  background: radial-gradient(ellipse at 77% 25%, rgba(36,102,155,.35), transparent 36%), #07121e;
}
html[data-theme="dark"] body.serov-tool-shell-active > .serov-tool-topbar {
  background: rgba(26,54,74,.48); border-color: rgba(185,219,243,.27);
  color: #f5faff; box-shadow: inset 0 1px rgba(255,255,255,.16), 0 16px 40px rgba(1,8,20,.24);
}
html[data-theme="dark"] body.serov-tool-depth-tool > .serov-tool-topbar,
html[data-theme="dark"] body.serov-tool-prompt-library > .serov-tool-topbar,
html[data-theme="dark"] body.serov-tool-image-generator > .serov-tool-topbar {
  background: transparent; border: 0; box-shadow: none;
}
html[data-theme="dark"] body.serov-tool-shell-active .serov-tool-topbar :is(a,button) { color: #e7f4ff; }
html[data-theme="dark"] body.serov-tool-shell-active .serov-tool-topbar :is(a,button):hover { background: rgba(96,151,188,.24); color: #fff; }
html[data-theme="dark"] body.serov-tool-shell-active .serov-tool-home,
html[data-theme="dark"] body.serov-tool-shell-active .serov-tool-home:hover { color: #f5faff !important; background: rgba(78,121,150,.24) !important; }
html[data-theme="dark"] body.serov-tool-shell-active :is(.serov-tool-service-menu,.serov-tool-dropdown,.serov-tool-billing-status) {
  background: rgba(19,43,61,.92); border-color: rgba(185,219,243,.27); color: #f5faff;
  box-shadow: inset 0 1px rgba(255,255,255,.16), 0 20px 48px rgba(1,8,20,.4);
}
html[data-theme="dark"] body.serov-tool-shell-active .serov-tool-service-menu a {
  background:transparent; border-color:transparent; box-shadow:none; color:#e1eff9;
}
html[data-theme="dark"] body.serov-tool-shell-active .serov-tool-service-menu a:is(:hover,:focus-visible) {
  background:rgba(115,188,229,.18); color:#fff;
}
html[data-theme="dark"] body.serov-tool-shell-active .serov-tool-service-menu-group strong { color:#c1d4e4; }
html[data-theme="dark"] body.serov-tool-shell-active .serov-tool-service-menu-group { border-color:rgba(185,219,243,.15); }
html[data-theme="dark"] body.serov-tool-shell-active :is(.serov-tool-module-title,.serov-tool-billing-label,.serov-tool-dropdown-summary span) { color: #c1d4e4; }
html[data-theme="dark"] body.serov-tool-shell-active .serov-tool-avatar { background: rgba(77,138,179,.48); color: #f5faff; }
html[data-theme="dark"] body.serov-tool-prompt-library {
  --site-bg: transparent; --site-panel: rgba(29,57,78,.48); --site-panel-2: rgba(34,66,88,.5);
  --site-text: #f5faff; --site-muted: #c1d4e4; --site-line: rgba(185,219,243,.27);
  --site-accent: #8ec8ff; --site-accent-strong: #b4dcff;
  --nav-panel-bg: rgba(14,40,59,.5); --nav-active-bg: rgba(71,118,150,.42);
  --nav-hover-bg: rgba(71,118,150,.3); --nav-rail: rgba(185,219,243,.2);
}
html[data-theme="dark"] body.serov-tool-prompt-library .sidebar { background: rgba(7,27,43,.38); border-color: rgba(185,219,243,.2); }
html[data-theme="dark"] body.serov-tool-prompt-library .surface > * { border-color: rgba(185,219,243,.27); }

html[data-theme="dark"] body.login-page { --text:#f5faff; --muted:#c1d4e4; --accent:#8ec8ff; background:#07121e; }
html[data-theme="dark"] body.login-page .login-depth-scene { background:#07121e; }
html[data-theme="dark"] body.login-page .login-panel { background:rgba(29,57,78,.48); border-color:rgba(185,219,243,.27); box-shadow:inset 0 1px rgba(255,255,255,.16),0 24px 52px rgba(1,8,20,.3); }
html[data-theme="dark"] body.login-page input:not([type="checkbox"]) { background:rgba(5,24,40,.47); border-color:rgba(177,215,241,.32); }
html[data-theme="dark"] body.login-page .primary-button { color:#07121e; }
html[data-theme="dark"] body.dashboard-active .account-login { color:#f5faff; }
html[data-theme="dark"] body.dashboard-active .account-balance { color:#c1d4e4; }
html[data-theme="dark"] .depth-service-card--facades .depth-service-card-visual { filter:brightness(.58) saturate(.82); }
html[data-theme="dark"] .depth-service-card--video-generator .depth-service-card-visual { color:#a8d7ea; }
html[data-theme="dark"] .depth-service-card--facades .depth-service-card-title { background:rgba(9,27,43,.74); }
/* Prompt Library's workspace styles explicitly set light aliases on body. */
html[data-theme="dark"]:not([data-embedded-library-picker]):not([data-embedded-library-preview]):not([data-embedded-prompt-constructor]) body.serov-tool-prompt-library {
  color-scheme:dark; color:#f5faff;
  --bg:transparent; --panel:rgba(29,57,78,.48); --panel-2:rgba(34,66,88,.5);
  --text:#f5faff; --ink:#f5faff; --muted:#c1d4e4;
  --line:rgba(185,219,243,.27); --accent:#8ec8ff; --accent-2:#b4dcff;
}
html[data-theme="dark"] body.serov-tool-prompt-library :is(.library-workspace-header h1,.page-toolbar-title h2,.prompt-card-body strong,.prompt-section-card-body strong) { color:#f5faff; }
html[data-theme="dark"] body.serov-tool-prompt-library :is(.library-workspace-header p,.page-toolbar-kicker,.prompt-grid-page > .muted,.prompt-card-author,.prompt-section-card-description,.sidebar-brand) { color:#c1d4e4; }
html[data-theme="dark"] body.serov-tool-prompt-library :is(.surface,.sidebar) {
  background:rgba(8,25,40,.32); border-color:rgba(185,219,243,.2);
  box-shadow:inset 0 1px rgba(255,255,255,.13),0 18px 45px rgba(1,8,20,.2);
}
html[data-theme="dark"] body.serov-tool-prompt-library :is(.nav-button.selected,.nav-add-btn,.prompt-command-search-input-row,.prompt-section-card,.prompt-grid .prompt-card,.prompt-archive-empty,.prompt-detail-loading-panel,.prompt-form-section,.prompt-create-form,.settings-panel,.description-panel) {
  background:rgba(29,57,78,.54); border-color:rgba(185,219,243,.27); color:#f5faff;
  box-shadow:inset 0 1px rgba(255,255,255,.12),0 10px 28px rgba(1,8,20,.16);
}
html[data-theme="dark"] body.serov-tool-prompt-library :is(input,textarea,select) {
  background:rgba(5,24,40,.6); border-color:rgba(177,215,241,.32); color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-prompt-library .prompt-card-preview.empty-preview {
  background:linear-gradient(135deg,rgba(19,60,86,.85),rgba(56,111,151,.6)); color:#e6f5ff;
}
html[data-theme="dark"] body.serov-tool-prompt-library .prompt-card-preview.empty-preview > .empty-preview-label {
  background:rgba(11,34,52,.6); border-color:rgba(185,219,243,.3); color:#e6f5ff;
}
html[data-theme="dark"] body.serov-tool-prompt-library .prompt-card-body strong { color:#f5faff; }
html[data-theme="dark"] body.serov-tool-prompt-library .prompt-section-card-body { color:#f5faff; }
html[data-theme="dark"] body.serov-tool-prompt-library :is(.nav-button,.nav-category-toggle,.nav-label,.prompt-grid-page .muted) { color:#c1d4e4; }
html[data-theme="dark"] body.serov-tool-prompt-library .nav-button.selected { color:#f5faff; }
html[data-theme="dark"] body.serov-tool-prompt-library :is(.prompt-command-search-input-row button,.prompt-grid-page button:not(.primary)) { color:#dcefff; }
/* DXF's local ice-glass rules are explicit colors, so scope their night equivalents here. */
html[data-theme="dark"] body.serov-tool-dxf-boundaries {
  --dxf-surface:rgba(29,57,78,.48); --card:rgba(29,57,78,.48);
  --card2:rgba(34,66,88,.5); --field:rgba(5,24,40,.66);
  --text:#f5faff; --muted:#c1d4e4; --line:rgba(185,219,243,.27);
  --a:#8ec8ff; --a2:#5dadf3; --label-text:#dcefff;
  --tab-off-bg:rgba(20,48,68,.68); --tab-off-text:#dcefff;
  --surface-tint:rgba(32,65,88,.45); --canvas-bg:#0b2233;
  --canvas-grid:rgba(135,190,224,.14);
  background:#07121e;
}
html[data-theme="dark"] body.serov-tool-dxf-boundaries :is(.app,.layout,.card) { color:#f5faff; }
html[data-theme="dark"] body.serov-tool-dxf-boundaries .app {
  background:rgba(8,25,40,.34); border-color:rgba(185,219,243,.27);
  box-shadow:inset 0 1px rgba(255,255,255,.15),0 24px 64px rgba(0,8,20,.28);
}
html[data-theme="dark"] body.serov-tool-dxf-boundaries :is(.layout > .card,.card,.head,.tabs,.preview .head,.drop,.check,.plot,.metric,.status) {
  background:rgba(29,57,78,.48); border-color:rgba(185,219,243,.27);
  color:#f5faff; box-shadow:inset 0 1px rgba(255,255,255,.12);
}
html[data-theme="dark"] body.serov-tool-dxf-boundaries :is(.tab,button.secondary,textarea,input,select) {
  background:rgba(5,24,40,.66); border-color:rgba(177,215,241,.32); color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-dxf-boundaries .tab.active { background:rgba(61,133,188,.7); color:#fff; }
html[data-theme="dark"] body.serov-tool-dxf-boundaries .canvaswrap,
html[data-theme="dark"] body.serov-tool-dxf-boundaries canvas {
  background-color:#0b2233;
  background-image:linear-gradient(rgba(135,190,224,.14) 1px,transparent 1px),linear-gradient(90deg,rgba(135,190,224,.14) 1px,transparent 1px);
  background-size:20px 20px;
}
html[data-theme="dark"] body.serov-tool-dxf-boundaries .drop { background:rgba(17,45,64,.58); }
html[data-theme="dark"]:has(body.serov-tool-image-generator) { background:#07121e; color-scheme:dark; }
html[data-theme="dark"] body.serov-tool-image-generator {
  --ink:#f5faff; --muted:#c1d4e4; --faint:#a4bfd1;
  --line:rgba(185,219,243,.27); --line-strong:rgba(185,219,243,.35);
  --border-strong:rgba(185,219,243,.44);
  --canvas:#07121e; --sidebar:rgba(14,40,59,.52);
  --surface:rgba(29,57,78,.48); --surface-muted:rgba(34,66,88,.5);
  --soft:rgba(54,91,119,.58); --white:rgba(42,77,101,.8);
  --blue:#8ec8ff; --blue-hover:#5dabed; --blue-active:#3984c1;
  --blue-soft:rgba(67,115,149,.38); --selected-soft:rgba(72,126,164,.45);
  --shadow-panel:0 16px 38px rgba(1,8,20,.24);
  --shadow:0 20px 48px rgba(1,8,20,.34);
  background:#07121e; color:#f5faff;
}
/* One glass surface per workspace panel; the result sits directly on it. */
html body.serov-tool-image-generator .board-layout :is(.project-nav,.inspector,.board-empty-canvas.has-generation) {
  background:var(--image-generator-surface);
}
html body.serov-tool-image-generator .board-layout :is(.latest-generation-frame,.latest-generation-image,.canvas-result-layer,.latest-generation-bar) {
  background:transparent;
  box-shadow:none;
  backdrop-filter:none;
  -webkit-backdrop-filter:none;
}
html[data-theme="dark"] body.serov-tool-image-generator :is(.board-layout,.board-workspace) {
  background:transparent; border-color:rgba(185,219,243,.27);
}
html[data-theme="dark"] body.serov-tool-image-generator .board-layout {
  background:transparent;
  box-shadow:none;
}
html[data-theme="dark"] body.serov-tool-image-generator :is(.nav-item.active,.inspector-model-guide) {
  background:var(--generator-chip,rgba(45,76,99,.28)); border-color:rgba(185,219,243,.25); color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-image-generator :is(.project-nav-projects,.setting-group,.board-composer,.reference-pane,.prompt-pane) { background:transparent; }
html[data-theme="dark"] body.serov-tool-image-generator .prompt-variant {
  background:linear-gradient(145deg,var(--generator-glass-highlight),transparent 62%),var(--image-generator-surface);
}
html[data-theme="dark"] body.serov-tool-image-generator :is(.board-empty-canvas:not(.has-generation),.board-empty,.reference-drop) {
  background:rgba(20,55,78,.18); border-color:rgba(185,219,243,.27); color:#e6f4ff;
}
html[data-theme="dark"] body.serov-tool-image-generator :is(input,textarea,select,.format-trigger,.segmented button,.nav-item,.project-item) {
  background:rgba(8,31,48,.56); border-color:rgba(185,219,243,.28); color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-image-generator .model-option {
  background:var(--generator-chip,rgba(45,76,99,.28)); border-color:var(--generator-glass-edge,rgba(182,216,239,.24));
}
html[data-theme="dark"] body.serov-tool-image-generator .model-option:hover {
  background:rgba(53,94,122,.40); border-color:rgba(185,219,243,.44);
}
html[data-theme="dark"] body.serov-tool-image-generator .model-option:has(input:checked) {
  background:rgba(58,111,150,.7); border-color:#8ec8ff;
  box-shadow:0 0 0 2px rgba(142,200,255,.16);
}
html[data-theme="dark"] body.serov-tool-image-generator :is(.prompt-pane,.reference-pane,.board-composer) textarea { background:rgba(5,24,40,.47); color:#f5faff; }
html[data-theme="dark"] body.serov-tool-image-generator :is(.inspector,.project-nav,.board-workspace) :is(h1,h2,h3,strong,label) { color:#f5faff; }
html[data-theme="dark"] body.serov-tool-image-generator :is(.prompt-library-trigger,.control[data-open-constructor],.project-picker-trigger,.upscale-trigger,.reference-primary-upscale,.reference-paste-compact,.prompt-tag-insert-button,.prompt-phrase-insert-button,.clear-prompt-button,.prompt-expand-button,#add-to-queue-button,.control.repeat-button,.inspector-model-guide-trigger,.provider-picker-trigger,#polza-key-source,.latest-generation-actions .control) {
  background:var(--generator-chip,rgba(45,76,99,.28)); border-color:var(--generator-glass-edge,rgba(182,216,239,.24)); color:#f5faff;
  box-shadow:inset 0 1px var(--generator-glass-edge,rgba(182,216,239,.24)),0 3px 9px var(--generator-glass-shadow,rgba(0,10,22,.16));
}
html[data-theme="dark"] body.serov-tool-image-generator :is(.latest-generation-actions .control,.reference-primary-upscale,.reference-paste-compact):not(:disabled):hover {
  background:var(--soft); border-color:var(--border-strong); color:var(--ink);
}
html[data-theme="dark"] body.serov-tool-image-generator .reference-add-tile {
  background:rgba(31,65,87,.68); border-color:rgba(185,219,243,.45); color:#d2bfff;
}
html[data-theme="dark"] body.serov-tool-image-generator .reference-add-tile:hover,
html[data-theme="dark"] body.serov-tool-image-generator .reference-add-tile:focus-visible {
  background:rgba(65,94,123,.78); border-color:#bfa9f2; color:#f0eaff;
}
html[data-theme="dark"] body.serov-tool-image-generator .reference-compact-remove {
  background:rgba(26,61,84,.96); border-color:rgba(185,219,243,.7); color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-image-generator .reference-compact-remove:hover,
html[data-theme="dark"] body.serov-tool-image-generator .reference-compact-remove:focus-visible {
  background:#8d3841; border-color:#f5c2c5; color:#fff;
}
html[data-theme="dark"] body.serov-tool-image-generator button:disabled { color:#a6bfd0; }
html[data-theme="dark"] body.serov-tool-shell-active .serov-tool-library-back {
  background:rgba(32,62,83,.55); border-color:rgba(185,219,243,.3); color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-facades .shell,
html[data-theme="dark"] body.serov-tool-seamless-textures .workspace-frame,
html[data-theme="dark"] body.serov-tool-material-textures .app,
html[data-theme="dark"] body.serov-tool-archdata-extractor .tool-landing {
  background:rgba(8,25,40,.26); border-color:rgba(185,219,243,.28);
  box-shadow:inset 0 1px rgba(255,255,255,.15),0 24px 64px rgba(0,8,20,.28);
}
html[data-theme="dark"] body.serov-tool-facades :is(.panel,.project-context,.mode-box,.generation-output-settings .price-box) {
  background:rgba(29,57,78,.48); border-color:rgba(185,219,243,.27);
  box-shadow:inset 0 1px rgba(255,255,255,.12),0 12px 32px rgba(1,8,20,.18);
}
html[data-theme="dark"] body.serov-tool-facades :is(select,input,textarea,.ghost,.mode-tab) {
  background:rgba(5,24,40,.58); border-color:rgba(185,219,243,.28); color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-seamless-textures {
  --texture-cropper-surface:rgba(29,57,78,.48); --bg:#07121e;
  --panel:rgba(29,57,78,.48); --panel2:rgba(34,66,88,.5);
  --text:#f5faff; --muted:#c1d4e4; --accent:#8ec8ff;
  --border:rgba(185,219,243,.27); --input-border:rgba(185,219,243,.32);
  --hint-bg:rgba(34,66,88,.5); --workspace-checker:rgba(135,190,224,.14);
  color-scheme:dark;
}
html[data-theme="dark"] body.serov-tool-seamless-textures :is(.panel,.toolbar,.tabs,.settings,.ai-panel,.hint) {
  background:rgba(29,57,78,.48); border-color:rgba(185,219,243,.27);
  box-shadow:inset 0 1px rgba(255,255,255,.12);
}
html[data-theme="dark"] body.serov-tool-seamless-textures :is(.btn,.file-label,select,input,textarea,.tab) {
  background:rgba(5,24,40,.6); border-color:rgba(185,219,243,.32); color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-seamless-textures :is(.btn:hover,.file-label:hover) { background:rgba(61,107,138,.5); }
html[data-theme="dark"] body.serov-tool-seamless-textures :is(.primary,.tab.active) { background:#4d9bd8; color:#061b2b; }
html[data-theme="dark"] body.serov-tool-seamless-textures :is(.workspace,.preview-wrap) {
  background-color:#0b2233;
  background-image:linear-gradient(rgba(135,190,224,.14) 1px,transparent 1px),linear-gradient(90deg,rgba(135,190,224,.14) 1px,transparent 1px);
  background-size:20px 20px;
}
html[data-theme="dark"] body.serov-tool-material-textures {
  --material-texture-surface:rgba(29,57,78,.48); --bg:#07121e;
  --panel:rgba(29,57,78,.48); --panel2:rgba(34,66,88,.5); --panel3:rgba(39,75,99,.55);
  --line:rgba(185,219,243,.27); --line-soft:rgba(185,219,243,.2);
  --border-strong:rgba(185,219,243,.35); --text:#f5faff; --muted:#c1d4e4;
  --accent:#8ec8ff; --accent-contrast:#061b2b;
  --tabs-bg:rgba(34,66,88,.5); --input-bg:rgba(5,24,40,.6);
  --btn-secondary-bg:rgba(34,66,88,.58); --preview-dark-bg:#0b2233;
  --shadow:0 16px 38px rgba(1,8,20,.24); color-scheme:dark;
}
html[data-theme="dark"] body.serov-tool-material-textures :is(.panel,.preview,.section,.preview-card,.magnifier-card,.metric,.render-status) {
  background:rgba(29,57,78,.48); border-color:rgba(185,219,243,.27); color:#f5faff;
  box-shadow:inset 0 1px rgba(255,255,255,.12);
}
html[data-theme="dark"] body.serov-tool-material-textures :is(.tab-btn,input,select,button.secondary,.quick-presets button,.map-download-item button,.download-all-row button) {
  background:rgba(5,24,40,.6); border-color:rgba(185,219,243,.3); color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-material-textures .tab-btn.active { background:#4d9bd8; color:#061b2b; }
html[data-theme="dark"] body.serov-tool-material-textures :is(#textureCanvasBox,#tilePreviewCanvasBox,.magnifier) {
  background-color:#0b2233;
  background-image:linear-gradient(rgba(135,190,224,.14) 1px,transparent 1px),linear-gradient(90deg,rgba(135,190,224,.14) 1px,transparent 1px);
  background-size:20px 20px;
}
html[data-theme="dark"] body.serov-tool-archdata-extractor {
  --archdata-ice-surface:rgba(29,57,78,.48);
  --archdata-ice-surface-strong:rgba(39,75,99,.68);
  --archdata-ice-line:rgba(185,219,243,.27);
  --bg:#07121e; --panel:rgba(29,57,78,.48); --panel-2:rgba(34,66,88,.5);
  --text:#f5faff; --muted:#c1d4e4; --line:rgba(185,219,243,.27);
  --accent:#8ec8ff; --accent-strong:#b4dcff; color-scheme:dark;
}
html[data-theme="dark"] body.serov-tool-archdata-extractor :is(.hero-block,.section-card,.feature-card,.site-card,.step-card,.format-card,.info-block) {
  background:rgba(29,57,78,.48); border-color:rgba(185,219,243,.27);
  box-shadow:inset 0 1px rgba(255,255,255,.12),0 12px 30px rgba(1,8,20,.16);
}
html[data-theme="dark"] body.serov-tool-archdata-extractor .btn-ghost { background:rgba(34,66,88,.5); color:#f5faff; }
html[data-theme="dark"] body.serov-tool-archdata-extractor .btn-accent { color:#061b2b; }
html[data-theme="dark"] body.serov-tool-archdata-extractor .step-body code { background:rgba(5,24,40,.58); }
html[data-theme="dark"]:has(body.node-ui-page) {
  --bg:#07121e; --dot:rgba(135,190,224,.1);
  --panel:rgba(29,57,78,.68); --panel-soft:rgba(34,66,88,.62);
  --ink:#f5faff; --muted:#c1d4e4; --quiet:#9db8cc;
  --line:rgba(185,219,243,.27); --line-strong:rgba(185,219,243,.35);
  --panel-float:rgba(19,43,61,.94); --panel-float-dense:rgba(19,43,61,.98);
  --icon-ink:#c1d4e4; --node-bg:rgba(29,57,78,.9); --node-border:rgba(185,219,243,.27);
  --connection-stroke:#8ec8ff; color-scheme:dark;
}
html[data-theme="dark"] body.node-ui-page {
  background:radial-gradient(ellipse at 77% 25%,rgba(36,102,155,.35),transparent 36%),#07121e;
}
html[data-theme="dark"] body.node-ui-page :is(.topbar,.tool-panel,.canvas,.node,.panel,.drawer) {
  border-color:rgba(185,219,243,.27);
}
html[data-theme="dark"] body.node-ui-page .canvas {
  background-color:#0b2233;
  background-image:radial-gradient(rgba(135,190,224,.2) 1px,transparent 1px);
}
html body.node-ui-page .topbar-actions archtools-theme-switch { margin-right:6px; }
html body.node-ui-page .topbar-actions .site-theme-switch { width:36px; height:36px; min-width:36px; min-height:36px; }
html body.node-ui-page .topbar-actions .site-theme-switch .theme-switch-sun { top:5px; left:5px; }
html body.node-ui-page .topbar-actions .site-theme-switch .theme-switch-moon { right:5px; bottom:5px; }
html[data-theme="dark"] body.serov-tool-building-height-analyzer {
  --bg:#07121e; --panel:rgba(29,57,78,.82); --panel-soft:rgba(34,66,88,.74);
  --text:#f5faff; --muted:#c1d4e4; --line:rgba(185,219,243,.27);
  --accent:#8ec8ff; --accent-strong:#b4dcff;
  --height-ice-surface:rgba(29,57,78,.72); --height-ice-strong:rgba(39,75,99,.78);
  --height-ice-line:rgba(185,219,243,.27);
}
html[data-theme="dark"] body.serov-tool-building-height-analyzer :is(.app,.sidebar,.map-shell) {
  background:radial-gradient(ellipse at 77% 25%,rgba(36,102,155,.25),transparent 36%),#07121e;
  color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-building-height-analyzer :is(.sidebar,.dropzone,.input-wrap,select,.stat,.source-option,.summary-stat,.ghost-button,.icon-button,.mobile-toggle,.selection,.summary-card,.legend) {
  background:rgba(29,57,78,.72); border-color:rgba(185,219,243,.27); color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-building-height-analyzer #themeToggle { display:none; }
html[data-theme="dark"] body.serov-tool-territory-researcher {
  background:radial-gradient(ellipse at 77% 25%,rgba(36,102,155,.35),transparent 36%),#07121e;
  color:#f5faff;
}
html[data-theme="dark"] body.serov-tool-territory-researcher > .serov-tool-topbar {
  background:rgba(19,43,61,.86); border-color:rgba(185,219,243,.27);
}
/* The map's source imagery stays in its own pane; darken tiles without changing drawn GeoJSON layers. */
html[data-theme="dark"] body.serov-tool-territory-researcher .leaflet-tile-pane { filter:invert(.87) hue-rotate(180deg) saturate(.65); }
html[data-theme="dark"] body.node-ui-page :is(.topbar-main,.topbar-actions,.tool-panel,.node,.tool-drag-preview,.topbar-popover,.credit-toast) {
  background:rgba(29,57,78,.68); border-color:rgba(185,219,243,.27);
  box-shadow:inset 0 1px rgba(255,255,255,.12),0 12px 28px rgba(1,8,20,.24);
}
html[data-theme="dark"] body.node-ui-page :is(.brand-chip,.project-name:hover,.icon-button:hover,.tool-search,.tool-item:hover,.tool-item.active,.right-rail button,.bottom-toolbar button,.bottom-toolbar select) {
  background:rgba(34,66,88,.7); border-color:rgba(185,219,243,.27); color:#f5faff;
}
html[data-theme="dark"] body.node-ui-page .canvas { background:rgba(8,25,40,.48); border-color:rgba(185,219,243,.27); }
html[data-theme="dark"] body.node-ui-page .canvas-stage {
  background:linear-gradient(rgba(135,190,224,.12) 1px,transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg,rgba(135,190,224,.12) 1px,transparent 1px) 0 0 / 28px 28px,
    rgba(8,25,40,.34);
}
html[data-theme="dark"] body.node-ui-page :is(.tool-list,.tool-search input,.topbar-main,.topbar-actions) { color:#f5faff; }
html[data-theme="dark"] body.node-ui-page .app-shell {
  background:radial-gradient(ellipse at 77% 25%,rgba(36,102,155,.35),transparent 36%),
    radial-gradient(ellipse at 25% 61%,rgba(23,81,121,.29),transparent 46%),#07121e;
}
@media (max-width:860px) {
  html body.node-ui-page .topbar { display:flex; flex-wrap:wrap; gap:4px; }
  html body.node-ui-page .topbar-actions { display:flex; margin-left:auto; }
  html body.node-ui-page .topbar-actions .polza-spend-pill { display:none; }
}
html[data-theme="dark"] body.serov-tool-shell-active {
  background:radial-gradient(ellipse at 77% 25%,rgba(36,102,155,.35),transparent 36%),
    radial-gradient(ellipse at 25% 61%,rgba(23,81,121,.29),transparent 46%),#07121e !important;
}
html[data-theme="dark"] body.serov-tool-shell-active::before {
  background:radial-gradient(circle at 73% 26%,rgba(43,126,183,.18),transparent 22%),
    radial-gradient(circle at 29% 72%,rgba(24,85,126,.13),transparent 28%);
}

/* Gallery keeps its SIO frame; Library owns its glass card surfaces. */
html[data-theme] body:is(.serov-tool-prompt-library, .serov-tool-gallery) {
  --sio-card-surface: #fbfdff;
}

/* Working overlays use a solid surface. Decorative scene translucency stays
   outside dialogs so page text cannot bleed into the controls. */
html body.serov-tool-shell-active {
  --overlay-surface: #f5f9fc;
  --overlay-ink: #263e50;
}
html[data-theme="dark"] body.serov-tool-shell-active {
  --overlay-surface: #173349;
  --overlay-ink: #f5faff;
}
@media (max-width:720px) {
  html[data-theme] body.serov-tool-shell-active :is(dialog, .format-menu, .model-health-popover) {
    background-color: var(--overlay-surface);
    color: var(--overlay-ink);
    backdrop-filter: none;
  }
  html body.serov-tool-shell-active dialog::backdrop { background: #03132199; }
  html[data-theme="dark"] body.serov-tool-image-generator { --white: #173349; }
  /* Content keeps its existing glass material at narrow widths. Only
     transient overlays above use an opaque surface for legibility. */
}
html body.serov-tool-archdata-extractor .mobile-installation > summary { display:none; }
@media (max-width: 720px) {
  html body.serov-tool-archdata-extractor .tool-landing { height: auto; overflow: visible; }
  html body.serov-tool-archdata-extractor :is(.hero-block,.section-card,.step-card,.info-block) { padding: 16px; }
  html body.serov-tool-archdata-extractor .mobile-installation > summary { display:flex; align-items:center; min-height:48px; padding:12px 16px; cursor:pointer; font-weight:700; }
  html body.serov-tool-archdata-extractor .mobile-installation > summary::after { content:'⌄'; margin-left:auto; }
  html body.serov-tool-building-height-analyzer .legend { max-width: 160px; font-size: 12px; }
  html body.serov-tool-territory-researcher .console { max-height: 96px; }
}
html[data-theme="dark"] body:is(.serov-tool-prompt-library, .serov-tool-gallery) {
  --sio-card-surface: #1d394e;
}
html[data-theme] body:is(.serov-tool-prompt-library, .serov-tool-gallery)
.grid .card[data-sio-approved="true"] {
  border: 3px solid transparent;
  background:
    linear-gradient(var(--sio-card-surface), var(--sio-card-surface)) padding-box,
    linear-gradient(135deg, var(--sio-gold-1, #b8860b), var(--sio-gold-2, #f2dc9b) 25%, var(--sio-gold-3, #d4af37) 52%, var(--sio-gold-2, #f2dc9b) 76%, var(--sio-gold-1, #b8860b)) border-box;
  box-shadow: 0 0 0 1px rgba(212,175,55,.3), 0 8px 20px rgba(100,81,41,.16);
}
html[data-theme] body:is(.serov-tool-prompt-library, .serov-tool-gallery)
.grid .card[data-sio-approved="true"]:is(:hover, :focus-within) {
  box-shadow: 0 0 0 2px rgba(212,175,55,.5), 0 12px 25px rgba(100,81,41,.2);
}
html[data-theme] body.serov-tool-prompt-library .prompt-grid .prompt-card {
  background:linear-gradient(145deg,var(--pc-highlight),transparent 62%),var(--pc-glass);
}
html[data-theme] body.serov-tool-prompt-library .prompt-grid .prompt-card.prompt-card--sio:not(.prompt-card--archived) {
  border-color:rgba(193,151,49,.78);
}
/* The account preference pauses decorative backgrounds across shared pages. */
html[data-background-motion="paused"] body::before,
html[data-background-motion="paused"] :is(.ambient-mesh, .ambient-blob),
html[data-background-motion="paused"] .dashboard-scene::before,
html[data-background-motion="paused"] .dashboard-scene::after {
  animation: none !important;
}
