/* Inter - self-hosted */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('/assets/inter-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Material Icons - self-hosted */
@font-face {
    font-family: 'Material Icons Outlined';
    font-style: normal;
    font-weight: 400;
    font-display: block;
    src: url('/assets/material-icons-outlined.woff2') format('woff2');
}

.material-icons-outlined {
    font-family: 'Material Icons Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 24px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    width: 1em;
    height: 1em;
    overflow: hidden;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

:root {
    --accent: #1F6FE0;
    --accent-dark: #1a5fbd;
    --accent-light: #E8F0FE;
    --nec-ok: #22C55E;
    --nec-warn: #F59E0B;
    --nec-over: #EF4444;
    --nec-ok-text: #166534;
    --nec-warn-text: #92400E;
    --nec-over-text: #B91C1C;
    --bg: #F7F9FF;
    --text: #181C1F;
    --text-muted: #5F6672;
    --surface: #FFFFFF;
    --border: #E5E7EB;
    --focus-ring: rgba(31, 111, 224, 0.15);
    --accent-border: rgba(31, 111, 224, 0.15);
    --card-shadow: rgba(31, 111, 224, 0.06);
    color-scheme: light dark;
}

[data-theme="dark"] {
    --accent: #5BD0F4;
    --accent-dark: #7DDCF8;
    --accent-light: #0E1E2E;
    --bg: #121218;
    --text: #E8E8ED;
    --text-muted: #9CA3AF;
    --surface: #1E1E26;
    --border: #2E2E3A;
    --focus-ring: rgba(91, 208, 244, 0.2);
    --accent-border: rgba(91, 208, 244, 0.15);
    --card-shadow: rgba(91, 208, 244, 0.08);
    --nec-ok-text: #4ADE80;
    --nec-warn-text: #FCD34D;
    --nec-over-text: #FCA5A5;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 72px;
}

.no-transitions,
.no-transitions *,
.no-transitions *::before,
.no-transitions *::after {
    transition: none !important;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.6;
    padding-top: 57px;
    font-size: 16px;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Visited state only on inline content links --- not navigation */
.content-block a:visited,
.intro a:visited,
.faq-answer a:visited {
    color: var(--accent-dark);
}

/* Skip link */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--accent);
    color: #fff;
    padding: 8px 16px;
    z-index: 200;
    font-size: 14px;
    text-decoration: none;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    top: 0;
}

/* Header */
.header {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

[data-theme="dark"] .header {
    background: rgba(18, 18, 24, 0.7);
}

.header-inner {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 56px;
}

.header-logo img {
    height: 28px;
    width: auto;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    height: 38px;
    width: 320px;
    transition: border-color 0.15s;
}

.search-box:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.search-box .material-icons-outlined {
    font-size: 18px;
    color: var(--text-muted);
    margin-right: 8px;
}

.search-box input {
    border: none;
    background: none;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    width: 100%;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: border-color 0.15s, color 0.15s;
    flex-shrink: 0;
}

.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.theme-toggle .material-icons-outlined {
    font-size: 20px;
}

/* Show correct theme icon without JS */
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: inline-block; }

/* App menu */
.app-menu-wrap {
    position: relative;
}

.app-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    z-index: 200;
    grid-template-columns: repeat(3, 80px);
    gap: 8px;
}

.app-menu.open {
    display: grid;
}

.app-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 4px;
    border-radius: 8px;
    text-decoration: none;
    color: var(--text);
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    transition: background 0.15s;
    cursor: pointer;
}

.app-menu-item:hover {
    background: var(--accent-light);
}

.app-menu-item.dimmed {
    opacity: 0.4;
    pointer-events: none;
    cursor: default;
}

.app-menu-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
}

.app-menu-icon .material-icons-outlined {
    font-size: 22px;
}

/* Logo swap */
.logo-light { display: block; }
.logo-dark { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark { display: block; }

/* Page layout with ToC sidebar */
.page-layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 32px 64px;
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 48px;
}

.page-wrapper {
    min-width: 0;
}

/* Table of contents */
.toc {
    padding-top: 8px;
}

.toc-inner {
    position: -webkit-sticky;
    position: sticky;
    top: 80px;
}

.toc-title {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.toc ul {
    list-style: none;
}

.toc li {
    margin-bottom: 6px;
}

.toc a {
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    display: block;
    padding: 4px 0 4px 12px;
    border-left: 2px solid transparent;
    transition: color 0.15s, border-color 0.15s;
    line-height: 1.4;
}

.toc a:hover {
    color: var(--accent);
}

.toc a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 500;
}

/* Breadcrumb */
.breadcrumb ol {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    list-style: none;
    padding-left: 0;
}

.breadcrumb li {
    display: flex;
    align-items: center;
    gap: 6px;
}

.breadcrumb li:not(:last-child)::after {
    content: '>';
    font-size: 11px;
    color: var(--text-muted);
}

.breadcrumb a {
    color: var(--accent);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

/* Reverse link */
.reverse-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 16px;
}

.reverse-link:hover {
    text-decoration: none;
}

.reverse-link:hover span:not(.material-icons-outlined) {
    text-decoration: underline;
}

.reverse-link .material-icons-outlined {
    font-size: 16px;
}

/* Page headings */
h1 {
    font-size: 28px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 24px;
}

h2 {
    font-size: 20px;
    font-weight: 700;
    margin-top: 32px;
    margin-bottom: 12px;
}

