/* CardFox accessible dark theme: explicit preference, or system preference via JS. */
:root[data-theme="dark"]{
 color-scheme:dark;
 --orange:#e97935;--orange-dark:#ffac74;--orange-deep:#ffd0ad;
 --apricot:#ffb783;--cream:#30271f;--paper:#252322;--ground:#171717;
 --ink:#f4eee8;--secondary:#c6b9ad;--line:#49413c;
 --mint:#203e34;--mint-text:#a4e3ca;--soft:#3b2b20;
 --shadow:0 4px 18px rgba(0,0,0,.23);
}
:root[data-theme="dark"] body{background:var(--ground);color:var(--ink)}
:root[data-theme="dark"] .masthead{background:#8d3c1d}
:root[data-theme="dark"] .hero-card{background:#432a1d;color:#fff1e6;border-color:#75442c}
:root[data-theme="dark"] .panel,
:root[data-theme="dark"] .txitem,
:root[data-theme="dark"] .compare-row,
:root[data-theme="dark"] .benefit-item,
:root[data-theme="dark"] .source-row,
:root[data-theme="dark"] .merchant-advice,
:root[data-theme="dark"] .merchant-transport,
:root[data-theme="dark"] .notice,
:root[data-theme="dark"] .update-banner,
:root[data-theme="dark"] dialog,
:root[data-theme="dark"] .sheet-body{background:var(--paper);color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea{background:#302d2b;color:var(--ink);border-color:#66584e}
:root[data-theme="dark"] input::placeholder{color:#b6aaa1}
:root[data-theme="dark"] option{background:#302d2b;color:#f4eee8}
:root[data-theme="dark"] .lightbtn,
:root[data-theme="dark"] .iconbtn,
:root[data-theme="dark"] .mini-btn,
:root[data-theme="dark"] .tabs button,
:root[data-theme="dark"] .view-switch button,
:root[data-theme="dark"] .benefits-filter button,
:root[data-theme="dark"] .quick-merchant-row button,
:root[data-theme="dark"] .chips button,
:root[data-theme="dark"] .suggestions button{background:#332d29;color:var(--ink);border-color:var(--line)}
:root[data-theme="dark"] .tabs button.active,
:root[data-theme="dark"] .view-switch button.selected,
:root[data-theme="dark"] .benefits-filter button.selected{background:#57331f;color:#ffbb86}
:root[data-theme="dark"] .bottom-tabs{background:#22201e;border-color:var(--line)}
:root[data-theme="dark"] .bottom-tabs button{color:#c6b9ad}
:root[data-theme="dark"] .bottom-tabs button.active{background:#50301f;color:#ffb57e}
:root[data-theme="dark"] .rights-summary{background:#3b2d22;border-color:#705139;color:#f2d4b8}
:root[data-theme="dark"] .rights-summary strong{color:#ffbb86}
:root[data-theme="dark"] .benefit-tags span,
:root[data-theme="dark"] .chip,
:root[data-theme="dark"] .daybadge{background:#3c342d;color:#f3d7bd}
:root[data-theme="dark"] .track{background:#4a4039}
:root[data-theme="dark"] .track i{background:#f0985d}
:root[data-theme="dark"] .muted,
:root[data-theme="dark"] .micro,
:root[data-theme="dark"] .txmeta,
:root[data-theme="dark"] .compare-note{color:var(--secondary)}
:root[data-theme="dark"] a{color:#ffb47c}
:root[data-theme="dark"] .identity,
:root[data-theme="dark"] .masthead a{color:#fff}
:root[data-theme="dark"] .primary{background:#bf521f;color:white}
:root[data-theme="dark"] .toast{background:#ede1d4;color:#211b17}
:root[data-theme="dark"] .theme-switch{background:#342d28;color:var(--ink);border:1px solid var(--line)}
.theme-switch{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:6px 12px;font-size:13px;min-height:36px;cursor:pointer}
.theme-preference{display:grid;gap:8px;margin:12px 0}
.theme-preference select{width:100%;max-width:360px}

@media(max-width:390px){
 .header-actions{gap:4px}
 #theme-toggle{font-size:11px;min-height:32px;padding:4px 7px}
 .header-actions .update-link:not(#theme-toggle){font-size:11px;min-height:32px;padding:4px 7px}
 .header-actions .release{font-size:10px;padding:4px 6px}
}

/* v2.6.1 visual QA: fix hardcoded light surfaces and contrast, including empty state. */
:root[data-theme="dark"] .hero-card{
 background:linear-gradient(130deg,#573421 0%,#492d22 65%,#3a2822 100%);
 border-color:#8a5637;color:#f7e8d9;
}
:root[data-theme="dark"] .hero-card .hero-kicker,
:root[data-theme="dark"] .hero-card h2{color:#ffd2a8}
:root[data-theme="dark"] .hero-card .hero-description,
:root[data-theme="dark"] .hero-card .hero-metrics span,
:root[data-theme="dark"] .hero-card .hero-foot{color:#e9c4a6}
:root[data-theme="dark"] .hero-card .hero-metrics strong{color:#fff5e8}
:root[data-theme="dark"] .hero-card .hero-divider{background:#936344}
:root[data-theme="dark"] .hero-card:after{border-color:rgba(255,170,104,.09)}
:root[data-theme="dark"] .empty-state{background:#302922;color:#f5e9df;border:1px dashed #74543c}
:root[data-theme="dark"] .empty-state strong{color:#fff2e6}
:root[data-theme="dark"] .empty-state p{color:#d7c1b1}
:root[data-theme="dark"] .soft-count{background:#503323;color:#ffbc8e}
:root[data-theme="dark"] .view-switch{background:#37312d}
:root[data-theme="dark"] .view-switch button{color:#d3c3b6}
:root[data-theme="dark"] .view-switch button.selected{background:#63402b;color:#ffe2c6;box-shadow:none}
:root[data-theme="dark"] .rank-row .rname,
:root[data-theme="dark"] .rank-row .rnum{color:#ded0c5}
:root[data-theme="dark"] .rank-row.best .rname,
:root[data-theme="dark"] .rank-row.best .rnum{color:#ffbb88}
:root[data-theme="dark"] .compare-row{background:#2e2925}
:root[data-theme="dark"] .card-tag.richart,
:root[data-theme="dark"] .chip.orange{background:#56331f;color:#ffc28e}
:root[data-theme="dark"] .card-tag.line,
:root[data-theme="dark"] .card-tag.air{background:#35312d;color:#e6d6c9}
:root[data-theme="dark"] .daybadge{background:#3e332d;color:#ead0bd}
:root[data-theme="dark"] .tx-bottom{color:#c1afa2}
:root[data-theme="dark"] .bottom-tabs button{background:transparent}
:root[data-theme="dark"] .bottom-tabs button.active{background:#50301f;color:#ffbf91}
:root[data-theme="dark"] .bottom-tabs{box-shadow:0 -5px 18px #0005}
:root[data-theme="dark"] .primary{background:#c75b25;color:#fff}
:root[data-theme="dark"] .primary:hover{background:#d56b32}
:root[data-theme="dark"] .sheet-head,
:root[data-theme="dark"] .sheet-actions{background:#252322;color:#f4eee8;border-color:#49413c}
:root[data-theme="dark"] .suggestions{background:#292522;color:#f4eee8}
:root[data-theme="dark"] .suggestions button:hover{background:#493429}
:root[data-theme="dark"] .source-row a,
:root[data-theme="dark"] .benefit-item a{color:#ffbb8c}
:root[data-theme="dark"] .footer{color:#bcaea3}
:root[data-theme="dark"] button:focus-visible,
:root[data-theme="dark"] a:focus-visible,
:root[data-theme="dark"] input:focus-visible,
:root[data-theme="dark"] select:focus-visible{outline:3px solid #ffba81;outline-offset:2px}
@media(max-width:390px){
 .identity strong{font-size:17px}
 .identity small{font-size:9px}
 .foxmark{width:36px;height:36px}
 .header-actions{gap:3px}
 #theme-toggle{font-size:0;min-width:36px;padding:5px}
 #theme-toggle::first-letter{font-size:17px}
}

/* v2.7: audit explicit foreground and surface overrides. */
#theme-toggle{display:inline-grid;place-items:center;width:44px;height:44px;min-width:44px;padding:0}
#theme-toggle svg{width:21px;height:21px;fill:none;stroke:currentColor;stroke-width:1.9;stroke-linecap:round;stroke-linejoin:round}
.datecontrol{min-width:0}.datecontrol input[type=date]{box-sizing:border-box;min-width:0;width:100%;max-width:100%;margin:0}
.topbar .identity{min-width:0}.identity span:last-child{min-width:0}.identity strong,.identity small{white-space:nowrap}
.masthead{background:#b94c15}
.primary:disabled{opacity:.55;cursor:not-allowed}
:root[data-theme="dark"] label:not(.check),:root[data-theme="dark"] .check,:root[data-theme="dark"] .benefit-row strong,:root[data-theme="dark"] .compare-numbers b{color:var(--ink)}
:root[data-theme="dark"] .benefit-headline,:root[data-theme="dark"] .benefit-item summary,:root[data-theme="dark"] .compare-details summary,:root[data-theme="dark"] .merchant-advice b{color:#ffc293}
:root[data-theme="dark"] .mode-explain,:root[data-theme="dark"] .compare-details,:root[data-theme="dark"] .source-row small,:root[data-theme="dark"] .benefit-item details p{color:var(--secondary)}
:root[data-theme="dark"] .benefit-kind{background:#44382e;color:#f5d3af}
:root[data-theme="dark"] .compare-details,:root[data-theme="dark"] .benefit-item details{border-color:var(--line)}
:root[data-theme="dark"] .lookup-result-head{background:#392c24;color:var(--ink)}
:root[data-theme="dark"] .transport-calc span{color:#b1e4cf}
:root[data-theme="dark"] .dangerbtn{background:#482a29;color:#ffc0b5;border-color:#80504c}
:root[data-theme="dark"] .danger-text,:root[data-theme="dark"] .mini-btn.remove{color:#ffb1a2}
:root[data-theme="dark"] .primary{background:#a94312;color:#fff}
:root[data-theme="dark"] .primary:hover{background:#b54a17}
:root[data-theme="dark"] .top-tabs button:not(.active){background:transparent;color:var(--secondary)}
:root[data-theme="dark"] .skip{background:var(--paper);color:var(--ink)}
:root[data-theme="dark"] .card-tag.line{background:#253e30;color:#a8e0b9}
:root[data-theme="dark"] .card-tag.air{background:#38304a;color:#d9c9ff}
:root[data-theme="dark"] .chip.green{background:var(--mint);color:var(--mint-text)}
@media(max-width:390px){.topbar{gap:4px;padding-inline:10px}.header-actions{gap:4px}#theme-toggle{width:40px;min-width:40px;height:40px}.header-actions .update-link:not(#theme-toggle){min-height:40px;padding-inline:7px}.header-actions .release{font-size:10px;white-space:nowrap}.identity{gap:5px}.identity strong{font-size:16px}.identity small{font-size:9px}}
@media(max-width:335px){.topbar .foxmark{width:30px;height:30px}.header-actions .release .status-dot{display:none}.identity small{font-size:8px}}

/* v2.7.2: constrain intrinsic widths (especially WebKit narrow lookup). */
.app-shell,.screen,.lookup-grid,.settings-grid,.home-grid,.home-grid>div,.panel,.quicklist,.quick-merchant-row,#lookup-result,.result-choice,.merchant-advice,.merchant-transport{min-width:0;max-width:100%}
.screen{grid-template-columns:minmax(0,1fr)}
.lookup-grid,.settings-grid{width:100%;grid-template-columns:minmax(0,1fr)}
.quick-merchant-row{width:100%;max-width:100%;min-width:0;overflow-x:auto}
.result-choice>div{min-width:0;overflow-wrap:anywhere;flex:1}
.result-choice .details,.lookup-result-head p,.merchant-advice p,.compare-details p,.benefit-item p,.source-row p{overflow-wrap:anywhere}
.result-choice b{flex-shrink:0;font-size:14px}
.card-tag{max-width:100%;white-space:normal;overflow-wrap:anywhere}
.form-grid input,.form-grid select,#lookup-search,.transport-calc input{min-width:0;max-width:100%;width:100%}
.form-grid label{overflow-wrap:anywhere}
@media(min-width:690px){.lookup-grid,.settings-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:360px){.result-choice{align-items:start;flex-direction:column;gap:7px}.result-choice b{white-space:normal}.result-choice>div{width:100%}.transport-calc{flex-wrap:wrap}}
