:root{color-scheme:light}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;flex-shrink:0;width:44px;min-height:44px;padding:0;border:1px solid #d7dfd1;border-radius:8px;background:var(--paper)}
.theme-toggle:hover{background:var(--soft)}
.theme-icon-sun{display:none}
[data-theme="dark"] .theme-icon-moon{display:none}
[data-theme="dark"] .theme-icon-sun{display:block}
@media(max-width:560px){.topbar{gap:9px}}

:root[data-theme="dark"]{color-scheme:dark;--ink:#e3ecdf;--muted:#a6b7a7;--green:#a6cf87;--green-dark:#c2e5a7;--lime:#d9ed9c;--line:#344338;--page:#111a16;--paper:#19241e;--soft:#213026}
[data-theme="dark"] .sidebar,[data-theme="dark"] .sidebar-footer{background:#151f19}
[data-theme="dark"] .topbar{background:#152019}
[data-theme="dark"] .brand-mark{background:#294e3c}
[data-theme="dark"] .nav-button.active,[data-theme="dark"] .page-button.active{color:#142313}
[data-theme="dark"] .nav-button.active .nav-count{color:#243e23;border-color:#648653}
[data-theme="dark"] .sidebar-heading,[data-theme="dark"] .topic-group h3,[data-theme="dark"] .topic-total{color:#a6b6a0}
[data-theme="dark"] .topic-navigation{scrollbar-color:#4b5c4b transparent}
[data-theme="dark"] .topic-button:hover{background:var(--soft)}
[data-theme="dark"] .topic-button.active{background:#293b2d;border-color:#3b543d;color:#c7e4b8}
[data-theme="dark"] .sidebar-footer{color:#b4c9ab}
[data-theme="dark"] .breadcrumb{color:#acb8a6}
[data-theme="dark"] .breadcrumb strong{color:#d7e1d0}
[data-theme="dark"] .breadcrumb span{color:#6d7a67}
[data-theme="dark"] .eyebrow{color:#b0c6a2}
[data-theme="dark"] .collection-summary{border-color:var(--line)}
[data-theme="dark"] .collection-summary small{color:#b3c0a7}
[data-theme="dark"] .menu-toggle{color:#d5e1ce}
[data-theme="dark"] .search-box{background:var(--paper);color:#a9c29c;border-color:var(--line)}
[data-theme="dark"] .search-box:focus-within{border-color:#97b87d;box-shadow:0 0 0 3px #8cac6126}
[data-theme="dark"] .search-box input::placeholder{color:#a1ae99}
[data-theme="dark"] .search-box kbd{background:#26332a;color:#b2bca5}
[data-theme="dark"] .filter-control>span{color:#aab69f}
[data-theme="dark"] .filter-control select{background-color:var(--paper);color:#dce6d4}
[data-theme="dark"] .reset-filters{color:#b8c9aa}
[data-theme="dark"] .results-toolbar #result-detail{color:#abbca1}
[data-theme="dark"] .related-toggle{color:#b3c4a6}
[data-theme="dark"] .selected-topic{background:var(--soft);border-color:var(--line)}
[data-theme="dark"] .selected-topic p{color:#b4c3a8}
[data-theme="dark"] .question-card:hover{border-color:#637957}
[data-theme="dark"] .topic-pill{background:#2a3829;color:#bfd6ae}
[data-theme="dark"] .subtopic-label{color:#a8b99c}
[data-theme="dark"] .related-pill{background:#303528;color:#c6d4b4;border-color:#48543c}
[data-theme="dark"] .question-meta{color:#a8b79d}
[data-theme="dark"] .question-meta>span+span:before{color:#72806a}
[data-theme="dark"] .question-reference{color:#bfd0ac}
[data-theme="dark"] .marks{color:#b7c9a6}
[data-theme="dark"] .marks strong{color:#d8e8c6}
[data-theme="dark"] .scheme-link{color:#b2caa1;text-decoration-color:#6b8061}
[data-theme="dark"] .question-link,[data-theme="dark"] .primary-button,[data-theme="dark"] .skip-link{color:#142313}
[data-theme="dark"] .pagination{color:#b2c0a8}
[data-theme="dark"] .page-button,[data-theme="dark"] .empty-state,[data-theme="dark"] .paper-card{background:var(--paper)}
[data-theme="dark"] .page-button.active{background:var(--green)}
[data-theme="dark"] .empty-state{border-color:#52644b}
[data-theme="dark"] .page-footer{color:#abb99f}
[data-theme="dark"] .mini-mark{color:#b3c99c}
[data-theme="dark"] .source-details{background:var(--soft);color:#b8c7ad}
[data-theme="dark"] .independence-note{color:#abbaa1}
[data-theme="dark"] .library-intro>span,[data-theme="dark"] .library-intro p{color:#b8c7ac}
[data-theme="dark"] .paper-year h2 span,[data-theme="dark"] .paper-label,[data-theme="dark"] .paper-card p{color:#b3c4a5}
[data-theme="dark"] .paper-note,[data-theme="dark"] .erratum{color:#e9c683}
[data-theme="dark"] .paper-note:hover{color:#f8ddb1}
[data-theme="dark"] .qualification-switch{background:var(--soft);border-color:var(--line)}
[data-theme="dark"] .qualification-switch button{color:var(--muted)}
[data-theme="dark"] .qualification-switch button:hover{color:var(--ink)}
[data-theme="dark"] .qualification-switch button[aria-pressed="true"],[data-theme="dark"] .qualification-switch button[aria-pressed="true"]:hover{color:#142313}
[data-theme="dark"] .theme-toggle{border-color:var(--line)}
