﻿/* =====================================================================
   CalcHub â€” Design System  (v3.0)
   Sections: Fonts Â· Tokens Â· Reset Â· Layout Â· Nav Â· Components Â·
             Calculator Â· Charts Â· Content Â· Ads Â· Consent Â· Footer Â·
             Utilities Â· Responsive Â· Print Â· Motion
   ===================================================================== */

/* ============================ ðŸ”¤ LOCAL FONTS ============================ */
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 400; src: url('../fonts/inter-v20-latin-regular.woff2') format('woff2'); }
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 500; src: url('../fonts/inter-v20-latin-500.woff2') format('woff2'); }
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 600; src: url('../fonts/inter-v20-latin-600.woff2') format('woff2'); }
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 700; src: url('../fonts/inter-v20-latin-700.woff2') format('woff2'); }
@font-face { font-display: swap; font-family: 'Inter'; font-style: normal; font-weight: 800; src: url('../fonts/inter-v20-latin-800.woff2') format('woff2'); }

/* ============================ ðŸŽ¨ DESIGN TOKENS ============================ */
:root {
    color-scheme: light;

    /* Brand */
    --primary: #0f62fe;
    --primary-hover: #0043ce;
    --primary-soft: #e8f0ff;
    --primary-ring: rgba(15, 98, 254, 0.18);
    /* Hero panel gradient — deliberately dark in both themes so white text passes AA */
    --hero-from: #1656d6;
    --hero-to: #0b3ea8;

    --positive: #0f7a43;
    --positive-soft: #e7f7ee;
    --negative: #c81e1e;
    --negative-soft: #fdecec;
    --warning: #b45309;
    --warning-soft: #fff6e5;
    --purple: #7642d6;

    /* Surfaces */
    --bg: #f4f7fb;
    --bg-accent: radial-gradient(1200px 500px at 50% -10%, #e3ecff 0%, rgba(244, 247, 251, 0) 70%);
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f7;
    --border: #e3e8ef;
    --border-strong: #cbd5e1;

    /* Text */
    --text: #0f172a;
    --text-2: #475569;
    --text-muted: #64748b;

    /* Effects */
    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 22px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow: 0 6px 20px rgba(15, 23, 42, 0.07);
    --shadow-lg: 0 18px 45px rgba(15, 23, 42, 0.12);
    --ring: 0 0 0 4px var(--primary-ring);

    /* Metrics */
    --container: 1080px;
    --header-h: 64px;
    --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
}

html[data-theme="dark"] {
    color-scheme: dark;
    --primary: #6ea0ff;
    --primary-hover: #93b6ff;
    --primary-soft: #16274d;
    --primary-ring: rgba(110, 160, 255, 0.28);
    --hero-from: #1e4fb0;
    --hero-to: #12306e;

    --positive: #4ade80;
    --positive-soft: #102e21;
    --negative: #f87171;
    --negative-soft: #38161a;
    --warning: #fbbf24;
    --warning-soft: #33260d;
    --purple: #a78bfa;

    --bg: #0b1220;
    --bg-accent: radial-gradient(1200px 500px at 50% -10%, #16244a 0%, rgba(11, 18, 32, 0) 70%);
    --surface: #121b2e;
    --surface-2: #0e1728;
    --surface-3: #1b2740;
    --border: #22304a;
    --border-strong: #33425e;

    --text: #f1f5f9;
    --text-2: #cbd5e1;
    --text-muted: #94a3b8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 22px 50px rgba(0, 0, 0, 0.5);
}

/* ============================ ðŸ” RESET ============================ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    background-image: var(--bg-accent);
    background-repeat: no-repeat;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
    padding-bottom: env(safe-area-inset-bottom);
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font: inherit; color: inherit; }
ul, ol { list-style-position: outside; }
h1, h2, h3, h4 { line-height: 1.25; letter-spacing: -0.015em; color: var(--text); font-weight: 700; }
h1 { font-size: clamp(1.55rem, 1.2rem + 1.6vw, 2.15rem); font-weight: 800; }
h2 { font-size: clamp(1.2rem, 1.05rem + 0.7vw, 1.5rem); }
h3 { font-size: 1.1rem; }
p { color: var(--text-2); }
strong { color: var(--text); font-weight: 700; }

:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Icon system (SVG sprite) */
.icon {
    width: 1.15em; height: 1.15em;
    flex: none;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
    vertical-align: -0.16em;
}
.icon--fill { fill: currentColor; stroke: none; }
.icon-lg { width: 1.5em; height: 1.5em; }

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

/* Skip link */
.skip-link {
    position: absolute; top: -100px; left: 12px; z-index: 2000;
    background: var(--primary); color: #fff; padding: 10px 16px;
    border-radius: 0 0 var(--radius) var(--radius); font-weight: 700;
    transition: top .15s ease;
}
.skip-link:focus { top: 0; text-decoration: none; }

/* ============================ ðŸ“ LAYOUT ============================ */
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: 16px; }
main { flex: 1 0 auto; padding-top: 18px; }
.section-gap { margin-top: 28px; }

.page-head { text-align: center; margin: 18px 0 22px; }
.page-head h1 { margin-bottom: 8px; }
.page-head .lede { max-width: 640px; margin: 0 auto; color: var(--text-muted); font-size: 1rem; }
.page-head .updated { display: inline-block; margin-top: 10px; font-size: .78rem; color: var(--text-muted); background: var(--surface-2); border: 1px solid var(--border); padding: 3px 10px; border-radius: 999px; }

/* ============================ ðŸ§­ NAVBAR ============================ */
.site-header {
    position: sticky; top: 0; z-index: 900;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    -webkit-backdrop-filter: saturate(180%) blur(14px);
    backdrop-filter: saturate(180%) blur(14px);
    border-bottom: 1px solid var(--border);
}
@supports not (background: color-mix(in srgb, red 50%, blue)) {
    .site-header { background: var(--surface); }
}
.nav {
    height: var(--header-h);
    display: flex; align-items: center; gap: 14px;
    max-width: var(--container); margin-inline: auto; padding-inline: 16px;
}
.brand {
    display: inline-flex; align-items: center; gap: 9px;
    font-weight: 800; font-size: 1.12rem; color: var(--text); letter-spacing: -0.02em;
    text-decoration: none; flex: none;
}
.brand:hover { text-decoration: none; }
.brand img { width: 30px; height: 30px; border-radius: 8px; }
.brand b { color: var(--primary); font-weight: 800; }

.nav-links { display: flex; align-items: center; gap: 2px; margin-left: 6px; }
.nav-links a {
    color: var(--text-2); font-size: .875rem; font-weight: 600;
    padding: 8px 11px; border-radius: 999px; text-decoration: none;
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.nav-links a:hover { background: var(--surface-3); color: var(--text); text-decoration: none; }
.nav-links a[aria-current="page"] { background: var(--primary-soft); color: var(--primary); }

.nav-tools { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.currency-dropdown {
    appearance: none; -webkit-appearance: none;
    padding: 7px 28px 7px 10px;
    border: 1px solid var(--border); border-radius: 999px;
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px;
    color: var(--text); font-weight: 600; font-size: .82rem;
    cursor: pointer; min-height: 38px; max-width: 118px;
}
.icon-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-width: 40px; min-height: 40px; padding: 0 10px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px;
    color: var(--text); cursor: pointer; font-size: .85rem; font-weight: 600;
    transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
.icon-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.icon-btn:active { transform: scale(.97); }
.icon-btn .icon { width: 19px; height: 19px; }

.menu-toggle { display: none; }

/* Tool switch pills (sub navigation) */
.tool-switch {
    display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
    padding: 14px 0 4px; margin-bottom: 4px;
}
.tool-switch::-webkit-scrollbar { display: none; }
.tool-switch a {
    flex: none; display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px; border-radius: 999px; font-size: .85rem; font-weight: 600;
    background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
    box-shadow: var(--shadow-sm); text-decoration: none; min-height: 40px;
}
.tool-switch a:hover { border-color: var(--primary); color: var(--primary); text-decoration: none; }
.tool-switch a[aria-current="page"] { background: var(--primary); border-color: var(--primary); color: #fff; }
.tool-switch .icon { width: 16px; height: 16px; }

/* Language switcher */
.optbox { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; color: var(--text-muted); font-weight: 600; }
.lang-select {
    appearance: none; -webkit-appearance: none;
    padding: 7px 26px 7px 10px; border-radius: 999px; border: 1px solid var(--border);
    background: var(--surface-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center / 14px;
    color: var(--text); font-weight: 600; font-size: .82rem; cursor: pointer; min-height: 38px;
}

/* ============================ ðŸ§© COMPONENTS ============================ */
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    min-height: 44px; padding: 10px 18px; border-radius: var(--radius);
    border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
    font-weight: 600; font-size: .92rem; cursor: pointer; text-decoration: none;
    transition: background .15s ease, border-color .15s ease, color .15s ease, transform .1s ease;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: scale(.985); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .82rem; border-radius: 9px; }

.chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px; font-size: .75rem; font-weight: 600;
    background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.chip--ok { background: var(--positive-soft); color: var(--positive); border-color: transparent; }
.chip--warn { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.chip--bad { background: var(--negative-soft); color: var(--negative); border-color: transparent; }

/* ============================ ðŸ§® CALCULATOR SHELL ============================ */
.calc-shell {
    display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-xl); box-shadow: var(--shadow); overflow: hidden;
}
.calc-inputs { padding: 22px; border-right: 1px solid var(--border); min-width: 0; display: flex; flex-direction: column; }
.calc-inputs > .calc-actions { margin-top: auto; padding-top: 20px; }
@media (min-width: 861px) { .calc-shell { align-items: start; } .calc-results { min-height: 100%; } }
.calc-results {
    padding: 22px; background: var(--surface-2); min-width: 0;
    display: flex; flex-direction: column; gap: 14px;
    align-self: start;
}
.calc-results > h2 { font-size: 1rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

/* Field group */
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field__head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.field label, .field__label { font-weight: 600; font-size: .9rem; color: var(--text); display: block; }
.field small, .field__hint { display: block; font-size: .76rem; color: var(--text-muted); font-weight: 500; margin-top: 2px; }

.money-input {
    display: flex; align-items: center; gap: 0;
    border: 1.5px solid var(--border-strong); border-radius: var(--radius);
    background: var(--surface); overflow: hidden;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.money-input:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.money-input .affix {
    padding: 0 10px; font-weight: 700; color: var(--text-2); font-size: .95rem;
    border-right: 1px solid var(--border); align-self: stretch; display: flex; align-items: center;
    background: var(--surface-2); flex: none;
}
.money-input input {
    width: 100%; min-width: 0; border: 0; background: transparent; color: var(--text);
    padding: 13px 12px; font-size: 1.02rem; font-weight: 600; font-variant-numeric: tabular-nums;
    outline: none; border-radius: 0;
    line-height: 1.35;
}
/* Native number spinners steal width from long amounts — hide them and rely
   on the slider + keyboard, which is the primary interaction anyway. */
.money-input input[type="number"]::-webkit-outer-spin-button,
.money-input input[type="number"]::-webkit-inner-spin-button,
.field > input[type="number"]::-webkit-outer-spin-button,
.field > input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.money-input input[type="number"],
.field > input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
.field > input[type="number"], .field > input[type="text"], .field > select {
    width: 100%; padding: 13px 12px; font-size: 1rem; font-weight: 600;
    border: 1.5px solid var(--border-strong); border-radius: var(--radius);
    background: var(--surface); color: var(--text); outline: none;
    font-variant-numeric: tabular-nums;
    transition: border-color .15s ease, box-shadow .15s ease;
}
.field > input:focus, .field > select:focus { border-color: var(--primary); box-shadow: var(--ring); }
.field > input.invalid, .money-input.invalid { border-color: var(--negative); box-shadow: 0 0 0 4px var(--negative-soft); }

/* Range slider */
input[type="range"] {
    -webkit-appearance: none; appearance: none;
    width: 100%; height: 22px; margin-top: 10px; background: transparent; cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
    height: 6px; border-radius: 99px;
    background: linear-gradient(to right, var(--primary) var(--fill, 0%), var(--surface-3) var(--fill, 0%));
}
input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--surface-3); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 99px; background: var(--primary); }
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; appearance: none;
    width: 20px; height: 20px; margin-top: -7px; border-radius: 50%;
    background: #fff; border: 3px solid var(--primary);
    box-shadow: 0 1px 4px rgba(15, 23, 42, .25);
    transition: transform .12s ease;
}
input[type="range"]::-moz-range-thumb {
    width: 16px; height: 16px; border-radius: 50%;
    background: #fff; border: 3px solid var(--primary);
    box-shadow: 0 1px 4px rgba(15, 23, 42, .25);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }
html[data-theme="dark"] input[type="range"]::-webkit-slider-thumb { background: #0b1220; }
html[data-theme="dark"] input[type="range"]::-moz-range-thumb { background: #0b1220; }

/* Two-column field row */
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* Segmented control (tabs inside a calculator) */
.segmented {
    display: inline-flex; padding: 4px; gap: 4px; background: var(--surface-3);
    border-radius: 999px; border: 1px solid var(--border); margin-bottom: 18px;
    max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented button {
    border: 0; background: transparent; color: var(--text-2); font-weight: 600; font-size: .84rem;
    padding: 7px 14px; border-radius: 999px; cursor: pointer; white-space: nowrap; min-height: 34px;
}
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--primary); box-shadow: var(--shadow-sm); }

/* Result cards */
.result-card {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 13px 16px;
}
.result-card p { font-size: .84rem; color: var(--text-muted); font-weight: 600; margin: 0; }
.result-card p small { display: block; font-size: .72rem; font-weight: 500; color: var(--text-muted); opacity: .85; }
.result-card h4, .result-card .val {
    font-size: 1.05rem; font-weight: 700; color: var(--text);
    font-variant-numeric: tabular-nums; white-space: nowrap; margin: 0;
}
.result-card .val--pos { color: var(--positive); }
.result-card .val--neg { color: var(--negative); }

.result-hero {
    background: linear-gradient(135deg, var(--hero-from) 0%, var(--hero-to) 100%);
    color: #fff; border: 0; border-radius: var(--radius-lg); padding: 18px;
    box-shadow: 0 10px 24px rgba(15, 98, 254, .28);
}
.result-hero p { color: rgba(255, 255, 255, .82); font-size: .82rem; font-weight: 600; }
.result-hero .val {
    font-size: clamp(1.5rem, 1.2rem + 1.2vw, 1.95rem); font-weight: 800; color: #fff;
    letter-spacing: -0.02em; line-height: 1.15; font-variant-numeric: tabular-nums;
    display: block; margin-top: 4px;
}
.result-hero small { color: rgba(255, 255, 255, .8); font-size: .78rem; }
html[data-theme="dark"] .result-hero { box-shadow: 0 10px 24px rgba(0, 0, 0, .45); }

.result-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.result-mini .result-card { flex-direction: column; align-items: flex-start; gap: 2px; padding: 11px 13px; }
.result-mini .result-card p { font-size: .74rem; }

/* Insights strip */
.insights { display: flex; flex-direction: column; gap: 8px; }
.insight {
    display: flex; gap: 9px; align-items: flex-start;
    font-size: .82rem; color: var(--text-2); line-height: 1.45;
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid var(--primary); border-radius: 8px; padding: 9px 11px;
}
.insight .icon { color: var(--primary); width: 16px; height: 16px; margin-top: 1px; }
.insight--ok { border-left-color: var(--positive); }
.insight--ok .icon { color: var(--positive); }
.insight--warn { border-left-color: var(--warning); }
.insight--warn .icon { color: var(--warning); }
.insight--bad { border-left-color: var(--negative); }
.insight--bad .icon { color: var(--negative); }

/* Action bar */
.calc-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.calc-actions .btn { flex: 1 1 auto; }

/* ============================ ðŸ“Š CHART ============================ */
.chart-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 18px 14px; box-shadow: var(--shadow-sm); }
.chart-card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.chart-card__head h3 { font-size: 1rem; }
.chart-wrap { position: relative; height: 300px; }
.chart-wrap canvas { width: 100% !important; height: 100% !important; }
/* Bar charts look best wide and short */
.chart-card--bars .chart-wrap { height: 230px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 600; color: var(--text-2); }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }

/* ============================ ðŸ“‹ TABLES ============================ */
.table-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-head { padding: 16px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--border); }
.table-head h2, .table-head h3 { font-size: 1.05rem; }
.table-wrap { max-height: 430px; overflow: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: .84rem; font-variant-numeric: tabular-nums; }
table.data thead th {
    position: sticky; top: 0; z-index: 1; background: var(--surface-2);
    text-align: right; font-weight: 700; color: var(--text-2); font-size: .76rem;
    text-transform: uppercase; letter-spacing: .04em; padding: 10px 14px;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data thead th:first-child, table.data tbody td:first-child { text-align: left; }
table.data tbody td { padding: 9px 14px; text-align: right; color: var(--text-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data tbody td:first-child { color: var(--text); font-weight: 600; }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data .pos { color: var(--positive); font-weight: 600; }
table.data .neg { color: var(--negative); font-weight: 600; }
.table-foot { padding: 10px 18px; font-size: .78rem; color: var(--text-muted); border-top: 1px solid var(--border); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* ============================ ðŸ“– CONTENT ============================ */
.content-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: clamp(18px, 3vw, 30px); box-shadow: var(--shadow-sm); }
.content-card h2 { margin: 26px 0 10px; }
.content-card h2:first-child, .content-card h1 + h2 { margin-top: 0; }
.content-card h3 { margin: 20px 0 8px; font-size: 1.02rem; }
.content-card p { margin-bottom: 12px; font-size: .95rem; }
.content-card ul, .content-card ol { margin: 0 0 14px 20px; color: var(--text-2); font-size: .95rem; }
.content-card li { margin-bottom: 6px; }
.content-card a { font-weight: 600; }

.formula {
    display: block; background: var(--surface-2); border: 1px solid var(--border);
    border-left: 3px solid var(--primary); border-radius: 8px; padding: 11px 14px;
    font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .85rem;
    color: var(--text); margin: 0 0 14px; overflow-x: auto; white-space: nowrap;
}

.note { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: .87rem; color: var(--text-2); }
.note .icon { flex: none; margin-top: 2px; }
.note--warn { background: var(--warning-soft); border-color: transparent; color: var(--text-2); }
.note--warn .icon { color: var(--warning); }

/* FAQ accordion */
.faq { display: flex; flex-direction: column; gap: 10px; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 16px; box-shadow: var(--shadow-sm); }
.faq details[open] { border-color: var(--border-strong); }
.faq summary {
    cursor: pointer; list-style: none; font-weight: 600; font-size: .93rem; color: var(--text);
    padding: 14px 32px 14px 0; position: relative;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
    content: ''; position: absolute; right: 4px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
    background: currentColor; opacity: .55; transform: rotate(45deg); transition: transform .2s ease;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4v16M4 12h16' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 4v16M4 12h16' stroke='black' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.faq details[open] summary::after { transform: rotate(135deg); }
.faq details > div { padding: 0 0 16px; font-size: .9rem; color: var(--text-2); }

/* Related tools */
.related-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.related-card {
    display: flex; align-items: center; gap: 12px; padding: 14px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    text-decoration: none; color: var(--text); box-shadow: var(--shadow-sm);
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.related-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); text-decoration: none; }
.related-card .rel-ic {
    width: 40px; height: 40px; flex: none; border-radius: 10px; display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary);
}
.related-card b { display: block; font-size: .9rem; }
.related-card span { display: block; font-size: .76rem; color: var(--text-muted); }

.disclaimer {
    margin-top: 26px; padding: 14px 18px; background: var(--surface-2);
    border: 1px solid var(--border); border-radius: var(--radius);
    font-size: .8rem; color: var(--text-muted); line-height: 1.6;
}

/* ============================ ðŸ  HOME ============================ */
.hero { text-align: center; padding: 26px 0 22px; }
.hero h1 { max-width: 780px; margin: 0 auto 12px; }
.hero p { max-width: 620px; margin: 0 auto; color: var(--text-muted); }
.hero .trust { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.tool-card {
    display: flex; flex-direction: column; gap: 10px; padding: 20px;
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm); color: var(--text); text-decoration: none;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    position: relative;
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--primary); text-decoration: none; }
.tool-card__ic {
    width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
    font-size: 1.35rem; flex: none;
}
.tool-card h3 { font-size: 1.05rem; }
.tool-card p { font-size: .86rem; color: var(--text-muted); flex: 1; margin: 0; }
.tool-card__go { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--primary); }
.tool-card__go .icon { width: 15px; height: 15px; transition: transform .18s ease; }
.tool-card:hover .tool-card__go .icon { transform: translateX(3px); }

.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 34px 0 16px; }
.section-title h2 { font-size: 1.25rem; }
.section-title a { font-size: .85rem; font-weight: 700; }

