:root {
    --panel: #fff;
    --line: #dbe2ea;
    --text: #0f172a;
    --muted: #64748b;
    --brand: #0f766e;
    --bg: #f8fafc;
    --shadow: 0 20px 60px rgba(15, 23, 42, 0.14);
    --radius: 20px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, Arial, sans-serif; background: var(--bg); color: var(--text); }
.page { max-width: 1200px; margin: 0 auto; padding: 24px; }
.hero { background: linear-gradient(135deg, #0f172a 0%, #134e4a 100%); color: #fff; padding: 24px; border-radius: 24px; margin-bottom: 0; }
.hero p { margin: 6px 0 0; opacity: 0.9; }
.hero-back { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,0.7); text-decoration: none; margin-bottom: 10px; }
.hero-back:hover { color: #fff; }
.sticky-bar { position: sticky; top: 0; z-index: 100; background: var(--bg); padding: 12px 0; margin-bottom: 16px; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.sticky-bar button { font-size: 13px; padding: 9px 12px; width: 100%; text-align: center; }
.layout { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.card { background: var(--panel); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-inner { padding: 24px; }
.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
input[type="text"], input[type="number"], input[type="email"], input[type="password"], select {
    width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; font-size: 15px; font-family: inherit;
}
input[type="range"] { width: 100%; accent-color: var(--brand); }
.help-text { color: var(--muted); font-size: 12px; line-height: 1.4; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 20px; }
button {
    border: 0; border-radius: 999px; padding: 12px 20px; font-weight: 700; cursor: pointer;
    background: linear-gradient(135deg, var(--brand) 0%, #14b8a6 100%); color: #fff;
}
button.secondary { background: #e2e8f0; color: #0f172a; }
.result-main { border: 1px solid var(--line); border-radius: 16px; padding: 16px; margin-bottom: 16px; }
.result-label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.result-value { font-size: 32px; font-weight: 800; text-align: right; }
.stats { display: grid; gap: 10px; margin-bottom: 18px; }
.warning-box { background: #fff7ed; border: 1px solid #fdba74; border-radius: 14px; padding: 14px; margin-bottom: 16px; }
.warning-item { color: #9a3412; margin-bottom: 8px; }
.table-wrap { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 20px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; border-top: 1px solid #eef2f7; font-size: 14px; text-align: left; }
thead th { background: #f1f5f9; border-top: 0; }
.status-good { color: #166534; font-weight: 700; }
.status-mid { color: #a16207; font-weight: 700; }
.status-bad { color: #b91c1c; font-weight: 700; }
.chart-wrap { border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin-bottom: 16px; background: #fff; }

/* ── Pompinstallatie ─────────────────────────────────────────────────────── */
.block { margin-bottom: 20px; padding: 18px; background: #f8fafc; border: 1px solid var(--line); border-radius: 16px; }
.block h3 { margin: 0 0 16px; font-size: 16px; }
.section-title { margin: 0 0 10px; font-size: 22px; }
.section-subtitle { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.stat { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%); }
.stat .label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.stat .value { font-size: 28px; font-weight: 800; text-align: right; }
.muted-box { margin-top: 16px; padding: 14px; border-radius: 14px; background: #f8fafc; border: 1px dashed #cbd5e1; font-size: 13px; color: #475569; }
.button-secondary { appearance: none; border: 0; border-radius: 999px; padding: 12px 20px; font-size: 15px; font-weight: 700; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; background: #e2e8f0; color: #0f172a; }
/* ── Accordion stats ─────────────────────────────────────────────────────── */
.stat-toggle { cursor: pointer; user-select: none; }
.stat-toggle:hover { border-color: var(--brand); }
.stat-toggle .label { display: flex; justify-content: space-between; align-items: center; }
.stat-toggle .toggle-icon { font-size: 18px; color: var(--brand); transition: transform 0.2s; line-height: 1; }
.stat-toggle.open .toggle-icon { transform: rotate(180deg); }
.stat-group { display: grid; gap: 10px; overflow: hidden; max-height: 0; transition: max-height 0.3s ease, opacity 0.3s ease; opacity: 0; }
.stat-group.open { max-height: 600px; opacity: 1; }
.stat-sub { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; background: #f8fafc; }
.stat-sub .label { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.stat-sub .value { font-size: 20px; font-weight: 700; text-align: right; color: #334155; }
/* ── Save modal ──────────────────────────────────────────────────────────── */
#saveModal { display:none; position:fixed; inset:0; z-index:1000; align-items:center; justify-content:center; }
#saveModal.open { display:flex; }
.save-backdrop { position:absolute; inset:0; background:rgba(15,23,42,0.5); }
.save-box { position:relative; background:#fff; border-radius:20px; padding:28px; width:100%; max-width:400px; margin:16px; box-shadow:0 24px 60px rgba(15,23,42,0.25); }

@media (max-width: 900px) {
    .layout { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
    .page { padding: 12px; }
    .card-inner { padding: 16px; }
    .hero { padding: 18px; border-radius: 16px; }
    .hero h1 { font-size: 20px; }
    .sticky-bar {
        grid-template-columns: 1fr 1fr;
        margin-left: -12px;
        margin-right: -12px;
        padding: 10px 12px;
        gap: 8px;
    }
    .sticky-bar button { font-size: 12px; padding: 9px 8px; }
    .block { padding: 14px; }
    .stat .value { font-size: 22px; }
}
@page {
    size: A4 portrait;
    margin: 8mm;
}

@media print {
    body {
        background: #fff;
        font-size: 10px;
        line-height: 1.2;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .page {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    .hero {
        padding: 10px 12px;
        margin-bottom: 8px;
        border-radius: 10px;
        box-shadow: none;
    }

    .hero h1 {
        font-size: 18px;
        margin: 0;
    }

    .hero p {
        font-size: 10px;
        margin-top: 4px;
    }

    .layout {
        display: grid;
        grid-template-columns: 0.95fr 1.05fr;
        gap: 8px;
        align-items: start;
    }

    .card {
        box-shadow: none;
        border: 1px solid #dbe2ea;
        border-radius: 10px;
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .card-inner {
        padding: 10px;
    }

    h2 {
        font-size: 14px;
        margin: 0 0 8px;
    }

    h3 {
        font-size: 11px;
        margin: 10px 0 6px;
    }

    .field {
        margin-bottom: 8px;
        gap: 4px;
    }

    .grid-2 {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    label {
        font-size: 9px;
    }

    input[type="text"],
    input[type="number"],
    select {
        height: 22px;
        min-height: 22px;
        padding: 2px 6px;
        font-size: 9px;
        border-radius: 6px;
    }

    input[type="range"],
    .actions,
    .help-text {
        display: none !important;
    }

    .result-main {
        padding: 10px;
        margin-bottom: 10px;
        border-radius: 10px;
    }

    .result-label {
        font-size: 10px;
        margin-bottom: 2px;
    }

    .result-value {
        font-size: 20px;
    }

    .stats {
        gap: 5px;
        margin-bottom: 10px;
    }

    .stats div {
        font-size: 10px;
    }

    .warning-box {
        padding: 8px;
        margin-bottom: 10px;
        border-radius: 8px;
    }

    .warning-item {
        font-size: 9px;
        margin-bottom: 4px;
    }

    .table-wrap {
        margin-bottom: 10px;
        border-radius: 8px;
    }

    th, td {
        padding: 4px 6px;
        font-size: 9px;
    }

    /* Alleen compacte adviesrijen tonen */
    .print-compact tbody tr:nth-child(n+7) {
        display: none;
    }

    .chart-wrap {
        padding: 8px;
        border-radius: 8px;
        margin-bottom: 8px;
    }

    .chart-wrap canvas {
        max-height: 180px !important;
    }

    .print-hide {
        display: none !important;
    }

    /* Pompinstallatie print */
    .block { margin-bottom: 4px; padding: 4px; border-radius: 6px; }
    .block h3 { font-size: 9px; margin: 0 0 3px; }
    .section-title { font-size: 11px; margin: 0 0 3px; }
    .stat { padding: 5px 6px; border-radius: 6px; }
    .stat .label { font-size: 8px; margin-bottom: 1px; }
    .stat .value { font-size: 11px; }
    .muted-box { margin-top: 4px; padding: 4px 6px; font-size: 7px; border-radius: 6px; }
    .button-secondary { display: none; }
    .stat-group { max-height: none !important; opacity: 1 !important; }
    .stat-sub { padding: 3px 5px; border-radius: 5px; }
    .stat-sub .label { font-size: 7px; }
    .stat-sub .value { font-size: 9px; }
}