h2:first-child {
    margin-top: 0;
}

h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

p {
    color: var(--text);
    margin-bottom: 12px;
}

.intro {
    font-size: 15px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.7;
}

/* Also converted block */
.also-converted {
    background: var(--accent-light);
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.also-converted-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
}

.also-converted-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.also-converted-item {
    font-size: 14px;
    font-weight: 500;
}

.also-converted-item a {
    color: var(--accent);
    text-decoration: none;
}

.also-converted-item a:hover {
    text-decoration: underline;
}

/* Calculator card */
.calc-sub-result {
    text-align: center;
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 8px;
}

.calculator-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    margin: 28px 0 36px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.calc-row {
    display: flex;
    align-items: center;
    gap: 16px;
}

.calc-row-outputs {
    margin-top: 18px;
    padding-top: 18px;
    border-top: 1px dashed var(--border);
}

.calc-note {
    margin-top: 14px;
    color: var(--text-muted);
    line-height: 1.5;
}

.calc-field {
    flex: 1;
    min-width: 0;
}

/* For calculator outputs that render two values in one field (e.g. "23.50V (19.59%)"
   on voltage-drop). Gives the field ~60% more flex weight so the combined value fits
   without clipping at typical screen widths, and a min-width fallback for narrower
   viewports. */
.calc-field--wide {
    flex: 1.6;
    min-width: 160px;
}

.calc-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.calc-input-wrap {
    display: flex;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    min-height: 46px;
    overflow: hidden;
    position: relative;
    transition: border-color 0.15s;
}

.calc-input-wrap:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.calc-input-wrap input {
    border: none;
    outline: none;
    background: none;
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    padding: 0 14px;
    width: 100%;
    height: 100%;
    color: var(--text);
}

.calc-phase-select {
    border: none;
    outline: none;
    background: var(--surface);
    color: var(--text);
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    padding: 0 36px 0 14px;
    width: 100%;
    height: 100%;
    min-height: 44px;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235F6672' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
}
.calc-phase-select option {
    background: var(--surface);
    color: var(--text);
}

.calc-unit {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    padding-right: 14px;
    white-space: nowrap;
}

.calc-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    color: var(--accent);
    flex-shrink: 0;
    margin-top: 22px;
}

/* Hub calculator card */
.calc-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px 32px;
    margin-bottom: 32px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

.calc-card .calc-label {
    text-align: center;
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
}

/* WireResult multi-input calculator layout */
.calc-input-group {
    margin-bottom: 16px;
}
.calc-input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.calc-input-group input,
.calc-input-group select {
    width: 100%;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 500;
    padding: 0 14px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}
.calc-input-group input:focus,
.calc-input-group select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}
.calc-input-group.calc-solved label::after {
    content: ' (solved)';
    color: var(--accent);
    font-weight: 500;
    font-size: 12px;
}
.calc-input-group.calc-solved input[readonly] {
    background: var(--accent-light);
    color: var(--text);
    border-color: var(--accent-border);
    cursor: not-allowed;
}
.calc-input-group.calc-solved input[readonly]:focus {
    box-shadow: none;
    border-color: var(--accent-border);
}
.calc-input-group select {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%235F6672' d='M2 4l4 4 4-4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 36px;
}
.calc-detail-link {
    display: block;
    text-align: center;
    font-size: 13px;
    color: var(--accent);
    margin-top: 12px;
}
.calc-detail-link:hover {
    text-decoration: underline;
}

/* Hub calculators -- wider than result page calcs but not full width */
.hub-calc {
    max-width: 780px;
}
.hub-calc .calc-result-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
    padding: 16px;
    background: var(--accent-light);
    border-radius: 10px;
}
.hub-calc .calc-output {
    font-size: 36px;
    font-weight: 700;
    color: var(--accent-dark);
}
.hub-calc .calc-equals {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-muted);
}
.calc-unit-label {
    font-size: 18px;
    font-weight: 500;
    color: var(--text-muted);
}

/* Pop grid label (optional span inside pop-item) */
.pop-label {
    display: inline;
}

/* Hero subtitle (alias for hero p) */
.hero-subtitle {
    font-size: 17px;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 600px;
    margin: 0 auto 32px;
}

.calc-card .calc-row {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.calc-card .calc-field {
    position: relative;
    flex: 0 1 140px;
}

.calc-card .calc-field input {
    width: 100%;
    height: 46px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    padding: 0 14px;
    background: var(--bg);
    color: var(--text);
    outline: none;
    transition: border-color 0.15s;
}

.calc-card .calc-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.calc-prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

.calc-card .calc-field input.has-prefix {
    padding-left: 28px;
}

/* Hide native number input spinner arrows on inline row calculators only */
.calc-card .calc-field input[type="number"]::-webkit-inner-spin-button,
.calc-card .calc-field input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.calc-card .calc-field input[type="number"] {
    -moz-appearance: textfield;
}

.calc-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    pointer-events: none;
}

.calc-of {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-muted);
}

.calc-result-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 16px;
}

.calc-equals {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-muted);
}

.calc-output {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.calc-formula {
    text-align: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
}

.calc-link {
    display: block;
    text-align: center;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    margin-top: 12px;
}

.calc-estimate-note {
    text-align: center;
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
    padding: 0 12px;
}

.calc-link:hover {
    text-decoration: underline;
}

.calc-reverse {
    text-align: center;
    margin-top: 10px;
}

.calc-reverse a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    color: var(--text-muted);
    text-decoration: none;
    background: var(--surface);
    transition: all 0.15s;
}

