:root {
    --bg: #f3f6f7;
    --card: #ffffff;
    --ink: #17212b;
    --muted: #687684;
    --line: #dfe7ea;
    --accent: #3f7895;
    --accent-dark: #2f5f79;
    --soft: #e9f2f7;
    --danger: #b42318;
    --warning: #a15c00;
    --success: #217a4b;
    --shadow: 0 12px 32px rgba(20, 40, 50, .07);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--ink); }
button, input, select { font: inherit; }
.topbar { height: 68px; padding: 0 max(24px, calc((100vw - 1380px)/2)); display: flex; align-items: center; justify-content: space-between; background: rgba(255,255,255,.96); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(12px); }
.topbar > div, .topbar-user { display: flex; align-items: center; gap: 12px; }
.container { width: min(1380px, calc(100% - 36px)); margin: 0 auto; padding: 34px 0 62px; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 8px 0 28px; }
h1 { margin: 2px 0 7px; font-size: clamp(32px, 4vw, 50px); letter-spacing: -.035em; }
h2 { margin: 2px 0; font-size: 21px; letter-spacing: -.015em; }
.eyebrow { margin: 0; color: var(--accent); text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 850; }
.muted, .chart-hint { color: var(--muted); }
.chart-hint { margin: 5px 0 0; font-size: 12px; }
.brand-mark { width: 48px; height: 48px; display: inline-flex; align-items: center; justify-content: center; border-radius: 14px; background: linear-gradient(145deg,var(--accent),var(--accent-dark)); color: white; font-weight: 900; letter-spacing: -.04em; box-shadow: 0 6px 14px rgba(63,120,149,.18); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 19px; box-shadow: var(--shadow); }
.filters { padding: 18px; display: grid; grid-template-columns: minmax(220px,1.4fr) 180px 180px auto; gap: 14px; align-items: end; }
label { display: grid; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 750; }
input, select { width: 100%; border: 1px solid var(--line); background: white; color: var(--ink); border-radius: 11px; min-height: 44px; padding: 9px 12px; outline: none; }
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.filter-actions { display: flex; flex-wrap: wrap; gap: 8px; }
button { border: 0; border-radius: 10px; padding: 11px 14px; cursor: pointer; font-weight: 800; }
button.primary { background: var(--accent); color: white; box-shadow: 0 5px 12px rgba(63,120,149,.16); }
button.primary:hover { background: var(--accent-dark); }
button.secondary { background: #edf2f4; color: var(--ink); }
button.secondary:hover { background: #e3ebee; }
.link-button { background: transparent; color: var(--accent); padding: 6px; }
.metric-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin: 18px 0; }
.metric-card { background: linear-gradient(145deg,#fff,#f9fbfc); border: 1px solid var(--line); border-radius: 19px; padding: 20px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; width: 70px; height: 70px; border-radius: 50%; background: var(--soft); right: -28px; top: -34px; opacity: .72; }
.metric-card span { display: block; color: var(--muted); font-size: 13px; font-weight: 750; }
.metric-card strong { display: inline-block; margin-top: 8px; font-size: 32px; letter-spacing: -.045em; }
.metric-card small { margin-left: 5px; color: var(--muted); }
.chart-grid { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(390px,1fr); gap: 18px; margin-bottom: 18px; align-items: stretch; }
.chart-card { padding: 20px; min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.period-total { font-size: 18px; color: var(--accent-dark); white-space: nowrap; }
.canvas-wrap { height: 430px; position: relative; }
.energy-canvas { min-height: 430px; }
.asset-canvas { min-height: 390px; transition: height .2s ease; }
.asset-kpis { display: grid; grid-template-columns: 1.35fr 1fr .7fr; gap: 8px; margin: 14px 0 12px; }
.asset-kpis > div { background: #f7fafb; border: 1px solid #e5ecef; border-radius: 12px; padding: 10px 11px; min-width: 0; }
.asset-kpis span { display: block; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 800; }
.asset-kpis strong { display: block; margin-top: 5px; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-pill { background: var(--soft); color: var(--accent-dark); border: 1px solid #bce3ea; padding: 9px 12px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap; }
.status-pill.stale { background: #fff2f0; color: var(--danger); border-color: #ffd0ca; }
.status-pill.idle { background: #f2f5f6; color: #5f6c76; border-color: #d9e1e4; }
.data-card { overflow: hidden; }
.data-card .card-head { padding: 20px 20px 10px; margin: 0; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 14px 18px; border-top: 1px solid var(--line); white-space: nowrap; font-size: 14px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
td small { display: block; color: var(--muted); margin-top: 3px; }
.state { display: inline-block; border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 800; }
.state.ok { background: #edf8f2; color: var(--success); }
.state.idle { background: #f2f5f6; color: #5f6c76; }
.state.warn { background: #fff6e8; color: var(--warning); }
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top right,#dff4f7,transparent 35%), var(--bg); }
.login-card { width: min(420px, 100%); background: white; border: 1px solid var(--line); border-radius: 24px; padding: 30px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 30px; }
.login-card form { display: grid; gap: 16px; margin-top: 24px; }
.alert { background: #fff2f0; border: 1px solid #ffd0ca; color: var(--danger); border-radius: 10px; padding: 10px 12px; margin-top: 16px; }
@media (max-width: 1100px) { .chart-grid { grid-template-columns: 1fr; } .asset-kpis { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 1000px) { .filters { grid-template-columns: 1fr 1fr; } .metric-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 650px) { .container { width: min(100% - 22px, 1380px); padding-top: 18px; } .hero { align-items: flex-start; flex-direction: column; } .filters { grid-template-columns: 1fr; } .metric-grid { grid-template-columns: 1fr 1fr; gap: 10px; } .metric-card { padding: 15px; } .metric-card strong { font-size: 25px; } .canvas-wrap { height: 350px; } .asset-kpis { grid-template-columns: 1fr; } .topbar-user > span { display: none; } .period-total { font-size: 16px; } }

/* v2.4 - kleurrijke assetverdeling + ranglijst */
.distribution-card { overflow: hidden; }
.donut-canvas { height: 335px; min-height: 335px; max-width: 430px; margin: 0 auto; }
.family-legend { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 16px; margin: 4px 0 0; color: var(--muted); font-size: 12px; font-weight: 750; }
.family-legend span { display: inline-flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 3px rgba(255,255,255,.95); }
.dot.east { background: #3b82f6; }
.dot.south { background: #f59e0b; }
.dot.other { background: #64748b; }
.donut-note { margin: 9px auto 0; max-width: 390px; color: var(--muted); font-size: 11px; line-height: 1.45; text-align: center; }
.ranking-wide { margin-bottom: 18px; }
.ranking-wide .asset-kpis { grid-template-columns: 1.4fr 1fr .7fr; max-width: 700px; }
.ranking-wide .asset-canvas { min-height: 390px; }
.asset-detail { padding: 9px 0 2px; }
.asset-detail-name { font-size: 25px; line-height: 1.15; font-weight: 850; letter-spacing: -.025em; margin: 8px 0 18px; }
.asset-detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.asset-detail-grid > div { min-width: 0; border: 1px solid #e4ebef; background: linear-gradient(145deg,#fbfcfd,#f6f9fa); border-radius: 14px; padding: 14px; }
.asset-detail-grid span { display: block; color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .055em; }
.asset-detail-grid strong { display: block; margin-top: 7px; font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
#donutView[hidden], #assetDetail[hidden] { display: none !important; }

@media (max-width: 1100px) {
    .donut-canvas { height: 360px; }
}
@media (max-width: 650px) {
    .donut-canvas { height: 310px; min-height: 310px; }
    .asset-detail-grid { grid-template-columns: 1fr; }
    .ranking-wide .asset-kpis { grid-template-columns: 1fr; }
}
