/* Loaded last: all page families use one palette, including account/admin pages. */
:root{--theme-text:#f1f6ff;--theme-muted:#c5d2e5;--theme-link:#acd6ff;--theme-warning:#ffd1a8;--theme-success:#b9f3ca;--theme-error:#ffb8b4;--theme-border:rgba(194,217,247,.3);--theme-field:rgba(8,20,38,.8);--theme-soft:rgba(18,37,61,.72);--theme-solid:#15273e;--theme-surface:rgba(15,29,48,max(.68,var(--glass-opacity,.68)));--theme-user:rgba(36,75,96,.88);--theme-paper:#101828}
:root[data-background-theme=light]{color-scheme:light;--theme-text:#17283e;--theme-muted:#3f536c;--theme-link:#0755a6;--theme-warning:#7a3c0d;--theme-success:#176536;--theme-error:#a12224;--theme-border:rgba(39,67,102,.28);--theme-field:rgba(255,255,255,.85);--theme-soft:rgba(230,240,253,.82);--theme-solid:#f0f6ff;--theme-surface:rgba(248,251,255,max(.7,var(--glass-opacity,.7)));--theme-user:rgba(216,239,229,.92);--theme-paper:#edf3fa}
:root[data-background-theme],:root{--ink:var(--theme-text);--muted:var(--theme-muted);--line:var(--theme-border);--paper:var(--theme-paper);--panel:var(--theme-surface);--glass-bg:var(--theme-surface);--glass-border:var(--theme-border);--glass-surface:var(--theme-surface);--account-text:var(--theme-text);--account-muted:var(--theme-muted);--account-line:var(--theme-border)}
html:root body{color:var(--theme-text);background-color:var(--theme-paper)}
html:root body :is(.sidebar,.topbar,.panel,.results,.chat-panel,.chat-history,.chat-history.open,.modal,.chat-dialog,.auth-card,.profile-section,.profile-heading,.admin-section,.agreement-dialog){background:var(--theme-surface);color:var(--theme-text);border-color:var(--theme-border)}
html:root body :is(.profile-layout,.admin-layout),html:root body:is(.profile-page,.admin-page) .main-content{background:transparent}
html:root body :is(h1,h2,h3,h4,.brand strong,.crumb strong,.advanced-row b,.upload-zone b,.auth-brand strong,.quota-number,.code-header,.code-block,.code-block code,.code-block pre,.chat-bubble,.conversation-item,.agreement-body){color:var(--theme-text)}
html:root body :is(.brand span,.auth-brand span,.nav-item,.settings-link,.connection-pill,.side-section,.crumb,.crumb b,.eyebrow,.field-label,.field-label span,.advanced-row,.advanced-btn,.switch-label,.modal-desc,.privacy-note,.glass-setting small,.glass-setting output,.results-head p,.done-tag,.rail-title,.rail-title span,.result-count,.empty-state,.empty-state h3,.empty-state p,.upload-zone,.upload-zone small,.advanced-panel label,.chat-heading p,.chat-welcome,.model-picker,.request-picker,.history-date,.history-note,.chat-muted,.conversation-item small,.error-empty,.error-entry time,.reveal,.form-note,.auth-form label,.auth-form label small,.key-form label,.admin-form label,.profile-section p,.profile-heading p,.agreement-body p,.opacity-control,.opacity-control output,.usage-summary,.model-support-note,.model-feedback,.retention-notice){color:var(--theme-muted)}
html:root body :is(input:not([type=range]):not([type=checkbox]),select,textarea,.text-input,.custom-size,.advanced-panel input){background:var(--theme-field);color:var(--theme-text);border-color:var(--theme-border);caret-color:var(--theme-text)}
html:root body :is(input,textarea)::placeholder{color:var(--theme-muted);opacity:1}
html:root body select option{color:var(--theme-text);background:var(--theme-solid)}
html:root body :is(.ratio,.resolution-toggle,.resolution-toggle button,.chat-button,.ghost-btn,.close-btn,.icon-btn,.download,.model-fetch-button,.verification-row button,.admin-table button,.admin-pagination button,.agreement-heading button,.auth-tabs button,[data-reset-branding]){background:var(--theme-soft);color:var(--theme-text);border-color:var(--theme-border)}
html:root body :is(.ratio.active,.resolution-toggle button.active,.conversation-item.active,.nav-item.active,.sidebar nav .nav-item.active,.mode.active,.auth-tabs button.active){color:var(--theme-link);background:var(--theme-soft);border-color:var(--theme-link)}
html:root body :is(.mode,.mode small){color:var(--theme-muted)}
html:root body :is(.mode:hover,.nav-item:hover,.settings-link:hover,.chat-button:hover,.model-fetch-button:hover){color:var(--theme-link);background:var(--theme-soft)}
html:root body :is(.generate-btn,.primary-btn,.send-button,.auth-submit,.primary-link,.agreement-accept,.check-in-button){background:var(--theme-primary,#176dcc);color:var(--theme-on-primary,#fff);border-color:var(--theme-primary,#176dcc)}
html:root body :is(.glass-setting,.empty-state,.upload-zone,.history-rail,.result-card,.conversation-item,.opacity-control,.community-notice,.code-block,.code-header,.admin-table-wrap){background:var(--theme-soft);border-color:var(--theme-border)}
html:root body :is(.community-notice,.community-notice strong,.community-notice span){color:var(--theme-text)!important}
html:root body :is(.chat-bubble,.user .chat-bubble){background:var(--theme-field);color:var(--theme-text);border-color:var(--theme-border)}
html:root body .chat-bubble:before{border-right-color:var(--theme-field)}
html:root body .user .chat-bubble{background:var(--theme-user)}
html:root body .user .chat-bubble:before{border-left-color:var(--theme-user)}
html:root body :is(.admin-table th,.admin-table td,.admin-count,.admin-section-heading p,.admin-pagination){color:var(--theme-text);border-color:var(--theme-border)}
html:root body .admin-table th{background:var(--theme-solid)}
html:root body :is(.generated-image-link,.review-user-link,.usage-summary a,.usage-summary strong,.quota-number strong,.agreement-consent button,.empty-orbit,.upload-icon){color:var(--theme-link)}
html:root body :is(.resolution-hint,.image-save-notice,.image-page .results-head .image-save-notice,.form-feedback,.status-chip.warning){color:var(--theme-warning)!important}
html:root body :is(.message-error,#chatFeedback,#settingsFeedback,.model-feedback.error,.error-entry b,.error-entry p,.admin-table button.danger){color:var(--theme-error)}
html:root body :is(.model-feedback.success,.status-chip.success){color:var(--theme-success)}
html:root body .back-link{color:var(--theme-text);background:var(--theme-surface);padding:8px 12px;border-radius:6px}
html:root body :is(.status-chip.success,.status-chip.warning){background:var(--theme-soft)}
html:root body :is(.download-format-dialog,.review-item,.review-item>a){background:var(--theme-surface);color:var(--theme-text);border-color:var(--theme-border)}
html:root body :is(.download-format-head p,.download-format-options span,.review-caption time){color:var(--theme-muted)}
html:root body :is(.review-caption p,.download-format-options strong){color:var(--theme-text)}
html:root body :is(.download-format-head>button,.download-format-options button,.review-download,.code-header button){background:var(--theme-soft);color:var(--theme-text);border-color:var(--theme-border)}
html:root body :is(.review-delete,.download-format-feedback){color:var(--theme-error)}
html:root body .thinking-status{color:var(--theme-link)}
html:root body .thinking-status:before{border-color:var(--theme-border);border-top-color:var(--theme-link)}

/* Fixed presets override the sampled palette; wallpaper and its uploads stay independent. */
:root[data-ui-preset=black]{color-scheme:dark;--theme-text:#f5f5f5;--theme-muted:#cbcbcf;--theme-link:#e4e4eb;--theme-border:rgba(225,225,232,.26);--theme-field:rgba(15,15,18,.93);--theme-soft:rgba(46,46,51,.9);--theme-solid:#242428;--theme-surface:rgba(22,22,26,max(.86,var(--glass-opacity,.86)));--theme-user:rgba(57,57,64,.95);--theme-paper:#101012;--theme-primary:#e5e5eb;--theme-on-primary:#19191f}
:root[data-ui-preset=white]{color-scheme:light;--theme-text:#20232b;--theme-muted:#515763;--theme-link:#303946;--theme-border:rgba(63,73,90,.23);--theme-field:rgba(255,255,255,.97);--theme-soft:rgba(235,237,242,.94);--theme-solid:#f4f5f8;--theme-surface:rgba(255,255,255,max(.9,var(--glass-opacity,.9)));--theme-user:rgba(226,230,239,.97);--theme-paper:#f5f5f7;--theme-primary:#303846;--theme-on-primary:#fff}
:root[data-ui-preset=red]{color-scheme:dark;--theme-text:#fff3f2;--theme-muted:#efc8c5;--theme-link:#ffb9ae;--theme-border:rgba(255,177,167,.3);--theme-field:rgba(43,13,18,.95);--theme-soft:rgba(91,29,38,.93);--theme-solid:#48171e;--theme-surface:rgba(55,16,24,max(.88,var(--glass-opacity,.88)));--theme-user:rgba(113,38,48,.94);--theme-paper:#260e14;--theme-primary:#b93340;--theme-on-primary:#fff}
:root[data-ui-preset=blue]{color-scheme:dark;--theme-text:#f0f7ff;--theme-muted:#c3d8f0;--theme-link:#aad4ff;--theme-border:rgba(157,199,255,.3);--theme-field:rgba(7,24,48,.94);--theme-soft:rgba(20,53,93,.93);--theme-solid:#102c50;--theme-surface:rgba(12,32,62,max(.88,var(--glass-opacity,.88)));--theme-user:rgba(26,66,112,.95);--theme-paper:#08172d;--theme-primary:#2169c7;--theme-on-primary:#fff}
:root[data-ui-preset=purple]{color-scheme:dark;--theme-text:#faf3ff;--theme-muted:#deceee;--theme-link:#ddbcff;--theme-border:rgba(214,174,255,.3);--theme-field:rgba(28,14,46,.95);--theme-soft:rgba(66,35,99,.93);--theme-solid:#321c4f;--theme-surface:rgba(39,21,62,max(.88,var(--glass-opacity,.88)));--theme-user:rgba(81,46,119,.95);--theme-paper:#1d102e;--theme-primary:#8350bb;--theme-on-primary:#fff}
:root[data-ui-preset=pink]{color-scheme:light;--theme-text:#49233b;--theme-muted:#744d64;--theme-link:#97305f;--theme-border:rgba(156,69,112,.26);--theme-field:rgba(255,249,252,.97);--theme-soft:rgba(251,221,235,.94);--theme-solid:#fff0f6;--theme-surface:rgba(255,239,247,max(.92,var(--glass-opacity,.92)));--theme-user:rgba(247,206,225,.97);--theme-paper:#fff1f7;--theme-primary:#aa396d;--theme-on-primary:#fff}
