/* ================================================
   Design System – Toolkasten.de
   Light default · Dark auto via prefers-color-scheme
   Mobile-first · Modern glassmorphism
   ================================================ */

/* ---------- Tokens ---------- */

:root {
    --bg:           #F7FAFF;
    --bg2:          #F0F4FA;
    --surface:      rgba(255, 255, 255, 0.82);
    --surface2:     rgba(255, 255, 255, 0.92);
    --border:       rgba(15, 23, 42, 0.10);
    --text:         #0F172A;
    --muted:        #475569;
    --primary:      #0F172A;
    --accent:       #2563EB;
    --accent2:      #60A5FA;
    --success:      #16A34A;
    --warning:      #F59E0B;

    --shadow:       0 16px 48px rgba(15, 23, 42, 0.10);
    --shadow2:      0 8px 24px rgba(15, 23, 42, 0.07);
    --shadow-hover: 0 20px 56px rgba(15, 23, 42, 0.15);

    --radius:    18px;
    --radius-sm: 14px;
    --container: 1120px;

    --fs-0: 0.75rem;
    --fs-1: 0.875rem;
    --fs-2: 1rem;
    --fs-3: 1.125rem;
    --fs-4: 1.375rem;
    --fs-5: 1.75rem;
    --fs-6: 2.625rem;

    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 0.25s var(--ease);
}

/* ---------- Dark mode ---------- */

/* System preference (default when no manual override) */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:           #0B1220;
        --bg2:          #0E1629;
        --surface:      rgba(255, 255, 255, 0.06);
        --surface2:     rgba(255, 255, 255, 0.09);
        --border:       rgba(255, 255, 255, 0.10);
        --text:         rgba(255, 255, 255, 0.92);
        --muted:        rgba(255, 255, 255, 0.60);
        --primary:      rgba(255, 255, 255, 0.92);
        --shadow:       0 16px 48px rgba(0, 0, 0, 0.40);
        --shadow2:      0 8px 24px rgba(0, 0, 0, 0.30);
        --shadow-hover: 0 24px 64px rgba(0, 0, 0, 0.50);
    }
}

/* Manual override: force dark */
:root[data-theme="dark"] {
    --bg:           #0B1220;
    --bg2:          #0E1629;
    --surface:      rgba(255, 255, 255, 0.06);
    --surface2:     rgba(255, 255, 255, 0.09);
    --border:       rgba(255, 255, 255, 0.10);
    --text:         rgba(255, 255, 255, 0.92);
    --muted:        rgba(255, 255, 255, 0.60);
    --primary:      rgba(255, 255, 255, 0.92);
    --shadow:       0 16px 48px rgba(0, 0, 0, 0.40);
    --shadow2:      0 8px 24px rgba(0, 0, 0, 0.30);
    --shadow-hover: 0 24px 64px rgba(0, 0, 0, 0.50);
}

/* ---------- Reset & base ---------- */

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

/* Skip-to-content link (a11y) */
.skip-link {
    position: absolute;
    top: -100%;
    left: 16px;
    z-index: 200;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    font-size: var(--fs-1);
    text-decoration: none;
    transition: top 0.2s ease;
}
.skip-link:focus {
    top: 12px;
}

/* Global focus-visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
button:focus:not(:focus-visible),
a:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible) {
    outline: none;
}

html {
    height: 100%;
    scroll-behavior: smooth;
    overflow-x: clip;
}

body {
    margin: 0;
    min-height: 100%;
    overflow-x: clip;
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--text);
    line-height: 1.6;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;

    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 120% 50% at 10% 0%,  rgba(96, 165, 250, 0.18), transparent),
        radial-gradient(ellipse 100% 60% at 90% 5%,  rgba(37,  99, 235, 0.14), transparent),
        radial-gradient(ellipse 100% 50% at 50% 100%, rgba(34, 197,  94, 0.08), transparent),
        linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%);
    background-attachment: fixed;
}

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

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}
@media (max-width: 980px) {
    .container { padding: 0 16px; }
}
@media (max-width: 480px) {
    .container { padding: 0 12px; }
}

/* ---------- Scroll animation ---------- */

.fade-up {
    opacity: 0;
    transform: translateY(24px);
    transition:
        opacity   0.6s cubic-bezier(0.16, 1, 0.3, 1),
        transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}
