/* ============================================
   pieker.be — Warm Industrial Dark Theme
   ============================================ */

:root {
    /* ---- Palette ---- */
    --color-bg: #0c0e14;
    --color-surface: #151820;
    --color-surface-raised: #1c1f29;
    --color-text: #e4e5e9;
    --color-text-secondary: #9296a5;
    --color-primary: #e8a838;
    --color-primary-hover: #f0b840;
    --color-primary-muted: rgba(232, 168, 56, 0.12);
    --color-accent: #34d399;
    --color-accent-muted: rgba(52, 211, 153, 0.12);
    --color-border: #22252e;
    --color-success: #34d399;
    --color-danger: #f87171;
    --color-danger-muted: rgba(248, 113, 113, 0.12);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.25), 0 1px 2px rgba(0, 0, 0, 0.15);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-glow: 0 0 24px rgba(232, 168, 56, 0.18);
    --max-width: 960px;
    --font-display: 'Syne', sans-serif;
    --font-body: 'Outfit', sans-serif;
}

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-body);
    font-weight: 400;
    background: var(--color-bg);
    color: var(--color-text);
    line-height: 1.6;
    min-height: 100vh;
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--color-bg); }
::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #3a3d48; }

::selection { background: rgba(232, 168, 56, 0.3); color: var(--color-text); }

/* ---- Layout ---- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.container-wide { max-width: 2200px; margin: 0 auto; padding: 0 2rem; }

/* ---- Rapport flow layout ---- */
.rapport-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.rapport-grid > * {
    flex: 1 1 450px;
    min-width: 0;
    max-width: 100%;
}

.rapport-grid > .span-full {
    flex-basis: 100%;
}

.rapport-layout {
    display: grid;
    grid-template-columns: minmax(230px, 280px) minmax(0, 1fr);
    align-items: start;
    gap: 1.5rem;
}

.report-evidence-details {
    margin-top: 1.25rem;
}

.report-evidence-details > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 44px;
    padding: 1rem 1.15rem;
    margin-bottom: 0;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow);
    cursor: pointer;
}

.report-evidence-details > summary:hover,
.report-evidence-details > summary:focus-visible {
    border-color: var(--color-primary);
}

.report-evidence-details > summary span {
    display: grid;
    gap: 0.2rem;
}

.report-evidence-details > summary small {
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-weight: 400;
}

.report-evidence-details > summary::after {
    content: '›';
    flex: 0 0 auto;
    color: var(--color-primary);
    font-size: 1.5rem;
    line-height: 1;
    transition: transform 0.2s ease;
}

.report-evidence-details[open] > summary {
    margin-bottom: 1.25rem;
}

.report-evidence-details[open] > summary::after {
    transform: rotate(90deg);
}

.rapport-sidebar {
    position: sticky;
    top: 5.25rem;
    max-height: calc(100svh - 6rem);
    margin-right: -0.35rem;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding-right: 0.35rem;
    scrollbar-color: transparent transparent;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
}

.rapport-sidebar:hover,
.rapport-sidebar:focus-within {
    scrollbar-color: rgba(125, 129, 144, 0.38) transparent;
}

.rapport-sidebar::-webkit-scrollbar {
    width: 6px;
}

.rapport-sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.rapport-sidebar::-webkit-scrollbar-thumb {
    background: transparent;
    border-radius: 999px;
}

.rapport-sidebar:hover::-webkit-scrollbar-thumb,
.rapport-sidebar:focus-within::-webkit-scrollbar-thumb {
    background: rgba(125, 129, 144, 0.34);
}

.rapport-sidebar:hover::-webkit-scrollbar-thumb:hover {
    background: rgba(125, 129, 144, 0.52);
}

.rapport-main {
    min-width: 0;
}

header {
    border-bottom: 1px solid var(--color-border);
    padding: 0.9rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(12, 14, 20, 0.82);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
}

header .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

main { padding: 2rem 0 4rem; }

footer {
    border-top: 1px solid var(--color-border);
    padding: 2rem 0;
    text-align: center;
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    letter-spacing: 0.02em;
}

.footer-brand {
    color: var(--color-primary);
    font-weight: 600;
    font-family: var(--font-display);
}

/* ---- Logo ---- */
.logo {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    text-decoration: none;
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.02em;
}

.logo-icon { flex-shrink: 0; }

.logo-text span { color: var(--color-primary); }

.peak-glow {
    animation: peakPulse 3.5s ease-in-out infinite;
}

@keyframes peakPulse {
    0%, 100% { opacity: 0.12; }
    50% { opacity: 0.28; }
}

/* ---- Navigation ---- */
nav { display: flex; align-items: center; }

header nav a {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 500;
    margin-left: 1.5rem;
    transition: color 0.2s;
    letter-spacing: 0.01em;
    position: relative;
    white-space: nowrap;
}

header nav a:hover { color: var(--color-text); }

header nav a.active {
    color: var(--color-primary);
}

header nav a.active::after {
    content: '';
    position: absolute;
    bottom: -0.9rem;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px;
}

header nav a.active.no-underline::after {
    display: none;
}

/* ---- Steps nav ---- */
.steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}

.step {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    transition: background 0.15s, color 0.15s;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
}

.step:hover:not(.disabled) {
    background: var(--color-surface-raised);
    color: var(--color-text);
}

.step.active {
    color: var(--color-primary);
    font-weight: 600;
}

.step.done {
    color: var(--color-success);
}

.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    font-size: 0.78rem;
    font-weight: 600;
    flex-shrink: 0;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.step.active .step-number {
    border-color: var(--color-primary);
    background: var(--color-primary);
    color: var(--color-bg);
}

.step.active .step-label {
    color: var(--color-primary);
}

.step.done .step-number {
    border-color: var(--color-primary);
    background: transparent;
    color: var(--color-primary);
}

.step.done .step-label {
    color: var(--color-text);
}

.step.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.step-connector {
    width: 2rem;
    height: 2px;
    background: var(--color-border);
    flex-shrink: 0;
    transition: background 0.15s;
}

.step-connector.done {
    background: var(--color-primary);
}

/* ---- Typography ---- */
h1 {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.15;
    margin-bottom: 0.5rem;
}

h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

h3 {
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.3rem;
}

p { margin-bottom: 1rem; }
.text-secondary { color: var(--color-text-secondary); }
.text-sm { font-size: 0.875rem; }

a { color: var(--color-primary); transition: color 0.2s; }
a:hover { color: var(--color-primary-hover); }

/* ---- Cards ---- */
.card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    transition: border-color 0.3s, box-shadow 0.3s;
}

.card:hover {
    border-color: rgba(232, 168, 56, 0.18);
}

.card + .card { margin-top: 1.5rem; }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

/* ---- Stats ---- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow);
    position: relative;
    overflow: hidden;
    transition: border-color 0.3s;
}

.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.stat:nth-child(1)::before { background: var(--color-primary); }
.stat:nth-child(2)::before { background: var(--color-accent); }
.stat:nth-child(3)::before { background: var(--color-danger); }
.stat:nth-child(4)::before { background: var(--color-danger); }

.stat:hover { border-color: rgba(232, 168, 56, 0.15); }

.stat-value {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

.stat-value.primary { color: var(--color-primary); }
.stat-value.accent { color: var(--color-accent); }
.stat-value.success { color: var(--color-success); }
.stat-value.danger { color: var(--color-danger); }

.stat-unit {
    font-size: 0.55em;
    font-weight: 500;
    opacity: 0.7;
    margin-left: 0.15em;
    letter-spacing: 0;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
    margin-top: 0.35rem;
}

.stat-sub {
    font-size: 0.72rem;
    color: var(--color-text-secondary);
    margin-top: 0.2rem;
    line-height: 1.3;
}

.stat-period-total {
    display: block;
    margin-top: 0.12rem;
}

.source-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.4rem;
}

.source-badge {
    border: 1px solid var(--color-border);
    border-radius: 999px;
    color: var(--color-text-secondary);
    font-size: 0.62rem;
    font-weight: 650;
    letter-spacing: 0.03em;
    line-height: 1;
    padding: 0.24rem 0.42rem;
    text-transform: uppercase;
}

.source-badge.measured {
    border-color: rgba(76, 154, 255, 0.28);
    color: var(--color-primary);
}

.source-badge.estimated {
    border-color: rgba(232, 168, 56, 0.28);
    color: var(--color-accent);
}

/* ---- Charts ---- */
.chart-container {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.rapport-grid > .chart-container {
    margin-bottom: 0;
    height: 100%;
}

.chart-container .plotly-graph-div { width: 100% !important; }
/* SVG text (titles, annotations) that Plotly can't wrap must never stretch
   the page — clip it to the chart instead. */
.plotly-graph-div { overflow: hidden; }

.chart-container.section-unavailable {
    opacity: 0.4;
    pointer-events: none;
}
.chart-container.section-unavailable .unavailable-reason {
    opacity: 1;
}

/* ---- Plotly notification toast ---- */
.notifier-note {
    background: var(--color-surface-raised) !important;
    border: 1px solid var(--color-border) !important;
    color: var(--color-text-secondary) !important;
    font-family: var(--font-body) !important;
    font-size: 0.82rem !important;
    border-radius: var(--radius-sm) !important;
    box-shadow: var(--shadow) !important;
    padding: 0.5rem 0.85rem !important;
}

/* ---- Chart interaction toolbar ---- */
.chart-wrapper {
    position: relative;
}

.chart-toolbar {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 10;
}

.chart-wrapper:hover .chart-toolbar,
.chart-toolbar-visible {
    opacity: 1;
}

/* Shared icon-button chrome for chart toolbar and modal close */
.chart-toolbar button,
.chart-modal-close {
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    color: var(--color-text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, border-color 0.15s;
    padding: 0;
}

.chart-toolbar button {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.chart-toolbar button:hover,
.chart-modal-close:hover {
    color: var(--color-text);
    border-color: var(--color-primary);
}

.chart-toolbar svg,
.chart-modal-close svg {
    width: 14px;
    height: 14px;
    stroke: currentColor;
    fill: none;
    stroke-linecap: round;
}

.chart-toolbar svg {
    stroke-width: 1.5;
    stroke-linejoin: round;
}

/* ---- Drag-zoom selection: darken outside, highlight selection ---- */
.zoomlayer > .zoombox {
    fill: rgba(0, 0, 0, 0.45) !important;
}

.zoomlayer > .zoombox-corners {
    stroke: var(--color-primary) !important;
    opacity: 0.8 !important;
}

/* ---- Chart fullscreen modal ---- */
.chart-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 2rem;
}

.chart-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.chart-modal-content {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 1600px;
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    position: relative;
}

.chart-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.chart-modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
}

.chart-modal-close svg {
    stroke-width: 2;
}

.chart-insight {
    margin-top: 0.75rem;
    padding: 0.8rem 1rem;
    background: var(--color-surface-raised);
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    color: var(--color-text-secondary);
    line-height: 1.55;
    border-left: 3px solid var(--color-primary);
}

/* ---- Narrative section dividers ---- */
.report-section-heading-wrap {
    margin: 1.5rem 0 0.25rem 0;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    width: 100%;
}
.report-section-heading-wrap:first-child { border-top: none; padding-top: 0; }
.report-section-heading {
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    margin: 0;
    color: var(--color-text);
}
.report-section-divider {
    width: 100%;
    height: 1px;
    background: var(--color-border);
    margin: 1rem 0 0 0;
}

/* Details-as-chart-container (for expert-only charts) */
.chart-container-details {
    padding: 1rem 1.25rem;
}
.chart-container-details > summary {
    cursor: pointer;
    padding: 0.25rem 0;
    user-select: none;
    color: var(--color-text-secondary);
}
.chart-container-details > summary::before {
    content: '▸ ';
    color: var(--color-text-secondary);
    display: inline-block;
}
.chart-container-details[open] > summary::before { content: '▾ '; }
.chart-container-details[open] > summary { margin-bottom: 0.5rem; }
.chart-container-details > summary h3 { color: var(--color-text-secondary); font-size: 1rem; font-weight: 500; }
.chart-container-details[open] > summary h3 { color: var(--color-text); }

/* Inline callouts (warning, info) */
.callout {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    line-height: 1.55;
    margin: 0.5rem 0;
}
.callout-warning {
    background: rgba(248, 113, 113, 0.06);
    border-left: 3px solid var(--color-danger);
    color: var(--color-text);
}
.callout-info {
    background: rgba(129, 140, 248, 0.06);
    border-left: 3px solid #818cf8;
    color: var(--color-text);
}

/* ---- Opportunity-style cards (report preview, decision matrix, budget banner) ---- */
.opportunity-card {
    background: linear-gradient(135deg, rgba(232, 168, 56, 0.08) 0%, rgba(52, 211, 153, 0.05) 100%);
    border: 1px solid rgba(232, 168, 56, 0.28);
    border-left: 4px solid var(--color-primary);
    padding: 1.75rem;
    border-radius: var(--radius);
    margin-bottom: 2rem;
    box-shadow: var(--shadow-md);
    container-type: inline-size;
}

.opportunity-header {
    margin-bottom: 1rem;
}

.opportunity-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: 0.5rem;
}