.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.feature {
    padding: 18px; border-radius: var(--radius); background: var(--surface);
    border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.feature .icon { width: 22px; height: 22px; color: var(--primary); margin-bottom: 10px; }
.feature h3 { font-size: .95rem; margin-bottom: 4px; }
.feature p { font-size: .84rem; color: var(--text-muted); margin: 0; }

/* ============================ ðŸ’° AD SLOTS ============================ */
/* Container proportions are reserved so inserted ads cause zero layout shift. */
.ad-slot {
    margin: 24px auto; text-align: center; overflow: hidden;
    min-height: 100px; max-width: 100%;
    background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: var(--radius);
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600;
}
.ad-slot::before { content: 'Advertisement'; opacity: .7; }
.ad-slot ins { display: block; width: 100%; }
.ad-slot--in-article { min-height: 280px; }
/* Ad-free period / consent rejected â†’ hide placeholder entirely */
.ad-slot[hidden] { display: none !important; }
body.no-ads .ad-slot { display: none !important; }

/* ============================ ðŸª CONSENT ============================ */
.consent {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1500;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -10px 30px rgba(15, 23, 42, .12);
    transform: translateY(110%); transition: transform .35s cubic-bezier(.22,.61,.36,1);
}
.consent.is-open { transform: none; }
.consent__inner { max-width: var(--container); margin: 0 auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.consent p { flex: 1 1 320px; font-size: .8rem; color: var(--text-2); margin: 0; }
.consent p a { font-weight: 600; }
.consent__btns { display: flex; gap: 8px; flex-wrap: wrap; }
.consent .btn { min-height: 40px; font-size: .84rem; padding: 8px 16px; }

/* ============================ ðŸ”» FOOTER ============================ */
.site-footer { margin-top: 48px; border-top: 1px solid var(--border); background: var(--surface); }
.footer-main {
    display: grid; grid-template-columns: 1.3fr 1fr 1fr 1fr; gap: 28px;
    max-width: var(--container); margin-inline: auto; padding: 36px 16px 28px;
}
.footer-col h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); margin-bottom: 12px; }
.footer-col ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.footer-col a { color: var(--text-2); font-size: .86rem; font-weight: 500; }
.footer-col a:hover { color: var(--primary); }
.footer-brand p { font-size: .84rem; color: var(--text-muted); margin: 10px 0 14px; max-width: 280px; }
.footer-bottom {
    border-top: 1px solid var(--border); max-width: var(--container); margin-inline: auto;
    padding: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
    font-size: .8rem; color: var(--text-muted);
}
.footer-bottom nav { display: flex; flex-wrap: wrap; gap: 14px; }
.footer-bottom a { color: var(--text-muted); font-weight: 600; }
.footer-bottom a:hover { color: var(--primary); }