.fade-up.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ---------- Topbar ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 100;
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    border-bottom: 1px solid var(--border);
    transition: box-shadow var(--transition);
}
.topbar.scrolled {
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 900;
    letter-spacing: -0.03em;
    color: var(--primary);
    text-decoration: none;
    font-size: var(--fs-2);
}
.brand:hover { text-decoration: none; }
.brand-tld  { color: var(--accent); font-weight: 800; }

.logo {
    width: 52px;
    border-radius: 14px;
    object-fit: contain;
    flex-shrink: 0;
}
.logo-sm {
    width: 24px;
    height: 24px;
    border-radius: 8px;
}

.nav {
    display: flex;
    gap: 4px;
    align-items: center;
}
.nav a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 10px;
    color: var(--muted);
    font-weight: 500;
    font-size: var(--fs-1);
    transition: background var(--transition), color var(--transition);
}
.nav a:hover {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--accent);
    text-decoration: none;
}
.nav a i { font-size: 16px; }

/* ---------- Theme toggle ---------- */

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.theme-toggle {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    color: var(--muted);
    font-size: 18px;
    padding: 0;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
}
.theme-toggle:hover {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    color: var(--accent);
    border-color: var(--border);
}

/* ---------- Mobile nav ---------- */

.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 10px;
    transition: background var(--transition);
    z-index: 110;
}
.nav-toggle:hover {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.nav-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

@media (max-width: 720px) {
    .nav-toggle { display: flex; }

    .nav {
        position: fixed;
        top: 0;
        right: 0;
        width: min(300px, 80vw);
        height: 100dvh;
        flex-direction: column;
        align-items: stretch;
        padding: 80px 24px 32px;
        gap: 4px;
        background: color-mix(in srgb, var(--bg) 95%, transparent);
        backdrop-filter: blur(24px) saturate(1.6);
        -webkit-backdrop-filter: blur(24px) saturate(1.6);
        border-left: 1px solid var(--border);
        box-shadow: -8px 0 40px rgba(0, 0, 0, 0.12);
        transform: translateX(100%);
        visibility: hidden;
        transition:
            transform  0.35s var(--ease),
            visibility 0s 0.35s;
        z-index: 105;
    }
    .nav.open {
        transform: translateX(0);
        visibility: visible;
        transition:
            transform  0.35s var(--ease),
            visibility 0s 0s;
    }
    .nav a {
        font-size: var(--fs-2);
        padding: 14px 16px;
        border-radius: 12px;
    }
}

.nav-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 99;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0s 0.3s;
    -webkit-tap-highlight-color: transparent;
}
.nav-overlay.active {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0s 0s;
}

/* ---------- Hero ---------- */

.hero { padding: 48px 0 24px; }
@media (max-width: 720px) { .hero { padding: 28px 0 16px; } }

.hero-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 28px;
    align-items: start;
}
@media (max-width: 980px) { .hero-grid { grid-template-columns: 1fr; } }

h1 {
    margin: 10px 0;
    font-size: clamp(1.75rem, 3.6vw, 3.375rem);
    line-height: 1.1;
    letter-spacing: -0.04em;
    color: var(--primary);
}

.hero h1 .accent-gradient {
    background: linear-gradient(135deg, var(--accent), var(--accent2), var(--success));
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 6s ease infinite;
}
@keyframes gradient-shift {
    0%, 100% { background-position: 0% center; }
    50%      { background-position: 100% center; }
}

.sub {
    margin: 0;
    font-size: var(--fs-3);
    color: var(--muted);
    max-width: 76ch;
    line-height: 1.65;
}
@media (max-width: 720px) { .sub { font-size: var(--fs-2); } }

.hero-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.badge {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface2);
    box-shadow: var(--shadow2);
    color: var(--text);
    font-weight: 700;
    font-size: var(--fs-1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: transform var(--transition), box-shadow var(--transition);
}
.badge:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    text-decoration: none;
}
.badge i, a.badge i {
    width: 20px;
    height: 20px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent2) 30%, transparent),
        color-mix(in srgb, var(--accent)  20%, transparent));
    border: 1px solid color-mix(in srgb, var(--accent2) 30%, transparent);
    font-size: 12px;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow2);
    color: var(--text);
}

/* ---------- Cards ---------- */

.card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background:
        radial-gradient(600px 240px at 15% 8%, rgba(37, 99, 235, 0.06), transparent 60%),
        linear-gradient(180deg, var(--surface2), var(--surface));
    box-shadow: var(--shadow);
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.card:hover { box-shadow: var(--shadow-hover); }

.card-header {
    padding: 20px 20px 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}