.opportunity-header h2 {
    font-size: 1.55rem;
    line-height: 1.25;
    margin: 0;
}

.opportunity-why {
    font-size: 0.98rem;
    line-height: 1.65;
    margin-bottom: 0.9rem;
}

.opportunity-link {
    display: inline-block;
    color: var(--color-primary);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.4rem 0;
}
.opportunity-link:hover { text-decoration: underline; }

@media (max-width: 520px) {
    .opportunity-card { padding: 1.25rem; }
    .opportunity-header h2 { font-size: 1.25rem; }
}

/* ---- Savings budget banner (reconciled totals) ---- */
.budget-banner {
    margin-bottom: 2rem;
    padding: 1.5rem 1.75rem;
    border-radius: var(--radius);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
}

.budget-banner-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.budget-banner-header h2 {
    margin: 0.35rem 0 0;
    font-size: 1.3rem;
}

.budget-banner-total {
    font-family: var(--font-display, inherit);
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--color-accent);
    white-space: nowrap;
}

.budget-banner-total .unit {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-left: 0.15rem;
}

.budget-rows {
    margin-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.budget-row {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.5rem 0 0.15rem;
}

.budget-row-label { color: var(--color-text); }

.budget-row-amount {
    font-weight: 600;
    color: var(--color-success);
    white-space: nowrap;
}

.budget-row-detail {
    margin: 0 0 0.35rem;
    font-size: 0.8rem;
}

.budget-banner-footer {
    margin-top: 0.9rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

@media (max-width: 520px) {
    .budget-banner { padding: 1.1rem 1.2rem; }
    .budget-banner-total { font-size: 1.25rem; }
}

/* ---- Cost section (waterfall + drivers side-by-side) ---- */
.cost-inclusion-panel {
    margin-top: 0.75rem;
    padding: 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.cost-inclusion-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.65rem;
}

.cost-inclusion-head strong {
    font-size: 0.92rem;
}

.cost-inclusion-head span {
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    text-align: right;
}

.cost-inclusion-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.65rem;
}

.cost-inclusion-grid > div {
    min-width: 0;
}

.cost-inclusion-grid span {
    display: block;
    color: var(--color-text);
    font-size: 0.74rem;
    font-weight: 700;
    margin-bottom: 0.18rem;
}

.cost-inclusion-grid p {
    color: var(--color-text-secondary);
    font-size: 0.74rem;
    line-height: 1.35;
    margin: 0;
}

.cost-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

/* ---- Cost Drivers (C16) ---- */
.cost-drivers { display: flex; flex-direction: column; gap: 1rem; }
.cost-driver-row { position: relative; }
.cost-driver-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.25rem; }
.cost-driver-label { font-weight: 500; font-size: 0.9rem; }
.cost-driver-amount { font-weight: 600; font-size: 0.95rem; font-family: var(--font-display); }
.cost-driver-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--color-surface-raised);
    position: relative;
    overflow: hidden;
}
.cost-driver-bar::after {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: var(--pct, 0%);
    background: var(--color-primary);
    border-radius: 2px;
    transition: width 0.5s ease;
}
.cost-driver-tip {
    font-size: 0.8rem;
    color: var(--color-text-secondary);
    margin-top: 0.25rem;
    line-height: 1.4;
}
.text-success { color: #34d399; }
.text-danger { color: #f87171; }

/* ---- Benchmark Bars (F36) ---- */
.benchmark-bars { display: flex; flex-direction: column; gap: 0.4rem; }
.benchmark-row { display: flex; align-items: center; gap: 0.75rem; }
.benchmark-label { min-width: 120px; font-size: 0.8rem; color: var(--color-text-secondary); }
.benchmark-bar-bg { flex: 1; height: 18px; background: var(--color-bg); border-radius: 4px; position: relative; overflow: hidden; }
.benchmark-bar-fill { height: 100%; border-radius: 4px; transition: width 0.5s ease; }
.benchmark-value { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 0.72rem; color: var(--color-text-secondary); }

/* ---- Baseload Devices (F35) ---- */
.device-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.5rem;
}
.device-card {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    background: var(--color-surface-raised);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
}
.device-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 0.1rem; }
.device-name { font-size: 0.85rem; font-weight: 500; }
.device-watts { font-size: 0.78rem; color: var(--color-text-secondary); }
.device-hint { font-size: 0.75rem; color: var(--color-primary); margin-top: 0.15rem; }

/* ---- Analysis period rail ---- */
.date-filter {
    margin-bottom: 1rem;
}

.analysis-rail {
    padding: 0.25rem 0 0.25rem 1rem;
    border-left: 1px solid var(--color-border);
}

.period-panel-kicker {
    color: var(--color-primary);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    line-height: 1;
    margin-bottom: 0.45rem;
    text-transform: uppercase;
}

.analysis-rail-copy {
    color: var(--color-text-secondary);
    font-size: 0.8rem;
    line-height: 1.45;
    margin: 0.55rem 0 0.85rem;
}

.period-date-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.42rem;
    margin: 0 0 0.8rem;
}

.period-date-form.active {
    color: var(--color-text);
}

/* Shared uppercase micro-label recipe for the rail's kickers */
.period-date-form label,
.period-option-label,
.period-status-card > span,
.period-quality div > span {
    color: var(--color-text-secondary);
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    line-height: 1;
    margin-bottom: 0.35rem;
    text-transform: uppercase;
}

.period-date-form label,
.period-status-card > span,
.period-quality div > span {
    display: block;
}

/* Shared small-input recipe (period date fields, battery inputs, day picker) */
.period-date-form input[type="text"],
.battery-inline-input input,
.battery-price-input-wrap input,
.battery-day-custom input[type="date"] {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: var(--color-surface-raised);
    color: var(--color-text);
    font-family: inherit;
    transition: border-color 0.2s;
}

.period-date-form input[type="text"]:focus,
.battery-inline-input input:focus,
.battery-price-input-wrap input:focus,
.battery-day-custom input[type="date"]:focus {
    outline: none;
    border-color: var(--color-primary);
}

.period-date-form input[type="text"] {
    padding: 0.45rem 0.55rem;
    font-size: 0.84rem;
}

.period-date-form input[type="text"].invalid {
    border-color: var(--color-danger);
}

.period-option-label {
    margin: 0.8rem 0 0.4rem;
}

.period-status-card {
    padding: 0.75rem 0.8rem;
    margin-top: 0.9rem;
    border-radius: 8px;
    background: var(--color-surface);
    border: 1px solid rgba(232, 168, 56, 0.16);
}

.period-status-card > strong {
    display: block;
    color: var(--color-text);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.25;
}

.period-option-list {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.35rem;
}

