/* Theme controls are additive. The existing white theme keeps its own palette. */
.theme-toggle[data-theme-toggle]{display:inline-flex;align-items:center;justify-content:center;gap:7px;flex:0 0 auto;min-width:42px;min-height:40px;max-width:126px;padding:8px 11px;border:1px solid #91c8e1;border-radius:14px;background:#f6fcff;color:#234e69;font:700 12px/1.3 var(--body);box-shadow:inset 0 1px #fff,0 2px #2a83a51a;cursor:pointer}
.theme-toggle[data-theme-toggle]:hover{background:#fff5d7;border-color:#cfad59}
.theme-toggle[data-theme-toggle] :is(svg,.theme-toggle-icon){width:18px;height:18px;flex:0 0 18px}
.theme-toggle[data-theme-toggle]:focus-visible{outline:3px solid #8a541c;outline-offset:3px}
.theme-toggle[data-theme-toggle] .theme-sun{display:none}
html[data-theme=dark] .theme-toggle[data-theme-toggle] .theme-moon{display:none}
html[data-theme=dark] .theme-toggle[data-theme-toggle] .theme-sun{display:block}

html[data-theme=dark]{color-scheme:dark;--theme-bg:#0b1324;--theme-surface:#142238;--theme-raised:#1c2d46;--theme-input:#101d31;--theme-line:#334b65;--theme-text:#e7f0f7;--theme-muted:#a6bbcd;--theme-cyan:#9ddcf5;--theme-gold:#f1c969;--theme-coral:#ed8090;--theme-green:#89d5b3;--theme-warm:#302c25;--theme-error:#36232f;--theme-success:#18352f;--theme-shadow:inset 0 1px #ffffff07,0 4px #060e1b;--ink:var(--theme-text);--muted:var(--theme-muted);--paper:var(--theme-bg);--sky:var(--theme-surface);--sky-deep:var(--theme-cyan);--blue-soft:var(--theme-raised);--red:var(--theme-coral);--gold:var(--theme-gold);--line:var(--theme-line)}
html[data-theme=dark] body{background:var(--theme-bg);color:var(--theme-text)}
html[data-theme=dark] ::selection{background:#51758e;color:#fff}
html[data-theme=dark] :is(button,a,input,textarea,select,summary,[tabindex]):focus-visible{outline-color:var(--theme-gold);outline-offset:3px}
html[data-theme=dark] :where(main,dialog) :is(h1,h2,h3,h4,summary,legend){color:var(--theme-text);text-shadow:none}
html[data-theme=dark] :where(main,dialog) :is(p,small,dt,label){color:var(--theme-muted)}
html[data-theme=dark] :where(main,dialog) :is(dd,output){color:var(--theme-text)}
html[data-theme=dark] :where(main,dialog) a{color:var(--theme-cyan)}
html[data-theme=dark] :is(.eyebrow,.micro-label,.tiny-label,.quiet,.muted,.field-hint,.lede,.section-foot,.dialog-lede,.support-drafts,.timeline-date,.receipt-bottom,.balance-caption,.big-number>span,.record-banner div>span,.note small,.benefit p,.benefit-meta,.flow small,.flow-top,.flow-bottom,.record-aside p,.timeline p,.work-row div>span){color:var(--theme-muted)}
html[data-theme=dark] :is(.definition-list dt,.lookup-token h3 small,.work-row .row-tag,.row-number,.section-foot a,.text-button,.green-text,.icon-button){color:var(--theme-cyan)}
html[data-theme=dark] :is(.definition-list dd,.journey-value strong,.ledger-art b,.balance-split strong,.receipt-number){color:var(--theme-text)}
html[data-theme=dark] :is(.section,.section-foot,.work-list,.work-row,.saved-row,.definition-list>div,.balance-split,.lookup-token,.record-title,.timeline>li>div,.local-notes,.note,.benefit-meta,.receipt-header,.receipt-bottom,details){border-color:var(--theme-line)}

/* Header, mobile navigation and footer retain their existing layout. */
html[data-theme=dark] .preview{background:#101e32;color:var(--theme-muted)}
html[data-theme=dark] .preview-divider{color:#66829c}
html[data-theme=dark] .header{background:var(--theme-surface);border-color:var(--theme-line)}
html[data-theme=dark] .brand{color:var(--theme-text)}
html[data-theme=dark] .header :is(nav,#main-navigation){background:var(--theme-input);border-color:var(--theme-line);box-shadow:0 3px #060e1b}
html[data-theme=dark] .header nav a{color:var(--theme-muted)}
html[data-theme=dark] .header nav a:hover{background:var(--theme-raised);color:var(--theme-text)}
html[data-theme=dark] .header nav a[aria-current=page]{background:var(--theme-gold);color:#302718;box-shadow:inset 0 1px #fff4cb}
html[data-theme=dark] .header :is(.help-button,.menu-toggle,.header-community,.header-balance,.header-balance-hide){background:var(--theme-raised);border-color:var(--theme-line);color:var(--theme-text);box-shadow:0 2px #060e1b}
html[data-theme=dark] .header :is(.help-button,.menu-toggle,.header-community,.header-balance,.header-balance-hide):hover{background:#29435e;border-color:#6589a6}
html[data-theme=dark] .header .header-account{background:var(--theme-gold);border-color:#e2bc61;color:#302718;box-shadow:0 2px #6a542a}
html[data-theme=dark] .header .header-account:hover{background:#f6d98e}
html[data-theme=dark] .menu-toggle span{background:var(--theme-cyan)}
html[data-theme=dark] .menu-open .menu-toggle{background:#30465f;border-color:var(--theme-gold)}
html[data-theme=dark] .theme-toggle[data-theme-toggle]{background:var(--theme-input);color:var(--theme-cyan);border-color:var(--theme-line);box-shadow:0 2px #060e1b}
html[data-theme=dark] .theme-toggle[data-theme-toggle]:hover{background:#2b3b4a;border-color:var(--theme-gold)}
html[data-theme=dark] :is(footer,.site-footer,.site-footer.footer-compact){background:var(--theme-surface);color:var(--theme-muted);border-color:var(--theme-line)}
html[data-theme=dark] .site-footer :is(.footer-preview span,.footer-rights,.footer-links a,.footer-links button,.footer-rights button,.footer-bottom,.footer-group summary){color:var(--theme-muted);border-color:var(--theme-line)}
html[data-theme=dark] .site-footer :is(.footer-groups,.footer-group,.footer-rights,.footer-bottom){border-color:var(--theme-line)}
html[data-theme=dark] .site-footer :is(.footer-preview strong,.footer-group summary:hover,.footer-links a:hover,.footer-links button:hover){color:var(--theme-text)}
html[data-theme=dark] .footer-group summary::after{color:var(--theme-cyan);border-color:#58748f}
html[data-theme=dark] .footer-shortcuts a{background:var(--theme-raised);border-color:var(--theme-line);color:var(--theme-cyan);box-shadow:var(--theme-shadow)}
html[data-theme=dark] .footer-shortcuts a:hover{background:#29435e;border-color:#6589a6}
html[data-theme=dark] .site-footer .footer-bottom button[data-scroll-to=top],html[data-theme=dark] .back-top{background:var(--theme-raised)!important;color:var(--theme-cyan)!important;border-color:var(--theme-line)!important}

/* Home chapters, receipts and the original static product screens. */
html[data-theme=dark] :is(.page-heading,.joy-hero,.journey-chapter,.lookup-sheet){background:var(--theme-surface)}
html[data-theme=dark] :is(.page-heading .eyebrow,.page-heading .lede,.hero-eyebrow,.joy-copy>p,.hero-text-link,.hero-caption,.home-intro p,.journey-intro p,.mascot-copy p,.how-steps p,.faq-list p,.console-caption,.hero-disclosure,.journey-value p,.journey-value>span,.feature-caption p,.feature-index,.ledger-label,.ledger-art>div span,.ledger-check,.mascot-tag,.little-receipt div>span){color:var(--theme-muted)}
html[data-theme=dark] :is(.page-heading h1,.joy-copy h1,.journey-intro h2,.mascot-copy h2){color:var(--theme-text);text-shadow:none}
html[data-theme=dark] :is(.home-intro h2 span,.journey-intro h2 span){color:var(--theme-coral)}
html[data-theme=dark] :is(.hero-console,.product-feature,.feature-caption,.little-receipt,.ledger-art,.pass-art,.record-art>span,.mascot-stage,.faq-list details,.lookup-form,.sample-project,.record-banner,.note,.benefit,.benefit-body,.calculator,.cost-receipt,.work-row,.table-scroll){background:var(--theme-surface);border-color:var(--theme-line);box-shadow:var(--theme-shadow);color:var(--theme-text)}
html[data-theme=dark] body:not([data-page=home]) :is(.balance-sheet,.benefit-budget,.record-aside,.flow-sheet,.cost-receipt){background:var(--theme-surface);color:var(--theme-text);border-color:var(--theme-line);box-shadow:var(--theme-shadow)}
html[data-theme=dark] :is(.feature-ledger .feature-art,.feature-benefits .feature-art,.feature-records .feature-art,.benefit-art.blue,.benefit-art.green,.benefit-art.orange,.mascot-chapter,.mascot-film-section,.feature-film-layout){background:var(--theme-raised);color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme=dark] .feature-art::before,html[data-theme=dark] .benefit-art::before{background:#ffffff06}
html[data-theme=dark] :is(.signal-strip,.home-end){background:#302c30;color:var(--theme-text)}
html[data-theme=dark] :is(.home-end .eyebrow,.home-end p){color:#ddbdc5}
html[data-theme=dark] :is(.home-end h2 span,.joy-copy h1 span,.pass-art strong){color:var(--theme-gold)}
html[data-theme=dark] :is(.hero-sticker,.receipt-check,.feature-caption>span b){background:var(--theme-gold);color:#302718}
html[data-theme=dark] :is(.journey-stepper,.filters,.record-art i,.record-art>span,.evidence-note,.evidence-box,.support-drafts p,.page-guide details,.mascot-film-credit,.joy-hero .scroll-cue){background:var(--theme-raised);border-color:var(--theme-line);color:var(--theme-muted)}
html[data-theme=dark] :is(.journey-stepper button,.filters button){color:var(--theme-muted)}
html[data-theme=dark] :is(.journey-stepper button[aria-pressed=true],.filters button[aria-pressed=true]){background:var(--theme-gold);color:#302718;box-shadow:none}
html[data-theme=dark] :is(.mascot-film-copy h2,.mascot-film-copy p,.mascot-rights-note,.mascot-rights-note button){color:var(--theme-muted)}
html[data-theme=dark] :is(.feature-film-guide li>span,.feature-film-media,.mascot-film-frame){background:var(--theme-input);border-color:var(--theme-line);color:var(--theme-muted)}
html[data-theme=dark] .feature-film-guide li.is-active>span{background:#305d76;color:#e8f8ff;border-color:#7dbed8}

/* Component-local variables override the original white palettes at their source. */
html[data-theme=dark] .workbench{--wb-ink:var(--theme-text);--wb-muted:var(--theme-muted);--wb-line:var(--theme-line);--wb-blue:var(--theme-raised);--wb-cream:var(--theme-warm);--wb-red:var(--theme-coral)}
html[data-theme=dark] .cm-community{--cm-ink:var(--theme-text);--cm-muted:var(--theme-muted);--cm-blue:var(--theme-raised);--cm-line:var(--theme-line);--cm-cream:var(--theme-surface)}
html[data-theme=dark] .generator{--gen-ink:var(--theme-text);--gen-muted:var(--theme-muted);--gen-line:var(--theme-line)}
html[data-theme=dark] .practice-lab{--lab-line:var(--theme-line);--lab-muted:var(--theme-muted);color:var(--theme-text)}
html[data-theme=dark] .explorer{--ex-ink:var(--theme-text);--ex-muted:var(--theme-muted);--ex-line:var(--theme-line)}
html[data-theme=dark] .listings{--ls-ink:var(--theme-text);--ls-muted:var(--theme-muted);--ls-line:var(--theme-line)}
html[data-theme=dark] .roadmap{--rm-ink:var(--theme-text);--rm-muted:var(--theme-muted);--rm-line:var(--theme-line)}
html[data-theme=dark] .coin-exchange{--ce-ink:var(--theme-text);--ce-muted:var(--theme-muted);--ce-line:var(--theme-line);--ce-blue:var(--theme-cyan);--ce-gold:var(--theme-gold);--ce-green:var(--theme-green);--ce-red:var(--theme-coral)}
html[data-theme=dark] .nft-exchange{--nx-ink:var(--theme-text);--nx-muted:var(--theme-muted);--nx-line:var(--theme-line);--nx-paper:var(--theme-surface);--nx-blue:var(--theme-raised);--nx-gold:var(--theme-gold)}
html[data-theme=dark] :is(.chain-shell,.ea-panel,.ac-panel,.policies,.rh-panel){color:var(--theme-text)}

/* Panels and cards: checked against the selectors in each feature stylesheet. */
html[data-theme=dark] :is(.wb-panel,.wb-project-card,.cm-panel,.cm-composer,.cm-post,.cm-profile-card,.cm-account,.cm-side-note,.ac-wallet-summary,.ac-wallet-card,.gen-layer,.gen-settings,.gen-preview-grid article,.gen-export,.gen-reopen,.lab-panel,.lab-balances>div,.lab-asset-list article,.lab-nft-grid article,.lab-token-results article,.ex-card,.ex-coin,.ex-profile,.ex-collection,.ex-nft,.ex-connection,.chain-card,.chain-review,.ea-form,.ea-review,.ls-panel,.ls-identity,.ls-provider,.ls-destination,.rm-cost-section,.pol-document,.rh-panel,.rh-entry,.ce-market-panel,.ce-panel,.nx-collection-card,.nx-item-card,.nx-collection-header,.nx-stats>div,.nx-item-filters,.nx-order-table,.nx-detail,.nx-ranking,.nx-signal,.nx-sales-history,.nx-detail .nx-sales-history,.te-panel,.mc-shell){background:var(--theme-surface);border-color:var(--theme-line);box-shadow:var(--theme-shadow);color:var(--theme-text)}
html[data-theme=dark] :is(.wb-account,.wb-token-picker,.wb-token-shortcuts button,.wb-token-results button,.wb-swap-readiness,.cm-quoted,.cm-post .cm-composer,.cm-tombstone,.cm-profile-banner,.cm-attachment,.cm-socials a,.cm-photo-preview,.cm-chain-label,.cm-wallet-ready span,.ac-message-note,.ac-networks,.ac-native,.ac-data-notes,.ac-family-note,.gen-local-note,.gen-upload,.gen-icon-button,.lab-quote,.lab-clock,.lab-reset,.ex-notice,.ex-copy,.ex-nft-large,.ex-traits>div,.ex-provider,.ex-issued,.chain-toolbar,.chain-drafts,.chain-help,.chain-artwork,.recipient-import,.recipient-file,.recipient-summary li,.chain-handoff,.chain-traits,.ea-login,.ea-notice,.ls-lookup-help,.ls-manual form,.ls-notice,.ls-disclosure-state,.rm-disclosure-label,.pol-nav,.pol-section .pol-emphasis,.pol-fees,.mc-route,.mc-token-picker,.mc-token-option,.rh-transactions a,.ce-mode,.ce-period,.ce-preview-tag,.ce-side,.ce-amount-field,.ce-amount-presets button,.ce-receive,.nx-toolbar,.nx-tabbar,.nx-price-box,.nx-traits>div,.nx-ranking-period,.te-native-choice){background:var(--theme-raised);border-color:var(--theme-line);box-shadow:none;color:var(--theme-muted)}
html[data-theme=dark] :is(.wb-tabs,.cm-tabs,.lab-tabs,.ex-tabs,.chain-family-tabs,.ce-execution-modes){background:var(--theme-input);border-color:var(--theme-line)}
html[data-theme=dark] :is(.wb-tabs a,.cm-tabs a,.lab-tabs button,.ex-tabs a,.chain-family-tabs button,.pol-nav a,.ce-execution-modes button,.nx-tabbar button){color:var(--theme-muted);background:transparent;border-color:var(--theme-line)}
html[data-theme=dark] :is(.wb-tabs a[aria-current=page],.cm-tabs a[aria-current=page],.lab-tabs button[aria-current=page],.ex-tabs a[aria-current=page],.chain-family-tabs button[aria-pressed=true],.chain-tabs button[aria-pressed=true],.pol-nav a[aria-current=page],.ce-execution-modes button[aria-pressed=true],.nx-tabbar button[aria-selected=true]){background:#30465f;color:var(--theme-cyan);border-color:#658aa6;box-shadow:none}
html[data-theme=dark] :is(.wb-project-card.selected,.cm-scope .cm-button[aria-pressed=true],.ac-network[aria-pressed=true],.ce-market-selected,.ce-intervals button[aria-pressed=true],.mc-toolbar button[aria-pressed=true]){background:#29425a;color:var(--theme-cyan);border-color:#668eaa;box-shadow:none}
html[data-theme=dark] :is(.wb-project-card,.cm-post-actions>button,.cm-post-actions>a,.cm-socials a,.ex-profile,.ex-collection,.ex-nft,.mc-token-option,.ce-market,.ce-amount-presets button,.nx-ranking,.nx-category-bar button,.nx-carousel-controls>button,.sc-control>.sc-trigger,.mc-toolbar button):hover{background:#29435e;border-color:#6589a6;color:var(--theme-text)}
html[data-theme=dark] :is(.wb-token-results button,.wb-token-shortcuts button,.chain-tabs button,.nx-category-bar button,.nx-carousel-controls>button,.mc-toolbar button){background:var(--theme-input);border-color:var(--theme-line);color:var(--theme-muted);box-shadow:none}
html[data-theme=dark] .nx-category-bar button[aria-pressed=true]{background:var(--theme-gold);border-color:#d3ad54;color:#302718;box-shadow:0 3px #65502a}
html[data-theme=dark] :is(.ce-detail-tabs button[aria-selected=true],.cm-small-link,.ac-asset-link,.ex-link,.ls-link,.chain-links a,.gen-links a){color:var(--theme-cyan)}
html[data-theme=dark] :is(.ce-detail-tabs button,.ce-intervals button,.ce-link,.nx-source,.nx-back){color:var(--theme-muted)}

/* Forms, tables and buttons share the same contrast in every route. */
html[data-theme=dark] :is(input,textarea,select,.workbench input,.workbench textarea,.workbench select,.cm-community input,.cm-community textarea,.cm-community select,.generator input,.generator textarea,.practice-lab input:not([type=checkbox]),.practice-lab textarea,.practice-lab select,.explorer input,.explorer select,.chain-field input:not([type=checkbox]),.chain-field textarea,.chain-toolbar select,.chain-drafts select,.ea-field input,.ea-field textarea,.ea-field select,.ls-field input,.ls-field textarea,.ls-field select,.mc-fields input,.mc-fields select,.mc-search-form input,.coin-exchange input,.coin-exchange select,.nft-exchange input,.nft-exchange select,.ac-wallet-label select,.ac-network-choice select,.remote-wallet-manual input){background:var(--theme-input);color:var(--theme-text);border-color:#435e78;box-shadow:inset 0 2px 3px #050c1726;accent-color:var(--theme-gold)}
html[data-theme=dark] :is(input,textarea,select):focus{background:#172940;color:var(--theme-text);border-color:var(--theme-cyan)}
html[data-theme=dark] :is(input,textarea)::placeholder{color:#91a8bd;opacity:1}
html[data-theme=dark] select option{background:var(--theme-surface);color:var(--theme-text)}
html[data-theme=dark] .coin-exchange .ce-amount-field input{background:transparent;color:var(--theme-text);box-shadow:none}
html[data-theme=dark] .gen-layer-name input{background:transparent;box-shadow:none}
html[data-theme=dark] :is(table,.ex-table,.nx-order-table table){color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme=dark] :is(table th,.ex-table th,.nx-order-table th,.ce-trades th,.ce-trades thead){background:var(--theme-input);color:var(--theme-muted);border-color:var(--theme-line)}
html[data-theme=dark] :is(table td,.ex-pool-table tbody tr){background:var(--theme-surface);color:var(--theme-text);border-color:var(--theme-line)}
html[data-theme=dark] table tbody tr:hover td{background:var(--theme-raised)}
html[data-theme=dark] :is(table small,.ce-identity dt,.ce-order-counts dt,.ce-stats dt,.nx-stats dt,.nx-identity dt,.te-review dt){color:var(--theme-muted)}
html[data-theme=dark] :is(.button.secondary,body:not([data-page=home]) .button.secondary,.hero-white,.cm-button,.cm-file-button,.ac-button,.ea-button,.ls-secondary,.ce-secondary,.rh-panel button,.table-action,.flow-bottom button,.work-row>.row-cue,.dialog-top .icon-button){background:var(--theme-raised);border-color:#48647f;color:var(--theme-text);box-shadow:var(--theme-shadow)}
html[data-theme=dark] :is(.button.secondary,.hero-white,.cm-button,.cm-file-button,.ac-button,.ea-button,.ls-secondary,.ce-secondary,.rh-panel button,.table-action):hover{background:#29435e;border-color:#7196af;color:var(--theme-text)}
html[data-theme=dark] :is(.button.primary,body:not([data-page=home]) .button.primary,.hero-primary,.cm-button.cm-primary,.ac-button.ac-primary,.ea-primary,.ls-button,.ex-button,.gen-button,.ce-primary,.ce-search-submit,.nft-exchange .primary){background:linear-gradient(#f6d98e,var(--theme-gold));border-color:#d6b25d;color:#302718;box-shadow:inset 0 1px #fff0bd,0 3px #66502a}
html[data-theme=dark] :is(.button.primary,.hero-primary,.cm-button.cm-primary,.ac-button.ac-primary,.ea-primary,.ls-button,.ex-button,.gen-button,.ce-primary,.ce-search-submit,.nft-exchange .primary):hover{background:#f7d98c;color:#302718;border-color:#ffe5a3}
html[data-theme=dark] :is(.joy-primary,.hero-dark){background:#993e50;border-color:#c36174;color:#fff;box-shadow:0 4px #4b2434}
html[data-theme=dark] :is(button,input,textarea,select):disabled{opacity:.55;cursor:not-allowed}
html[data-theme=dark] .workbench .button:disabled{background:var(--theme-raised);color:var(--theme-muted);border-color:var(--theme-line)}

/* Empty, loading, warning, failure and confirmed states remain distinct. */
html[data-theme=dark] :is(.empty-state,.inline-empty,.wb-empty,.wb-loading,.cm-empty,.ac-empty,.gen-empty,.lab-empty,.ex-loading,.ex-empty,.explorer .ex-image-unavailable,.ce-chart-empty,.ce-notice,.nx-empty,.nx-notice,.mc-empty){background:var(--theme-input);color:var(--theme-muted);border-color:var(--theme-line);box-shadow:none}
html[data-theme=dark] :is(.sample-label,.pill.pending,.storage-warning,.wb-boundary,.wb-policy-note,.wb-quote-result,.wb-quote-result .wb-boundary,.wb-status-warn,.cm-join,.cm-confirm,.ac-limited,.lab-mode,.lab-warning,.lab-clock,.ex-risk-list li,.ex-status-configuration_required,.chain-warning,.chain-status,.chain-artwork-status,.ea-chip,.ea-warning,.ls-unknown,.ls-not_reported,.ls-requirement,.nx-trade-notice,.te-fee,.te-panel .te-notice,.remote-wallet-dialog .remote-wallet-note){background:var(--theme-warm);color:#edd59b;border-color:#6d6041;box-shadow:none}
html[data-theme=dark] :is(.inline-error,.wb-error,.wb-inline-error,.cm-error,.ac-error,.gen-error,.lab-error,.ex-notice-error,.chain-alert,.ea-error,.ls-error,.rh-error,.nx-error,.ce-error,.te-panel .te-error){background:var(--theme-error);color:#ffb9c4;border-color:#805361;box-shadow:none}
html[data-theme=dark] :is(.wb-success,.wb-status-good,.cm-success,.ac-available,.lab-success,.ex-status-read_only,.chain-notice,.ea-message,.ea-state-included,.ls-indexed,.ls-provided){background:var(--theme-success);color:#a3e3c5;border-color:#467d6a;box-shadow:none}
html[data-theme=dark] :is(.wb-status,.ex-status,.ls-state,.rh-state,.ea-state,.count,.pill.matched,.pill.received,.row-number,.cm-you,.ac-wallet-available,.ac-wallet-discontinued,.ac-wallet-deprecated){background:var(--theme-raised);color:var(--theme-cyan);border-color:var(--theme-line)}
html[data-theme=dark] :is(.rh-state[data-state=finalized],.rh-state[data-state=included],.rh-state[data-state=confirmed]){background:var(--theme-success);color:#a3e3c5}
html[data-theme=dark] :is(.rh-state[data-state=failed],.ea-state-failed,.ea-state-unknown,.cm-button.cm-danger,.cm-post-actions>button[aria-pressed=true]){background:var(--theme-error);color:#ffb9c4;border-color:#805361}
html[data-theme=dark] :is(.ce-up,.ex-up,.gen-message,.ac-wallet-available .ac-wallet-status){color:var(--theme-green)}
html[data-theme=dark] :is(.ce-down,.ex-down,.danger,.workbench .text-button.danger,.gen-text-button){color:var(--theme-coral)}
html[data-theme=dark] .ce-side button[data-ce-side=buy][aria-pressed=true]{background:#234b40;color:#a3e3c5}
html[data-theme=dark] .ce-side button[data-ce-side=sell][aria-pressed=true]{background:#513042;color:#ffb9c4}
html[data-theme=dark] .nx-loading-art>div{background:linear-gradient(130deg,var(--theme-input),var(--theme-raised));border-color:var(--theme-line)}
html[data-theme=dark] .gen-settings progress,html[data-theme=dark] .gen-settings progress::-webkit-progress-bar{background:var(--theme-input)}
html[data-theme=dark] .gen-settings progress::-webkit-progress-value{background:#64b6d8}

/* Source images and videos keep their original pixels and color profiles. */
html[data-theme=dark] :is(.nx-art,.ex-image-placeholder,.ls-asset-art,.cm-avatar,.cm-avatar-placeholder,.cm-post-image-link,.cm-photo-preview,.cm-profile-banner,.nx-feature-slide){background:var(--theme-input);border-color:var(--theme-line)}
html[data-theme=dark] .cm-banner-empty{background:linear-gradient(120deg,#19374d,#273c50 65%,#3b3529)}
html[data-theme=dark] :is(.cm-wallet-marks>span,.ac-wallet-mark){background:#f5f8fa}
html[data-theme=dark] :is(.cm-wallet-marks>.cm-wallet-dark,.ac-wallet-mark-dark){background:#171a20}
html[data-theme=dark] .ce-token-mark{background:linear-gradient(140deg,#28485d,#1b314a);color:var(--theme-cyan)}
html[data-theme=dark] :is(.nx-feature-content h3,.nx-feature-content>p,.nx-feature-stats dd){color:#fff}
html[data-theme=dark] .nx-feature-stats dt{color:#d9e7ef}
html[data-theme=dark] .nx-feature-label{background:#163148;color:#d6f0fd;border-color:#4d6c83}

html[data-theme=dark] .feature-film-media video{background:var(--theme-input)}
html[data-theme=dark] :is(.gen-preview-grid img,.gen-nft-preview img){background:repeating-conic-gradient(#24374e 0 25%,#16263c 0 50%) 50%/16px 16px;border-color:var(--theme-line)}
html[data-theme=dark] .gen-trait>img{background:repeating-conic-gradient(#24374e 0 25%,#16263c 0 50%) 50%/12px 12px;border-color:var(--theme-line)}
html[data-theme=dark] .chain-handoff>img{background:var(--theme-input);border-color:var(--theme-line)}

/* Dialogs, custom selects and the language picker have their own portal roots. */
html[data-theme=dark] :is(dialog,.language-panel,.remote-wallet-dialog,.sc-popup,.cm-post-menu>div){background:var(--theme-surface);color:var(--theme-text);border-color:var(--theme-line);box-shadow:0 12px 60px #0008}
html[data-theme=dark] :is(dialog,.language-panel,.remote-wallet-dialog)::backdrop{background:#020713ba;backdrop-filter:blur(3px)}
html[data-theme=dark] :is(.language-button,.language-panel button,.language-panel .language-auto,.remote-wallet-dialog button,.cm-post-menu .cm-button){background:var(--theme-raised);color:var(--theme-text);border-color:#48647f;box-shadow:none}
html[data-theme=dark] :is(.language-button,.language-panel button,.remote-wallet-dialog button):hover{background:#29435e;color:var(--theme-text)}
html[data-theme=dark] :is(.language-panel button[aria-pressed=true],.remote-wallet-actions button:first-child){background:var(--theme-gold);color:#302718;border-color:#d6b25d}
html[data-theme=dark] :is(.language-note,.language-status,.remote-wallet-dialog p,.sc-popup-heading,.sc-group-label,.sc-empty){color:var(--theme-muted)}
html[data-theme=dark] .remote-wallet-qr{background:#fff;border-color:#d9e7ef}
html[data-theme=dark] .sc-control>.sc-trigger,html[data-theme=dark] .coin-exchange .ce-market-toolbar .sc-trigger{background:var(--theme-input);color:var(--theme-text);border-color:#435e78;box-shadow:inset 0 1px #ffffff04}
html[data-theme=dark] :is(.sc-action,.sc-popup>.sc-search){background:var(--theme-raised);color:var(--theme-cyan);border-color:var(--theme-line)}
html[data-theme=dark] .sc-option{color:var(--theme-text)}
html[data-theme=dark] .sc-option.sc-option-active{background:#29435e;color:var(--theme-text)}
html[data-theme=dark] .sc-option[aria-selected=true],html[data-theme=dark] .sc-option[aria-selected=true].sc-option-active{background:#4b432e;color:#ffe5a3}
html[data-theme=dark] .sc-option[aria-disabled=true]{color:#8b9fb0;background:transparent}
html[data-theme=dark] #toast{background:#28435c;color:#e7f4ff;border:1px solid #6586a1;box-shadow:0 6px 28px #0005}
html[data-theme=dark] .skip{background:var(--theme-raised);color:var(--theme-text)}

/* Data labels with hard-coded white-theme colors are mapped explicitly. */
html[data-theme=dark] :is(.wb-mode,.wb-context-note,.wb-selection,.wb-record p,.wb-record small,.wb-footer-note,.wb-swap-readiness .wb-swap-boundary,.cm-handle,.cm-post-date,.cm-reposted,.cm-activity-meta,.ac-small,.ac-wallet-status,.ac-portfolio-intro,.ac-holdings-heading>span,.gen-summary,.gen-local-note span,.gen-trait label>span,.gen-upload small,.gen-settings>label,.gen-two-fields label,.gen-export label,.lab-hero p,.lab-hero .lab-hero-note,.lab-field small,.lab-save-note,.lab-boundary,.lab-footer,.chain-page-head p,.chain-field small,.chain-card small,.chain-review-empty p,.chain-review-heading span,.chain-fees p,.chain-fees small,.recipient-help,.recipient-summary p,.ea-header p,.ea-login p,.ea-field small,.ea-small,.ea-note,.ls-caption,.ls-auto,.rm-hero .rm-hero-lede,.rm-hero .rm-hero-note,.rm-hero-caption>p,.rm-stage-copy>p:not(.rm-stage-label):not(.rm-stage-check),.rm-scope-title>span,.rm-scope-note,.rm-cost-points p,.pol-section p,.pol-section li,.pol-footnote,.rh-heading p,.rh-entry p,.rh-times,.rh-note,.rh-empty,.ce-heading p,.ce-eyebrow,.ce-mode p,.ce-source,.ce-chart-caption,.ce-token-name,.ce-pool-label,.ce-pool-label>span,.ce-market small,.ce-market-price .ce-market-metric,.ce-chart-tools,.ce-hint,.ce-fee p,.ce-quote-state,.ce-bottom-note,.ce-amount-field>span,.ce-receive>span,.nx-status,.nx-header .nx-eyebrow,.nx-card-description,.nx-card-prices dd,.nx-history-status,.nx-source-note,.nx-policy,.mc-hint,.mc-credit,.mc-pane-note,.mc-readout){color:var(--theme-muted)}
html[data-theme=dark] :is(.gen-summary b,.recipient-summary>strong,.ea-wallet strong,.ac-empty strong,.ls-requirement b,.ls-provided b,.rm-scope-body h4,.rm-cost-points h3,.ce-mode>strong,.ce-order-pair,.ce-amount-field b,.ce-receive b,.ce-receive output,.ce-ohlc b,.nx-card-floor strong,.nx-card-prices strong,.nx-policy strong){color:var(--theme-text)}
html[data-theme=dark] :is(.gen-links a,.gen-upload span,.chain-review-empty a,.chain-faucet,.chain-history a,.ea-transaction-link,.cm-post-text a,.cm-side-note a,.ac-policy-links a,.ac-wallet-guide,.rm-hero h1>span,.rm-hero-caption>span,.mc-credit a,.ce-fee strong span){color:var(--theme-cyan)}
html[data-theme=dark] .gen-small{color:var(--theme-muted)!important}
html[data-theme=dark] :is(.mc-shell:fullscreen,.mc-shell.mc-expanded){background:var(--theme-surface);color:var(--theme-text)}
html[data-theme=dark] :is(.mc-stage,.mc-shell,.ce-fee,.ce-identity,.nx-policy,.nx-card-prices,.nx-order-table td,.rh-entry,.rh-transactions,.wb-details,.wb-record,.cm-post-actions,.cm-profile-stats,.ac-assets li,.gen-trait,.lab-records article,.ex-metrics>div,.chain-details>div,.ea-summary>div,.ls-manual,.rm-status-strip,.rm-stage,.rm-scope){border-color:var(--theme-line)}

/* Remaining accents keep their depth without the white theme’s pastel fills. */
html[data-theme=dark] .page-heading::after{background:var(--theme-surface)}
html[data-theme=dark] .sun-disc{background:radial-gradient(circle at 35% 25%,#817145,#4c4936 60%,#2b322f);box-shadow:0 0 0 22px #ffffff05,0 14px 55px #050a1738}
html[data-theme=dark] :is(.lab-hero-art,.rm-hero-art,.chain-artwork-preview){background:var(--theme-raised);color:var(--theme-text);border-color:var(--theme-line);box-shadow:var(--theme-shadow)}
html[data-theme=dark] :is(.wb-project-letter,.avatar.green,.step-number){background:#254b63;color:#bfebfc;box-shadow:0 3px #122c40}
html[data-theme=dark] .avatar.purple{background:#503347;color:#fac6d6}
html[data-theme=dark] :is(.avatar.orange,.how-steps li:nth-child(2) .step-number,.lookup-copy .circle-arrow,.receipt-stamp){background:#4b432e;color:#f1d794;border-color:#72623e;box-shadow:0 3px #29261d}
html[data-theme=dark] .how-steps li:nth-child(3) .step-number{background:#513447;color:#fac6d6;box-shadow:0 3px #2e2030}
html[data-theme=dark] .wb-timeline li::before{background:var(--theme-line)}
html[data-theme=dark] :is(.wb-timeline-dot,.evidence-dot){background:var(--theme-cyan)}
html[data-theme=dark] .evidence-dot.recipient{background:var(--theme-gold)}
html[data-theme=dark] .evidence-dot.receipt{background:var(--theme-coral)}
html[data-theme=dark] :is(.wb-mode b,.lab-check){color:var(--theme-green)}
html[data-theme=dark] :is(.lab-hero h1 span,.how-steps a,.rh-transactions a,.cm-post-text,.cm-bio,.gen-guide){color:var(--theme-text)}
html[data-theme=dark] :is(.rm-stage-marker>span,.rm-stage .rm-stage-check,.rm-close p:not(.rm-eyebrow),.pol-header p,.pol-header small){color:var(--theme-muted)}
html[data-theme=dark] :is(.rm-stage-current .rm-stage-label,.rm-cost-intro>.rm-eyebrow){color:var(--theme-gold)}
html[data-theme=dark] .rm-stage-next .rm-stage-label{color:var(--theme-cyan)}
html[data-theme=dark] :is(.wb-status.wb-status-good,.ex-status.ex-status-read_only,.ls-state.ls-indexed,.ea-state.ea-state-included){background:var(--theme-success);color:#a3e3c5;border-color:#467d6a}
html[data-theme=dark] :is(.wb-status.wb-status-warn,.ex-status.ex-status-configuration_required,.ls-state.ls-unknown,.ls-state.ls-not_reported){background:var(--theme-warm);color:#edd59b;border-color:#6d6041}
html[data-theme=dark] :is(.cm-origin-recovery a,.ac-origin-recovery a){background:var(--theme-gold);color:#302718!important;border-color:#d6b25d;box-shadow:0 3px #66502a}
html[data-theme=dark] .nx-carousel-dots span{background:#597087}
html[data-theme=dark] .nx-carousel-dots button[aria-pressed=true] span{background:var(--theme-gold)}
html[data-theme=dark] .sc-control>.sc-trigger[aria-expanded=true]{border-color:var(--theme-cyan);box-shadow:0 0 0 3px #609ab52a}
html[data-theme=dark] .sc-control>.sc-trigger[aria-invalid=true]{border-color:var(--theme-coral)}
html[data-theme=dark] .sc-options{scrollbar-color:#58768f var(--theme-input)}
html[data-theme=dark] .te-text-button{color:var(--theme-cyan)}

@media(max-width:700px){
  .theme-toggle[data-theme-toggle]{max-width:44px;width:40px;min-width:40px;padding:8px;gap:0}
  .theme-toggle[data-theme-toggle] .theme-toggle-label{display:none}
  html[data-theme=dark] .header nav{background:var(--theme-surface);box-shadow:0 8px 18px #0004}
}
@media(prefers-reduced-motion:reduce){.theme-toggle[data-theme-toggle]{transition:none}}

/* Match the ID-scoped depth rules in brand.css so no white rims leak through. */
html[data-theme=dark] #page-guide{color:var(--theme-muted)}
html[data-theme=dark] #page-guide details{background:var(--theme-surface);border-color:var(--theme-line);box-shadow:var(--theme-shadow)}
html[data-theme=dark] #page-guide summary{color:var(--theme-text)}
html[data-theme=dark] #page-guide summary>strong{color:var(--theme-text)}
html[data-theme=dark] #page-guide summary>span{color:var(--theme-muted)}
html[data-theme=dark] #page-guide details>div{background:transparent;color:var(--theme-muted);border-color:var(--theme-line)}
html[data-theme=dark] #page-guide p{color:var(--theme-muted)}
html[data-theme=dark] #page-guide a{color:var(--theme-cyan)}
html[data-theme=dark] #page-guide summary:focus-visible{outline-color:var(--theme-cyan)}
html[data-theme=dark] #main :is(.wb-panel,.wb-account,.lab-panel,.lab-hero-art,.chain-card,.chain-toolbar,.ex-card,.gen-layer,.gen-settings,.gen-export,.gen-local-note,.rm-hero-art,.rm-cost-section,.balance-sheet,.flow-sheet,.calculator,.record-aside,.benefit,.sample-project,.lookup-sheet,.chain-review,.wb-policy-note,.benefit-budget){border-color:var(--theme-line);box-shadow:var(--theme-shadow)}
html[data-theme=dark] #feature-film .feature-film-layout{border-color:var(--theme-line);box-shadow:var(--theme-shadow)}
html[data-theme=dark] body[data-page=home] #main>.joy-hero{box-shadow:inset 0 1px #ffffff06,inset 0 -1px #ffffff06}

/* Text roles use source-scoped selectors: names and values stay bright, context stays muted. */
html[data-theme=dark] #main :is(.wb-field label,.wb-hint,.wb-preserve,.wb-budget-list small,.wb-balance-main span,.wb-panel-heading .tiny-label,.wb-details summary>span,.wb-details>small,.wb-policy-note p,.wb-policy-note .tiny-label,.wb-token-results span,.wb-timeline p,.wb-timeline small,.wb-timeline code,.cm-kicker,.cm-compose-bottom .cm-character-count,.cm-author span,.cm-quote-author span,.cm-person-link p,.cm-activity-status>span,.cm-handle,.cm-reposted,.ac-intro p,.ac-session p,.ac-eyebrow,.ac-wallet-card>p,.ac-network-choice>span,.gen-layer-number,.gen-trait label>span,.gen-guide p,.gen-guide li,.lab-hint,.lab-section-title>span,.lab-section-title p,.lab-collection h3 small,.lab-history li p,.lab-history li small,.lab-records p,.lab-records div>span,.ex-pair-name small,.ex-address>span,.ex-listed-nft code,.ls-field,.ls-caption,.ls-auto,.chain-handoff p,.chain-traits dt,.chain-details dt,.recipient-tools .recipient-file>span,.recipient-help,.recipient-summary p,.ea-summary dt,.rh-account,.rh-times,.te-state,.te-small,.te-review dt,.ce-market-name small,.ce-selected-price small,.ce-source,.ce-pool-label,.nx-rank-number,.nx-card-prices dd,.nx-history-controls label,.nx-history-coverage p,.nx-sales-history .nx-section-heading p,.evidence-key dt,.budget-note){color:var(--theme-muted)}
html[data-theme=dark] #main :is(.wb-project-card strong,.wb-record h3,.wb-record h4,.wb-balance-main strong,.wb-token-results strong,.cm-author strong,.cm-post-text,.cm-quote-author strong,.cm-profile-details>h2,.cm-activity-item p,.ac-wallet-card h4,.ac-assets li strong,.ac-native>strong,.lab-asset-list strong,.lab-nft-grid strong,.lab-quote strong,.ex-source-name,.ex-listed-nft .ex-list-price,.chain-review h2,.chain-review h3,.chain-details dd,.ea-wallet strong,.ea-summary dd,.ls-identity h2,.rh-account code,.te-review dd,.ce-market-name strong,.ce-market-price>strong,.ce-price,.ce-order-pair,.ce-stats dd,.ce-identity dd,.nx-card-body h4,.nx-rank-name strong,.nx-rank-metric strong,.nx-card-prices strong,.nx-price-box strong,.nx-identity dd,.nx-traits strong,.evidence-key dd){color:var(--theme-text)}
html[data-theme=dark] #main :is(.cm-section-heading>a,.cm-small-link,.ac-policy-links a,.ac-wallet-guide,.lab-hero h1 span,.ex-lookup summary,.ex-source-asset,.ce-link,.nx-source,.nx-source:hover,.nx-back,.gen-links a,.chain-links a,.chain-history a,.te-panel a,.rh-transactions a){color:var(--theme-cyan)}
html[data-theme=dark] #main :is(.ex-source,.ex-small){color:var(--theme-muted)!important}
html[data-theme=dark] #main .sample-project .text-button{color:var(--theme-cyan)!important}
html[data-theme=dark] #main :is(.te-panel .te-message,.gen-message,.lab-check,.ac-wallet-available .ac-wallet-status){color:var(--theme-green)}
html[data-theme=dark] #main :is(.cm-button.cm-danger,.gen-text-button,.text-button.danger,.ea-state-failed,.ea-state-unknown){color:#ffb9c4}
html[data-theme=dark] #main :is(.wb-boundary,.wb-status-warn,.wb-policy-note,.cm-confirm,.lab-warning,.ea-warning) :is(p,small){color:#edd59b}
html[data-theme=dark] #feature-film :is(.feature-film-credit,.feature-film-summary,.feature-film-note){color:var(--theme-muted);border-color:var(--theme-line)}
html[data-theme=dark] #feature-film :is(.feature-film-guide h2,.feature-film-guide li>p){color:var(--theme-text)}
html[data-theme=dark] #feature-film .feature-film-mode{color:var(--theme-gold)}
html[data-theme=dark] #feature-film .feature-film-error{color:#ffb9c4}
html[data-theme=dark] .site-footer :is(.footer-brand p,.footer-column>strong,.footer-note p,.footer-column a,.footer-column button){color:var(--theme-muted)}
html[data-theme=dark] .site-footer :is(.footer-column a,.footer-column button):hover{color:var(--theme-cyan)}
html[data-theme=dark] dialog :is(.dialog-inner>h2,.dialog-top strong,.remote-wallet-head h2,.ac-wallet-summary strong,.ac-assets li strong,.ac-native>strong){color:var(--theme-text)}
html[data-theme=dark] .remote-wallet-dialog :is(.remote-wallet-eyebrow,.remote-wallet-expiry){color:var(--theme-muted)}
html[data-theme=dark] .remote-wallet-dialog .remote-wallet-qr [data-remote-status]{color:#29465c}
html[data-theme=dark] :is(.te-transactions li,.te-history,.te-history li,.ns-tx,.feature-film-note){border-color:var(--theme-line)}

html[data-theme=dark] .faq-list summary::after{color:var(--theme-cyan)}

/* Keep the screen-mode control in the upper-right group on narrow headers. */
.theme-toggle-icon svg{display:block;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round}
@media(max-width:700px){
 .header{grid-template-columns:minmax(0,1fr) minmax(0,1.15fr) 40px 40px 40px;gap:13px 6px}
 .header .theme-toggle[data-theme-toggle]{grid-column:3;grid-row:1;justify-self:center;align-self:center}
 .header .header-controls .help-button{grid-column:4;grid-row:1}
 .header .menu-toggle{grid-column:5;grid-row:1}
 .header .header-account{grid-column:1/3;grid-row:2}
 .header .header-balance{grid-column:3/5;grid-row:2}
 .header .header-balance-hide{grid-column:5;grid-row:2}
 .header .header-community{grid-column:1/3;grid-row:3}
 .header[data-account-signed-in=false] .header-account{grid-column:1/3;grid-row:2}
 .header[data-account-signed-in=false] .header-community{grid-column:3/6;grid-row:2}
}
@media(max-width:380px){
 .header{grid-template-columns:minmax(0,1fr) minmax(0,1fr) 34px 34px 34px;gap:12px 5px}
 .header .theme-toggle[data-theme-toggle]{width:32px;min-width:32px;min-height:34px;padding:6px;border-radius:12px}
 .header .menu-toggle{width:34px;height:34px}
 .header>.brand{font-size:21px;gap:5px}.header>.brand img{width:37px;height:37px}
}
