/* Dark theme (quiet, Notion/Obsidian-like). Every rule is scoped to :root[data-theme="dark"],
   so this file does nothing until theme.js sets the attribute. Load it after all other stylesheets. */

/* ---------- tokens ---------- */
:root[data-theme="dark"]{
  color-scheme:dark;
  --bg:#191919;--panel:#202020;--panel2:#252525;--line:#333333;--ink:#d4d4d4;--muted:#969696;
  --gold:#d4d4d4;--blue:#8fb8d8;--mint:#7fb8a2;--red:#e39a94;
  --text:#d4d4d4;--surface:#202020;--surface-alt:#2a2a2a;--hover:#2c2c2c;--border:#333333;
  --accent:#7fb8a2;--dk-raised:#252525;--dk-raised2:#2c2c2c;--dk-strong:#ececec;--dk-faint:#7a7a7a;
  --say:#b49be6;--say-bg:#2a2533;--say-head:#332b40;--quote:#9aa6ba;--quote-bg:#23262b;
  --mine:#7fb8a2;--mine-bg:#1f2a26;--mine-head:#26352f;--ai:#8faee6;--ai-bg:#212732;--ai-head:#283246;
  --dig:#d9a04a;--dig-bg:#2b2519;--mark:#5c5124;
  background:var(--bg);color:var(--ink);
  scrollbar-color:#4a4a4a #191919;
}
:root[data-theme="dark"] body{background:#191919;color:var(--ink)}
:root[data-theme="dark"] ::selection{background:#3d5a4f;color:#fff}
:root[data-theme="dark"] ::-webkit-scrollbar{width:11px;height:11px;background:#191919}
:root[data-theme="dark"] ::-webkit-scrollbar-thumb{background:#3a3a3a;border:3px solid #191919;border-radius:8px}
:root[data-theme="dark"] ::-webkit-scrollbar-thumb:hover{background:#4d4d4d}
:root[data-theme="dark"] img{filter:none}
:root[data-theme="dark"] .boot{background:#191919;color:var(--muted)}

/* ---------- form controls & buttons ---------- */
:root[data-theme="dark"] input,:root[data-theme="dark"] textarea,:root[data-theme="dark"] select{background:#202020;border-color:#383838;color:var(--ink)}
:root[data-theme="dark"] input:focus,:root[data-theme="dark"] textarea:focus,:root[data-theme="dark"] select:focus{outline-color:#4f7d6c}
:root[data-theme="dark"] input::placeholder,:root[data-theme="dark"] textarea::placeholder{color:#767676}
:root[data-theme="dark"] input[type=checkbox],:root[data-theme="dark"] input[type=radio]{accent-color:#7fb8a2}
:root[data-theme="dark"] option{background:#252525;color:var(--ink)}
:root[data-theme="dark"] .btn{background:#252525;border-color:#3a3a3a;color:var(--ink)}
:root[data-theme="dark"] .btn:hover,:root[data-theme="dark"] .btn.ghost:hover,:root[data-theme="dark"] .iconbtn:hover{background:#2f2f2f}
:root[data-theme="dark"] .btn.ghost{background:transparent;border-color:transparent}
:root[data-theme="dark"] .btn.primary{background:#2f6f5e;border-color:#2f6f5e;color:#f2f2f2}
:root[data-theme="dark"] .btn.primary:hover{background:#387d6a}
:root[data-theme="dark"] .iconbtn{color:var(--muted)}
:root[data-theme="dark"] .filter.active{background:#2c2c2c}
:root[data-theme="dark"] .pill,:root[data-theme="dark"] .managed-block,:root[data-theme="dark"] .asset-card{background:#252525}
:root[data-theme="dark"] kbd{background:#2a2a2a;border-color:#3a3a3a;color:#a8a8a8}

/* ---------- shell: sidebar, top bars, page tree ---------- */
:root[data-theme="dark"] .sidebar{background:#202020;border-right-color:#2c2c2c;box-shadow:none}
:root[data-theme="dark"] .workspace-icon{background:#2f2f2f}
:root[data-theme="dark"] .nav-item{color:#b4b4b4}
:root[data-theme="dark"] .nav-item:hover,:root[data-theme="dark"] .nav-item.active{background:#2c2c2c;color:#ececec}
:root[data-theme="dark"] .nav-item kbd,:root[data-theme="dark"] .nav-item em{color:#a8a8a8}
:root[data-theme="dark"] .sidebar-heading,:root[data-theme="dark"] .nav-caption{color:#939393}
:root[data-theme="dark"] .page-icon,:root[data-theme="dark"] .add-page,:root[data-theme="dark"] .tree-add,:root[data-theme="dark"] .tree-more{color:#a3a3a3}
:root[data-theme="dark"] .tree-chevron,:root[data-theme="dark"] .tree-leaf{color:#a3a3a3}
:root[data-theme="dark"] .page-tree-row:hover{background:#2a2a2a}
:root[data-theme="dark"] .page-tree-row:has(.page-item.active){background:#2b3531}
:root[data-theme="dark"] .page-tree-row:has(.page-item.active) .page-label{color:#f0f0f0}
:root[data-theme="dark"] .page-children{border-left-color:#333}
:root[data-theme="dark"] .page-group>summary:focus-visible{outline-color:#7fb8a2}
:root[data-theme="dark"] .favorite-pages .nav-item>span:first-child{color:#d0a85c}
:root[data-theme="dark"] .tree-guidance{color:#8f8f8f}
:root[data-theme="dark"] .drag-message{color:#8fb8d8}
:root[data-theme="dark"] .drag-message:not(:empty){background:#1f2a33}
:root[data-theme="dark"] .drop-before{box-shadow:inset 0 3px #7fb8a2}
:root[data-theme="dark"] .drop-after{box-shadow:inset 0 -3px #7fb8a2}
:root[data-theme="dark"] .drop-inside{background:#24352f!important;outline-color:#7fb8a2}
:root[data-theme="dark"] .tree-dig{border-color:#5a4826;color:#d9a04a}
:root[data-theme="dark"] .sidebar-menu>summary::after,:root[data-theme="dark"] .sidebar-menu-label{color:#8f8f8f}
:root[data-theme="dark"] .sidebar-menu:not([open])>summary.has-current{color:#ececec}
:root[data-theme="dark"] .sidebar-menu-list{border-left-color:#333}
:root[data-theme="dark"] .workspace-chip,:root[data-theme="dark"] .quick-capture{background:transparent}
:root[data-theme="dark"] .searchbox kbd{border-color:#3a3a3a}
:root[data-theme="dark"] .demo-banner{background:#252525;color:#c8c3b4;border-color:#333}
:root[data-theme="dark"] .topbar{background:#191919;border-color:#2a2a2a}
:root[data-theme="dark"] .crumb-divider{color:#8a8a8a}
:root[data-theme="dark"] .page-cover-icon{color:#7a7a7a}
:root[data-theme="dark"] .note-title-input{color:#ececec;background:transparent}
:root[data-theme="dark"] .note-title-input::placeholder{color:#5e5e5e}
:root[data-theme="dark"] .document-properties>summary,:root[data-theme="dark"] .document-extras>details>summary{color:#8f8f8f}
:root[data-theme="dark"] .body-editor{background:transparent;color:var(--ink)}
:root[data-theme="dark"] .body-editor::placeholder{color:#6c6c6c}
:root[data-theme="dark"] .panel{background:#202020}
:root[data-theme="dark"] .note-row:hover,:root[data-theme="dark"] .study-card:hover,:root[data-theme="dark"] .template-choice:hover,:root[data-theme="dark"] .child-page-link:hover{background:#252525}
:root[data-theme="dark"] .child-pages h3 span{color:#8a8a8a}
:root[data-theme="dark"] .child-pages>.row>.btn{background:#252525;border-color:#3a3a3a;color:#c4c4c4}
:root[data-theme="dark"] .workspace-navigation{background:#191919;border-bottom-color:#2a2a2a}
:root[data-theme="dark"] .workspace-navigation kbd{color:#a8a8a8}
:root[data-theme="dark"] .navigation-results button.active,:root[data-theme="dark"] .navigation-results button:hover{background:#2a2a2a}
:root[data-theme="dark"] .focus-reading .workspace-navigation [data-action="navigation-focus"]{background:#24312c;color:#a8d4c2}
:root[data-theme="dark"] .navigation-save{color:#949494}
:root[data-theme="dark"] .navigation-save[data-state="pending"]{color:#d4b06a}
:root[data-theme="dark"] .editor-meta-row>details{border-color:#2f2f2f!important;background:#202020!important}
:root[data-theme="dark"] .editor-meta-row>details[open]{background:#202020!important}
:root[data-theme="dark"] .editor-meta-row>details>summary{color:#a0a0a0!important}
:root[data-theme="dark"] .editor-meta-row>details>summary::before{color:#777}
:root[data-theme="dark"] .block-bar{border-color:#2f2f2f;background:#202020}
:root[data-theme="dark"] .block-bar-label{color:#8f8f8f}
:root[data-theme="dark"] .block-chip{color:#c4c4c4}
:root[data-theme="dark"] .block-chip:hover{background:#2a2a2a;border-color:#3a3a3a}
:root[data-theme="dark"] .block-chip i{color:#191919}
:root[data-theme="dark"] .block-mark i{background:#c9ad3c;color:#191919}
:root[data-theme="dark"] .editor-tool-menu[open]>summary{background:#2a2a2a}
:root[data-theme="dark"] .note-property-fields,:root[data-theme="dark"] .note-property-row{border-color:#2f2f2f}
:root[data-theme="dark"] .note-property-name small,:root[data-theme="dark"] .note-property-row>span,:root[data-theme="dark"] .property-status{color:#909090}
:root[data-theme="dark"] .note-property-message{color:#e39a94}

/* ---------- overlays: modals, popovers, menus, toast ---------- */
:root[data-theme="dark"] .modal-overlay{background:#000000a6}
:root[data-theme="dark"] .modal{background:#252525;border-color:#383838;box-shadow:0 18px 70px #000a;color:var(--ink)}
:root[data-theme="dark"] .modal input,:root[data-theme="dark"] .modal textarea,:root[data-theme="dark"] .modal select{background:#1e1e1e}
:root[data-theme="dark"] .search-result:hover,:root[data-theme="dark"] .search-result.search-active{background:#2f2f2f}
:root[data-theme="dark"] .page-picker-row:hover,:root[data-theme="dark"] .page-picker-row.active,:root[data-theme="dark"] .page-picker-row[aria-pressed=true]{background:#2f2f2f}
:root[data-theme="dark"] .shortcut-grid>div{background:#2a2a2a}
:root[data-theme="dark"] .slash-popover{background:#252525;color:var(--ink);border-color:#383838;box-shadow:0 10px 34px #0009,0 2px 6px #0006}
:root[data-theme="dark"] .slash-search-row,:root[data-theme="dark"] .slash-popover footer{border-color:#333}
:root[data-theme="dark"] .slash-search-row kbd,:root[data-theme="dark"] .slash-group,:root[data-theme="dark"] .slash-option small,:root[data-theme="dark"] .slash-popover footer,:root[data-theme="dark"] .slash-popover footer button,:root[data-theme="dark"] .slash-empty{color:#999}
:root[data-theme="dark"] .slash-option{color:var(--ink)}
:root[data-theme="dark"] .slash-option:hover,:root[data-theme="dark"] .slash-option.selected{background:#323232}
:root[data-theme="dark"] .slash-glyph{border-color:#3d3d3d;background:#1e1e1e;color:#bdbdbd}
:root[data-theme="dark"] .slash-popover input{background:transparent}
:root[data-theme="dark"] .block-menu{background:#252525;border-color:#383838;box-shadow:0 10px 30px #0009}
:root[data-theme="dark"] .block-menu button{color:var(--ink)}
:root[data-theme="dark"] .block-menu button:hover,:root[data-theme="dark"] .block-menu button:focus-visible{background:#323232}
:root[data-theme="dark"] .block-menu kbd{color:#a8a8a8;background:transparent;border:0}
:root[data-theme="dark"] .block-menu-label{border-top-color:#333;color:#8f8f8f}
:root[data-theme="dark"] .tree-menu,:root[data-theme="dark"] .link-choice{background:#252525;border-color:#383838;box-shadow:0 10px 30px #0009;color:#a8a8a8}
:root[data-theme="dark"] .tree-menu button,:root[data-theme="dark"] .link-choice button{color:var(--ink)}
:root[data-theme="dark"] .tree-menu button:hover,:root[data-theme="dark"] .tree-menu button:focus-visible,:root[data-theme="dark"] .link-choice button:hover{background:#323232}
:root[data-theme="dark"] .tree-menu button.danger{color:#ec9a92}
:root[data-theme="dark"] .tree-menu button.danger:hover{background:#3a2624}
:root[data-theme="dark"] .tree-menu button small,:root[data-theme="dark"] .link-choice kbd{color:#888}
:root[data-theme="dark"] .tree-menu hr{border-top-color:#333}
:root[data-theme="dark"] .icon-choice{background:#252525;border-color:#383838}
:root[data-theme="dark"] .icon-choice:hover,:root[data-theme="dark"] .icon-choice.active{border-color:#7fb8a2;background:#24312c}
:root[data-theme="dark"] .editor-tool-popover{background:#252525;border-color:#383838;box-shadow:0 9px 26px #0009}
:root[data-theme="dark"] .editor-tool-popover h3,:root[data-theme="dark"] .editor-tool-popover kbd,:root[data-theme="dark"] .editor-tool-popover>p{color:#939393}
:root[data-theme="dark"] .editor-tool-popover>p{border-top-color:#333}
:root[data-theme="dark"] .editor-tool-popover button{color:var(--ink)}
:root[data-theme="dark"] .editor-tool-popover button:hover,:root[data-theme="dark"] .editor-tool-popover button:focus-visible{background:#323232}
:root[data-theme="dark"] .format-bar{background:#333;box-shadow:0 6px 20px #0008}
:root[data-theme="dark"] .format-bar .fmt-mark{color:#1b1b1b}
:root[data-theme="dark"] #toast{background:#e8e8e8;color:#1b1b1b;box-shadow:0 6px 24px #0008}
:root[data-theme="dark"] .source-drawer{background:#202020;box-shadow:-3px 0 20px #0008}
:root[data-theme="dark"] .source-controls button{background:#2a2a2a;border-color:#3a3a3a;color:var(--ink)}
:root[data-theme="dark"] .source-pdf{background:#151515}
:root[data-theme="dark"] .source-text pre{background:#202020;color:var(--ink)}
:root[data-theme="dark"] .errorbar{background:#3a2422;color:#f0c4bf;border-color:#5c3330}
:root[data-theme="dark"] .conflict-box{border-color:#5c3330;background:#2a1f1e}
:root[data-theme="dark"] .folder-error,:root[data-theme="dark"] #bundle-edit-error,:root[data-theme="dark"] .filter-preview [role=alert],:root[data-theme="dark"] .filter-dialog-error,:root[data-theme="dark"] #db-column-error,:root[data-theme="dark"] #db-view-error,:root[data-theme="dark"] #db-view-manager-error,:root[data-theme="dark"] #db-view-reset-error,:root[data-theme="dark"] .md-import-error,:root[data-theme="dark"] #md-import-error,:root[data-theme="dark"] #routine-form-error,:root[data-theme="dark"] .inline-attachment-missing{color:#ec9a92!important}

/* find panel (find-replace.css already darkens the panel itself) */
:root[data-theme="dark"] .find-panel input[type="text"],:root[data-theme="dark"] .find-panel input[type="text"]:focus{background:#191919;border-color:#3a3a3a;color:var(--ink)}
:root[data-theme="dark"] .find-panel.no-results .find-query{background:#2c201e;border-color:#5c3330}
:root[data-theme="dark"] .find-panel .find-count,:root[data-theme="dark"] .find-panel .find-close,:root[data-theme="dark"] .find-panel .find-options{color:#a3a3a3}
:root[data-theme="dark"] .find-panel .find-btn{color:#d4d4d4}
:root[data-theme="dark"] .find-panel .find-btn:hover:not(:disabled){background:#2c2c2c;border-color:#3a3a3a}
:root[data-theme="dark"] .find-panel .find-btn:disabled{color:#5e5e5e}
:root[data-theme="dark"] .find-panel .find-error{color:#ec9a92}
:root[data-theme="dark"] ::highlight(find-match){background:#6b5a1e;color:#fff}
:root[data-theme="dark"] ::highlight(find-current){background:#f59e0b;color:#000}
:root[data-theme="dark"] .find-block-hit{background:#2b2519}

/* ---------- reading view ---------- */
:root[data-theme="dark"] .prose{color:var(--ink)}
:root[data-theme="dark"] .prose pre,:root[data-theme="dark"] .prose code{background:#252525;color:#dcdcdc}
:root[data-theme="dark"] .prose blockquote{color:#b8b8b8;background:#202020}
:root[data-theme="dark"] .code-block{border-color:#333}
:root[data-theme="dark"] .code-block-bar{background:#252525;color:#949494}
:root[data-theme="dark"] .body-preview{color:#d9d8d3}
:root[data-theme="dark"] .body-preview h1,:root[data-theme="dark"] .body-preview h2,:root[data-theme="dark"] .body-preview h4,:root[data-theme="dark"] .body-preview strong{color:#f0efea}
:root[data-theme="dark"] .body-preview h3{color:#a8d4c2}
:root[data-theme="dark"] .body-preview h2{border-top-color:#2f2f2f}
:root[data-theme="dark"] .body-preview h2::before{background:#7fb8a2}
:root[data-theme="dark"] .body-preview strong{background:linear-gradient(transparent 62%,#e6c94a33 62%)}
:root[data-theme="dark"] .body-preview li::marker{color:#8a8a8a}
:root[data-theme="dark"] .body-preview a,:root[data-theme="dark"] .body-preview sup.fn-ref a,:root[data-theme="dark"] .wiki-link,:root[data-theme="dark"] .page-chip{color:#8fc9b1;text-decoration-color:#8fc9b166}
:root[data-theme="dark"] .wiki-link.missing{color:#d9a27e}
:root[data-theme="dark"] .body-preview .md-cite a,:root[data-theme="dark"] .body-preview .fn-back,:root[data-theme="dark"] .body-preview .md-embed figcaption a{color:#8a8a8a}
:root[data-theme="dark"] .body-preview .md-cite a:hover{color:#8fc9b1}
:root[data-theme="dark"] .body-preview blockquote{background:#202225;border-left-color:#5f6b7d;color:#c4c4c4}
:root[data-theme="dark"] .body-preview blockquote p:last-child:not(:first-child){color:#999}
:root[data-theme="dark"] .body-preview hr.markdown-divider,:root[data-theme="dark"] .body-preview hr{border-color:#333;border-top-color:#333;background:none}
:root[data-theme="dark"] .body-preview del{color:#8a8a8a}
:root[data-theme="dark"] .body-preview code{background:#2a2a2a;color:#e6c3a8}
:root[data-theme="dark"] .body-preview pre,:root[data-theme="dark"] .body-preview .code-block pre{background:#202020;color:#dcdcdc}
:root[data-theme="dark"] .body-preview pre code{background:none;color:inherit}
:root[data-theme="dark"] .body-preview .footnotes{border-top-color:#333;color:#b4b4b4}
:root[data-theme="dark"] .body-preview .just-inserted{outline-color:#7fb8a266}
:root[data-theme="dark"] .body-preview .inline-attachment-embed img{box-shadow:0 0 0 1px #ffffff14}
:root[data-theme="dark"] .body-preview .inline-attachment-embed span{color:#8a8a8a}
:root[data-theme="dark"] .body-preview .md-link-card a{background:#202020;border-color:#333;color:var(--ink)}
:root[data-theme="dark"] .body-preview .md-link-card a:hover{background:#262626;border-color:#444}
:root[data-theme="dark"] .body-preview .md-embed iframe,:root[data-theme="dark"] .slide-zoom{background:#202020}
:root[data-theme="dark"] .body-preview .inline-deck{background:#202020;border-color:#333}
:root[data-theme="dark"] mark{background:#5c5124;color:#f3efdc}
/* highlights keep their hue but sink into the page so light text stays readable */
:root[data-theme="dark"] .body-preview mark,:root[data-theme="dark"] .document-mentions mark{background:#5c5124;color:#f3efdc}
:root[data-theme="dark"] .body-preview mark.em-mark{background:color-mix(in srgb,var(--em-color,#fff4b8) 30%,#191919);color:#f0efea}
:root[data-theme="dark"] .body-preview mark.em-level-5{box-shadow:inset 0 -2px 0 #e0675a88}
:root[data-theme="dark"] .heading-highlight{background:#3a3620;outline-color:#3a3620}
/* tables */
:root[data-theme="dark"] .markdown-table th,:root[data-theme="dark"] .markdown-table td,:root[data-theme="dark"] .body-preview th,:root[data-theme="dark"] .body-preview td{border-color:#333}
:root[data-theme="dark"] .markdown-table th,:root[data-theme="dark"] .body-preview th{background:#252525;color:#e6e6e6}
:root[data-theme="dark"] .markdown-table-scroll,:root[data-theme="dark"] .body-preview table{border-color:#333}
/* callouts */
:root[data-theme="dark"] .markdown-callout{--callout-color:#8fb8d8;--callout-background:#1f252a}
:root[data-theme="dark"] .markdown-callout.callout-note{--callout-color:#8fb8d8;--callout-background:#1f252a}
:root[data-theme="dark"] .markdown-callout.callout-tip{--callout-color:#8fcf96;--callout-background:#1f2820}
:root[data-theme="dark"] .markdown-callout.callout-question{--callout-color:#d9b46a;--callout-background:#2a2519}
:root[data-theme="dark"] .markdown-callout.callout-warning{--callout-color:#e69a82;--callout-background:#2c201c}
:root[data-theme="dark"] .markdown-callout.callout-example{--callout-color:#bba3dc;--callout-background:#262130}
:root[data-theme="dark"] .markdown-callout.callout-quote{--callout-color:#a8a8a8;--callout-background:#232323}
:root[data-theme="dark"] .markdown-callout.callout-say,:root[data-theme="dark"] .markdown-callout[data-callout="say"]{--callout-color:#b49be6;--callout-background:#2a2533}
:root[data-theme="dark"] .markdown-callout.callout-mine,:root[data-theme="dark"] .markdown-callout[data-callout="mine"]{--callout-color:#7fb8a2;--callout-background:#1f2a26}
:root[data-theme="dark"] .markdown-callout.callout-ai{--callout-color:#8faee6;--callout-background:#212732}
:root[data-theme="dark"] .body-preview .markdown-callout{color:#d9d8d3}
:root[data-theme="dark"] .body-preview .markdown-callout.callout-say,:root[data-theme="dark"] .body-preview .markdown-callout[data-callout="say"]{border-left-color:#9b7fe0}
:root[data-theme="dark"] .body-preview .markdown-callout.callout-mine,:root[data-theme="dark"] .body-preview .markdown-callout[data-callout="mine"]{border-left-color:#6aa891}
:root[data-theme="dark"] .body-preview .markdown-callout.callout-ai{border-left-color:#6f8fcc}
:root[data-theme="dark"] .body-preview .markdown-callout .callout-content,:root[data-theme="dark"] .body-preview .markdown-callout.callout-say .callout-content,:root[data-theme="dark"] .body-preview .markdown-callout.callout-mine .callout-content{color:#d9d8d3}
:root[data-theme="dark"] .body-preview .markdown-callout.callout-ai .callout-heading::before{background:#3f5f9a;color:#f2f2f2}
:root[data-theme="dark"] .body-preview .markdown-callout[data-callout="info"]{color:#a8a8a8}
:root[data-theme="dark"] .body-preview .markdown-dig,:root[data-theme="dark"] .dig-panel{color:#e6dcc6;background:#2b2519;border-color:#4d3f22;border-left-color:#d9a04a}
:root[data-theme="dark"] .dig-badge,:root[data-theme="dark"] .dig-panel h2 small{background:#b07a28;color:#fff}
:root[data-theme="dark"] .dig-item{border-bottom-color:#3d3322;color:var(--ink)}
:root[data-theme="dark"] .dig-item:hover{background:#332b1d}
:root[data-theme="dark"] .dig-item small{color:#b3a383}

/* ---------- in-place editing ---------- */
:root[data-theme="dark"] .body-preview.live-editable [data-src]:not(.live-edit-holder):hover{background:#212121;box-shadow:0 0 0 4px #212121}
:root[data-theme="dark"] .body-preview textarea.live-edit{background:#1f2724;border-left-color:#6aa891;color:#e4e4e4;caret-color:#a8d4c2}
:root[data-theme="dark"] .live-append{color:#8a8a8a}
:root[data-theme="dark"] .live-append:hover,:root[data-theme="dark"] .live-append:focus-visible{color:#d0d0d0}
:root[data-theme="dark"] .block-handle button{color:#9a9a9a}
:root[data-theme="dark"] .block-handle button:hover,:root[data-theme="dark"] .block-handle button:focus-visible{background:#2c2c2c;color:#cfcfcf}
:root[data-theme="dark"] .block-drop{background:#7fb8a2}
:root[data-theme="dark"] .write-backdrop mark{background:#5c5124}
:root[data-theme="dark"] .write-backdrop b{background:#3f3820}
:root[data-theme="dark"] .wl-quote{background:#23262b;box-shadow:inset 3px 0 #5f6b7d}
:root[data-theme="dark"] .wl-c-say{background:#2a2533;box-shadow:inset 4px 0 #9b7fe0}
:root[data-theme="dark"] .wl-c-say.wl-c-head{background:#332b40}
:root[data-theme="dark"] .wl-c-ai{background:#212732;box-shadow:inset 4px 0 #6f8fcc}
:root[data-theme="dark"] .wl-c-ai.wl-c-head{background:#283246}
:root[data-theme="dark"] [class*="wl-c-"]:not(.wl-c-say):not(.wl-c-ai){background:#242424;box-shadow:inset 3px 0 #666}
:root[data-theme="dark"] .wl-dig{background:#2b2519;box-shadow:inset 4px 0 #d9a04a}
:root[data-theme="dark"] .wl-h1,:root[data-theme="dark"] .wl-h2{background:linear-gradient(90deg,#24312c,transparent 75%);box-shadow:inset 4px 0 #7fb8a2}
:root[data-theme="dark"] .wl-h3{background:linear-gradient(90deg,#212b27,transparent 60%)}
:root[data-theme="dark"] .wl-code{background:#252525}
:root[data-theme="dark"] .table-edit,:root[data-theme="dark"] .table-edit-cell{color:var(--ink)}
:root[data-theme="dark"] .table-edit-btn,:root[data-theme="dark"] .table-edit-btn:disabled{background:#252525;border-color:#383838;color:#c4c4c4}
:root[data-theme="dark"] .table-edit-btn:hover,:root[data-theme="dark"] .table-edit-btn:focus-visible{background:#2f2f2f;color:#ececec}
:root[data-theme="dark"] .table-edit-btn[aria-pressed="true"]{border-color:#6aa891;background:#24312c;color:#a8d4c2}
:root[data-theme="dark"] .table-edit-label{color:#8a8a8a}
:root[data-theme="dark"] .table-edit-done,:root[data-theme="dark"] .table-edit-done:hover,:root[data-theme="dark"] .table-edit-done:focus-visible{background:#2f6f5e;border-color:#2f6f5e;color:#f2f2f2}
:root[data-theme="dark"] .table-edit-scroll,:root[data-theme="dark"] .table-edit-grid th,:root[data-theme="dark"] .table-edit-grid td{border-color:#333}
:root[data-theme="dark"] .table-edit-grid th{background:#252525}
:root[data-theme="dark"] .table-edit-cell:focus{background:#1f2724;box-shadow:inset 0 0 0 2px #6aa891}
:root[data-theme="dark"] .mobile-toolbar{background:#202020;border-top-color:#333;box-shadow:0 -2px 8px #0006}
:root[data-theme="dark"] .mobile-toolbar button{color:var(--ink)}
:root[data-theme="dark"] .mobile-toolbar button:active{background:#2f2f2f}
:root[data-theme="dark"] .mobile-toolbar .mt-slash,:root[data-theme="dark"] .mobile-toolbar .mt-done{color:#999}
:root[data-theme="dark"] .mobile-toolbar .mt-mark{background:linear-gradient(transparent 55%,#5c5124 55%)}

/* ---------- outlines ---------- */
:root[data-theme="dark"] .floating-outline,:root[data-theme="dark"] .floating-outline-panel{color:#a8a8a8}
:root[data-theme="dark"] .floating-outline-panel{background:#202020;border-color:#333;box-shadow:0 8px 28px #0008}
:root[data-theme="dark"] .floating-outline i{background:#4a4a4a}
:root[data-theme="dark"] .floating-outline button{color:#a8a8a8}
:root[data-theme="dark"] .floating-outline button:hover{color:#ececec;background:#2a2a2a}
:root[data-theme="dark"] .floating-outline button.current{color:#a8d4c2}
:root[data-theme="dark"] .floating-outline button.current i{background:#7fb8a2}
:root[data-theme="dark"] .document-outline{background:#202020}
:root[data-theme="dark"] .document-outline nav>div>button:hover{background:#2a2a2a}
:root[data-theme="dark"] .reading-outline{color:#a0a0a0}
:root[data-theme="dark"] .reading-outline nav{background:#202020}
:root[data-theme="dark"] .document-mentions article small{color:#d9a27e}
:root[data-theme="dark"] .document-embed{background:#1e1e1e;border-color:#333;border-left-color:#5c8a77}
:root[data-theme="dark"] .document-embed .document-embed{background:#232323}
:root[data-theme="dark"] .document-embed>header{border-bottom-color:#333}
:root[data-theme="dark"] .document-embed>header button{color:#8fc9b1}
:root[data-theme="dark"] .page-connections,:root[data-theme="dark"] .linked-database,:root[data-theme="dark"] .linked-row{border-color:#333}
:root[data-theme="dark"] .inline-attachment{background:#232323}
:root[data-theme="dark"] .inline-attachment:focus-visible{outline-color:#7fb8a2}

/* ---------- start screen ---------- */
:root[data-theme="dark"] .daily-start{color:var(--ink)}
:root[data-theme="dark"] .daily-action,:root[data-theme="dark"] .daily-panel{background:#202020;border-color:#2f2f2f}
:root[data-theme="dark"] .daily-action:hover{background:#252a27;border-color:#4f7d6c}
:root[data-theme="dark"] .daily-action span{color:#8fc9b1}
:root[data-theme="dark"] .daily-recent{color:var(--ink);border-bottom-color:#2f2f2f}
:root[data-theme="dark"] .daily-recent:hover{color:#a8d4c2}
:root[data-theme="dark"] .daily-demo,:root[data-theme="dark"] .backup-summary{background:#232323;color:#b4b4b4}
:root[data-theme="dark"] .daily-start button:focus-visible{outline-color:#7fb8a2}
:root[data-theme="dark"] .release-tag{color:#a8d4c2;background:#24312c;border-color:#2f4a40}
:root[data-theme="dark"] .start-capture{background:#202020;border-color:#333;box-shadow:none}
:root[data-theme="dark"] .start-capture:focus-within{border-color:#4f7d6c;box-shadow:0 0 0 3px #7fb8a21f}
:root[data-theme="dark"] .start-capture textarea{background:transparent;color:#e4e4e4}
:root[data-theme="dark"] .start-capture textarea::placeholder,:root[data-theme="dark"] .start-capture-hint{color:#7c7c7c}
:root[data-theme="dark"] .start-capture-bar{border-top-color:#2c2c2c}
:root[data-theme="dark"] .start-capture-target label,:root[data-theme="dark"] .start-chips-label{color:#a0a0a0}
:root[data-theme="dark"] .start-capture-target label:has(input:checked){background:#24312c;color:#a8d4c2}
:root[data-theme="dark"] .start-chips .start-chip{background:#202020;border-color:#333;color:var(--ink)}
:root[data-theme="dark"] .start-chips .start-chip:hover{background:#2a2a2a;border-color:#444}
:root[data-theme="dark"] .start-chips .start-chip.ghost{color:#a0a0a0}
:root[data-theme="dark"] .quote-panel p{color:#c4c4c4}
:root[data-theme="dark"] .heatmap span{background:#262626}
:root[data-theme="dark"] .heatmap span.filled{background:#4f7d6c}

/* ---------- calendar, lectures, slides ---------- */
:root[data-theme="dark"] .calendar-day,:root[data-theme="dark"] .week-name{background:#1e1e1e}
:root[data-theme="dark"] .calendar-day.off{background:#1a1a1a;color:#666}
:root[data-theme="dark"] .calendar-day.today{background:#1f2a33}
:root[data-theme="dark"] .cal-event{background:#22303b}
:root[data-theme="dark"] .today .day-label b{color:#191919}
:root[data-theme="dark"] .lecture-info{border-bottom-color:#2c2c2c}
:root[data-theme="dark"] .lecture-info label,:root[data-theme="dark"] .lecture-materials h2 small,:root[data-theme="dark"] .slide-deck-head small,:root[data-theme="dark"] .slide-label,:root[data-theme="dark"] .slide-empty,:root[data-theme="dark"] .slide-empty small{color:#8f8f8f}
:root[data-theme="dark"] .lecture-info input{background:#232323;color:var(--ink)}
:root[data-theme="dark"] .lecture-info input:focus{background:#1e1e1e;border-color:#444}
:root[data-theme="dark"] .lecture-drop-empty{border-color:#3a3a3a;color:#8f8f8f}
:root[data-theme="dark"] .asset-file-icon{background:#2a2a2a;color:#aaa}
:root[data-theme="dark"] .slide-toolbar{background:#202020ee;border-color:#333}
:root[data-theme="dark"] .slide-tools .active{background:#2f2f2f;color:#ececec}
:root[data-theme="dark"] .slide-card{border-bottom-color:#2c2c2c}
:root[data-theme="dark"] .slide-note{background:#202020;border-color:#333;color:var(--ink)}
:root[data-theme="dark"] .slide-note:focus{background:#1e1e1e;border-color:#444}
/* slide stages and drawing pads stay paper-white on purpose: ink colours are chosen for white. */

/* ---------- knowledge map ---------- */
:root[data-theme="dark"] .km-area{background:#202020;border-color:#333;color:#b4b4b4}
:root[data-theme="dark"] .km-area.active{background:#24312c;border-color:#5c8a77;color:#a8d4c2}
:root[data-theme="dark"] .km-search{border-color:#333}
:root[data-theme="dark"] .km-canvas{background:radial-gradient(circle at 50% 45%,#222 0,#1d1d1d 60%,#191919 100%);border-color:#2c2c2c}
:root[data-theme="dark"] .km-edge{stroke:#4a4a4a}
:root[data-theme="dark"] .km-edge.km-link{stroke:#6aa891}
:root[data-theme="dark"] .km-edge.km-parent{stroke:#555}
:root[data-theme="dark"] .km-node circle{stroke:#191919}
:root[data-theme="dark"] .km-node text{fill:#b4b4b4;stroke:#191919f0}
:root[data-theme="dark"] .km-node .km-label-strong{fill:#ececec}
:root[data-theme="dark"] .km-concept text{fill:#e8c770}
:root[data-theme="dark"] .km-node:hover circle,:root[data-theme="dark"] .km-node:focus circle,:root[data-theme="dark"] .km-picked circle{stroke:#ececec}
:root[data-theme="dark"] .km-legend{background:#202020d9;color:#a8a8a8}
:root[data-theme="dark"] .km-dot-note{background:#6aa891}
:root[data-theme="dark"] .km-line-link{border-top-color:#6aa891}
:root[data-theme="dark"] .km-side{background:#202020;border-color:#2f2f2f}
:root[data-theme="dark"] .km-side h3,:root[data-theme="dark"] .km-link{color:#8fc9b1}
:root[data-theme="dark"] .km-side h3 small,:root[data-theme="dark"] .km-suggest small,:root[data-theme="dark"] .km-stat,:root[data-theme="dark"] .km-occur p{color:#9a9a9a}
:root[data-theme="dark"] .km-chip{background:#2b2519;border-color:#4d3f22;color:#e8c770}
:root[data-theme="dark"] .km-chip small{color:#c9a35a}
:root[data-theme="dark"] .km-chip.km-bridge{background:#212732;border-color:#34405a;color:#a8bfe8}
:root[data-theme="dark"] .km-suggest,:root[data-theme="dark"] .km-occur{border-bottom-color:#2c2c2c}
:root[data-theme="dark"] .km-start{background:#212732;border-color:#34405a;border-left-color:#6f8fcc}
:root[data-theme="dark"] .graph-canvas{--ink:#e6e6e6;--muted:#a0a0a0}

/* ---------- research, reading bundles, databases ---------- */
:root[data-theme="dark"] .research-tools,:root[data-theme="dark"] .study-intro,:root[data-theme="dark"] .reading-guide,:root[data-theme="dark"] .understanding-panel,:root[data-theme="dark"] .analysis-inbox,:root[data-theme="dark"] .bundle-shelf,:root[data-theme="dark"] .bundle-wcard,:root[data-theme="dark"] .bundle-terms details,:root[data-theme="dark"] .bundle-activity details,:root[data-theme="dark"] .filter-group,:root[data-theme="dark"] .routine-open{background:#202020;border-color:#2f2f2f;color:var(--ink)}
:root[data-theme="dark"] .research-label,:root[data-theme="dark"] .source-questions summary,:root[data-theme="dark"] .analysis-origin,:root[data-theme="dark"] .paper-empty,:root[data-theme="dark"] .paper-status-row,:root[data-theme="dark"] .concept-link span:last-child,:root[data-theme="dark"] .method-paper-row p,:root[data-theme="dark"] .paper-reader .missing-method-fields,:root[data-theme="dark"] .bundle-tabs button,:root[data-theme="dark"] .bundle-shelf p,:root[data-theme="dark"] .bundle-shelf small,:root[data-theme="dark"] .bundle-step-nav button,:root[data-theme="dark"] .bundle-workflow,:root[data-theme="dark"] .bundle-hints,:root[data-theme="dark"] .bundle-memo,:root[data-theme="dark"] .bundle-takeaway small,:root[data-theme="dark"] .filter-group legend,:root[data-theme="dark"] .db-filter-summary,:root[data-theme="dark"] .routine-history time,:root[data-theme="dark"] .routine-period,:root[data-theme="dark"] .routine-template-list p,:root[data-theme="dark"] .drive-file small,:root[data-theme="dark"] .review-note-tools b,:root[data-theme="dark"] .db-view-manager small{color:#a0a0a0}
:root[data-theme="dark"] .learning-status,:root[data-theme="dark"] .evidence-details summary,:root[data-theme="dark"] .evidence-details .btn,:root[data-theme="dark"] .dynamic-reader summary,:root[data-theme="dark"] .answer-clue summary,:root[data-theme="dark"] .bundle-terms summary,:root[data-theme="dark"] .bundle-activity summary,:root[data-theme="dark"] .md-import-preview-link{color:#8fc9b1}
:root[data-theme="dark"] .learning-field,:root[data-theme="dark"] .understanding-field,:root[data-theme="dark"] .candidate-field>label,:root[data-theme="dark"] .batch-paper,:root[data-theme="dark"] .paper-reader,:root[data-theme="dark"] .paper-reader-title,:root[data-theme="dark"] .paper-reader-nav>a,:root[data-theme="dark"] .bundle-reader{color:var(--ink)}
:root[data-theme="dark"] .learning-field textarea,:root[data-theme="dark"] .understanding-field textarea{background:#1e1e1e}
:root[data-theme="dark"] .question-excerpt,:root[data-theme="dark"] #paper-section-summary,:root[data-theme="dark"] .evidence-details blockquote,:root[data-theme="dark"] .ai-review,:root[data-theme="dark"] .bundle-takeaway,:root[data-theme="dark"] .review-intent{background:#222;border-left-color:#5c8a77}
:root[data-theme="dark"] .paper-reader .pill,:root[data-theme="dark"] .candidate-columns>div,:root[data-theme="dark"] .bundle-workflow span,:root[data-theme="dark"] .review-reasons li,:root[data-theme="dark"] .filter-preview,:root[data-theme="dark"] .routine-preview,:root[data-theme="dark"] .markdown-tool-preview,:root[data-theme="dark"] #md-import-preview,:root[data-theme="dark"] .portable-preview,:root[data-theme="dark"] .portable-warnings,:root[data-theme="dark"] .filter-group .filter-group,:root[data-theme="dark"] .db-view-bar,:root[data-theme="dark"] .bundle-table-scroll th,:root[data-theme="dark"] .bundle-evidence .btn{background:#252525;color:var(--ink)}
:root[data-theme="dark"] .paper-reader-nav,:root[data-theme="dark"] .paper-section-card,:root[data-theme="dark"] .method-focus,:root[data-theme="dark"] .concept-link,:root[data-theme="dark"] .concept-suggestion,:root[data-theme="dark"] .inbox-row,:root[data-theme="dark"] .candidate-field,:root[data-theme="dark"] .method-paper-row,:root[data-theme="dark"] .answer-clue,:root[data-theme="dark"] .bundle-tabs,:root[data-theme="dark"] .bundle-analysis,:root[data-theme="dark"] .bundle-analysis section,:root[data-theme="dark"] .bundle-table-scroll,:root[data-theme="dark"] .bundle-table-scroll th,:root[data-theme="dark"] .bundle-table-scroll td,:root[data-theme="dark"] .bundle-activity,:root[data-theme="dark"] .dynamic-reading,:root[data-theme="dark"] .filter-rule,:root[data-theme="dark"] .routine-settings,:root[data-theme="dark"] .routine-history>button,:root[data-theme="dark"] .routine-template-list article,:root[data-theme="dark"] .drive-file,:root[data-theme="dark"] .course-record,:root[data-theme="dark"] .course-plan{border-color:#2f2f2f}
:root[data-theme="dark"] .bundle-tabs{background:#191919}
:root[data-theme="dark"] .bundle-tabs button[aria-current=page],:root[data-theme="dark"] .bundle-step-nav button[aria-current=step],:root[data-theme="dark"] .review-filters>button.active,:root[data-theme="dark"] .review-reasons li.selected{background:#24312c;border-color:#5c8a77;color:#a8d4c2}
:root[data-theme="dark"] .bundle-shelf:hover,:root[data-theme="dark"] .routine-history>button:hover{background:#252a27;border-color:#4f7d6c}
:root[data-theme="dark"] .bundle-hint:focus,:root[data-theme="dark"] .bundle-hint:hover{background:#3a3620}
:root[data-theme="dark"] .bundle-activity button[aria-pressed=true]{background:#2f6f5e;border-color:#2f6f5e;color:#f2f2f2}
:root[data-theme="dark"] .knowledge-meter{background:#2c2c2c}
:root[data-theme="dark"] .review-match small{color:#d9a27e;border-color:#4d3f22}
:root[data-theme="dark"] .filter-error,:root[data-theme="dark"] .portable-error{background:#2c201e;border-color:#5c3330;color:#f0b3ab}
:root[data-theme="dark"] .db-url-cell>a{color:#8fb8d8}
:root[data-theme="dark"] .db-table,:root[data-theme="dark"] .db-table th,:root[data-theme="dark"] .db-table td{border-color:#2f2f2f}
:root[data-theme="dark"] .dynamic-reader iframe{border-color:#333}
/* PDF pages and source iframes keep a white page; that is the document, not chrome. */