.period-option {
    width: 100%;
    min-height: 2.1rem;
    padding: 0.42rem 0.35rem;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.period-option strong {
    display: block;
    color: inherit;
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.15;
}

.period-option:hover {
    color: var(--color-text);
    border-color: rgba(232, 168, 56, 0.55);
    background: rgba(232, 168, 56, 0.04);
}

.period-option.active {
    color: var(--color-text);
    background: var(--color-primary-muted);
    border-color: rgba(232, 168, 56, 0.5);
    box-shadow: inset 0 -2px 0 var(--color-primary);
}

.period-quality {
    display: flex;
    align-items: flex-start;
    gap: 0.55rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.period-quality-dot {
    width: 0.55rem;
    height: 0.55rem;
    margin-top: 0.22rem;
    border-radius: 50%;
    background: #818cf8;
    flex-shrink: 0;
}

.period-quality strong {
    color: var(--color-text);
    display: block;
    font-size: 0.85rem;
    line-height: 1.3;
}

.period-quality-low .period-quality-dot {
    background: var(--color-danger);
}

.period-quality-high .period-quality-dot {
    background: var(--color-success);
}

.rail-assumptions {
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--color-border);
}

.rail-note-card {
    border: 1px solid var(--color-border);
    border-radius: 8px;
    background: var(--color-surface);
    overflow: hidden;
}

.rail-note-card + .rail-note-card {
    margin-top: 0.55rem;
}

.rail-note-card summary,
.rail-note-summary {
    color: var(--color-text);
    cursor: pointer;
    font-size: 0.84rem;
    font-weight: 650;
    line-height: 1.2;
    padding: 0.6rem 0.7rem;
}

.rail-note-summary {
    cursor: default;
}

.rail-note-card summary::after {
    content: '+';
    float: right;
    color: var(--color-text-secondary);
}

.rail-note-card[open] summary::after {
    content: '-';
}

.rail-note-body {
    border-top: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 0.76rem;
    line-height: 1.4;
    padding: 0.65rem 0.7rem 0.75rem;
}

.rail-note-body p {
    margin: 0 0 0.55rem;
}

.rail-note-body p:last-child {
    margin-bottom: 0;
}

.rail-assumption-list,
.rail-note-list {
    list-style: none;
    margin: 0 0 0.55rem;
    padding: 0;
}

.rail-assumption-list li,
.rail-note-list li {
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.42rem 0;
}

.rail-assumption-list li:first-child,
.rail-note-list li:first-child {
    border-top: 0;
    padding-top: 0;
}

.rail-assumption-list strong,
.rail-section-title {
    color: var(--color-text);
}

.rail-section-title {
    font-weight: 650;
    margin-bottom: 0.45rem;
}

.rail-section-notes[hidden] {
    display: none;
}

.chart-toggle {
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--color-border);
}
.btn-toggle {
    padding: 0.3rem 0.9rem;
    background: var(--color-surface);
    color: var(--color-text-secondary);
    border: none;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: inherit;
    transition: all 0.15s;
}
.btn-toggle:not(:last-child) { border-right: 1px solid var(--color-border); }
.btn-toggle:hover { color: var(--color-text); }
.btn-toggle.active {
    background: var(--color-primary);
    color: var(--color-bg);
    font-weight: 600;
}
/* ---- Forms ---- */
form { max-width: 100%; }

.form-group { margin-bottom: 1.25rem; }

label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
    color: var(--color-text);
    letter-spacing: 0.01em;
}

label .hint {
    font-weight: 400;
    color: var(--color-text-secondary);
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--color-text);
    background: var(--color-surface-raised);
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px var(--color-primary-muted);
}

select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237d8190' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2.5rem;
}

option { background: var(--color-surface-raised); color: var(--color-text); }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* ---- Buttons ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px; /* touch-target accessibility floor */
    gap: 0.4rem;
    padding: 0.65rem 1.5rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    letter-spacing: 0.01em;
}

.btn-primary {
    background: var(--color-primary);
    color: #0c0e14;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}
.btn-secondary:disabled {
    opacity: 0.45;
    cursor: wait;
    border-color: var(--color-border);
    color: var(--color-text-secondary);
}

.btn-lg { padding: 0.85rem 2rem; font-size: 1.05rem; }

/* ---- Upload zones ---- */
.upload-zone {
    border: 2px dashed var(--color-border);
    border-radius: var(--radius);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
    background: var(--color-surface-raised);
}

.upload-zone:hover, .upload-zone.dragover {
    border-color: var(--color-primary);
    background: rgba(232, 168, 56, 0.04);
    box-shadow: inset 0 0 40px rgba(232, 168, 56, 0.03);
}

.upload-zone input[type="file"] { display: none; }
.upload-zone .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.upload-zone p { color: var(--color-text-secondary); margin: 0; }
.upload-zone .filename { color: var(--color-primary); font-weight: 600; margin-top: 0.5rem; }

.upload-zone-unified { padding: 3.5rem 2rem; min-height: 180px; transition: padding 0.3s, min-height 0.3s; }
.upload-zone-compact { padding: 1.5rem 2rem; min-height: 0; }
.upload-zone-compact .icon { display: none; }

/* ---- Upload results grid ---- */
#upload-results {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
}

.upload-result {
    display: flex;
    gap: 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1rem;
    background: var(--color-surface-raised);
    transition: border-color 0.3s, box-shadow 0.3s, transform 0.3s;
    animation: fadeInUp 0.35s ease-out both;
}

.upload-result:hover {
    border-color: rgba(232, 168, 56, 0.18);
    box-shadow: var(--shadow);
}

.upload-result-success { border-top: 2px solid var(--color-success); }
.upload-result-error { border-top: 2px solid var(--color-danger); }
.upload-result-pending { border-top: 2px solid var(--color-primary); }

/* Colored icon box */
.upload-result-icon-box {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}
.upload-result-icon-box.ub-data    { background: rgba(228, 229, 233, 0.10); }
.upload-result-icon-box.ub-bill    { background: rgba(129, 140, 248, 0.12); }
.upload-result-icon-box.ub-solar   { background: rgba(251, 191, 36, 0.12); }
.upload-result-icon-box.ub-battery { background: rgba(52, 211, 153, 0.12); }
.upload-result-icon-box.ub-ev      { background: rgba(129, 140, 248, 0.12); }
.upload-result-icon-box.ub-hp      { background: rgba(248, 113, 113, 0.12); }
.upload-result-icon-box.ub-unknown { background: rgba(125, 129, 144, 0.12); }

/* Pending spinner in icon box */
.upload-result-pending .upload-result-icon-box {
    background: var(--color-primary-muted);
}

.upload-result-body {
    flex: 1;
    min-width: 0;
}

.upload-result-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.upload-result-top > div:first-child {
    min-width: 0;
    flex: 1;
}

.upload-result-type-label {
    display: block;
    font-family: var(--font-display);
    font-size: 0.9rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.upload-result-filename {
    display: block;
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-top: 0.1rem;
}

/* Hover scroll: the inner span slides left to reveal full name */
.upload-result-filename .fn-inner {
    display: inline-block;
    transition: transform 0.15s ease-out;
    white-space: nowrap;
}

.upload-result-filename.is-scrolling {
    text-overflow: clip;
}

.upload-result-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.upload-result-badge {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.72rem;
    flex-shrink: 0;
}

.upload-result-badge.success {
    background: var(--color-success);
    color: var(--color-bg);
}

.upload-result-badge.error {
    background: var(--color-danger);
    color: var(--color-bg);
}

.upload-result-dismiss {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: none;
    background: none;
    color: var(--color-text-secondary);
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
}

.upload-result:hover .upload-result-dismiss {
    opacity: 1;
}

.upload-result-dismiss:hover {
    color: var(--color-danger);
    background: var(--color-danger-muted);
}

.upload-result-message {
    font-size: 0.82rem;
    margin-top: 0.4rem;
    color: var(--color-text-secondary);
    line-height: 1.45;
}

.upload-result-message.success { color: var(--color-text-secondary); }
.upload-result-message.error { color: var(--color-danger); }
.upload-result-message.pending { color: var(--color-primary); font-weight: 500; }

.upload-result-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-top: 0.5rem;
}

.upload-result-detail {
    font-size: 0.78rem;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    padding: 0.2rem 0.55rem;
    border-radius: 4px;
    border: 1px solid var(--color-border);
}

.upload-result-detail strong { color: var(--color-text); }

/* Inline form inside upload result card */
.upload-result-inline-form {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--color-border);
}

.upload-result-form-row {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.upload-result-form-group label {
    font-size: 0.78rem;
    margin-bottom: 0.2rem;
}

.upload-result-form-group select,
.upload-result-form-group input[type="number"],
.upload-result-form-group input[type="text"] {
    font-size: 0.85rem;
    padding: 0.4rem 0.55rem;
}

/* ---- Hero (landing page) ---- */
.hero {
    text-align: center;
    padding: 5rem 0 3rem;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    width: 650px;
    height: 650px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232, 168, 56, 0.07) 0%, transparent 70%);
    top: -220px;
    left: 50%;
    transform: translateX(-70%);
    pointer-events: none;
    animation: floatOrb 25s ease-in-out infinite;
}

.hero::after {
    content: '';
    position: absolute;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(52, 211, 153, 0.04) 0%, transparent 70%);
    bottom: -280px;
    right: 50%;
    transform: translateX(80%);
    pointer-events: none;
    animation: floatOrb 30s ease-in-out infinite reverse;
}

@keyframes floatOrb {
    0%, 100% { transform: translateX(-70%) translateY(0); }
    50% { transform: translateX(-70%) translateY(-18px); }
}

.hero h1 {
    font-size: 3rem;
    letter-spacing: -0.04em;
    margin-bottom: 1.25rem;
    position: relative;
    animation: fadeInUp 0.6s ease-out;
}

