/* Shared theme tokens; the saved System preference resolves in the boot script. */
html[data-zexir-resolved-theme="dark"] {
  color-scheme: dark;
  --z-page: #111111;
  --z-sidebar: #181818;
  --z-surface: #1c1c1c;
  --z-surface-muted: #222222;
  --z-surface-subtle: #222222;
  --z-line: #353535;
  --z-line-strong: #484848;
  --z-control: #2b2b2b;
  --z-menu-selected: #333333;
  --z-accent: #ededed;
  --z-surface-hover: #2b2b2b;
  --z-text: #ededed;
  --z-text-secondary: #ababab;
  --z-text-tertiary: #929292;
  --z-hairline: #353535;
  --z-hairline-soft: #2b2b2b;
  --z-shadow-menu: 0 16px 48px #0006;
  --z-action-gradient: #ededed;
  background: var(--z-page);
}
html[data-zexir-resolved-theme="dark"] body {
  background: var(--z-page) !important;
  color: var(--z-text) !important;
}
html[data-zexir-resolved-theme="dark"] ::selection { background: #515151; color: #fff; }
html[data-zexir-resolved-theme="dark"] * { scrollbar-color: #505050 transparent; }
html[data-zexir-resolved-theme="dark"] :is(.zexirai-boot-overlay,.app-boot-overlay) { background: #111 !important; }

/* Resolve legacy light-only overrides at the shell's actual surfaces. */
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(.viewport,#chat-scroller,#chat-container,.chat-header,.top-bar,.header,.header-bar,.input-region) {
  background: var(--z-page) !important;
  color: var(--z-text) !important;
  border-color: var(--z-hairline-soft) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace #sidebar,
html[data-zexir-resolved-theme="dark"] body.index-workspace #sidebar :is(.sidebar-header,.sidebar-top-nav,.sidebar-main-content,.sidebar-bottom,.sidebar-user-menu-wrap,.sidebar-profile-shell,.sidebar-footer,.sidebar-history,.sidebar-history-scroll,#sidebar-auth-slot,.sidebar-bottom-profile,#sidebarLockBtn) {
  background: var(--z-sidebar) !important;
  color: var(--z-text) !important;
  border-color: var(--z-hairline-soft) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace #sidebar :is(button,a,.sidebar-profile-name,.sidebar-chat-title,.chat-title,.history-title,.sidebar-section-label) {
  color: var(--z-text) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace #sidebar :is(.sidebar-nav-item,.sidebar-profile-btn,.sidebar-lock-btn,.history-item,.chat-item,.sidebar-history-item) {
  background: transparent !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace #sidebar :is(button,a,.history-item,.chat-item,.sidebar-history-item):hover {
  background-color: var(--z-surface-hover) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(#idleComposerBrand,.idle-composer-brand,#workspaceModeToggle,#temporaryChatBtn,#mobileSidebarBtn,#userInput,#modelPickerBtn,#selectedModelLabel,.model-picker-current,.message-content,.assistant-message,.markdown-body) {
  color: var(--z-text) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace #workspaceModeToggle {
  background: transparent !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(#workspaceModeToggle,#temporaryChatBtn):hover {
  background: var(--z-surface-hover) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace .input-region .composer,
html[data-zexir-resolved-theme="dark"] body.index-workspace .input-region .composer:is(:hover,:focus,:focus-within) {
  background: var(--z-surface) !important;
  color: var(--z-text) !important;
  border-color: #383838 !important;
  box-shadow: 0 2px 12px #0002 !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(.composer-body,#userInput) { background: transparent !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace #userInput::placeholder { color: #969696 !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace .input-region::before {
  background: linear-gradient(to bottom, #1110, #111b 55%, #111) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(.workspace-control-icon,.sidebar-icon,.settings-nav-icon,.workspace-sheet-close img,.settings-card-dismiss img,img[src^="/frontend/icons/ui/"]) { filter: invert(1) !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(#addContentBtn,#micBtn,#modelPickerBtn) {
  color: var(--z-text) !important;
  background: transparent !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(#addContentBtn,#micBtn,#modelPickerBtn):is(:hover,[aria-expanded="true"]) {
  background: var(--z-surface-hover) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace .model-picker-btn#modelPickerBtn:is(:hover,[aria-expanded="true"]) { background: var(--z-surface-hover) !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace #modelPickerMenu .thinking-effort-value { color: var(--z-text) !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace .input-region .composer #sendBtn:is(.record-idle,.ready,.streaming) { background: #ededed !important; color: #111 !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace .input-region .composer #sendBtn #btnIcon.workspace-control-icon { filter: none !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace #idleComposerBrand .idle-brand-text { color: var(--z-text) !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace #sendBtn:disabled { background: #414141 !important; color: #999 !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(#modelPickerMenu,#composerAddMenu,.thinking-picker-view,.sidebar-user-menu-panel,.sidebar-user-submenu,.chat-options-menu,.chat-context-menu,.response-more-menu,.workspace-settings-sheet,.workspace-settings-main,.modal-content,.modal-box) {
  background: var(--z-surface) !important;
  color: var(--z-text) !important;
  border-color: var(--z-hairline) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(#modelPickerMenu,#composerAddMenu,.sidebar-user-menu-panel,.sidebar-user-submenu,.chat-options-menu,.response-more-menu,.workspace-settings-sheet) :is(button,label,h1,h2,h3,strong,.row-title,.settings-row-title,.settings-label,.settings-nav-item,.model-name,.thinking-picker-title,.composer-add-menu-item,.sidebar-user-menu-item) {
  color: var(--z-text) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(#modelPickerMenu,#composerAddMenu,.sidebar-user-menu-panel,.sidebar-user-submenu,.workspace-settings-sheet) :is(button,.composer-add-menu-item,.sidebar-user-menu-item) {
  background-color: transparent !important;
  border-color: var(--z-hairline) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(#modelPickerMenu,#composerAddMenu,.sidebar-user-menu-panel,.workspace-settings-sheet) :is(button:hover,[aria-selected="true"],.settings-nav-item.active) {
  background-color: var(--z-surface-hover) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace .workspace-settings-nav { background: var(--z-sidebar) !important; border-color: var(--z-hairline) !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace .workspace-settings-sheet :is(.settings-row,.settings-list,.settings-section,.settings-security-card,.settings-usage-card,.settings-storage-card) {
  background: transparent !important;
  border-color: var(--z-hairline) !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace .workspace-settings-sheet :is(p,small,.row-copy,.settings-row-copy,.settings-row-description,.settings-nav-group-label,.settings-description,.settings-security-copy) { color: var(--z-text-secondary) !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(input:not([type="range"]):not([type="checkbox"]),textarea,select,.settings-select) {
  color: var(--z-text) !important;
  background-color: var(--z-surface-muted) !important;
  border-color: #414141 !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(.user-message .message-content,.user-message-bubble,pre,.code-block) { background: var(--z-surface-muted) !important; color: var(--z-text) !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace .message-content :is(p,li,h1,h2,h3,h4,code,blockquote) { color: inherit !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace.zexir-high-contrast :is(button,.composer,.workspace-settings-sheet,.sidebar-user-menu-panel) { border-color: #aaa !important; }

/* Shared non-chat pages, including the checkout reached from Plans. */
html[data-zexir-resolved-theme="dark"] body:not(.index-workspace) :is(.topbar,.about-topbar,.plugins-topbar,.checkout-topbar,.page-topbar) { background: #181818f2 !important; border-color: var(--z-hairline) !important; }
html[data-zexir-resolved-theme="dark"] body:not(.index-workspace) :is(.checkout-main,.checkout-summary,.checkout-gate,.panel,.card,.settings-card,.plugin-card,.auth-card) { background: var(--z-surface) !important; color: var(--z-text) !important; border-color: var(--z-hairline) !important; }
html[data-zexir-resolved-theme="dark"] body:not(.index-workspace) :is(h1,h2,h3,.brand,.plan-price,.feature-list) { color: var(--z-text); }
html[data-zexir-resolved-theme="dark"] body:not(.index-workspace) .primary-action { color: #111 !important; background: #ededed !important; }

html[data-zexir-resolved-theme="dark"] body.index-workspace #temporaryChatBtn .incognito-simple-icon::before { border-color: #dedede !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace #temporaryChatBtn[aria-pressed="true"] .incognito-simple-icon::before { background: #ededed !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace #temporaryChatBtn[aria-pressed="true"] .incognito-simple-icon::after { border-color: #111 !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace #sidebar :is(.sidebar-empty,.sidebar-history-empty-text,.sidebar-empty-copy) { color: #999 !important; }

html[data-zexir-resolved-theme="dark"] body.index-workspace .workspace-settings-nav img { filter: invert(1) !important; }
html[data-zexir-resolved-theme="dark"] body.index-workspace #workspaceSettingsTitle { border-color: var(--z-hairline) !important; }

html[data-zexir-resolved-theme="dark"] body.index-workspace :is(.workspace-login-sheet,.workspace-signup-sheet,.workspace-sheet-panel) {
  --white: #1c1c1c; --text-high: #ededed; --text-med: #b5b5b5; --text-low: #999;
  background: var(--z-surface) !important; color: var(--z-text) !important; border-color: var(--z-hairline) !important; box-shadow: 0 16px 48px #0005 !important;
}
html[data-zexir-resolved-theme="dark"] body.index-workspace :is(.workspace-login-sheet,.workspace-signup-sheet) :is(h1,h2,h3,label,.subtitle,.brand-title) { color: var(--z-text) !important; }

html[data-zexir-resolved-theme="dark"] body { min-height: 100dvh; }
html[data-zexir-resolved-theme="dark"] body:not(.index-workspace) .checkout-main { background: transparent !important; }
html[data-zexir-resolved-theme="dark"] body:not(.index-workspace) :is(.checkout-topbar a,.summary-head a,.feature-list li,.feature-list .material-symbols-rounded) { color: var(--z-text) !important; }
html[data-zexir-resolved-theme="dark"] body:not(.index-workspace) :is(.summary-head,.plan-price span,.checkout-gate p,.checkout-message,.payment-trust,.renewal-copy) { color: var(--z-text-secondary) !important; }
html[data-zexir-resolved-theme="dark"] body:not(.index-workspace) :is(.checkout-heading,.summary-total,.payment-trust) { border-color: var(--z-hairline) !important; }
/* Native cursor states do not need a mutation observer. Interactive controls
   keep the pointing hand before, during, and after their state changes. */
:is(button, a[href], summary, [role="button"], [role="tab"], [role="switch"],
  [role="checkbox"], [role="radio"], [role="menuitem"], [role="menuitemradio"],
  [role="menuitemcheckbox"], input[type="button"], input[type="submit"],
  input[type="reset"], input[type="checkbox"], input[type="radio"]):not(:disabled):not([aria-disabled="true"]),
:is(button, a[href], summary, [role="button"], [role="tab"], [role="switch"],
  [role="checkbox"], [role="radio"], [role="menuitem"], [role="menuitemradio"],
  [role="menuitemcheckbox"], input[type="button"], input[type="submit"],
  input[type="reset"], input[type="checkbox"], input[type="radio"]):not(:disabled):not([aria-disabled="true"]) * {
  cursor: pointer !important;
}

:is(button, input)[disabled], [aria-disabled="true"] {
  cursor: default !important;
}