/* ============================ ðŸ›  UTILITIES ============================ */
.mt-0 { margin-top: 0 !important; }
.text-center { text-align: center; }
.muted { color: var(--text-muted); }
.stack-sm > * + * { margin-top: 10px; }
.stack > * + * { margin-top: 20px; }
.hidden { display: none !important; }

/* Button spinner */
.spinner {
    display: inline-block; width: 15px; height: 15px; border-radius: 50%;
    border: 2px solid currentColor; border-right-color: transparent;
    animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Toast */
.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
    background: var(--text); color: var(--surface); padding: 10px 18px; border-radius: 999px;
    font-size: .84rem; font-weight: 600; z-index: 1600; opacity: 0; pointer-events: none;
    transition: opacity .2s ease, transform .2s ease; max-width: calc(100vw - 32px); text-align: center;
}
.toast.is-open { opacity: 1; transform: translate(-50%, 0); }

/* ============================ ðŸ“± RESPONSIVE ============================ */
@media (max-width: 900px) {
    .footer-main { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
    :root { --header-h: 58px; }

    .nav-links {
        position: fixed; inset: var(--header-h) 0 auto 0; z-index: 950;
        flex-direction: column; align-items: stretch; gap: 2px;
        background: var(--surface); border-bottom: 1px solid var(--border);
        padding: 10px 14px 14px; box-shadow: var(--shadow-lg);
        display: none;
    }
    .nav-links.is-open { display: flex; }
    .nav-links a { padding: 12px 12px; font-size: .95rem; border-radius: 10px; }
    .menu-toggle { display: inline-flex; }
    .nav-tools .label-hide { display: none; }

    .calc-shell { grid-template-columns: 1fr; }
    .calc-inputs { border-right: 0; border-bottom: 1px solid var(--border); }
    .calc-inputs, .calc-results { padding: 18px; }
    .chart-wrap { height: 260px; }
}

@media (max-width: 600px) {
    body { font-size: 15.5px; }
    .container { padding-inline: 12px; }

    /* Keep the toolbar on one row: compact selects, icon-only theme button */
    .nav { gap: 8px; padding-inline: 12px; }
    .nav-tools { gap: 4px; }
    .currency-dropdown, .lang-select {
        max-width: 78px; min-height: 36px; padding: 6px 22px 6px 8px;
        font-size: .76rem;
        background-position: right 7px center;
        text-overflow: ellipsis;
    }
    .icon-btn { min-width: 36px; min-height: 36px; padding: 0; }
    .lang-select { display: none; }
    .brand img { width: 26px; height: 26px; }
    .brand { font-size: 1.02rem; }
    .page-head { margin: 12px 0 16px; }
    .page-head .lede { font-size: .92rem; }
    .field-row { grid-template-columns: 1fr; gap: 0; }
    .field-row > .field { margin-bottom: 18px; }
    .calculator-wrapper, .calc-shell { border-radius: var(--radius-lg); }
    .chart-legend { gap: 6px 12px; }
    .footer-main { grid-template-columns: 1fr; gap: 22px; padding: 26px 14px 20px; text-align: left; }
    .footer-bottom { flex-direction: column; text-align: center; }
    .footer-bottom nav { justify-content: center; }
    .calc-actions .btn { flex: 1 1 46%; }
    .table-wrap { max-height: 340px; }
    .consent__inner { flex-direction: column; align-items: stretch; }
    .consent__btns .btn { flex: 1; }
    .ad-slot--in-article { min-height: 250px; }
}

@media (max-width: 380px) {
    .brand span { font-size: .95rem; }
    .result-mini { grid-template-columns: 1fr; }
    .currency-dropdown { max-width: 66px; }
}

@media (max-width: 340px) {
    .brand span { display: none; }
}

/* ============================ ðŸ–¨ PRINT ============================ */
@media print {
    @page { margin: 1.2cm; size: A4; }
    html, body { background: #fff !important; color: #000 !important; padding: 0 !important; font-size: 12px; }
    .site-header, .site-footer, .tool-switch, .ad-slot, .calc-actions, .consent, .toast,
    .content-card, .faq, .related-grid, .section-title, .chart-legend, .segmented, .insights,
    .skip-link, .disclaimer, input[type="range"], .btn { display: none !important; }
    .calc-shell, .container, .calc-inputs, .calc-results {
        display: block !important; border: 0 !important; box-shadow: none !important;
        background: #fff !important; padding: 0 !important; width: 100% !important; max-width: 100% !important;
    }
    .page-head { text-align: left; margin: 0 0 14px; }
    .page-head h1 { font-size: 20px; }
    .field { display: flex !important; justify-content: space-between; align-items: center; border-bottom: 1px dotted #bbb; padding: 6px 0; margin: 0; }
    .field__head { margin: 0; }
    .field small, .field__hint { display: none; }
    .money-input, .field > input { border: 0 !important; background: transparent !important; width: auto !important; }
    .money-input .affix { border: 0; background: transparent; padding: 0 4px 0 0; }
    .field input { padding: 0 !important; text-align: right; font-weight: 700; }
    .calc-results { margin-top: 14px; border-top: 2px solid #000 !important; padding-top: 10px !important; }
    .result-card { background: #fff !important; border: 0 !important; border-bottom: 1px solid #eee !important; border-radius: 0; padding: 6px 0; }
    .result-hero { background: #fff !important; box-shadow: none !important; border: 1px solid #000 !important; padding: 10px; }
    .result-hero p, .result-hero .val, .result-hero small { color: #000 !important; }
    .chart-card { border: 0; padding: 0; margin-top: 10px; }
    .chart-wrap { height: auto; }
    .table-wrap { max-height: none; overflow: visible; }
    table.data thead th { position: static; }
    tr { break-inside: avoid; }
}

/* ============================ ðŸŽ¬ MOTION ============================ */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ============================ ðŸ“ˆ SVG CHARTS ============================ */
.chart-host { position: relative; width: 100%; height: 100%; min-height: 220px; }
.chart-empty { display: grid; place-items: center; height: 100%; color: var(--text-muted); font-size: .9rem; }
.chart-grid-line { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart-axis { fill: var(--text-muted); font-size: 11px; font-family: var(--font); font-weight: 600; }
.chart-dot { filter: drop-shadow(0 0 6px rgba(15, 98, 254, .45)); }
.chart-svg--donut { max-width: 260px; height: 260px !important; margin: 0 auto; }
.chart-center-label { fill: var(--text-muted); font-size: 11px; font-weight: 600; font-family: var(--font); text-transform: uppercase; letter-spacing: .06em; }
.chart-center-value { fill: var(--text); font-size: 17px; font-weight: 800; font-family: var(--font); }
.chart-host rect[tabindex]:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.chart-tip {
    position: absolute; top: 4px; left: 0; transform: translate(-50%, 0);
    pointer-events: none; opacity: 0; z-index: 5;
    background: var(--text); color: var(--surface);
    border-radius: 10px; padding: 8px 11px; font-size: .76rem; line-height: 1.5;
    box-shadow: var(--shadow); white-space: nowrap; transition: opacity .12s ease;
}
.chart-tip.is-visible { opacity: 1; }
.chart-tip strong { display: block; font-size: .72rem; opacity: .75; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.chart-tip span { display: flex; align-items: center; gap: 6px; }
.chart-tip span i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.chart-tip span b { margin-left: 6px; font-variant-numeric: tabular-nums; }

.donut-layout { display: flex; flex-direction: column; align-items: center; gap: 12px; }

/* Two-column visualisation row (chart + donut) */
.viz-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .viz-grid { grid-template-columns: 1fr; } }


/* Bar chart */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 100%; min-height: 200px; padding-top: 8px; }
.bar-item { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; height: 100%; min-width: 0; outline-offset: 2px; border-radius: 6px; }
.bar-col { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar-fill { width: 100%; max-width: 34px; border-radius: 4px 4px 2px 2px; transition: height .3s ease, opacity .15s ease; min-height: 2px; }
.bar-item:hover .bar-fill, .bar-item:focus-visible .bar-fill { opacity: .82; }
.bar-label { font-size: .62rem; font-weight: 600; color: var(--text-muted); padding-top: 5px; white-space: nowrap; }

/* Progress bar */
.progress { height: 10px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress__bar { height: 100%; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--positive), var(--primary)); transition: width .35s ease; }