.title    { margin: 0; font-size: var(--fs-4); letter-spacing: -0.03em; color: var(--primary); }
.card-body .title + .title,
.card-body p + .title { margin-top: 18px; }
.subtitle { margin: 6px 0 0; color: var(--muted); font-size: var(--fs-1); }
.card-body { padding: 0 20px 20px; }

/* Hero stat card */
.hero-stat {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background:
        radial-gradient(500px 200px at 70% 20%, rgba(96, 165, 250, 0.12), transparent 60%),
        linear-gradient(180deg, var(--surface2), var(--surface));
    box-shadow: var(--shadow);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition);
}
.hero-stat:hover { box-shadow: var(--shadow-hover); }
.hero-stat h3 { margin: 0 0 6px; font-size: var(--fs-3); letter-spacing: -0.03em; }
.hero-stat p  { margin: 0; color: var(--muted); font-size: var(--fs-1); }

.mini-kpis { margin-top: 14px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini-kpi {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    padding: 14px;
    transition: transform var(--transition);
}
.mini-kpi:hover { transform: translateY(-1px); }
.mini-kpi .l { color: var(--muted); font-size: var(--fs-0); text-transform: uppercase; letter-spacing: 0.04em; }
.mini-kpi .v { font-variant-numeric: tabular-nums; font-size: 20px; font-weight: 900; letter-spacing: -0.02em; margin-top: 4px; }

/* ---------- Grid layout ---------- */

.grid {
    display: grid;
    grid-template-columns: 0.75fr 1.25fr;
    gap: 20px;
    padding: 20px 0 32px;
}
@media (max-width: 980px) { .grid { grid-template-columns: 1fr; } }

/* Calculator mobile reorder */
@media (max-width: 980px) {
    .grid.has-results .card-input  { order: 2; }
    .grid.has-results .card-result { order: 1; }
}

.result-edit-bar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    margin-bottom: 16px;
    font-size: var(--fs-1);
    color: var(--muted);
}
.result-edit-bar .edit-params {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--accent);
    font-weight: 600;
    font-size: var(--fs-1);
    text-decoration: none;
    white-space: nowrap;
    padding: 6px 12px;
    border-radius: 8px;
    transition: background var(--transition);
}
.result-edit-bar .edit-params:hover {
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    text-decoration: none;
}
.result-edit-bar .param-summary { display: flex; flex-wrap: wrap; gap: 6px; font-variant-numeric: tabular-nums; }
.result-edit-bar .param-tag {
    padding: 3px 8px;
    border-radius: 6px;
    background: color-mix(in srgb, var(--accent) 6%, transparent);
    font-size: var(--fs-0);
    font-weight: 600;
}
@media (max-width: 980px) {
    .grid.has-results .result-edit-bar { display: flex; }
}

/* ---------- Form ---------- */

.form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin-top: 6px;
}
@media (max-width: 620px) { .form { grid-template-columns: 1fr; } }

label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: var(--fs-1);
    font-weight: 500;
}

.input, select {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    color: var(--text);
    outline: none;
    font-size: var(--fs-2);
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

/* Select: custom arrow + fix dark-mode dropdown */
select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23475569' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    cursor: pointer;
}

/* Dark mode: swap chevron color + force readable option colours */
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) select {
        background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    }
    :root:not([data-theme="light"]) select option {
        background: #1e293b;
        color: #e2e8f0;
    }
}
:root[data-theme="dark"] select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
:root[data-theme="dark"] select option {
    background: #1e293b;
    color: #e2e8f0;
}

select:hover {
    border-color: color-mix(in srgb, var(--accent2) 40%, transparent);
}

.input:focus, select:focus {
    border-color: color-mix(in srgb, var(--accent2) 60%, transparent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent2) 12%, transparent);
}

.span2 { grid-column: span 2; }
@media (max-width: 620px) { .span2 { grid-column: span 1; } }

/* ---------- Buttons ---------- */

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 16px;
}

.btn {
    height: 48px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    padding: 0 20px;
    font-weight: 700;
    letter-spacing: -0.01em;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: var(--fs-2);
    font-family: inherit;
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow var(--transition), background var(--transition);
}
.btn:hover {
    background: var(--surface2);
    box-shadow: var(--shadow2);
    text-decoration: none;
}
.btn:active { transform: translateY(1px); }

@media (max-width: 480px) {
    .actions { flex-direction: column; }
    .actions .btn { width: 100%; justify-content: center; }
}