.calc-reverse a .material-icons-outlined {
    font-size: 16px;
    color: var(--accent);
}

.calc-reverse a:hover {
    color: var(--accent);
    border-color: var(--accent);
    text-decoration: none;
}

/* Result page reverse link (percentvalue-style, accent colored) */
.reverse-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
    text-decoration: none;
    margin-bottom: 16px;
}
.reverse-link:hover {
    text-decoration: none;
}
.reverse-link:hover span:not(.material-icons-outlined) {
    text-decoration: underline;
}
.reverse-link .material-icons-outlined {
    font-size: 18px;
}

/* Action bar (Cite / Embed toggles on result pages) */
.action-bar {
    display: flex;
    gap: 8px;
    margin: 14px 0 20px;
    flex-wrap: wrap;
}
.action-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.action-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.action-toggle[aria-expanded="true"] {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(31, 111, 224, 0.06);
}
.action-toggle .material-icons-outlined {
    font-size: 16px;
}
.action-panel {
    margin-top: 10px;
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
}
.action-panel[hidden] { display: none; }
.action-desc {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}
.action-code {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--text);
    resize: vertical;
    margin-bottom: 8px;
    line-height: 1.5;
}
.action-copy {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.action-copy:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.action-copy.copied {
    border-color: #28a745;
    color: #28a745;
}
.action-copy .material-icons-outlined {
    font-size: 16px;
}

/* Embed this calculator panel */
.embed-panel {
    max-width: 780px;
    margin: 16px auto 0;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    overflow: hidden;
}
.embed-panel summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    list-style: none;
    user-select: none;
}
.embed-panel summary::-webkit-details-marker { display: none; }
.embed-panel summary::after {
    content: 'expand_more';
    font-family: 'Material Icons Outlined';
    font-size: 20px;
    margin-left: auto;
    color: var(--text-muted);
    transition: transform 0.15s;
}
.embed-panel[open] summary::after { transform: rotate(180deg); }
.embed-panel summary:hover { background: rgba(31, 111, 224, 0.04); }
.embed-panel summary .material-icons-outlined {
    font-size: 18px;
    color: var(--accent);
}
.embed-panel-body {
    padding: 0 16px 16px;
    border-top: 1px solid var(--border);
}
.embed-panel-body p {
    font-size: 13px;
    color: var(--text-muted);
    margin: 12px 0 10px;
}
.embed-code-box {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    font-family: ui-monospace, monospace;
    font-size: 12px;
    color: var(--text);
    resize: vertical;
    margin-bottom: 8px;
}
.embed-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}
.embed-copy-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.embed-copy-btn.copied {
    border-color: #28a745;
    color: #28a745;
}
.embed-copy-btn .material-icons-outlined {
    font-size: 16px;
}
.embed-preview {
    margin-top: 14px;
}
.embed-preview iframe {
    width: 100%;
    display: block;
}
.embed-note {
    font-size: 11px !important;
    color: var(--text-muted);
    margin-top: 10px !important;
    font-style: italic;
}

/* Standards & References block */
.references-section {
    border-top: 1px solid var(--border);
    padding-top: 24px;
}
.references-list {
    padding-left: 20px;
    margin: 16px 0;
}
.references-list li {
    margin-bottom: 14px;
    font-size: 14px;
    line-height: 1.6;
}
.references-list li strong {
    color: var(--accent);
}
.references-list small {
    color: var(--text-muted);
    font-size: 12px;
}
.references-list a {
    color: var(--accent);
    text-decoration: none;
}
.references-list a:hover {
    text-decoration: underline;
}

/* Screen reader only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.calc-result {
    background: var(--accent-light);
    border-color: var(--accent-border);
}

.calc-result output {
    border: none;
    outline: none;
    font-family: inherit;
    font-size: 18px;
    font-weight: 600;
    white-space: nowrap;
    padding: 0 14px;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    color: var(--accent-dark);
    background: none;
}

/* Content sections */
.section {
    margin-top: 36px;
    margin-bottom: 36px;
}

.section h3 {
    margin-top: 28px;
    margin-bottom: 8px;
}

.section h3:first-child {
    margin-top: 0;
}

.formula-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 4px 8px 8px 4px;
    padding: 16px 20px;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    font-family: 'Courier New', monospace;
    color: var(--text);
}

.definition-box {
    background: var(--accent-light);
    border: 1px solid var(--accent-border);
    border-left: 4px solid var(--accent);
    border-radius: 8px;
    padding: 16px 20px;
    margin: 0 0 28px 0;
    font-size: 16px;
    line-height: 1.55;
    color: var(--text);
}
.definition-box strong {
    color: var(--accent);
    font-weight: 600;
}

/* Common queries */
.common-queries {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 12px;
}

.common-query-link {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text);
    text-decoration: none;
    transition: border-color 0.15s;
}

.common-query-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

.common-query-link .material-icons-outlined {
    font-size: 16px;
    color: var(--accent);
}

.common-query-desc {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
    margin-top: 2px;
}

/* Conversion table */
.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 12px;
}

.conv-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 16px;
}

/* Tables that need to scroll wrap in div[style*="overflow-x:auto"] */

