:root{color-scheme:light}
.theme-toggle{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-width:40px;min-height:40px;padding:8px 12px;border:1px solid var(--line);border-radius:8px;background:var(--white);color:var(--ink);font-size:13px;font-weight:600;flex-shrink:0;white-space:nowrap}
.theme-toggle:hover{background:var(--soft);border-color:var(--accent)}
.theme-toggle svg{width:18px;height:18px;flex-shrink:0}
.theme-moon{display:none}
:root[data-theme=dark]{color-scheme:dark;--ink:#f1f5f9;--text:#e2e8f0;--muted:#b1c2d4;--line:#33475b;--paper:#0b1423;--white:#111e30;--accent:#7dd3fc;--lime:#23455e;--soft:#163047}
[data-theme=dark] .theme-sun{display:none}
[data-theme=dark] .theme-moon{display:block}
[data-theme=dark] .brand-mark{color:#0369a1}
[data-theme=dark] .site-header,[data-theme=dark] .admin-header{background:var(--white)}
[data-theme=dark] .admin-body{background:var(--paper)}
[data-theme=dark] .converter-card,[data-theme=dark] .result-panel,[data-theme=dark] .page-link,[data-theme=dark] .site-footer{border-color:var(--line)}
[data-theme=dark] .field input,[data-theme=dark] .field select,[data-theme=dark] .unit-search-row input,[data-theme=dark] .search-box,[data-theme=dark] .swap-button,[data-theme=dark] .category-card,[data-theme=dark] .content-card,[data-theme=dark] .reference-card,[data-theme=dark] .definition-grid,[data-theme=dark] .mobile-menu summary,[data-theme=dark] .mobile-menu nav,[data-theme=dark] .precision-control select,[data-theme=dark] .field-tip p,[data-theme=dark] .calculation-report,[data-theme=dark] .report-header,[data-theme=dark] .report-close,[data-theme=dark] .calculation-report th,[data-theme=dark] .admin-card,[data-theme=dark] .admin-button.secondary,[data-theme=dark] .skip-link,[data-theme=dark] .copy-fallback{background:var(--white);color:var(--text)}
[data-theme=dark] .admin-main input:not([type=checkbox]):not([type=hidden]),[data-theme=dark] .admin-main textarea,[data-theme=dark] .admin-main select{background:var(--white);color:var(--ink);border-color:var(--line)}
[data-theme=dark] .field input,[data-theme=dark] .field select,[data-theme=dark] .unit-search-row input{border-color:#536b83}
[data-theme=dark] .eyebrow,[data-theme=dark] h1 em,[data-theme=dark] .checkmark,[data-theme=dark] .result-label,[data-theme=dark] .result-unit,[data-theme=dark] .copy-button,[data-theme=dark] .category-icon,[data-theme=dark] .formula-box,[data-theme=dark] .footer-dot,[data-theme=dark] .step-number,[data-theme=dark] .hvac-diagram{color:var(--accent)}
[data-theme=dark] .equation,[data-theme=dark] .converter-bottom>span,[data-theme=dark] .category-arrow,[data-theme=dark] .popular-card>span:last-child,[data-theme=dark] .footer-inner p,[data-theme=dark] .footer-links,[data-theme=dark] .breadcrumb,[data-theme=dark] th,[data-theme=dark] .sources,[data-theme=dark] .precision-warning,[data-theme=dark] .quantity-note,[data-theme=dark] .admin-path,[data-theme=dark] .auth-intro,[data-theme=dark] .auth-note{color:var(--muted)}
[data-theme=dark] .search-box input{color:var(--ink)}
[data-theme=dark] .search-box svg{stroke:var(--muted)}
[data-theme=dark] input::placeholder,[data-theme=dark] textarea::placeholder{color:#94a9bd}
[data-theme=dark] .category-icon,[data-theme=dark] .site-footer,[data-theme=dark] .formula-box,[data-theme=dark] th,[data-theme=dark] .measurement-field select,[data-theme=dark] .reference-toolbar,[data-theme=dark] .calculator-examples button,[data-theme=dark] .precision-warning,[data-theme=dark] .quantity-note,[data-theme=dark] .category-card:hover{background:var(--soft)}
[data-theme=dark] .calculator-grid .reference-card{background:linear-gradient(130deg,var(--soft),var(--white))}
[data-theme=dark] td,[data-theme=dark] th{border-bottom-color:var(--line)}
[data-theme=dark] .primary-link,[data-theme=dark] .convert-button,[data-theme=dark] .admin-button:not(.secondary),[data-theme=dark] .category-filters button[aria-pressed=true],[data-theme=dark] .page-link.current{background:#0369a1;color:#fff;border-color:#38bdf8}
[data-theme=dark] .primary-link:hover,[data-theme=dark] .convert-button:hover,[data-theme=dark] .admin-button:not(.secondary):hover{background:#075985}
[data-theme=dark] .admin-button.secondary{color:var(--accent)}
[data-theme=dark] .form-error,[data-theme=dark] .admin-errors{background:#382323;color:#fecaca;border-color:#815050}
[data-theme=dark] .field-error{color:#fca5a5}
[data-theme=dark] .field input[aria-invalid=true],[data-theme=dark] .field select[aria-invalid=true]{border-color:#fca5a5}
[data-theme=dark] :is(a,button,input,select,summary):focus-visible{outline-color:#38bdf8}
@media(max-width:760px){.header-inner{gap:10px}.site-header .brand{margin-right:auto}.site-header .theme-toggle{padding:8px}.site-header .theme-toggle span{display:none}}
@media(max-width:480px){.admin-header{flex-wrap:wrap}.admin-header-actions{gap:10px}}
@media print{
 :root[data-theme=dark]{color-scheme:light;--ink:#0f172a;--text:#1e293b;--muted:#475569;--line:#cbd5e1;--paper:#fff;--white:#fff;--accent:#0369a1;--lime:#bae6fd;--soft:#e0f2fe}
 .theme-toggle{display:none!important}
 .calculation-report,.calculation-report .report-header,.calculation-report th,.calculation-report .report-answer{background:#fff!important;color:#000!important}
 .calculation-report :is(h2,h3,h4,p,a,td,th){color:#000!important}
}
.header-preferences{display:flex;align-items:center;gap:12px;flex-shrink:0}
.language-switch{position:relative;flex-shrink:0}
.language-choice{display:inline-flex;align-items:center;gap:9px}
.language-flag{display:inline-flex;align-items:center;justify-content:center;width:24px;height:16px;flex-shrink:0;line-height:1}
.language-flag img{display:block;width:24px;height:16px;object-fit:cover;border-radius:2px;box-shadow:0 0 0 1px #64748b40}
.language-switch summary{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:40px;min-width:122px;padding:8px 12px;border:1px solid var(--line);border-radius:8px;background:var(--white);color:var(--ink);font-size:13px;font-weight:600;cursor:pointer;list-style:none}
.language-switch summary::-webkit-details-marker{display:none}
.language-switch summary svg{width:16px;height:16px;flex-shrink:0}
.language-switch[open] summary svg{transform:rotate(180deg)}
.language-switch summary:hover{border-color:var(--accent);background:var(--soft)}
.site-header .language-switch nav{position:absolute;right:0;top:calc(100% + 8px);z-index:30;display:flex;flex-direction:column;gap:4px;min-width:180px;max-height:min(520px,calc(100vh - 80px));overflow-y:auto;padding:6px;border:1px solid var(--line);border-radius:10px;background:var(--white);box-shadow:0 10px 30px #0002;font-size:14px}
.site-header .language-switch nav a{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:10px 12px;min-height:40px;color:var(--ink);border-radius:6px;white-space:nowrap}
.site-header .language-switch nav a:hover,.site-header .language-switch nav a[aria-current]{background:var(--soft);color:var(--accent)}
.site-header .language-switch nav a[aria-current]{font-weight:700}
@media(max-width:1100px){.site-header .header-about{display:none}.header-inner{gap:20px}.site-header .desktop-nav{gap:20px}}
@media(max-width:760px){.header-preferences{gap:8px}.site-header .language-switch nav a:last-child{display:flex}.language-switch summary{min-width:40px;min-height:40px;padding:8px;justify-content:center}.language-switch summary .language-name,.language-switch summary svg{display:none}.site-header .mobile-menu summary{padding:9px 10px}}
@media(max-width:380px){.site-header{height:60px;min-height:60px}.header-inner{flex-wrap:nowrap;padding:6px 10px;gap:6px}.site-header .brand{font-size:20px}.mobile-menu{margin-left:auto}.header-preferences{margin-left:auto;gap:6px}.site-header .brand-mark{width:27px;height:27px}.site-header .brand{gap:7px}.site-header .theme-toggle{min-width:36px;padding:8px}.site-header .mobile-menu summary{font-size:12px;padding:8px}.site-header .mobile-menu summary span{margin-left:0}.site-header .mobile-menu-label{display:none}}
@media print{.header-preferences{display:none!important}}
[data-theme=dark] .input-clear-btn{color:var(--muted)}
[data-theme=dark] .input-clear-btn:hover,[data-theme=dark] .input-clear-btn:focus-visible{background:var(--soft);color:var(--accent)}
[data-theme=dark] .error-hero-card,[data-theme=dark] .error-secondary-link,[data-theme=dark] .error-search-row input{background:var(--white);color:var(--text);border-color:var(--line)}
[data-theme=dark] .error-search{background:var(--paper);border-color:var(--line)}
[data-theme=dark] .error-secondary-link:hover{background:var(--soft);border-color:var(--accent);color:var(--accent)}
[data-theme=dark] .error-svg-ticks{stroke:#64748b}