.hero h1 .highlight {
    background: linear-gradient(135deg, var(--color-primary) 20%, #f5c84c 80%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero .subtitle {
    font-size: 1.15rem;
    color: var(--color-text-secondary);
    max-width: 520px;
    margin: 0 auto 2.5rem;
    line-height: 1.65;
    position: relative;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.hero .btn {
    position: relative;
    animation: fadeInUp 0.6s ease-out 0.2s both;
}

/* ---- Alerts ---- */
.alert {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(52, 211, 153, 0.08);
    border: 1px solid rgba(52, 211, 153, 0.2);
    color: #6ee7b7;
}

.alert-error {
    background: rgba(248, 113, 113, 0.08);
    border: 1px solid rgba(248, 113, 113, 0.2);
    color: #fca5a5;
}

/* ---- Details / Summary ---- */
details summary { list-style: none; }
details summary::-webkit-details-marker { display: none; }
.setup-disclosure::before {
    content: '›';
    display: inline-block;
    margin-right: 0.5rem;
    color: var(--color-primary);
    font-size: 1.2em;
    transition: transform 0.2s ease;
}
details[open] > .setup-disclosure::before { transform: rotate(90deg); }

/* ---- Animations ---- */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(18px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive ---- */
@media (max-width: 1180px) {
    .rapport-layout {
        grid-template-columns: 1fr;
    }

    .rapport-sidebar {
        position: static;
        max-height: none;
        overflow: visible;
        /* Single column: the report itself comes first, the period/assumptions
           rail follows — readers shouldn't scroll past meta-info to reach
           their numbers. */
        order: 2;
    }

    /* The "Deze sectie" notes follow the viewport on desktop; stuck at the
       bottom of a stacked layout they are stale noise. */
    .rail-section-notes { display: none; }

    .analysis-rail {
        display: grid;
        grid-template-columns: minmax(220px, 1fr) minmax(260px, 1.25fr);
        gap: 0.8rem 1rem;
        padding: 1rem;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-sm);
        background: var(--color-surface);
    }

    .period-panel-kicker,
    .analysis-rail-copy {
        grid-column: 1;
    }

    .period-date-form,
    .period-status-card {
        grid-column: 1;
    }

    .period-option-list,
    .period-option-label {
        grid-column: 2;
    }

    .period-option-list {
        align-self: start;
    }

    .cost-inclusion-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .hero h1 { font-size: 2rem; }
    .hero { padding: 3rem 0 2rem; }
    .form-row { grid-template-columns: 1fr; }
    .stats { grid-template-columns: 1fr 1fr; }
    .decision-matrix { grid-template-columns: 1fr; }
    .stat-value { font-size: 1.4rem; }
    .steps { flex-wrap: wrap; }
    header nav a { margin-left: 0.7rem; font-size: 0.8rem; }
    .logo { font-size: 1.05rem; gap: 0.4rem; }
    .logo-icon { width: 24px; height: 18px; }
    /* iOS Safari auto-zooms into any focused input with a font under 16px,
       which throws the whole layout off. */
    input[type="text"],
    input[type="number"],
    input[type="email"],
    input[type="date"],
    select,
    textarea {
        font-size: 16px;
    }
    .container-wide { padding: 0 1rem; }
    .chart-modal { padding: 0.75rem; }
    .chart-toolbar button { width: 24px; height: 24px; }
    .chart-toolbar svg { width: 12px; height: 12px; }
    .cost-split { grid-template-columns: 1fr; }
    .cost-inclusion-head {
        display: block;
    }
    .cost-inclusion-head span {
        display: block;
        margin-top: 0.2rem;
        text-align: left;
    }
    .cost-inclusion-grid {
        grid-template-columns: 1fr;
    }
    .analysis-rail {
        display: block;
        padding: 1rem;
        border: 1px solid var(--color-border);
    }
}

/* ---- Detected installation suggestions ---- */
.detected-config {
    margin-top: 1rem;
    padding: 1rem;
    border: 1px solid var(--color-accent-muted, rgba(232, 168, 56, 0.35));
    border-radius: var(--radius-sm);
    background: rgba(232, 168, 56, 0.05);
}

.detected-config h3 {
    font-size: 1rem;
    margin-bottom: 0.25rem;
}

.detected-suggestion {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.75rem 0;
    border-top: 1px solid var(--color-border);
    margin-top: 0.75rem;
}

/* ---- HTMX / Loading ---- */
.htmx-error-note {
    padding: 1rem;
    border: 1px dashed var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.htmx-indicator { display: none; }
.htmx-request .htmx-indicator { display: inline-block; }
.htmx-request.htmx-indicator { display: inline-block; }

.spinner {
    display: inline-block;
    width: 1.2rem;
    height: 1.2rem;
    border: 2px solid var(--color-border);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.spinner-lg {
    width: 2rem;
    height: 2rem;
    border-width: 3px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.insight-loading {
    margin-top: 0.75rem;
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.insight-loading .placeholder-blur {
    padding: 0.8rem 1rem;
    font-size: 0.88rem;
    line-height: 1.55;
    color: var(--color-text-secondary);
    background: var(--color-surface-raised);
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--color-primary);
    filter: blur(5px);
    user-select: none;
    -webkit-user-select: none;
}

.insight-loading .loading-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(21, 24, 32, 0.3);
    border-radius: var(--radius-sm);
}

.section-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem 1rem;
    gap: 0.75rem;
}

/* ---- Data tables ---- */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
    margin-top: 1rem;
}

.data-table th {
    text-align: left;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-secondary);
    padding: 0.5rem 0.75rem;
    border-bottom: 2px solid var(--color-border);
}

.data-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

.data-table tbody tr:hover {
    background: rgba(232, 168, 56, 0.04);
}

.data-table .text-right { text-align: right; }

/* ---- Tooltips (CSS-only, instant) ---- */
[data-tip] {
    position: relative;
    cursor: help;
    border-bottom: 1px dotted var(--color-text-secondary);
}

[data-tip]::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--color-surface-raised);
    color: var(--color-text);
    font-size: 0.78rem;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    line-height: 1.45;
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-md);
    white-space: normal;
    width: max-content;
    max-width: 260px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.12s;
    z-index: 100;
}

[data-tip]:hover::after {
    opacity: 1;
}

/* Keep right-aligned column tooltips from overflowing */
.text-right[data-tip]::after,
th:last-child[data-tip]::after {
    left: auto;
    right: 0;
    transform: none;
}

th:first-child[data-tip]::after {
    left: 0;
    transform: none;
}

/* ---- Equipment cards ---- */
.equipment-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.75rem;
}

.equipment-card {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 0.85rem 1rem;
    transition: border-color 0.2s;
}

.equipment-card:hover {
    border-color: rgba(232, 168, 56, 0.18);
}

.equipment-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.4rem;
}