.conv-table th {
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.conv-table td {
    padding: 10px 16px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.conv-table tr:last-child td {
    border-bottom: none;
}

.conv-table tbody tr:hover {
    background: var(--accent-light);
}

.conv-table td:first-child {
    font-weight: 500;
}

.conv-table td:last-child {
    color: var(--accent-dark);
    font-weight: 600;
}

.conv-table tr.highlight {
    background: var(--accent-light);
}

.conv-table a {
    color: inherit;
    text-decoration: none;
}

.main-content.hub-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 32px 64px;
}

.hub-content .section {
    margin-top: 32px;
    margin-bottom: 32px;
}

.hub-content h2 {
    margin-top: 32px;
}

.formula-cell {
    font-family: 'Courier New', monospace;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conv-table:has(.formula-cell) {
    table-layout: auto;
}

.content-list {
    margin-left: 20px;
    margin-bottom: 12px;
}

.content-list li {
    margin-bottom: 8px;
}

.table-footer {
    margin-top: 12px;
}

.conv-table a:hover {
    color: var(--accent);
}

.conv-table .table-desc {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 400;
}

.table-more {
    display: block;
    text-align: center;
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    color: var(--accent);
    text-decoration: none;
    border-top: 1px solid var(--border);
}

.table-more:hover {
    background: var(--accent-light);
}

/* Related links */
.related-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 12px;
}

.related-col h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
}

.related-col ul {
    list-style: none;
}

.related-col li {
    margin-bottom: 4px;
}

.related-col a {
    font-size: 14px;
    color: var(--accent);
    text-decoration: none;
}

.related-col a:hover {
    text-decoration: underline;
}

/* FAQ */
.faq-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin-bottom: 12px;
}

.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    color: var(--text);
    font-family: inherit;
}

.faq-question:hover {
    color: var(--accent);
}

.faq-question .material-icons-outlined {
    font-size: 20px;
    color: var(--text-muted);
    transition: transform 0.2s;
}

.faq-item.open .faq-question .material-icons-outlined {
    transform: rotate(180deg);
}

.faq-answer {
    display: none;
    padding: 0 18px 16px;
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
}

.faq-answer a {
    color: var(--accent);
    text-decoration: none;
}

.faq-answer a:visited {
    color: var(--accent);
}

.faq-answer a:hover {
    text-decoration: underline;
}

.faq-item.open .faq-answer {
    display: block;
}

/* E-E-A-T footer */
.eeat-footer {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    margin-top: 32px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 32px;
}

.eeat-footer span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.eeat-footer .material-icons-outlined {
    font-size: 14px;
}

/* Hero (homepage) */
.hero {
    max-width: 100%;
    padding: 80px 24px 56px;
    text-align: center;
    background: linear-gradient(135deg, var(--accent-light) 0%, var(--bg) 100%);
    border-bottom: 1px solid var(--border);
}

.hero h1 {
    font-size: 36px;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 16px;
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
}

.hero p {
    font-size: 17px;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 600px;
    margin: 0 auto 32px;
}

.hero-search {
    display: flex;
    align-items: center;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 0 16px;
    height: 52px;
    max-width: 480px;
    margin: 0 auto;
    transition: border-color 0.15s;
}

.hero-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--focus-ring);
}

.hero-search .material-icons-outlined {
    font-size: 22px;
    color: var(--text-muted);
    margin-right: 12px;
}

.hero-search input {
    border: none;
    background: none;
    outline: none;
    font-family: inherit;
    font-size: 16px;
    color: var(--text);
    width: 100%;
}

.hero-search input::placeholder {
    color: var(--text-muted);
}

/* Hero converter */
.hero-converter {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 24px auto 16px;
    max-width: 640px;
}

.hero-converter-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.hero-calc-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-muted);
}
.hero-calc-unit {
    margin-left: 8px;
}

.hero-converter-field input {
    width: 90px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    font-size: 16px;
    font-weight: 600;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    outline: none;
}

.hero-converter-field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--focus-ring);
}

.hero-converter select {
    width: 120px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 30px 0 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='%235F6672'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    background-size: 18px;
}

.hero-converter select:focus {
    border-color: var(--accent);
}

.hero-converter-arrow {
    font-size: 20px;
    color: var(--accent);
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: background 0.15s;
    width: 28px;
    height: 28px;
    overflow: hidden;
}

.hero-converter-arrow:hover {
    background: var(--accent-light);
}

.hero-converter-result {
    background: var(--accent-light);
    border: 1px solid var(--accent-border);
    border-radius: 8px;
    padding: 0 14px;
    height: 42px;
    display: flex;
    align-items: center;
    min-width: 90px;
}

.hero-converter-result output {
    font-size: 16px;
    font-weight: 600;
    color: var(--accent-dark);
}

.hero-converter-link {
    display: block;
    text-align: center;
    margin-top: 12px;
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
}

.hero-converter-link:hover {
    text-decoration: underline;
}

/* Try these links */
.hero-try {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 24px;
    font-size: 13px;
}

.hero-try-label {
    color: var(--text-muted);
}

.hero-try a {
    color: var(--accent);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.15s;
}

.hero-try a:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

@media (max-width: 700px) {
    .hero-converter {
        padding: 16px;
    }

    .hero-converter-row {
        flex-direction: column;
        gap: 8px;
    }

    .hero-calc-label {
        font-size: 14px;
    }

    .hero-converter-field {
        width: 100%;
    }

    .hero-converter-field input {
        width: 100%;
    }

    .hero-converter-result {
        width: 100%;
    }

    .hero-try a {
        font-size: 12px;
    }
}