.btn-primary {
    border-color: transparent;
    background: linear-gradient(135deg, var(--accent), var(--accent2));
    color: white;
    box-shadow: 0 8px 28px rgba(37, 99, 235, 0.28);
    position: relative;
    overflow: hidden;
}
.btn-primary::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent, rgba(255, 255, 255, 0.15), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}
.btn-primary:hover::before { transform: translateX(100%); }
.btn-primary:hover {
    box-shadow: 0 12px 36px rgba(37, 99, 235, 0.38);
    background: linear-gradient(135deg, var(--accent), var(--accent2));
}

/* ---------- KPI cards ---------- */

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 6px; }
@media (max-width: 620px) { .kpis { grid-template-columns: 1fr; } }

.kpi {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 16px;
    position: relative;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition);
}
.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow2); }
.kpi::before {
    content: "";
    position: absolute;
    inset: -40%;
    background: radial-gradient(circle at 30% 30%, rgba(96, 165, 250, 0.10), transparent 60%);
    pointer-events: none;
}
.kpi .inner { position: relative; }
.kpi .l { color: var(--muted); font-size: var(--fs-0); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.kpi .v { margin-top: 6px; font-size: 28px; font-weight: 950; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; color: var(--primary); }
.kpi.good .v { color: var(--success); }
.kpi .s { margin-top: 6px; color: var(--muted); font-size: var(--fs-0); }

/* ---------- Chart ---------- */

.chart {
    margin-top: 16px;
    height: 280px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface2), var(--surface));
    position: relative;
    overflow: hidden;
}

/* ---------- Tables ---------- */

.breakdown {
    margin-top: 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--surface);
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: var(--fs-1); }
th, td { padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th {
    text-align: left;
    color: var(--muted);
    background: var(--surface2);
    font-weight: 700;
    font-size: var(--fs-0);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }

/* Responsive card-table */
@media (max-width: 980px) {
    .breakdown.card-table .table-scroll { overflow-x: visible; }
    .breakdown.card-table table,
    .breakdown.card-table thead,
    .breakdown.card-table tbody,
    .breakdown.card-table tr,
    .breakdown.card-table th,
    .breakdown.card-table td { display: block; white-space: normal; }
    .breakdown.card-table thead { display: none; }
    .breakdown.card-table tbody tr {
        padding: 14px 16px;
        border-bottom: 1px solid var(--border);
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px 12px;
    }
    .breakdown.card-table tbody tr:last-child { border-bottom: none; }
    .breakdown.card-table td {
        padding: 0; border-bottom: none;
        display: flex; flex-direction: column; gap: 2px;
        text-align: left; font-variant-numeric: tabular-nums;
    }
    .breakdown.card-table td::before {
        content: attr(data-label);
        font-size: var(--fs-0); font-weight: 700;
        color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
    }
    .breakdown.card-table td:first-child {
        grid-column: 1 / -1;
        font-weight: 800; font-size: var(--fs-2); color: var(--primary);
    }
    .breakdown.card-table td:first-child::before { display: none; }
    .breakdown.card-table td.highlight { color: var(--success); font-weight: 800; }
}

/* ---------- Affiliate ---------- */

.affiliate {
    margin-top: 20px;
    border-radius: var(--radius-sm);
    border: 1px solid color-mix(in srgb, var(--accent2) 25%, transparent);
    background:
        radial-gradient(500px 220px at 85% 20%, rgba(96, 165, 250, 0.08), transparent),
        linear-gradient(135deg, var(--surface2), var(--surface));
    padding: 20px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.affiliate h3 { margin: 0 0 6px; font-size: var(--fs-3); letter-spacing: -0.03em; color: var(--primary); }
.affiliate p  { margin: 0; color: var(--muted); font-size: var(--fs-1); max-width: 70ch; }

.links { display: flex; flex-direction: column; gap: 10px; min-width: 240px; }
@media (max-width: 620px) { .links { min-width: 100%; } }

.alink {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 12px 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--text);
    transition: transform 0.15s ease, box-shadow var(--transition), background var(--transition);
}
.alink:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow2);
    background: var(--surface2);
    text-decoration: none;
}

/* ---------- Sections & FAQ ---------- */

.section { padding: 24px 20px 32px; }
.section h1 {
    margin: 0 0 20px;
}
.section h2 {
    margin: 20px 0 16px;
    font-size: var(--fs-5);
    letter-spacing: -0.04em;
    color: var(--primary);
}
.section .card .card-body {
    padding-top: 16px;
}