.equipment-type-badge {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.equipment-type-badge.solar { color: #fbbf24; }
.equipment-type-badge.battery { color: #34d399; }
.equipment-type-badge.ev { color: #818cf8; }
.equipment-type-badge.heat_pump { color: #f87171; }

.btn-delete {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.btn-delete:hover {
    color: var(--color-danger);
    background: var(--color-danger-muted);
}

.equipment-card-body {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.equipment-detail {
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    background: var(--color-surface);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

.equipment-form {
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

/* ---- Share link ---- */
.share-link-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.share-link-input {
    width: auto;
    min-width: 220px;
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    font-family: inherit;
    color: var(--color-text-secondary);
    background: var(--color-surface-raised);
    cursor: text;
}

.share-link-box .btn {
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
}

/* ---- Shared view banner ---- */
.shared-banner {
    padding: 0.65rem 1rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    margin-bottom: 1rem;
    background: var(--color-primary-muted);
    border: 1px solid rgba(232, 168, 56, 0.2);
    color: #fbbf24;
}

/* ---- Battery Simulator Unified View ---- */
.battery-layout {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    margin-top: 1rem;
}

.battery-chart-area {
    min-width: 0;
}

.battery-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.battery-sidebar-group h4 {
    font-family: var(--font-display);
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--color-text-secondary);
    margin-bottom: 0.5rem;
}

.battery-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.6rem;
}

.battery-section-title h4 {
    margin-bottom: 0;
}

.battery-pill {
    display: inline-flex;
    align-items: center;
    min-height: 1.45rem;
    padding: 0.12rem 0.45rem;
    border-radius: 999px;
    background: var(--color-primary-muted);
    color: var(--color-primary);
    font-size: 0.72rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.battery-power-mode-toggle {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border: 1px solid var(--color-border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 0.85rem;
}

.battery-mode-btn {
    min-width: 0;
    padding: 0.45rem 0.35rem;
    border: 0;
    border-right: 1px solid var(--color-border);
    background: var(--color-surface);
    color: var(--color-text-secondary);
    cursor: pointer;
    font-family: inherit;
    font-size: 0.76rem;
    font-weight: 600;
    line-height: 1.1;
}

.battery-mode-btn:last-child {
    border-right: 0;
}

.battery-mode-btn:hover {
    color: var(--color-text);
    background: var(--color-surface-raised);
}

.battery-mode-btn.active {
    background: var(--color-primary);
    color: var(--color-bg);
}

.battery-slider-block {
    margin-top: 0.9rem;
}

.battery-control-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.35rem;
}

.battery-control-head label {
    color: var(--color-text);
    font-size: 0.88rem;
    font-weight: 600;
}

.battery-control-head output {
    color: var(--color-primary);
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.battery-slider-block input[type="range"] {
    width: 100%;
    accent-color: var(--color-primary);
}

.battery-slider-markers {
    position: relative;
    min-height: 2.25rem;
    margin: 0.15rem 0 0.3rem;
}

.battery-slider-marker {
    position: absolute;
    top: 0;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.12rem;
    max-width: 4.4rem;
    color: var(--color-text-secondary);
    pointer-events: auto;
}

.battery-slider-marker i {
    width: 1px;
    height: 0.48rem;
    background: var(--color-border);
}

.battery-slider-marker b {
    font-size: 0.58rem;
    font-weight: 600;
    line-height: 1.05;
    text-align: center;
    white-space: normal;
}

.battery-inline-input,
.battery-price-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.battery-inline-input input,
.battery-price-input-wrap input {
    width: 6rem;
    padding: 0.35rem 0.5rem;
    font-size: 0.84rem;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}

.battery-price-input-wrap input {
    width: 8rem;
}

.battery-inline-input span,
.battery-price-input-wrap span {
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

.battery-microcopy {
    margin-top: 0.35rem;
    color: var(--color-text-secondary);
    font-size: 0.74rem;
    line-height: 1.35;
}

.battery-roi-card {
    margin-top: 0.9rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--color-border);
}

.battery-advanced-controls {
    border: 0;
}

.battery-advanced-controls summary {
    cursor: pointer;
    color: var(--color-text-secondary);
    font-size: 0.84rem;
    font-weight: 600;
}

.battery-advanced-controls summary:hover {
    color: var(--color-text);
}

.battery-advanced-body {
    margin-top: 0.65rem;
}

/* Strategy radios + day picker buttons (shared chrome) */
.battery-strategy-radios {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.battery-strategy-radio,
.battery-day-btn {
    display: flex;
    align-items: center;
    border-radius: 6px;
    cursor: pointer;
    color: var(--color-text-secondary);
    transition: all 0.15s;
    border: 1px solid transparent;
    background: none;
    font-family: inherit;
    text-align: left;
    width: 100%;
}

.battery-strategy-radio {
    gap: 0.5rem;
    padding: 0.4rem 0.6rem;
    font-size: 0.85rem;
}

.battery-day-btn {
    justify-content: space-between;
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
}

.battery-strategy-radio:hover,
.battery-day-btn:hover {
    color: var(--color-text);
    background: var(--color-surface-raised);
}

.battery-strategy-radio.active,
.battery-day-btn.active {
    color: var(--color-text);
    background: var(--color-surface-raised);
    border-color: var(--color-primary);
}

.battery-strategy-radio .radio-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.15s;
}

.battery-strategy-radio.active .radio-dot {
    border-color: var(--color-primary);
}

.battery-strategy-radio.active .radio-dot::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-primary);
}

/* Day picker list */
.battery-day-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.battery-day-btn .day-label {
    font-weight: 500;
}

.battery-day-btn .day-date {
    font-size: 0.75rem;
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.battery-day-custom {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.battery-day-custom input[type="date"] {
    flex: 1;
    padding: 0.35rem 0.5rem;
    font-size: 0.82rem;
}

/* Sidebar summary stats */
.battery-summary {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.battery-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    padding: 0.2rem 0;
}

.battery-summary-label {
    color: var(--color-text-secondary);
}

.battery-summary-value {
    font-weight: 600;
    font-family: var(--font-display);
    font-variant-numeric: tabular-nums;
}

/* Collapsible "Meer analyses" */

/* Battery secondary tabs (inside collapsible) */
.battery-tabs { display: flex; gap: 0.25rem; margin: 0 0 1rem; flex-wrap: wrap; }
.battery-tab { padding: 0.5rem 1rem; border-radius: 8px; background: var(--color-surface-raised); color: var(--color-text-secondary);
    border: 1px solid transparent; cursor: pointer; font-size: 0.85rem; transition: all 0.15s; font-family: inherit; }
.battery-tab:hover { background: var(--color-surface-raised); border-color: var(--color-border); }
.battery-tab.active { background: var(--color-primary); color: var(--color-bg); font-weight: 600; }
.battery-panel { display: none; } .battery-panel.active { display: block; }

/* Mobile: stack sidebar below chart */
@media (max-width: 768px) {
    .battery-layout {
        grid-template-columns: 1fr;
    }

    .battery-power-mode-toggle {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .battery-mode-btn:nth-child(2) {
        border-right: 0;
    }

    .battery-mode-btn:nth-child(-n + 2) {
        border-bottom: 1px solid var(--color-border);
    }
}

/* ============================================
   Fluvius Guide
   ============================================ */
.guide-toc {
    position: fixed;
    left: max(1rem, calc((100vw - var(--max-width)) / 2 - 180px));
    top: 5rem;
    width: 160px;
}
.guide-toc ul { list-style: none; display: flex; flex-direction: column; gap: 0.25rem; }
.guide-toc-link {
    display: block;
    padding: 0.35rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    transition: all 0.15s;
}
.guide-toc-link:hover { color: var(--color-text); }
.guide-toc-link.active {
    color: var(--color-primary);
    background: var(--color-primary-muted);
}
.guide { display: flex; flex-direction: column; gap: 2rem; min-width: 0; }
.guide-section {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 1.5rem 1.75rem;
}
.guide-section h2 {
    font-family: var(--font-display);
    font-size: 1.25rem;
    margin-bottom: 1.25rem;
    color: var(--color-primary);
}
.guide-step {
    margin-bottom: 1.5rem;
}
.guide-step:last-child { margin-bottom: 0; }
.guide-step-text { margin-bottom: 0.75rem; }
.guide-step-text p { color: var(--color-text-secondary); line-height: 1.7; }
.guide-step-text p + p { margin-top: 0.5rem; }
.guide-step-text strong { color: var(--color-text); }
.guide-step-text ul {
    margin: 0.5rem 0 0 1.25rem;
    color: var(--color-text-secondary);
    line-height: 1.7;
}
.guide-step-text ul li + li { margin-top: 0.25rem; }
.guide-img {
    display: block;
    max-width: 95%;
    width: 100%;
    margin: 0.4rem auto;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: opacity 0.15s;
}
.guide-img:hover { opacity: 0.85; }
.guide-img + .guide-img { margin-top: 0.4rem; }
.guide-callout {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--color-primary-muted);
    border-left: 3px solid var(--color-primary);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    line-height: 1.6;
}
.guide-callout strong { color: var(--color-text); }

/* Collapsible section */
.guide-collapse {
    margin-top: 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-raised);
}
.guide-collapse summary {
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-weight: 500;
    color: var(--color-primary);
    list-style: none;
}
.guide-collapse summary::-webkit-details-marker { display: none; }
.guide-collapse summary::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 0.5rem;
    font-size: 0.7rem;
    transition: transform 0.2s;
}
.guide-collapse[open] summary::before { transform: rotate(90deg); }
.guide-collapse > .guide-step {
    padding: 0 1rem;
    margin-bottom: 1.25rem;
}
.guide-collapse > .guide-step:first-of-type { margin-top: 0.25rem; }
.guide-collapse > .guide-step:last-child { margin-bottom: 1rem; }

/* Lightbox */
.guide-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 2rem;
}
.guide-lightbox.open { display: flex; }

@media (max-width: 1300px) {
    .guide-toc { display: none; }
}
@media (max-width: 600px) {
    .guide-section { padding: 1rem 1.25rem; }
    .guide-img { max-width: 100%; }
    .guide-lightbox { padding: 1rem; }
}

/* ============================================
   Print / PDF styles
   ============================================ */
@media print {
    @page { size: A4; margin: 12mm 10mm; }

    :root {
        --color-bg: #ffffff;
        --color-surface: #ffffff;
        --color-surface-raised: #f3f4f6;
        --color-text: #1a1a2e;
        --color-text-secondary: #6b7280;
        --color-border: #e5e7eb;
        --color-primary: #d97706;
        --color-accent: #059669;
        --color-success: #059669;
        --color-danger: #dc2626;
        --shadow: none;
        --shadow-md: none;
        --shadow-glow: none;
    }

    body {
        background: #fff !important;
        color: #1a1a2e !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        font-size: 11pt;
    }

    /* Hide interactive / non-printable elements */
    header, footer,
    .skip-link,
    .no-print,
    .date-filter,
    .chart-toggle,
    .chart-toolbar,
    .chart-modal,
    .chart-wrapper > .chart-toolbar,
    .section-loading,
    .insight-loading,
    .loading-overlay,
    .placeholder-blur { display: none !important; }

    .report-evidence-details > summary { display: none !important; }

    /* Layout — full width, no padding waste */
    main { padding: 0; }
    .container, .container-wide { max-width: 100%; padding: 0 0.5rem; }
    .rapport-layout { display: block; }
    .rapport-sidebar { display: none !important; }
    .rapport-grid { display: block; }

    /* Cards & containers */
    .chart-container {
        background: #fff !important;
        border: 1px solid #e5e7eb;
        break-inside: avoid;
        page-break-inside: avoid;
        margin-bottom: 0.75rem;
        padding: 0.75rem;
    }
    .stat {
        background: #f9fafb !important;
        border: 1px solid #e5e7eb;
    }
    .stats {
        gap: 0.5rem;
    }

    /* Typography */
    h1 { font-size: 1.4rem; }
    h2 { font-size: 1.1rem; }
    h1, h2, h3, .stat-value, .stat-label, .stat-sub,
    p, td, th, .text-secondary, .text-sm {
        color: #1a1a2e !important;
    }
    .text-secondary, .stat-sub { color: #6b7280 !important; }
    .stat-value.primary, .stat-value.accent { color: #1a1a2e !important; }
    .stat-value.danger, .text-danger { color: #dc2626 !important; }
    .stat-value.success, .text-success { color: #059669 !important; }
    .stat-value.peak { color: #dc2626 !important; }

    /* Tables */
    table { font-size: 0.8rem; }
    .data-table, .data-table th, .data-table td { border-color: #e5e7eb; }
    .data-table th { background: #f3f4f6 !important; color: #374151 !important; }

    /* Plotly charts — full width, avoid breaks */
    .js-plotly-plot {
        break-inside: avoid;
        page-break-inside: avoid;
        width: 100% !important;
    }
    .js-plotly-plot .main-svg { width: 100% !important; }
    .chart-wrapper { width: 100%; }

    /* Cost section — stack waterfall and drivers vertically so nothing truncates */
    .cost-split {
        display: block !important;
        grid-template-columns: none !important;
    }
    .cost-split > div { margin-bottom: 0.75rem; }

    /* Cost drivers */
    .cost-driver-label, .cost-driver-amount, .cost-driver-tip { color: #1a1a2e !important; }
    .cost-driver-bar { background: #f3f4f6 !important; }

    /* Benchmark bars */
    .benchmark-bar-bg { background: #f3f4f6 !important; }
    .benchmark-bar-fill { opacity: 1 !important; }
    .benchmark-label, .benchmark-value { color: #1a1a2e !important; }

    /* Device cards */
    .device-grid { gap: 0.5rem; }
    .device-card { border-color: #e5e7eb; background: #f9fafb !important; }
    .device-name { color: #1a1a2e !important; }
    .device-watts, .device-hint { color: #6b7280 !important; }

    /* Battery section — details elements open for print */
    details { break-inside: avoid; }
    details[open] summary { margin-bottom: 0.25rem; }

    /* Page break hints */
    h2 { page-break-after: avoid; }
    .stats { page-break-inside: avoid; }

    /* Print header */
    h1::after {
        content: " — pieker.be";
        font-size: 0.6em;
        color: #6b7280;
        font-family: var(--font-body);
        font-weight: 400;
    }
}

/* ---- Touch devices ----
   Hover-revealed UI has no touch equivalent: keep the chart toolbar and the
   upload-card dismiss button visible (slightly dimmed), and let [data-tip]
   tooltips open on tap via :focus (a base.html handler focuses tapped tips). */
@media (hover: none) {
    .chart-toolbar {
        opacity: 0.75;
    }

    .chart-toolbar-visible {
        opacity: 1;
    }

    .upload-result-dismiss {
        opacity: 0.7;
    }

    [data-tip]:focus::after,
    [data-tip]:focus-within::after {
        opacity: 1;
    }

    [data-tip]:focus:not(:focus-visible) {
        outline: none;
    }
}

/* Comfortable tap targets on coarse pointers. Must stay after the
   max-width:640px block, which shrinks the toolbar buttons to 24px. */
@media (pointer: coarse) {
    .chart-toolbar button {
        width: 40px;
        height: 40px;
    }

    .chart-toolbar svg {
        width: 16px;
        height: 16px;
    }

    .upload-result-dismiss {
        width: 40px;
        height: 40px;
    }
}

/* ---- Paywall: locked section cards ---- */
.locked-card {
    position: relative;
    overflow: hidden;
    min-height: 280px;
    /* Fill the grid slot so a shorter locked card never leaves a dead gap
       under the CTA when it sits next to a taller unlocked sibling. */
    display: flex;
    flex-direction: column;
}
.locked-backdrop {
    position: absolute;
    inset: 0;
    padding: 1.5rem;
    filter: blur(7px);
    opacity: 0.4;
    pointer-events: none;
    user-select: none;
    /* Fade the decoration out toward the bottom so it never competes
       with the hook + CTA and never reads as a broken chart. */
    -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 55%, transparent 92%);
    mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 55%, transparent 92%);
}
.locked-fake-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.25rem;
}
.locked-fake-stat {
    flex: 1;
    height: 56px;
    border-radius: 8px;
    background: var(--color-surface-raised);
}
.locked-fake-chart {
    display: flex;
    align-items: flex-end;
    gap: 6px;
    height: 160px;
}
.locked-fake-chart > div {
    flex: 1;
    border-radius: 3px 3px 0 0;
    background: linear-gradient(180deg, var(--color-primary-muted), var(--color-surface-raised));
}
.locked-overlay {
    position: relative;
    z-index: 1;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 280px;
    padding: 1.75rem 1.5rem;
    gap: 0.45rem;
}
.locked-overlay h3 {
    margin: 0;
    font-size: 1.05rem;
    max-width: 38ch;
    text-wrap: balance;
}
.locked-lock {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    margin-bottom: 0.35rem;
}
.locked-hook {
    color: var(--color-text);
    font-weight: 600;
    font-size: 1.12rem;
    line-height: 1.5;
    max-width: 46ch;
    text-wrap: balance;
    margin: 0;
}
.locked-bullets {
    list-style: none;
    padding: 0;
    margin: 0.15rem 0 0.35rem;
    color: var(--color-text-secondary, #a1a1aa);
    font-size: 0.88rem;
    line-height: 1.6;
    max-width: 54ch;
}
.locked-bullets li { margin: 0.15rem 0; }
.locked-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.75rem;
}
.locked-cta .btn { max-width: 100%; }
.locked-cta-sub {
    font-size: 0.8rem;
    color: var(--color-text-secondary, #a1a1aa);
}
.insight-locked {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 1rem;
    padding: 0.6rem 0.85rem;
    border-radius: 8px;
    background: var(--color-surface-raised);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary, #a1a1aa);
    font-size: 0.85rem;
}
.insight-locked svg { flex-shrink: 0; color: var(--color-primary); }

/* ---- Checkout success page ---- */
.checkout-success {
    max-width: 560px;
    margin: 3rem auto;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}
.checkout-success h1 { font-size: 2rem; }
.checkout-success > p { color: var(--color-text-secondary); margin-bottom: 0.5rem; }
.checkout-success-icon {
    filter: drop-shadow(0 0 16px rgba(52, 211, 153, 0.3));
}
.checkout-email-note {
    display: grid;
    gap: 0.15rem;
    width: 100%;
    margin: 0.35rem 0 0.15rem;
    padding: 0.85rem 1rem;
    border: 1px solid rgba(52, 211, 153, 0.28);
    border-radius: var(--radius-sm);
    background: var(--color-accent-muted);
    color: var(--color-text-secondary);
    text-align: left;
    font-size: 0.9rem;
}
.checkout-email-note strong { color: var(--color-success); }
.restore-link-box {
    margin-top: 2rem;
    padding: 1.25rem;
    border-radius: 12px;
    background: linear-gradient(180deg, rgba(232, 168, 56, 0.05), transparent 60%), var(--color-surface);
    border: 1px solid rgba(232, 168, 56, 0.3);
    box-shadow: var(--shadow);
    text-align: left;
    width: 100%;
}
.restore-link-box h3 {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin: 0 0 0.35rem;
    font-size: 1rem;
}
.restore-link-box h3 svg { flex-shrink: 0; color: var(--color-primary); }
.restore-link-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.6rem;
}
.restore-link-row input {
    flex: 1;
    min-width: 0;
    padding: 0.5rem 0.65rem;
    border-radius: 8px;
    border: 1px solid var(--color-surface-raised);
    background: var(--color-surface-raised);
    color: var(--color-text);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.78rem;
}
@media (max-width: 480px) {
    #upload-results { grid-template-columns: minmax(0, 1fr); }
    .restore-link-row { flex-direction: column; }
    .restore-link-row .btn { width: 100%; }
}

/* ---- Landing page: pricing block ("Wat krijg je?") ---- */
.pricing {
    margin: 3.5rem 0;
    text-align: center;
}
.pricing h2 {
    margin-bottom: 0.5rem;
}
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    max-width: 760px;
    margin: 0 auto;
    text-align: left;
    align-items: stretch;
}
.pricing-col {
    padding: 1.5rem;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
}
.pricing-col h3 {
    margin: 0 0 0.25rem;
}
.pricing-col-paid {
    border-color: rgba(232, 168, 56, 0.4);
    background: linear-gradient(180deg, rgba(232, 168, 56, 0.07), transparent 45%), var(--color-surface);
    box-shadow: var(--shadow-md), 0 0 32px rgba(232, 168, 56, 0.07);
}
.pricing-price {
    font-size: 1.7rem;
    font-weight: 700;
    color: var(--color-text);
    letter-spacing: -0.01em;
    margin: 0 0 0.75rem;
}
.pricing-col-paid .pricing-price {
    color: var(--color-primary);
}
.pricing-price span {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--color-text-secondary);
}
.pricing-list {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem;
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    flex: 1;
}
.pricing-list li {
    padding-left: 1.3rem;
    position: relative;
    margin: 0.4rem 0;
}
.pricing-list li::before {
    content: "\2713";
    position: absolute;
    left: 0;
    color: var(--color-success);
    font-weight: 600;
}
.pricing-col .btn {
    align-self: flex-start;
}
.pricing-note {
    margin: 0;
}
@media (max-width: 640px) {
    .pricing-grid { grid-template-columns: 1fr; }
}

/* Inside a left-aligned opportunity-style card the CTA follows the card's
   own alignment instead of the centered locked-card layout. */
.opportunity-card .locked-cta {
    align-items: flex-start;
    margin-top: 1.1rem;
}
@media (max-width: 520px) {
    .opportunity-card .locked-cta { align-items: stretch; text-align: center; }
    .opportunity-card .locked-cta .btn { width: 100%; }
}

/* ---- Paywall: print / PDF degradation ----
   Locked cards collapse to a plain "this exists" note: no CTA buttons, no
   blurred decoration (toner), no lock chrome. The global print block already
   hides .placeholder-blur. */
@media print {
    .locked-backdrop,
    .locked-lock,
    .locked-cta,
    .insight-locked { display: none !important; }
    .locked-card {
        display: block;
        min-height: 0;
    }
    .locked-overlay {
        min-height: 0;
        padding: 0.25rem 0;
        gap: 0.2rem;
        align-items: flex-start;
        text-align: left;
    }
    .locked-bullets { color: #6b7280 !important; }
}

/* ---- Mobile overflow guards ---- */
/* Wide data tables (solar expansion, degradation) scroll inside their card
   instead of stretching the page on small screens. */
.table-scroll { overflow-x: auto; }
/* Decorative landing artwork is clipped locally so genuine 320px reflow
   defects remain observable instead of being hidden at the document root. */
.hero { overflow: clip; }

/* ---- Checkout status banner (rapport) ---- */
.checkout-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 1.25rem;
    font-size: 0.9rem;
    background: var(--color-surface);
    border: 1px solid var(--color-surface-raised);
}
.checkout-banner-fout { border-color: rgba(239, 68, 68, 0.45); }
.checkout-banner-verwerking { border-color: rgba(232, 168, 56, 0.45); }
.checkout-banner-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

/* ============================================
   Public acquisition and trust pages
   ============================================ */

/* Keyboard focus must remain visible on dark cards and primary buttons. */
:where(a, button, summary, input, select, textarea):focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 1000;
    padding: 0.65rem 0.9rem;
    border-radius: var(--radius-sm);
    background: var(--color-primary);
    color: #0c0e14;
    font-weight: 700;
    text-decoration: none;
    transform: translateY(-180%);
}

.skip-link:focus { transform: translateY(0); }

header nav .nav-primary-action {
    margin-left: 1.25rem;
    padding: 0.48rem 0.85rem;
    border: 1px solid rgba(232, 168, 56, 0.55);
    border-radius: 7px;
    color: var(--color-primary);
    background: var(--color-primary-muted);
}

header nav .nav-primary-action:hover,
header nav .nav-primary-action.active {
    color: #0c0e14;
    background: var(--color-primary);
}

.footer-grid {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(320px, 1.5fr);
    align-items: start;
    gap: 2rem;
    text-align: left;
}

.footer-grid p { margin-bottom: 0.35rem; }

.footer-links {
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.55rem 1.2rem;
}

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

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

.landing-hero {
    max-width: 850px;
    margin: 0 auto;
}

.landing-hero h1 {
    max-width: 820px;
    margin-left: auto;
    margin-right: auto;
    text-wrap: balance;
    white-space: normal;
    animation: none;
}

.landing-hero .subtitle {
    max-width: 720px;
    margin-bottom: 1.75rem;
    font-size: 1.18rem;
    animation: none;
}

.eyebrow {
    margin-bottom: 0.65rem;
    color: var(--color-primary);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.11em;
    line-height: 1.35;
    text-transform: uppercase;
}

.hero-actions {
    position: relative;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.hero-actions .btn { animation: none; }

.hero-note {
    position: relative;
    margin: 0.9rem auto 0;
    color: var(--color-text-secondary);
    font-size: 0.85rem;
}

.trust-strip {
    margin: 0 0 5rem;
    padding: 1.2rem 1.4rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: rgba(21, 24, 32, 0.72);
}

.trust-strip ul {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    list-style: none;
}

.trust-strip li {
    color: var(--color-text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.trust-strip strong {
    display: block;
    margin-bottom: 0.1rem;
    color: var(--color-text);
}

.trust-strip-static { margin: 3.5rem 0; }

.public-section { margin: 5.5rem 0; }

.section-heading {
    max-width: 700px;
    margin: 0 auto 1.8rem;
    text-align: center;
}

.section-heading h2 {
    margin-bottom: 0.75rem;
    font-size: clamp(1.55rem, 3vw, 2.1rem);
    text-wrap: balance;
}

.section-heading p:not(.eyebrow) {
    color: var(--color-text-secondary);
    font-size: 1.02rem;
}

.section-heading-left {
    margin-left: 0;
    text-align: left;
}

.data-comparison {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}

.data-comparison article {
    padding: 1.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}

.data-comparison .comparison-highlight {
    border-color: rgba(232, 168, 56, 0.45);
    background: linear-gradient(180deg, rgba(232, 168, 56, 0.08), transparent 58%), var(--color-surface);
}

.comparison-label,
.pricing-kicker,
.sample-label {
    margin-bottom: 0.25rem;
    color: var(--color-text-secondary);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.plain-list {
    margin: 0.7rem 0 0;
    padding-left: 1.2rem;
    color: var(--color-text-secondary);
}

.plain-list li + li { margin-top: 0.45rem; }
.plain-list strong { color: var(--color-text); }

.value-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.value-card {
    padding: 1.6rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
}

.value-number {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: var(--color-primary);
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 700;
}

.value-card p {
    margin-bottom: 0;
    color: var(--color-text-secondary);
    font-size: 0.92rem;
}

.process-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.9rem;
    margin: 0;
    list-style: none;
}

.process-grid li {
    display: grid;
    grid-template-columns: 2.3rem 1fr;
    gap: 0.9rem;
    padding: 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.process-grid li > span,
.timeline-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.3rem;
    height: 2.3rem;
    border-radius: 50%;
    background: var(--color-primary-muted);
    color: var(--color-primary);
    font-weight: 700;
}

.process-grid h3 { margin-bottom: 0.2rem; }

.process-grid p {
    margin: 0;
    color: var(--color-text-secondary);
    font-size: 0.88rem;
}

.section-link {
    margin: 1rem 0 0;
    text-align: center;
}

.example-panel,
.cta-panel,
.support-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 2rem;
    border: 1px solid rgba(232, 168, 56, 0.35);
    border-radius: var(--radius-lg);
    background: linear-gradient(110deg, rgba(232, 168, 56, 0.08), rgba(21, 24, 32, 0.96) 58%);
}

.example-panel > div,
.cta-panel > div,
.support-card > div { max-width: 650px; }

.example-panel h2,
.cta-panel h2 { font-size: clamp(1.4rem, 3vw, 1.8rem); }

.example-panel p:not(.eyebrow),
.cta-panel p:not(.eyebrow),
.support-card p {
    color: var(--color-text-secondary);
}

.example-panel p:last-child,
.cta-panel p:last-child,
.support-card p:last-child { margin-bottom: 0; }

.example-panel .example-disclaimer {
    font-size: 0.82rem;
}

.example-panel .btn,
.cta-panel .btn,
.support-card .btn { flex-shrink: 0; }

.pricing.public-section .pricing-grid { max-width: 860px; }
.pricing.public-section .pricing-col { padding: 1.7rem; }
.pricing.public-section .pricing-col h3 { min-height: 2.7rem; }
.pricing.public-section .pricing-price { margin-top: 0.4rem; }
.pricing.public-section .pricing-note {
    color: var(--color-text-secondary);
    font-size: 0.82rem;
    line-height: 1.5;
}

.cta-panel { margin: 5.5rem 0 1.5rem; }

/* Long-form public pages */
.public-page { max-width: 900px; margin: 0 auto; }

.public-intro {
    max-width: 780px;
    margin: 2.2rem 0 3rem;
}

.public-intro h1 {
    margin-bottom: 1rem;
    font-size: clamp(2rem, 5vw, 3rem);
    text-wrap: balance;
    overflow-wrap: anywhere;
}

.public-intro > p:not(.eyebrow):not(.updated-date) {
    color: var(--color-text-secondary);
    font-size: 1.12rem;
    line-height: 1.7;
}

.updated-date {
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

.timeline { position: relative; }

.timeline::before {
    content: '';
    position: absolute;
    top: 1.15rem;
    bottom: 1.15rem;
    left: 1.15rem;
    width: 1px;
    background: var(--color-border);
}

.timeline-item {
    position: relative;
    display: grid;
    grid-template-columns: 2.3rem 1fr;
    gap: 1.25rem;
    padding-bottom: 2.5rem;
}

.timeline-number { z-index: 1; background: var(--color-surface-raised); border: 1px solid rgba(232, 168, 56, 0.4); }
.timeline-item h2 { font-size: 1.4rem; }
.timeline-item p { color: var(--color-text-secondary); }
.timeline-item .eyebrow { margin-bottom: 0.2rem; font-size: 0.7rem; }
.timeline-item .plain-list { margin-bottom: 1rem; }
.support-card { margin: 1.5rem 0 4rem; }

.on-page-nav {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 1rem;
    margin: 0 0 2rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text-secondary);
    font-size: 0.82rem;
}

.on-page-nav strong { color: var(--color-text); }
.on-page-nav a { text-decoration: none; }

.method-section {
    display: grid;
    grid-template-columns: 145px minmax(0, 1fr);
    gap: 1.5rem;
    padding: 2.4rem 0;
    border-top: 1px solid var(--color-border);
    scroll-margin-top: 6rem;
}

.method-section h2 { font-size: 1.55rem; }
.method-section p { color: var(--color-text-secondary); }

.method-label {
    color: var(--color-primary);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.method-note {
    padding: 0.8rem 1rem;
    border-left: 3px solid var(--color-primary);
    background: var(--color-primary-muted);
    font-size: 0.88rem;
}

.method-assumption-card {
    margin: 1.2rem 0;
    padding: 1rem 1.1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.method-assumption-card h3 { margin-bottom: 0.55rem; font-size: 1.05rem; }
.method-assumption-card h4 { margin-bottom: 0.45rem; font-size: 0.88rem; }
.method-assumption-card code { white-space: normal; }
.method-assumption-card .method-note { margin-bottom: 0; }

.method-factor-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin: 1rem 0;
}

.method-factor-list { margin: 0; }
.method-factor-list div {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.8rem;
}
.method-factor-list dt { color: var(--color-text-secondary); }
.method-factor-list dd { margin: 0; color: var(--color-text); font-variant-numeric: tabular-nums; }

.method-section-warning { border-bottom: 1px solid var(--color-border); }

.confidence-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.65rem;
    margin: 1.2rem 0;
}

.confidence-grid article {
    padding: 0.9rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.confidence-grid strong,
.confidence-grid span { display: block; }
.confidence-grid strong { color: var(--color-primary); }
.confidence-grid span { margin-top: 0.2rem; color: var(--color-text-secondary); font-size: 0.78rem; }

.independence-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 3rem;
}

.independence-grid .card + .card { margin-top: 0; }
.independence-grid p { margin: 0; color: var(--color-text-secondary); }

/* Illustrative report */
.illustrative-notice {
    display: flex;
    gap: 0.45rem;
    flex-direction: column;
    margin-bottom: 1rem;
    padding: 1rem 1.2rem;
    border: 1px solid rgba(232, 168, 56, 0.45);
    border-radius: var(--radius-sm);
    background: var(--color-primary-muted);
}

.illustrative-notice span { color: var(--color-text-secondary); font-size: 0.88rem; }

.sample-report {
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

.sample-report-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.6rem;
    border-bottom: 1px solid var(--color-border);
}

.sample-report-header h2 { margin: 0; }

.decision-badge {
    flex-shrink: 0;
    padding: 0.45rem 0.75rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
}

.decision-negative {
    border: 1px solid rgba(248, 113, 113, 0.35);
    background: var(--color-danger-muted);
    color: var(--color-danger);
}

.sample-validation {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    border-bottom: 1px solid var(--color-border);
}

.sample-validation article { padding: 1.25rem; }
.sample-validation article + article { border-left: 1px solid var(--color-border); }
.sample-validation span,
.sample-validation strong,
.sample-validation small { display: block; }
.sample-validation span { color: var(--color-text-secondary); font-size: 0.75rem; }
.sample-validation strong { margin-top: 0.2rem; font-size: 1.1rem; }
.sample-validation small { color: var(--color-text-secondary); }

.sample-decision-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    padding: 1.5rem;
}

.sample-result {
    padding: 1.25rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-raised);
}

.sample-amount {
    margin-bottom: 0.45rem;
    color: var(--color-primary);
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 700;
}

.sample-amount span { color: var(--color-text-secondary); font-family: var(--font-body); font-size: 0.85rem; font-weight: 400; }
.sample-result p:last-child { margin: 0; color: var(--color-text-secondary); font-size: 0.86rem; }

.sample-conclusion { margin: 0 1.5rem 1.5rem; padding: 1.3rem; border-left: 3px solid var(--color-danger); background: var(--color-danger-muted); }
.sample-conclusion p:last-child { margin: 0; color: var(--color-text-secondary); }

.sample-assumptions { border-top: 1px solid var(--color-border); }
.sample-assumptions summary { padding: 1rem 1.5rem; color: var(--color-primary); cursor: pointer; }
.sample-assumptions[open] summary { border-bottom: 1px solid var(--color-border); }
.sample-assumptions .plain-list { margin: 0; padding: 1rem 3rem 1.2rem; }

.case-study-note {
    max-width: 760px;
    margin: 1rem auto 0;
    color: var(--color-text-secondary);
    font-size: 0.82rem;
    text-align: center;
}

/* Privacy and FAQ */
.privacy-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.7rem;
    margin-bottom: 2rem;
}

.privacy-summary article {
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface);
}

.privacy-summary strong,
.privacy-summary span { display: block; }
.privacy-summary strong { color: var(--color-primary); font-size: 0.88rem; }
.privacy-summary span { margin-top: 0.25rem; color: var(--color-text-secondary); font-size: 0.75rem; }

.privacy-section {
    padding: 1.8rem 0;
    border-top: 1px solid var(--color-border);
}

.privacy-section p { color: var(--color-text-secondary); }
.privacy-section p:last-child { margin-bottom: 0; }
.privacy-delete { padding: 1.5rem; border: 1px solid rgba(232, 168, 56, 0.35); border-radius: var(--radius); background: var(--color-primary-muted); }

.faq-section { margin-top: 4rem; }
.faq-section details { border-top: 1px solid var(--color-border); }
.faq-section details:last-child { border-bottom: 1px solid var(--color-border); }
.faq-section summary {
    position: relative;
    padding: 1.1rem 2.5rem 1.1rem 0;
    color: var(--color-text);
    font-weight: 600;
    cursor: pointer;
}
.faq-section summary::after { content: '+'; position: absolute; right: 0.4rem; color: var(--color-primary); font-size: 1.25rem; }
.faq-section details[open] summary::after { content: '−'; }
.faq-section details > div { max-width: 760px; padding: 0 2rem 1.2rem 0; color: var(--color-text-secondary); }
.faq-section details p:last-child { margin-bottom: 0; }

@media (max-width: 820px) {
    .trust-strip ul,
    .privacy-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .value-grid { grid-template-columns: 1fr; }
    .value-card { display: grid; grid-template-columns: 2rem 1fr; column-gap: 0.75rem; }
    .value-card .value-number { grid-row: 1 / span 2; margin: 0; }
    .value-card p { grid-column: 2; }
    .confidence-grid { grid-template-columns: 1fr; }
    .method-factor-grid { grid-template-columns: 1fr; }
    .sample-validation { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sample-validation article:nth-child(3) { border-left: 0; border-top: 1px solid var(--color-border); }
    .sample-validation article:nth-child(4) { border-top: 1px solid var(--color-border); }
}

@media (max-width: 700px) {
    header .container { gap: 0.65rem; }
    header nav .nav-secondary { display: none; }
    header nav .nav-primary-action { margin-left: 0; padding: 0.5rem 0.7rem; }
    .footer-grid { grid-template-columns: 1fr; gap: 1.25rem; }
    .footer-links { justify-content: flex-start; }
    .hero { padding-top: 3.4rem; }
    .landing-hero h1 { font-size: clamp(2.05rem, 10vw, 2.6rem); }
    .landing-hero .subtitle { font-size: 1.04rem; }
    .hero-actions { align-items: stretch; flex-direction: column; }
    .hero-actions .btn { width: 100%; }
    .trust-strip { margin-bottom: 4rem; }
    .trust-strip ul,
    .privacy-summary { grid-template-columns: 1fr; gap: 0.8rem; }
    .public-section { margin: 4.2rem 0; }
    .data-comparison,
    .process-grid,
    .independence-grid,
    .sample-decision-grid { grid-template-columns: 1fr; }
    .example-panel,
    .cta-panel,
    .support-card { align-items: stretch; flex-direction: column; gap: 1.3rem; padding: 1.4rem; }
    .example-panel .btn,
    .cta-panel .btn,
    .support-card .btn { width: 100%; }
    .pricing.public-section .pricing-col h3 { min-height: 0; }
    .public-intro { margin-top: 1.3rem; }
    .method-section { grid-template-columns: 1fr; gap: 0.45rem; padding: 1.8rem 0; }
    .method-label { margin-bottom: 0.2rem; }
    .on-page-nav strong { width: 100%; }
    .sample-report-header { align-items: flex-start; flex-direction: column; }
    .sample-conclusion { margin: 0 1rem 1rem; }
    .sample-decision-grid { padding: 1rem; }
}

@media (max-width: 430px) {
    .container { padding-left: 1rem; padding-right: 1rem; }
    .logo-icon { display: none; }
    .hero-note { max-width: 32ch; }
    .sample-validation { grid-template-columns: 1fr; }
    .sample-validation article + article { border-left: 0; border-top: 1px solid var(--color-border); }
    .sample-assumptions .plain-list { padding-left: 2.25rem; padding-right: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   Integrated accessibility and guide controls
   ============================================ */

.btn.btn-sm { min-height: 40px; }

header nav > a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
}

.mobile-nav { display: none; }

.mobile-nav summary {
    display: inline-flex;
    min-width: 44px;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    margin-left: 0.4rem;
    padding: 0 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    color: var(--color-text);
    background: var(--color-surface);
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
}

.mobile-nav-panel {
    position: absolute;
    top: calc(100% + 0.55rem);
    right: 0;
    z-index: 120;
    display: grid;
    min-width: min(17rem, calc(100vw - 2rem));
    overflow: hidden;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

header nav .mobile-nav-panel a {
    display: flex;
    min-height: 46px;
    align-items: center;
    margin: 0;
    padding: 0.7rem 1rem;
    border-bottom: 1px solid var(--color-border);
    color: var(--color-text);
}

header nav .mobile-nav-panel a:last-child { border-bottom: 0; }
header nav .mobile-nav-panel a[aria-current="page"] {
    color: var(--color-primary);
    background: var(--color-primary-muted);
}
header nav .mobile-nav-panel a::after { display: none; }

.guide-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 2rem;
    padding: 1.25rem 1.4rem;
    border: 1px solid rgba(232, 168, 56, 0.35);
    border-radius: var(--radius);
    background: var(--color-primary-muted);
}

.guide-summary h2 { margin-bottom: 0.45rem; }
.guide-checklist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.35rem;
    margin: 0;
    padding-left: 1.2rem;
    color: var(--color-text-secondary);
}

.guide-mobile-progress { display: none; }
.guide-img[role="button"] { cursor: zoom-in; }
.guide-img[role="button"]:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.guide-lightbox[hidden] { display: none; }
.guide-lightbox-panel {
    width: min(1100px, 100%);
    max-height: calc(100svh - 2rem);
    overflow: auto;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-surface);
    box-shadow: var(--shadow-md);
}

.guide-lightbox-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-surface);
}

.guide-lightbox-header h2 { margin: 0; font-size: 1rem; }
.guide-lightbox-close {
    min-width: 44px;
    min-height: 44px;
    border: 1px solid var(--color-border);
    border-radius: 50%;
    color: var(--color-text);
    background: var(--color-surface-raised);
    cursor: pointer;
    font-size: 1.5rem;
    line-height: 1;
}

.guide-lightbox-panel img {
    display: block;
    width: auto;
    max-width: 100%;
    max-height: none;
    margin: 0 auto;
    padding: 0.75rem;
    border-radius: var(--radius);
    object-fit: contain;
}

body.dialog-open { overflow: hidden; }

.restore-link-actions { margin-top: 0.55rem; }
.restore-link-actions .btn-link {
    min-height: 40px;
    padding: 0.35rem 0;
    border: 0;
    color: var(--color-primary);
    background: transparent;
    cursor: pointer;
    text-align: left;
}

@media (max-width: 700px) {
    header nav { position: relative; }
    header nav .nav-primary-action {
        max-width: 10.5rem;
        white-space: normal;
        text-align: center;
        line-height: 1.15;
    }
    .mobile-nav { display: block; }
    .guide-summary {
        align-items: stretch;
        flex-direction: column;
        gap: 1rem;
    }
    .guide-summary .btn { width: 100%; }
    .guide-mobile-progress {
        position: sticky;
        top: 4.6rem;
        z-index: 30;
        display: block;
        margin: 0 0 1rem;
        padding: 0.55rem 0.75rem;
        border: 1px solid var(--color-border);
        border-radius: var(--radius-sm);
        color: var(--color-text);
        background: rgba(21, 24, 32, 0.96);
        font-size: 0.82rem;
        font-weight: 600;
        backdrop-filter: blur(10px);
    }
}

@media (max-width: 370px) {
    header .logo-text { font-size: 0.96rem; }
    header nav .nav-primary-action { max-width: 8.3rem; font-size: 0.76rem; }
    .mobile-nav summary { padding: 0 0.55rem; font-size: 0.78rem; }
}
/* ---- Admin (founder-only /admin page) ---- */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.admin-two-col {
    display: grid;
    /* min(320px, 100%) so the 320px floor can't overflow narrow phones */
    grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* The generic .stat rules give tiles 3 and 4 a red accent bar (cost tiles on
   the rapport); here they are positive metrics (betaald, omzet). */
#admin-stats .stat:nth-child(3)::before,
#admin-stats .stat:nth-child(4)::before { background: var(--color-success); }

.admin-two-col .card { margin-top: 0; }

.admin-id {
    font-family: var(--font-mono, monospace);
    font-size: 0.8rem;
}

.admin-status.ok { color: var(--color-success); }
.admin-status.warn { color: var(--color-primary); }

.admin-promo {
    color: var(--color-text-secondary);
    font-size: 0.72rem;
    white-space: nowrap;
}

.admin-login-error {
    color: var(--color-danger);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.admin-muted { color: var(--color-text-secondary); font-weight: 400; }

.admin-header-actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

/* Page-wide test-data switch: styled anchor, server-side state, no JS. */
.admin-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--color-text-secondary);
    text-decoration: none;
    white-space: nowrap;
}

.admin-switch:hover { color: var(--color-text); text-decoration: none; }

.admin-switch-track {
    width: 34px;
    height: 18px;
    border-radius: 999px;
    border: 1px solid var(--color-border);
    background: var(--color-surface-raised);
    position: relative;
    transition: background 0.15s, border-color 0.15s;
}

.admin-switch-dot {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-text-secondary);
    transition: transform 0.15s, background 0.15s;
}

.admin-switch.on { color: var(--color-text); }
.admin-switch.on .admin-switch-track { background: rgba(232, 168, 56, 0.2); border-color: var(--color-primary); }
.admin-switch.on .admin-switch-dot { transform: translateX(16px); background: var(--color-primary); }

/* Uploaded files: one compact link + doc-type tag per file, always visible. */
.admin-files-cell { min-width: 16rem; }

.admin-file {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    white-space: nowrap;
}

.admin-file + .admin-file { margin-top: 0.3rem; }

.admin-file a {
    max-width: 22rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.admin-doc-tag {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    background: var(--color-surface-raised);
}

.admin-doc-tag.meter_data { color: #60a5fa; border-color: rgba(96, 165, 250, 0.35); }
.admin-doc-tag.energy_bill { color: #e8a838; border-color: rgba(232, 168, 56, 0.35); }
.admin-doc-tag.solar_production,
.admin-doc-tag.solar_specs { color: #34d399; border-color: rgba(52, 211, 153, 0.35); }
.admin-doc-tag.test { color: #e8a838; border-color: rgba(232, 168, 56, 0.5); text-transform: uppercase; }

/* Test-user toggle: dim outline pill, filled amber when the flag is on. */
.admin-test-toggle {
    padding: 0.1rem 0.55rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    border: 1px solid var(--color-border);
    background: transparent;
    color: var(--color-text-secondary);
    cursor: pointer;
    opacity: 0.55;
    transition: opacity 0.15s, border-color 0.15s, color 0.15s;
}

.admin-test-toggle:hover { opacity: 1; border-color: var(--color-primary); color: var(--color-primary); }

.admin-test-toggle.on {
    opacity: 1;
    background: rgba(232, 168, 56, 0.15);
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* Rows flagged as test fade into the background but stay operable. */
tr.row-test td { color: var(--color-text-secondary); }
tr.row-test td a { color: var(--color-text-secondary); }
tr.row-test { background: rgba(232, 168, 56, 0.03); }