.hero-stats {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-top: 32px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 16px 0;
    max-width: 420px;
    margin-left: auto;
    margin-right: auto;
}

.hero-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    padding: 4px 16px;
}

.hero-stat-number {
    font-size: 24px;
    font-weight: 700;
    color: var(--accent);
}

.hero-stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
}

.hero-stat-divider {
    width: 1px;
    height: 36px;
    background: var(--border);
}

/* Main content (homepage) */
.main-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 32px 64px;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 16px;
    padding-left: 12px;
    border-left: 3px solid var(--accent);
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 48px;
}

.category-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s, box-shadow 0.15s;
    min-height: 260px;
}

.category-card:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px var(--card-shadow);
}

.category-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
    text-decoration: none;
    color: var(--text);
}

.category-card-header:hover {
    text-decoration: none;
}

.category-card-header:hover h3 {
    color: var(--accent);
}

.category-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-light);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent);
    flex-shrink: 0;
}

.category-icon .material-icons-outlined {
    font-size: 22px;
}

.category-card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 0;
}

.category-card.dimmed {
    opacity: 0.5;
    pointer-events: none;
}

.category-card.dimmed .category-card-header:hover h3 {
    color: var(--text);
}

.calc-count {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    display: block;
}

.category-card p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
    flex: 1;
}

.category-links {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.category-links a {
    font-size: 13px;
    color: var(--accent);
    text-decoration: none;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    transition: border-color 0.15s;
}

.category-links a:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    text-decoration: none;
}

/* Popular links */
.pop-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 48px;
}

.pop-item {
    display: block;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    text-decoration: none;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: border-color 0.15s, color 0.15s;
}

.pop-icon {
    font-size: 18px;
    color: var(--accent);
    vertical-align: middle;
    margin-right: 8px;
}

.pop-result {
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 400;
    float: right;
}

.pop-item:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}

/* Content blocks */
.content-block {
    margin-bottom: 48px;
}

.content-block h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

.content-block p {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.7;
    max-width: 720px;
    margin-bottom: 14px;
}

.content-block p:last-child {
    margin-bottom: 0;
}

.content-block ul,
.content-block ol {
    max-width: 720px;
    margin-bottom: 14px;
}

.content-block ul + p,
.content-block ol + p,
.content-block table + p,
.content-block .formula-block + p {
    margin-top: 16px;
}

.content-block ul {
    list-style: none;
}

.content-block li {
    font-size: 15px;
    color: var(--text-muted);
    line-height: 1.7;
    padding-left: 20px;
    position: relative;
    margin-bottom: 4px;
}

.content-block ul > li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 11px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

ol {
    padding-left: 1.2em;
}

.section ul {
    list-style: disc;
    padding-left: 24px;
    margin-bottom: 14px;
}

.section li {
    margin-bottom: 4px;
}

.section ul + p,
.section ol + p,
.section table + p,
.section .formula-block + p {
    margin-top: 16px;
}

.content-block ol > li {
    padding-left: 0;
}

/* 404 page */
.slim-page {
    max-width: 720px;
    margin: 0 auto;
    padding: 64px 24px;
    text-align: center;
    min-height: 60vh;
}

.slim-page .hero-search {
    max-width: 480px;
    margin: 32px auto;
}

.search-empty {
    text-align: center;
    color: var(--text-muted);
    grid-column: 1 / -1;
}

.slim-page-link {
    margin-top: 24px;
}

.slim-page-link a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.slim-page-link a:hover {
    text-decoration: underline;
}

/* Privacy page */
.privacy-content {
    max-width: 860px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.privacy-content ul {
    list-style: disc;
    padding-left: 24px;
    margin-bottom: 12px;
}

.privacy-content li {
    margin-bottom: 4px;
}

/* Admin dashboard */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-bottom: 32px;
}

.admin-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 16px;
    text-align: center;
}

.admin-stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
}

.admin-stat-label {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.admin-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.admin-badge.live {
    background: #d1fae5;
    color: #065f46;
}

.admin-badge.planned {
    background: #fef3c7;
    color: #92400e;
}

.admin-badge.dimmed {
    background: var(--border);
    color: var(--text-muted);
}

[data-theme="dark"] .admin-badge.live {
    background: #064e3b;
    color: #6ee7b7;
}

[data-theme="dark"] .admin-badge.planned {
    background: #78350f;
    color: #fcd34d;
}

.admin-note {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
    line-height: 1.6;
}

.admin-note code {
    background: var(--accent-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
}

.admin-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 32px;
}

.admin-control-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
}

.admin-control-card h3 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px;
}

.admin-control-card p {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.admin-inline-form {
    display: inline;
}

.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: border-color 0.15s, background 0.15s;
}

.admin-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.admin-btn-sm {
    padding: 4px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s;
}

.admin-btn-sm:hover {
    border-color: var(--accent);
}

.admin-btn-current {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
    box-shadow: 0 0 0 2px var(--focus-ring);
    cursor: default;
    font-weight: 600;
}

.admin-btn-danger {
    border-color: #ef4444;
    color: #ef4444;
}

.admin-btn-danger:hover {
    background: #fef2f2;
}

