:root { color-scheme: light; }
.header-actions { display: flex; align-items: center; gap: 18px; flex-shrink: 0; }
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); color: var(--ink); font-size: 12px; font-weight: 550; white-space: nowrap; }
.theme-toggle[hidden] { display: none; }
.theme-toggle:hover { border-color: var(--green); }
.theme-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.theme-toggle .theme-sun { display: none; }
:root[data-theme="dark"] { color-scheme: dark; --ink: #e8eee8; --muted: #a6b4aa; --green: #8ad6ad; --line: #34433a; --paper: #101713; --soft: #213027; --white: #19231d; }
:root[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .theme-sun { display: block; }
:root[data-theme="dark"] :is(.site-header,.site-footer,.calculator-card,.formula-box,.example-card,.table-wrap,.related,.skip) { background: var(--white); }
:root[data-theme="dark"] .brand-mark { background: #286b4b; color: #fff; }
:root[data-theme="dark"] .calculator-card { box-shadow: 0 4px 20px #00000018; }
:root[data-theme="dark"] .mode-switch { background: #111a15; }
:root[data-theme="dark"] .mode-switch button[aria-pressed="true"] { background: #34493b; color: #f1f6ee; box-shadow: none; }
:root[data-theme="dark"] .input-shell { background: #141e18; border-color: #415348; }
:root[data-theme="dark"] .input-shell:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px #8ad6ad24; }
:root[data-theme="dark"] .input-shell span { color: #a5b3a9; }
:root[data-theme="dark"] .form-error { color: #ffb4a9; }
:root[data-theme="dark"] .result-panel { background: #203728; border-color: #3e5943; }
:root[data-theme="dark"] :is(.result-kicker,.result-label,.result-formula) { color: #b4cba9; }
:root[data-theme="dark"] .result-value { color: #c8efb9; }
:root[data-theme="dark"] .result-note { color: #a5bba0; }
:root[data-theme="dark"] .copy-button { background: #2a4532; border-color: #516c49; color: #d0e8c5; }
:root[data-theme="dark"] .example-chip { background: #1c2b21; border-color: #435642; color: #c3d2b8; }
:root[data-theme="dark"] .example-chip:hover { background: #2d4030; border-color: #91ba87; }
:root[data-theme="dark"] :is(.trust-row,.footer-links,.footer-bottom) { color: #a3b19c; }
:root[data-theme="dark"] .side-tip { background: #1c2b20; }
:root[data-theme="dark"] :is(.side-tip p,.content-section p,.prose p,.prose li) { color: #adbcaa; }
:root[data-theme="dark"] :is(.side-tip strong,.steps strong) { color: #d7e5ce; }
:root[data-theme="dark"] .section-number { color: #c0cdb5; border-color: #41573c; }
:root[data-theme="dark"] .formula-box span { color: #a8b7a0; }
:root[data-theme="dark"] .formula-box code { color: #b9ddaa; }
:root[data-theme="dark"] .steps .step { background: #2b3c2b; color: #bcd2ad; }
:root[data-theme="dark"] :is(.example-icon,summary:after) { color: #acc49e; }
:root[data-theme="dark"] th { background: #243324; color: #c1d2b5; }
:root[data-theme="dark"] .related-links a { background: #223325; }
/* Theme only the site's reserved ad containers; never filter or restyle ad creatives. */
:root[data-theme="dark"] .ad { background: repeating-linear-gradient(135deg,#151e17,#151e17 6px,#18231a 6px,#18231a 12px); border-color: #344a35; color: #a6b69c; }
:root[data-theme="dark"] .ad-description { color: #94a88a; }
:root[data-theme="dark"] .noscript { background: #3b321d; color: #f1dfad; }
@media (max-width: 1200px) { .header-actions .header-note { display: none; } }
@media (max-width: 760px) {
  .header-inner > nav { order: 3; width: 100%; justify-content: space-between; }
  .header-actions { margin-left: auto; }
  .theme-toggle { min-height: 42px; }
}
@media (max-width: 360px) {
  .theme-toggle { min-width: 42px; padding: 10px; }
  .theme-toggle span { display: none; }
}
