:root {
    --bg: #F8FAFC;
    --card: #FFFFFF;
    --primary: #4F46E5;
    --text-main: #1E293B;
    --text-muted: #64748B;
    --border: #E2E8F0;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

* { box-sizing: border-box; }

body {
    background-color: var(--bg);
    color: var(--text-main);
    font-family: 'Inter', sans-serif;
    margin: 0;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.dashboard-container {
    width: 98vw;
    height: 96vh;
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 15px;
}

/* HEADER */
.top-bar {
    background: var(--card);
    padding: 15px 25px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: var(--shadow);
    flex-shrink: 0;
    border: 1px solid var(--border);
}

.brand-box h1 { margin: 0; font-size: 1.2rem; font-weight: 700; color: var(--text-main); }
.date-picker input {
    margin-top: 5px;
    border: 1px solid var(--border);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.stats-hub { display: flex; gap: 30px; }
.stat-card { display: flex; flex-direction: column; align-items: flex-end; }
.stat-label { font-size: 0.65rem; font-weight: 600; color: var(--text-muted); letter-spacing: 0.5px; }
.stat-value { font-size: 1.1rem; font-weight: 700; }
.total .stat-value { color: var(--primary); font-size: 1.4rem; }
.previous { border-left: 1px solid var(--border); padding-left: 20px; opacity: 0.7; }

/* MAIN LAYOUT */
.main-layout {
    display: grid;
    grid-template-columns: 1fr 1.5fr 1fr;
    grid-template-rows: 1fr;
    gap: 15px;
    flex-grow: 1;
    min-height: 0;
}

.column { height: 100%; min-height: 0; }

.card {
    background: var(--card);
    height: 100%;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}

.card-header {
    /* 1. Basis styling */
    background: #F9FAFB;
    border-bottom: 1px solid var(--border);
    padding: 10px 18px; /* Weer terug naar padding voor de 'look' */
    
    /* 2. De 'Waterpas': dwing alles op één lijn */
    display: flex;
    align-items: center;
    justify-content: space-between;
    
    /* 3. Hoogte fix: zorg dat ze minimaal de ruimte van de knop pakken */
    min-height: 52px; 
    box-sizing: border-box;
}

/* Zorg dat de tekst in de header zich overal hetzelfde gedraagt */
.card-header span {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.5px;
    line-height: 1.2; /* Dwing een vaste teksthoogte af */
    margin: 0;
    display: block;
}

/* De knoppen-container mag de hoogte niet beïnvloeden */
.header-btns {
    display: flex;
    align-items: center;
    height: 28px; /* Match de hoogte van je .btn-add-small */
}

.card-body { flex-grow: 1; overflow: hidden; position: relative; }

/* VIEWER */
.viewer-content { display: flex; justify-content: center; align-items: flex-start; overflow-y: auto; padding: 15px; }
#viewer-instructions { text-align: center; margin-top: 60px; color: var(--text-muted); }
#viewer-instructions .icon { font-size: 2.5rem; margin-bottom: 10px; opacity: 0.2; }
#receipt-img { max-width: 100%; height: auto; border-radius: 8px; box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1); }

/* CHART */
.chart-container { padding: 20px; }
.chart-wrapper { width: 100%; height: 100%; position: relative; }

/* LOG LIST */
.header-flex { display: flex; justify-content: space-between; align-items: center; }
.scrollable-log { overflow-y: auto; padding: 10px; }

.log-entry {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    margin-bottom: 6px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
}

/* Items MET scan */
.log-entry.has-receipt { cursor: pointer; }
.log-entry.has-receipt:hover { 
    background: #F1F5F9; 
    border-color: var(--border); 
    transform: translateX(4px); 
}
.log-entry.has-receipt .entry-store { color: var(--primary); }

/* Items ZONDER scan */
.log-entry.no-receipt { cursor: default; opacity: 0.6; }
.log-entry.no-receipt .entry-store::after {
    content: ' (geen scan)';
    font-size: 0.6rem;
    font-weight: 400;
    font-style: italic;
}

.entry-info { display: flex; flex-direction: column; }
.entry-store { font-weight: 600; font-size: 0.9rem; }
.entry-date { font-size: 0.7rem; color: var(--text-muted); }
.entry-price { font-weight: 700; font-size: 0.95rem; }

#reset-btn {
    display: none;
    background: var(--text-main);
    color: white;
    border: none;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 0.65rem;
    cursor: pointer;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 10px; }

/* RESPONSIVE */
@media (max-width: 1100px) {
    body { overflow-y: auto; height: auto; padding: 10px; }
    .dashboard-container { height: auto; width: 100%; }
    .top-bar { flex-direction: column; gap: 15px; text-align: center; }
    .main-layout { grid-template-columns: 1fr; }
    .column { height: 400px; }
}

/* ... hou je bestaande CSS en voeg dit toe ... */

.header-btns { display: flex; gap: 8px; align-items: center; }

.btn-add-small {
    background: var(--primary);
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.2s;
}

.btn-add-small:hover { transform: scale(1.1); background: #4338CA; }
.btn-close { background: #EF4444 !important; }

.scrollable-content { overflow-y: auto; height: 100%; padding: 10px; }

/* FORMULIER STYLING */
.form-content { padding: 25px; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.side-form { display: flex; flex-direction: column; gap: 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group label { font-size: 0.75rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.form-group input {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: inherit;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}
.form-group input:focus { border-color: var(--primary); }

.form-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 10px; }

.btn-save {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px;
    border-radius: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
}
.btn-save:hover { background: #4338CA; }

.btn-cancel {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 10px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
}

.btn-logout {
    text-decoration: none;
    font-size: 0.8rem;
    padding: 5px 12px;
    background-color: #ef4444; /* Rood */
    color: white;
    border-radius: 6px;
    font-weight: 600;
    transition: background 0.2s;
}

.btn-logout:hover {
    background-color: #dc2626;
}