[data-theme="dark"] .admin-btn-danger:hover {
    background: #450a0a;
}

.admin-key {
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}



.admin-category-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.admin-category-row {
    display: grid;
    grid-template-columns: 28px 180px 90px 90px 1fr;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.admin-category-row:last-child {
    border-bottom: none;
}

.admin-category-name {
    font-size: 14px;
    font-weight: 500;
}

.admin-category-pages {
    font-size: 13px;
    color: var(--text-muted);
}



.admin-cat-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.admin-cat-toggle:last-child {
    border-bottom: none;
}

.admin-cat-icon {
    font-size: 18px;
    color: var(--accent);
    flex-shrink: 0;
}

.admin-cat-name {
    font-size: 14px;
    font-weight: 500;
    min-width: 180px;
}

.admin-cat-pages {
    font-size: 13px;
    color: var(--text-muted);
    margin-left: auto;
    margin-right: 8px;
}

.admin-alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 24px;
}

.admin-alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

[data-theme="dark"] .admin-alert-success {
    background: #064e3b;
    color: #6ee7b7;
    border-color: #065f46;
}

.admin-alert-info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}

[data-theme="dark"] .admin-alert-info {
    background: #1e3a5f;
    color: #93c5fd;
    border-color: #1e40af;
}

.disclaimer {
    background: var(--accent-light);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
}

@media (max-width: 700px) {
    .admin-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Numeric value hero answer */
.hero-answer {
    background: var(--accent-light);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    text-align: center;
}

.hero-answer .result {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.hero-answer .result-formula {
    font-size: 22px;
    font-weight: 600;
    color: var(--accent);
    white-space: normal;
    word-wrap: break-word;
}

.hero-answer .result-sub {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.result-note {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 8px;
    margin-bottom: 0;
}

/* Percentage donut chart */
.pct-chart {
    text-align: center;
}

.pct-donut {
    width: 160px;
    height: 160px;
    margin: 0 auto 16px;
}

.pct-donut-bg {
    fill: none;
    stroke: #007DFC;
    stroke-width: 12;
}

.pct-donut-fill {
    fill: none;
    stroke: #5BD0F4;
    stroke-width: 12;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: center;
    transition: stroke-dasharray 0.6s ease-out;
}

.pct-donut-label {
    font-size: 18px;
    font-weight: 700;
    fill: var(--text);
    text-anchor: middle;
    dominant-baseline: central;
}

.pct-donut-sub {
    font-size: 13px;
    fill: var(--text-muted);
    text-anchor: middle;
    dominant-baseline: central;
}

.pct-chart-legend {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-bottom: 12px;
    font-size: 14px;
}

.pct-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text);
}

.pct-legend-swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.pct-legend-filled {
    background: #5BD0F4;
}

.pct-legend-remainder {
    background: #007DFC;
}

.pct-chart-caption {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    max-width: 520px;
    margin: 0 auto;
}

/* Site footer */
.site-footer {
    border-top: 1px solid var(--border);
    background: var(--surface);
    padding: 48px 24px 32px;
}

.footer-inner {
    max-width: 1100px;
    margin: 0 auto;
}

.footer-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr 1fr 1fr;
    gap: 32px;
    margin-bottom: 32px;
}

.footer-brand p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 12px;
    margin-bottom: 0;
    max-width: 400px;
    line-height: 1.6;
}

.footer-brand img {
    height: 24px;
    width: auto;
}

.footer-heading {
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text);
    margin-bottom: 12px;
}

.footer-col ul {
    list-style: none;
}

.footer-col li {
    margin-bottom: 8px;
}

.footer-col a {
    font-size: 14px;
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.15s;
}

.footer-col a:hover {
    color: var(--accent);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding-top: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: var(--text-muted);
}

.footer-bottom-links {
    display: flex;
    gap: 16px;
}

