/* Explicit night palette. PDF canvases and inserted images retain document colors. */
html[data-theme=dark]{color-scheme:dark;--bg:#111a16;--card:#1b2821;--text:#e0e9e2;--muted:#a6b9ab;--line:#354b3c;--green:#9dccaa;--green-dark:#b6dbbf;--green-light:#293e30;--red:#ff9f9f;--accent:#9dccaa}
html[data-theme=dark] body{background:var(--bg);color:var(--text)}
html[data-theme=dark] :is(.sidebar,.topbar,.login-card,.search-panel,.paper-card,.stat,.storage-card,.task-card,.discovery-basket,.modal,.modal-card,.dialog-card,.upload-dialog,.ai-notes-dialog){background:var(--card);border-color:var(--line);color:var(--text);box-shadow:none}
html[data-theme=dark] :is(h1,h2,h3,h4,.paper-title,.brand,.stat strong,.basket-paper-title,.task-title,.storage-card strong,.discovery-basket-heading){color:#e0e9e2}
html[data-theme=dark] :is(label,.muted,.page-heading p,.paper-authors,.paper-snippet,.paper-meta,.stat>span,.stat>div,.stat strong small,.scope-note,.search-info,.cvf-controls,.sidebar-bottom,.account-info span,#account-id,.side-label,.topbar,.api-chat-time,.discovery-basket-item small){color:var(--muted)}
html[data-theme=dark] :is(input,textarea,select){background:#142019;color:var(--text);border-color:#49604f}
html[data-theme=dark] :is(input,textarea)::placeholder{color:#91a999}
html[data-theme=dark] :is(.secondary,.discovery-tab,#discover-select-all,.pill,.text-button,.side-filter,.nav:not(.active),.reader-side-tab){background:transparent;color:#bad7c2;border-color:var(--line)}
html[data-theme=dark] :is(.secondary,.discovery-tab,.side-filter,.nav:not(.active)):hover{background:#293e30}
html[data-theme=dark] :is(.nav.active,.primary,.pill.active){background:#396a4b;border-color:#538364;color:#fff}
html[data-theme=dark] :is(.discovery-tab.active,.side-filter.active,.paper-card.is-picked,.notice,.direct-import,.private-badge,.source-badge,.tag,.note-status-badge,.paper-symbol,.reader-score-toggle,.discovery-basket-item,.api-chat-prompt){background:#253a2c;border-color:#45644d;color:#d0e7d5}
html[data-theme=dark] :is(.nav b,.side-filter b,.discovery-basket-heading>span){background:#314a39;color:#d4e5d7}
html[data-theme=dark] :is(.searchbox,.side-separator,.discovery-basket-item,.discovery-basket-heading,.cvf-controls,.search-panel){border-color:var(--line)}
html[data-theme=dark] :is(.reader-page,.reader-shell,.reader-workspace,.reader-panel,.reader-side,.reader-notes-panel,.api-chat-panel,.reader-header,.reader-topbar,.reader-sidebar,.reader-heading,.reader-side-tabs,.reader-titlebar,.reader-tabs,.reader-right,.reader-content,.pdf-toolbar,.annotation-toolbar,.notes-section,.notes-section-header,.note-section,.note-section-header,.rich-toolbar,.rich-editor-scroll,.rich-editor,.api-chat-heading,.api-chat-form,.api-chat-context,.api-chat-status,.translation-panel,.translation-card,.reader-score-panel){background:var(--card);color:var(--text);border-color:var(--line)}
html[data-theme=dark] :is(.rich-editor .tiptap,.rich-editor .ProseMirror){background:transparent;color:var(--text)}
html[data-theme=dark] :is(.rich-editor,.api-chat-answer) :is(h1,h2,h3,h4,h5,p,li,blockquote){color:inherit}
html[data-theme=dark] :is(.rich-editor,.api-chat-answer) :is(code,pre){background:#111c15;color:#d5e9da;border-color:var(--line)}
html[data-theme=dark] :is(.rich-editor,.api-chat-answer) table :is(th,td){border-color:#4a6251}
html[data-theme=dark] :is(.rich-editor,.api-chat-answer) th{background:#2b4032}
html[data-theme=dark] :is(.pdf-viewer,.pdf-reader-viewer,.reader-pdf-panel){background:#0b130e}
html[data-theme=dark] :is(.api-chat-message,.api-chat-answer,.api-chat-empty,.api-chat-form-actions,.api-chat-message-heading){color:var(--text);border-color:var(--line)}
html[data-theme=dark] :is(.error,.danger,.text-button.danger,.discovery-basket-item small.error){color:#ffabab}
html[data-theme=dark] :is(.theme-toggle,.theme-toggle:hover){background:#24362a;color:#d6eadb;border-color:#526e5b}
html[data-theme=dark] a:not(.primary):not(.paper-title):not(.nav):not(.brand){color:#abd3b7}
html[data-theme=dark] mark{background:#645b21;color:#fff3c4}
html[data-theme=dark] :is(.paper-card,.search-panel,.storage-card):hover{border-color:#5c7a65}
html[data-theme=dark] .api-chat-message.is-selected{background:#2b4433}
html[data-theme=dark] :is(.rich-editor,.api-chat-answer) [style*="color: rgb(37, 99, 235)"],html[data-theme=dark] :is(.rich-editor,.api-chat-answer) [style*="color: #2563eb"]{color:#83b8ff!important}
html[data-theme=dark] :is(.notes-column,.notes-heading,.notes-display-controls,.notes-bottom,.reader-hint,.reader-info,.reader-side-tabs,.note-section-title,.formula-composer,.pdf-context-menu){background:var(--card);color:var(--text);border-color:var(--line)}
html[data-theme=dark] .notes-section.active>.note-section-title{background:#2c4533;color:#c9e9d2;box-shadow:inset 3px 0 #90c9a0}
html[data-theme=dark] .note-section-title{background:#24382b;color:#c0d9c7}
html[data-theme=dark] :is(.notes-heading strong,.notes-heading span,.notes-times,.reader-hint,.notes-color-label,.rich-toolbar button,.notes-bottom){color:var(--muted)}
html[data-theme=dark] .reader-page button:not(.annotation-color):not(.primary){background:#263b2d;border-color:#47624f;color:#c5ddcd}
html[data-theme=dark] .reader-page button.danger{color:#ffabab}
html[data-theme=dark] .reader-page button.active:not(.annotation-color){background:#3b5b44;color:#e2f4e6}
html[data-theme=dark] :is(.notes-resizer,.notes-section-resizer,.reader-side-tabs){background:#24382b;border-color:var(--line)}

html[data-theme=dark] :is(.reader-sidebar-tabs,.notes-section-splitter,.notes-splitter,.notes-divider,.notes-section-handle){background:#24382b;border-color:var(--line)}
html[data-theme=dark] .reader-header-actions #reader-notes-toggle{background:#263b2d;color:#c5ddcd}
html[data-theme=dark] dialog{background:var(--card);color:var(--text);border-color:var(--line)}
