:root {
    /* --- JOUW KLEURENPALET  --- */
    --bg-main: #ffffff;
    --text-primary: #1a1a1a;
    --text-secondary: #888888;
    --border-color: #e5e5e5;
    --card-bg: #ffffff;
    
    --color-primary: #ff8b1a;   /* Donker oranje (Centrale verwarming) */
    --color-secondary: #ffce9e; /* Licht oranje (Warm water) */
    --color-import: #ef4444; /* Tailwind red-500 */
    --color-export: #22c55e; /* Tailwind green-500 */
    --color-solar: #eab308;  /* Tailwind yellow-500 */
    --color-ev: #c084fc;     /* Tailwind purple-400 */
    
    --toggle-bg: #f2f2f2;
    --toggle-active-bg: #ffffff;
    --toggle-active-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Basis Reset & Styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 400px; /* Simuleert een telefoonscherm */
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.icon-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-primary);
    cursor: pointer;
}

.info-btn {
    border: 1px solid var(--text-primary);
    border-radius: 50%;
    width: 24px;
    height: 24px;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.title-dropdown {
    font-weight: 500;
    font-size: 16px;
    border: 1px solid var(--border-color);
    padding: 8px 16px;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
/* Nieuwe scrolling voor Factuuroverzicht en KPI */
#billingSummarySection, #kpiSection {
    /* De 100px trekt de hoogte van de fixed bottom-nav en wat marge eraf */
    max-height: calc(100vh - 100px); 
    overflow-y: auto;
    /* Optioneel: verberg overflow-x om ongewenst horizontaal scrollen te voorkomen */
    overflow-x: hidden; 
}

/* Main Consumption */
.main-consumption {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 1px;
}

.total-number {
/* Adaptieve Euro-notatie specifiek voor het Grafiek tabblad */
    /* clamp(minimum_grootte, ideale_grootte_in_vw, maximum_grootte) */
    font-size: clamp(1.5rem, 6vw, 2.5rem) !important; 
    white-space: nowrap !important; /* Voorkomt afbreken naar een nieuwe regel */
    overflow: hidden;
    text-overflow: ellipsis; /* Zet puntjes aan het eind als het op extreem kleine schermen alsnog niet past */
}

.unit {
    font-size: 18px;
    font-weight: 500;
}

.period {
    color: var(--text-secondary);
    font-weight: 400;
}

/* Breakdown Card */
.breakdown-card {
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background-color: var(--card-bg);
    margin-bottom: 8px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 8px;
    font-size: 14px;
}

.border-bottom {
    border-bottom: 1px solid var(--border-color);
}

.label {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
}

.color-box {
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.color-primary { background-color: var(--color-primary); }
.color-secondary { background-color: var(--color-secondary); }

.value { color: var(--text-primary); }

/* Date Nav */
.date-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.circle-btn {
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.date-text {
    font-size: 18px;
    font-weight: 500;
}

/* Chart Area */
.chart-container {
    flex-grow: 1;
    min-height: 200px;
    max-height: 350px;
    margin-bottom: 10px;
}

.grid-line {
    position: absolute;
    width: calc(100% - 40px);
    border-bottom: 1px dashed var(--border-color);
    z-index: 1;
}

.y-axis {
    position: absolute;
    right: 0;
    height: 100%;
    width: 30px;
    color: var(--text-secondary);
    font-size: 12px;
}

.y-axis span {
    position: absolute;
    transform: translateY(50%);
}

.y-unit {
    right: 0;
    font-weight: 500;
}

.bars-wrapper {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    height: 100%;
    padding-right: 40px; /* Ruimte voor de Y-as */
    position: relative;
    z-index: 2;
}

.bar-group {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    width: 8px; /* Breedte van de staafjes */
    height: 100%;
}

.bar {
    width: 100%;
}

.bar.top {
    background-color: var(--color-secondary);
    border-radius: 4px 4px 0 0;
}

.bar.bottom {
    background-color: var(--color-primary);
    border-radius: 0 0 2px 2px;
}

/* Zorg dat een enkele onderste bar ook afgerond is aan de bovenkant */
.bar-group:has(.top[style*="height: 0%"]) .bottom {
    border-radius: 4px 4px 2px 2px;
}

.x-axis {
    display: flex;
    justify-content: space-between;
    padding-right: 40px;
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 12px;
}

/* Bottom Toggle */
.time-toggle {
    display: flex;
    background-color: var(--toggle-bg);
    border-radius: 20px;
    padding: 4px;
}

.toggle-btn {
    flex: 1;
    background: none;
    border: none;
    padding: 10px 0;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    border-radius: 16px;
    cursor: pointer;
}

.toggle-btn.active {
    background-color: var(--toggle-active-bg);
    box-shadow: var(--toggle-active-shadow);
}

/* --- AUTOMATISCH DARK THEME (Luistert naar je apparaat) --- */
@media (prefers-color-scheme: dark) {
    :root {
        /* Achtergronden en tekst */
        --bg-main: #121212;           /* Diep donkergrijs/zwart voor de hoofdachtergrond */
        --card-bg: #1e1e1e;            /* Iets lichter donkergrijs voor de kaarten/vlakken */
        --text-primary: #f5f5f5;       /* Bijna wit voor goede leesbaarheid */
        --text-secondary: #9aa0a6;   /* Zacht grijs voor secundaire tekst */  
        --border-color: #3c4043;     /* Subtiele donkere randen */    
        
        /* Grafiekkleuren: iets helderder gemaakt */
        --color-primary: #ff9d33;    /* Helder oranje */
        --color-secondary: #ffb870;  /* Zacht, licht oranje */
        
        /* Knoppen onderin */
        --toggle-bg: #202124;
        --toggle-active-bg: #3c4043;
        --toggle-active-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);
    }
}




/* --- NIEUW: Specifieke UI elementen voor de Grafiek Pagina --- */
        .header-ui { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
        .icon-btn-ui { background: none; border: none; font-size: 20px; color: #E2E8F0; cursor: pointer; padding: 5px; }
        .info-btn-ui { border: 1px solid #E2E8F0; border-radius: 50%; width: 24px; height: 24px; font-size: 14px; display: flex; align-items: center; justify-content: center; }
        .title-dropdown-ui { font-weight: 500; font-size: 15px; border: 1px solid #334155; padding: 8px 16px; border-radius: 20px; display: flex; align-items: center; gap: 8px; cursor: pointer; background: #1e293b; color: #E2E8F0; transition: background 0.2s;}
        .title-dropdown-ui:hover { background: #334155; }
        
        .main-consumption-ui { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 30px; }
        .total-number-ui { font-size: 56px; font-weight: 400; color: #E2E8F0; letter-spacing: -1px; margin: 0; line-height: 1; }
        .unit-ui { font-size: 16px; font-weight: 500; color: #E2E8F0; }
        
        .breakdown-card-ui { border: 1px solid #334155; border-radius: 12px; background-color: #1e293b; margin-bottom: 30px; overflow: hidden; }
        .breakdown-row-ui { display: flex; justify-content: space-between; padding: 16px; font-size: 14px; border-bottom: 1px solid #334155; }
        .breakdown-row-ui:last-child { border-bottom: none; }
        .label-ui { display: flex; align-items: center; gap: 12px; color: #94A3B8; }
        .color-box-ui { width: 12px; height: 12px; border-radius: 2px; }
        
        .date-nav-ui { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
        .circle-btn-ui { border: 1px solid #334155; border-radius: 50%; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: #1e293b; color: white; cursor: pointer; transition: background 0.2s;}
        .circle-btn-ui:hover { background: #334155; }
        .date-text-ui { font-size: 18px; font-weight: 500; color: #E2E8F0; text-transform: capitalize; }
        
        .time-toggle-ui { display: flex; background-color: #1e293b; border-radius: 20px; padding: 4px; margin-top: 20px; }
        .toggle-btn-ui { flex: 1; background: none; border: none; padding: 10px 0; font-size: 14px; font-weight: 500; color: #94A3B8; border-radius: 16px; cursor: pointer; transition: all 0.2s; }
        .toggle-btn-ui.active-btn { background-color: #3B82F6; color: white; box-shadow: 0 2px 5px rgba(0,0,0,0.2); }












/* --- EXTRA VARIABELEN VOOR HET STARTSCHERM --- */
:root {
    --bg-home: #f0ece3; /* De zachte beige kleur van het startscherm */
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-home: #121212; /* In donkere modus is dit gewoon donkergrijs */
    }
}

/* --- APP LAYOUT (Zorgt dat de navigatiebalk onderaan blijft) --- */
body {
    margin: 0;
    height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh; /* Neemt de hele hoogte van het scherm in */
    max-height: 850px;
    padding: 0; /* Padding verplaatst naar de schermen */
    position: relative;
    overflow: hidden;
}

.screen {
    display: none; /* Verbergt standaard alle schermen */
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: 30px; /* Extra ruimte voor de scroll */
}

.screen.active {
    display: block; /* Toont het actieve scherm */
}

/* --- STYLING STARTSCHERM --- */
.home-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
}

.pill-btn {
    background-color: var(--card-bg);
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.circle-btn-small {
    background-color: var(--card-bg);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-weight: bold;
    color: var(--text-primary);
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.temp-display {
    text-align: center;
    margin-bottom: 20px;
}

.main-temp {
    font-size: 72px;
    font-weight: 400;
    margin-bottom: 5px;
    letter-spacing: -2px;
}

.sub-status {
    font-size: 16px;
    font-weight: 500;
}

.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}

.house-placeholder {
    flex: 1;
    min-height: 250px; /* Dit is de ruimte waar het huis stond */
}

/* Apparaat Kaarten */
.device-cards {
    display: flex;
    gap: 12px;
    overflow-x: auto; /* Zorgt dat je horizontaal kunt scrollen als het er veel zijn */
    padding-bottom: 10px;
}

.device-card {
    background-color: var(--card-bg);
    min-width: 110px;
    padding: 16px;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}

.card-icon {
    font-size: 24px;
    margin-bottom: 10px;
}

.card-title {
    font-size: 14px;
    font-weight: 600;
}

.card-status {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
}

.check-icon {
    border: 1px solid var(--text-secondary);
    border-radius: 50%;
    width: 12px;
    height: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
    margin-right: 6px;
}

/* --- BOTTOM NAVIGATION --- */
.bottom-nav {
    display: flex;
    justify-content: space-around;
    background-color: var(--card-bg);
    padding: 12px 10px 25px 10px; /* Extra padding onder voor mobiele telefoons */
    border-top: 1px solid var(--border-color);
}

.nav-btn {
    background: none;
    border: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 10px;
    font-weight: 600;
}

.nav-icon {
    font-size: 22px;
}

.nav-btn.active {
    color: var(--text-primary);
}

/* Zorgt dat de emoji's ook grijs lijken als ze niet actief zijn (optioneel trucje) */
.nav-btn:not(.active) .nav-icon {
    opacity: 0.5;
    filter: grayscale(100%);
}