.footer-bottom-links a {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-bottom-links a:hover {
    color: var(--accent);
}

.footer-credit {
    color: var(--text-muted);
    text-decoration: none;
}

.footer-credit:hover {
    color: var(--accent);
}

/* Responsive */
@media (max-width: 900px) {
    .page-layout {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .toc {
        display: none;
    }
}

@media (min-width: 641px) and (max-width: 960px) {
    .category-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 700px) {
    .hero h1 {
        font-size: 28px;
    }

    .hero p {
        font-size: 15px;
    }

    .search-box {
        display: none;
    }

    .calc-row {
        flex-direction: column;
        gap: 8px;
    }

    .calc-arrow {
        margin-top: 0;
        transform: rotate(90deg);
    }

    .calc-card {
        padding: 20px 16px;
    }

    .calc-card .calc-row {
        gap: 6px;
    }

    .calc-card .calc-field {
        flex: 1 1 auto;
        width: 100%;
    }

    .calc-of {
        margin: 0;
        font-size: 13px;
    }

    .calc-result-row {
        margin-top: 8px;
    }

    .calc-output {
        font-size: 18px;
    }

    .calculator-card {
        padding: 16px;
    }

    .calculator-card .calc-row {
        flex-direction: column;
        gap: 8px;
    }

    .calculator-card .calc-field {
        width: 100%;
        flex: none;
    }

    .calculator-card .calc-arrow {
        display: none;
    }

    .calculator-card .calc-result output {
        font-size: 16px;
    }

    .category-grid {
        grid-template-columns: 1fr;
    }

    .pop-grid {
        grid-template-columns: 1fr;
    }

    .related-grid {
        grid-template-columns: 1fr;
    }

    .common-queries {
        grid-template-columns: 1fr;
    }

    .hero-answer .result {
        font-size: 26px;
    }

    .conv-table .table-desc {
        display: none;
    }

    /* Mobile tables: smaller text, tighter padding */
    .conv-table th,
    .conv-table td {
        padding: 8px 10px;
        font-size: 13px;
    }

    h1 {
        font-size: 24px;
    }

    .eeat-footer {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 24px;
    }

    .footer-brand {
        grid-column: 1 / -1;
    }

    .footer-bottom {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
}

/* --- WireResult-specific: NEC Compliance Badges --- */
.nec-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
}
.nec-badge .material-icons-outlined { font-size: 18px; }
.nec-ok { background: rgba(34, 197, 94, 0.12); color: var(--nec-ok-text); }
.nec-warn { background: rgba(245, 158, 11, 0.12); color: var(--nec-warn-text); }
.nec-over { background: rgba(239, 68, 68, 0.12); color: var(--nec-over-text); }

/* --- Table utilities --- */
.table-scroll { overflow-x: auto; }
.status-ok { color: var(--nec-ok); }
.status-warn { color: var(--nec-warn); }
.status-over { color: var(--nec-over); }
.row-current { background: var(--accent-light); }

/* --- Inline note utilities --- */
.circuit-basis-note { margin: 8px 0 16px; color: var(--text-muted); }
.nec-compliance-block { margin: 20px 0; }
.hero-compare-note {
    margin: -8px 0 18px;
    padding: 10px 14px;
    background: var(--surface);
    border-left: 3px solid var(--border);
    border-radius: 4px;
    color: var(--text-muted);
    font-size: 12px;
    line-height: 1.5;
}
.hero-compare-note strong { color: var(--text); font-weight: 600; }

/* Ampacity warning: multi-line prose block for reference-only/ampacity-invalid inputs.
   Distinct from .nec-badge (which is pill-sized) because the content is a paragraph,
   not a status label. */
.ampacity-warning {
    margin: 20px 0;
    padding: 14px 16px;
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-left: 4px solid var(--nec-warn);
    border-radius: 8px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.55;
}
.ampacity-warning-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    color: var(--nec-warn-text);
    font-size: 14px;
}
.ampacity-warning-header .material-icons-outlined {
    font-size: 20px;
    flex-shrink: 0;
}
.ampacity-warning p {
    margin: 0 0 8px 0;
}
.ampacity-warning p:last-child {
    margin-bottom: 0;
}
.ampacity-warning a {
    color: var(--accent);
    font-weight: 600;
}
.page-role-note {
    margin: 8px 0 20px;
    padding: 10px 14px;
    border-left: 3px solid var(--border);
    background: var(--surface-alt, var(--surface));
    color: var(--text-muted);
    border-radius: 0 6px 6px 0;
}
.hero-note {
    margin: 12px 0 0;
    color: var(--text-muted);
    line-height: 1.5;
}
.calc-assumptions {
    margin: 12px 0 0;
    color: var(--text-muted);
    line-height: 1.5;
}
.is-hidden { display: none !important; }

/* Global snapshot sections aggregate multi-source reference data. The snapshot-notice
   callout visually separates the section from the calculator-output sections above,
   so a reader can see at a glance that this is editorial context, not a live answer. */
.snapshot-section .snapshot-notice {
    margin: 0 0 20px;
    padding: 14px 18px;
    border-left: 3px solid var(--accent);
    background: var(--surface-alt, var(--surface));
    border-radius: 0 8px 8px 0;
    color: var(--text-muted);
}
.snapshot-section .snapshot-notice p {
    margin: 0;
    line-height: 1.55;
}
.source-cadence {
    display: inline-block;
    margin-top: 3px;
    padding: 1px 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    background: var(--surface-alt, var(--surface));
    border: 1px solid var(--border);
    border-radius: 4px;
}
.row-source {
    display: block;
    margin-top: 2px;
    color: var(--text-muted);
    font-size: 11px;
    text-align: left;
}
.row-source a { display: block; }
.row-source .source-cadence { margin-left: 0; }

/* Snapshot table: on mobile the 5-column layout is too wide for most viewports.
   Hide Per Day and Per Month (cols 3 and 4) at <= 640px so the table collapses
   to Country / Rate / Per Year, which fits without horizontal scroll. Desktop
   keeps all five columns. */
@media (max-width: 640px) {
    .snapshot-section .conv-table th:nth-child(3),
    .snapshot-section .conv-table td:nth-child(3),
    .snapshot-section .conv-table th:nth-child(4),
    .snapshot-section .conv-table td:nth-child(4) {
        display: none;
    }
}
.hero-reset {
    margin-top: 0.5rem;
    font-size: 0.85rem;
    opacity: 0.8;
}
.hero-reset a { color: inherit; text-decoration: underline; }
.section-gap { margin-top: 36px; }

/* --- Result Hero --- */
.result-hero {
    background: var(--accent-light);
    border: 1px solid var(--accent-border);
    border-radius: 12px;
    padding: 24px 28px;
    margin: 24px 0 32px;
}
.result-hero-value {
    font-size: 32px;
    font-weight: 700;
    color: var(--accent-dark);
    line-height: 1.2;
}
.result-hero-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}
.result-hero-variants {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.result-hero-variant {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    font-size: 14px;
}
.result-hero-variant strong { color: var(--text); }
.result-hero-variant:target {
    background: var(--accent-light);
    border-radius: 6px;
    padding-left: 10px;
    padding-right: 10px;
    margin: 0 -10px;
    border-top-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent-border);
}
.result-hero-variant:target strong { color: var(--accent); }

