
:root{--enh-accent:#09618a;--enh-text:#142c40;--enh-card:#f4f8fc;--enh-border:#b5cfdf}
.enh-toolbar{display:flex;gap:9px;flex-wrap:wrap;align-items:center;padding:14px 0;margin:0 0 10px}
.enh-toolbar button,.enh-toolbar a,.enh-toolbar select{font:600 14px system-ui,sans-serif;min-height:44px;padding:9px 13px;border:1px solid #789db5;border-radius:9px;background:#fff;color:#17415d;cursor:pointer;text-decoration:none}
.enh-toolbar button[aria-pressed=true]{background:#e3f2fc;border-color:#09618a;color:#07476c}
.enh-actions{border:1px solid var(--enh-border);border-radius:13px;padding:14px;background:#f4f8fc;margin:12px 0 22px}
.enh-actions h2{font-size:1rem;margin:0 0 10px;color:#17384b}
.enh-action-row{display:flex;flex-wrap:wrap;gap:9px}
.enh-action-row button,.enh-action-row a{font:600 14px system-ui,sans-serif;min-height:44px;padding:10px 14px;background:#fff;border:1px solid #849eaf;color:#183e54;border-radius:9px;cursor:pointer;text-decoration:none}
.enh-status{font-size:.88rem;margin:9px 0;color:#23536d;min-height:1.2em}
.enh-history{margin:12px 0}.enh-history summary{font-weight:700;cursor:pointer;padding:8px 0}.enh-history ul{padding-left:22px}.enh-history li{margin:9px 0;line-height:1.55}.enh-history button{margin-left:8px}
.enh-fav-list{padding:8px}.enh-fav-list a{display:block;color:#e7f4ff;padding:10px 9px;line-height:1.4;min-height:40px}.enh-fav-list p{color:#fff;font-size:13px}
.enh-local-notice{font-size:.82rem;line-height:1.5}
:where(.enh-toolbar button,.enh-toolbar a,.enh-action-row button,.enh-action-row a,.enh-fav-list a):focus-visible{outline:3px solid #d97706;outline-offset:3px}
html[data-theme=dark] body{background:#0e1926!important;color:#e7eff8!important}
html[data-theme=dark] .sc-content,html[data-theme=dark] main,html[data-theme=dark] .guide,html[data-theme=dark] .enh-actions{background:#172637!important;color:#eef5fc!important}
html[data-theme=dark] .enh-toolbar button,html[data-theme=dark] .enh-action-row button,html[data-theme=dark] .enh-action-row a{background:#23384b;color:#fff;border-color:#6a91a7}
html[data-theme=dark] p,html[data-theme=dark] h1,html[data-theme=dark] h2,html[data-theme=dark] h3{color:inherit!important}
@media(max-width:650px){.enh-toolbar button,.enh-toolbar select{flex:1 1 auto}.enh-action-row button{flex:1 1 120px}}
@media(prefers-reduced-motion:reduce){*,*:before,*:after{scroll-behavior:auto!important;animation-duration:.01ms!important;transition-duration:.01ms!important}}

.enh-compare{overflow:auto;margin-top:14px}.enh-compare table{border-collapse:collapse;width:100%;min-width:420px;font-size:13px}.enh-compare th,.enh-compare td{text-align:left;padding:10px;border:1px solid #b4c9d7;overflow-wrap:anywhere;vertical-align:top}.enh-compare th{background:#e2edf5;color:#183d53}.enh-compare h3{font-size:1rem;margin:9px 0}

/* Header utility controls: always available at top of calculator page */
.sc-content>header{display:flex;align-items:center;justify-content:space-between;flex-wrap:wrap;gap:12px;min-height:74px}
.sc-content>header>a{flex:0 0 auto}
.sc-content>header .enh-toolbar{margin:0;padding:0;display:flex;align-items:center;justify-content:flex-end;gap:9px;flex:1 1 340px}
.sc-content>header .enh-toolbar :is(button,select){white-space:nowrap;min-height:44px}
@media(max-width:650px){.sc-content>header{padding:12px 14px}.sc-content>header .enh-toolbar{justify-content:flex-start;flex-wrap:wrap;flex:1 1 100%}.sc-content>header .enh-toolbar :is(button,select){flex:1 1 140px;min-width:0}}
/* Theme tokens apply to page AND iframe; replace hard-coded white surfaces in dark mode. */
html[data-theme=dark]{color-scheme:dark;--blue:#78cbff;--nav:#101e30;--border:#557086;--enh-card:#1b3043;--enh-border:#557086;--enh-text:#edf5fc;--nav-ink:#edf5fc}
html[data-theme=dark] body{background:#0d1827!important;color:#eef5fc!important}
html[data-theme=dark] :is(.sc-content,.sc-content main,.sc-content .card,.sc-content article,.sc-content .guide,.enh-actions,.enh-compare,.enh-history,footer,.intro,.sectionhead,.cardhead,.fields,.result,.new-card,.new-wrap,.new-grid,.directory-card,.unified-directory,.popular-links){background:#182b3e!important;color:#eef5fc!important;border-color:#557086!important;box-shadow:none!important}
html[data-theme=dark] :is(.sc-content h1,.sc-content h2,.sc-content h3,.sc-content h4,.sc-content p,.sc-content label,.sc-content span,.sc-content li,.sc-content small,.sc-content strong,.sc-content .sectionhead p,.sc-content .cardhead p,.sc-content .intro p,.sc-content .result,.sc-content .fields label){color:#eef5fc!important}
html[data-theme=dark] :is(.sc-content a,.enh-footer a,.guide a){color:#a8ddff!important}
html[data-theme=dark] :is(.sc-content input,.sc-content select,.sc-content textarea,.sc-content output,.sc-content option,.enh-toolbar button,.enh-toolbar select,.enh-action-row button,.enh-history button,.enh-compare td,.enh-compare th,.fields input,.fields select,.new-card input,.new-card select){background:#243b51!important;color:#ffffff!important;border-color:#90abc2!important}
html[data-theme=dark] :is(.sc-content input,.sc-content select,.sc-content textarea)::placeholder{color:#d0e0ec!important}
html[data-theme=dark] :is(.sc-content button:not(.sc-category),.enh-toolbar button,.enh-action-row button,.filter-button,.new-card button){background:#265276!important;color:#ffffff!important;border-color:#8fb6d1!important}
html[data-theme=dark] .enh-toolbar button[aria-pressed=true]{background:#305d54!important;color:#fafffa!important;border-color:#9bdfb1!important}
html[data-theme=dark] :is(.enh-status,.enh-local-notice,.sc-search-status){color:#d4e8f5!important}
html[data-theme=dark] :is(.sc-content a,.sc-content button,.sc-content input,.sc-content select):focus-visible{outline:3px solid #ffbe70!important;outline-offset:3px!important}
html[data-theme=dark] :is(.enh-compare th,.enh-compare td){border-color:#68849a!important}
/* Existing light mode contrast: explicit backgrounds for interactive surfaces */
html[data-theme=light]{color-scheme:light}
html[data-theme=light] .enh-actions{background:#f4f8fc;color:#18394f}