details {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface);
    padding: 0;
    margin-bottom: 10px;
    box-shadow: var(--shadow2);
    overflow: hidden;
    transition: box-shadow var(--transition);
}
details:hover, details[open] { box-shadow: var(--shadow); }

summary {
    cursor: pointer;
    font-weight: 700;
    color: var(--primary);
    padding: 16px 20px;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: background var(--transition);
}
summary:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
summary::-webkit-details-marker { display: none; }
summary::after {
    content: "+";
    font-size: 20px;
    font-weight: 600;
    color: var(--muted);
    flex-shrink: 0;
    transition: transform 0.3s ease;
}
details[open] summary::after { content: "\2212"; }

details p {
    margin: 0;
    padding: 4px 20px 16px;
    color: var(--muted);
    font-size: var(--fs-2);
    max-width: 92ch;
    line-height: 1.7;
}

/* ---------- Footer ---------- */

footer {
    border-top: 1px solid var(--border);
    padding: 32px 0 40px;
    color: var(--muted);
    font-size: var(--fs-1);
    margin-top: 24px;
}
.footer-grid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}
.footer-brand { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.footer-links { display: flex; gap: 20px; flex-wrap: wrap; }
.footer-links a { color: var(--muted); transition: color var(--transition); }
.footer-links a:hover { color: var(--accent); text-decoration: none; }

.fineprint {
    color: var(--muted);
    font-size: var(--fs-0);
    max-width: 95ch;
    margin-top: 16px;
    line-height: 1.6;
    opacity: 0.75;
}

/* ---------- Back to top ---------- */

.back-to-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 85%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    color: var(--text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow2);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.3s ease, transform 0.3s ease, box-shadow var(--transition);
    z-index: 90;
    pointer-events: none;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); pointer-events: auto; }
.back-to-top:hover { box-shadow: var(--shadow); }
.back-to-top i { font-size: 18px; }

/* ---------- Utility ---------- */

.hint { color: var(--muted); font-size: var(--fs-1); padding: 20px 0; }
.dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--success) 18%, transparent);
}

/* ---------- Home – tool cards ---------- */

.tool-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
    padding: 14px 0 22px;
}

.tool-card {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: linear-gradient(180deg, var(--surface2), var(--surface));
    box-shadow: var(--shadow2);
    padding: 24px;
    transition: transform 0.2s ease, box-shadow var(--transition);
    position: relative;
    overflow: hidden;
}
.tool-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    opacity: 0;
    transition: opacity var(--transition);
}
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.tool-card:hover::before { opacity: 1; }

.tool-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg,
        color-mix(in srgb, var(--accent2) 15%, transparent),
        color-mix(in srgb, var(--accent)  8%, transparent));
    border: 1px solid color-mix(in srgb, var(--accent2) 20%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 22px;
    color: var(--accent);
}

.tool-card h3 { margin: 0 0 8px; font-size: var(--fs-4); letter-spacing: -0.03em; color: var(--primary); }
.tool-card p  { margin: 0; color: var(--muted); font-size: var(--fs-1); line-height: 1.6; }
.tool-card .btn { margin-top: 18px; }

.tool-card .coming-soon {
    height: 48px;
    border-radius: var(--radius-sm);
    border: 1px dashed var(--border);
    background: transparent;
    color: var(--muted);
    padding: 0 20px;
    font-weight: 600;
    font-size: var(--fs-1);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 18px;
}

/* ---------- Cookie Consent Banner ---------- */

.cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 200;
    padding: 0 24px 24px;
    pointer-events: none;
}

.cookie-banner-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 20px 24px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--bg) 92%, transparent);
    backdrop-filter: blur(20px) saturate(1.6);
    -webkit-backdrop-filter: blur(20px) saturate(1.6);
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    pointer-events: auto;
}

.cookie-banner-text {
    flex: 1;
    min-width: 280px;
}
.cookie-banner-text strong {
    display: block;
    font-size: var(--fs-3);
    margin-bottom: 4px;
    color: var(--primary);
}
.cookie-banner-text p {
    margin: 0;
    font-size: var(--fs-1);
    color: var(--muted);
    line-height: 1.6;
}

.cookie-banner-actions {
    display: flex;
    gap: 10px;
    flex-shrink: 0;
}

@media (max-width: 620px) {
    .cookie-banner { padding: 0 16px 16px; }
    .cookie-banner-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 16px 20px;
    }
    .cookie-banner-actions {
        flex-direction: column;
    }
    .cookie-banner-actions .btn {
        width: 100%;
        justify-content: center;
    }
}