/* --- Reverse Link --- */
.reverse-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.reverse-link:hover { color: var(--accent); }
.reverse-link .material-icons-outlined { font-size: 16px; }

/* --- Also Calculate Block --- */
.also-calc {
    margin: 28px 0;
}
.also-calc h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-muted);
}
.also-calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 10px;
}
.also-calc-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    color: var(--text);
    transition: border-color 0.15s;
}
.also-calc-link:hover {
    border-color: var(--accent);
    color: var(--accent);
    text-decoration: none;
}
.also-calc-link .material-icons-outlined {
    font-size: 18px;
    color: var(--accent);
    flex-shrink: 0;
}
.also-calc-link-stacked {
    align-items: flex-start;
}
.also-calc-link-stacked .material-icons-outlined {
    margin-top: 1px;
}
.also-calc-link-stacked .also-calc-main,
.also-calc-link-stacked .also-calc-hint {
    display: block;
    line-height: 1.35;
}
.also-calc-link-stacked .also-calc-main {
    flex: 1;
}
.also-calc-link-stacked .also-calc-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.also-calc-link-stacked:hover .also-calc-hint {
    color: var(--accent);
}
.also-calc-link-stacked > .material-icons-outlined + .also-calc-main {
    display: block;
}
.also-calc-link-stacked {
    flex-wrap: wrap;
}
.also-calc-link-stacked .also-calc-main {
    width: calc(100% - 26px);
}
.also-calc-link-stacked .also-calc-hint {
    width: 100%;
    padding-left: 26px;
}

/* --- Formula Display Block --- */
.formula-block {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 24px;
    margin: 20px 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    color: var(--text);
}
.formula-block .formula-var {
    color: var(--accent-dark);
}

/* --- Step-by-Step --- */
.steps {
    counter-reset: step;
    list-style: none;
    padding: 0;
    margin: 16px 0;
}
.steps li {
    counter-increment: step;
    padding: 12px 0 12px 48px;
    position: relative;
    border-bottom: 1px solid var(--border);
}
.steps li:last-child { border-bottom: none; }
.steps li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 12px;
    width: 32px;
    height: 32px;
    background: var(--accent-light);
    color: var(--accent-dark);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}

/* --- Related Calculators --- */
.related-calcs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin: 20px 0;
}
.related-calc-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.related-calc-link:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 8px var(--card-shadow);
    text-decoration: none;
}
.related-calc-link .material-icons-outlined {
    font-size: 22px;
    color: var(--accent);
}

/* --- Copy Button --- */
.copy-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}
.copy-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    color: var(--text-muted);
    border-radius: 4px;
    display: flex;
    align-items: center;
}
.copy-btn:hover { color: var(--accent); }
.copy-btn .material-icons-outlined { font-size: 18px; }

/* --- Disclaimer --- */
.disclaimer {
    margin-top: 36px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.6;
}

/* --- Code/Pre --- */
code {
    font-family: 'Courier New', Courier, monospace;
    background: var(--accent-light);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.9em;
}
pre {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
    overflow-x: auto;
    font-size: 14px;
    line-height: 1.5;
}
pre code {
    background: none;
    padding: 0;
}

/* --- Admin Dashboard --- */
.admin-stats {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin: 24px 0 32px;
}
.admin-stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 20px 16px;
    text-align: center;
}
.admin-stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--accent);
    line-height: 1.1;
}
.admin-stat-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    margin-top: 6px;
}

.admin-section {
    margin: 32px 0;
}
.admin-section h2 {
    margin-bottom: 12px;
    font-size: 18px;
}

.admin-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-left: 4px;
}
.admin-badge.live    { background: #d1fae5; color: #065f46; }
.admin-badge.warn    { background: #fef3c7; color: #92400e; }
.admin-badge.dimmed  { background: var(--border); color: var(--text-muted); }
[data-theme="dark"] .admin-badge.live   { background: #064e3b; color: #6ee7b7; }
[data-theme="dark"] .admin-badge.warn   { background: #78350f; color: #fcd34d; }

.admin-message {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
    border-radius: 8px;
    padding: 12px 16px;
    margin: 16px 0;
    font-weight: 500;
    font-size: 14px;
}
[data-theme="dark"] .admin-message {
    background: #064e3b;
    color: #a7f3d0;
    border-color: #065f46;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}
.admin-inline-form { display: inline; }
.admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 12px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
}
.admin-btn:hover {
    border-color: var(--accent);
    background: var(--accent-light);
    color: var(--accent);
}

.admin-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}
.admin-link:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.admin-link .material-icons-outlined {
    font-size: 18px;
}

.admin-table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    margin-top: 12px;
}
.admin-table-wrap .conv-table { margin-bottom: 0; }
.admin-table-wrap .conv-table td,
.admin-table-wrap .conv-table th {
    padding: 10px 14px;
}

@media (max-width: 900px) {
    .admin-stats { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 640px) {
    .admin-stats { grid-template-columns: repeat(2, 1fr); }
}
