/* --------------------------------------------------------------
   Gasten-overzicht — Astridur & Jesse
   Palet: crème basis, donkergroen accent, bordeaux highlight
   -------------------------------------------------------------- */

:root {
    --bg: #fbf9f5;
    --surface: #ffffff;
    --surface-2: #f7f3ec;
    --border: #e8e1d4;
    --border-strong: #d4c9b5;
    --text: #1b1b1a;
    --text-dim: #6b6a65;
    --text-muted: #9a9790;
    --accent: #1e4d3e;
    --accent-2: #2a6b57;
    --accent-soft: #e2ede8;
    --bordeaux: #6b2633;
    --bordeaux-soft: #f1e2e5;
    --warn: #b45309;
    --warn-soft: #fef3c7;
    --error: #b42318;
    --error-soft: #fee4e2;
    --ok: #027a48;
    --ok-soft: #d1fadf;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow-sm: 0 1px 2px rgba(27, 27, 26, 0.04), 0 1px 1px rgba(27, 27, 26, 0.03);
    --shadow: 0 4px 14px rgba(27, 27, 26, 0.06), 0 1px 2px rgba(27, 27, 26, 0.04);
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
    --font-serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

/* ---------- Login ---------- */
.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background:
        radial-gradient(ellipse at top, #f0ebe0 0%, var(--bg) 60%),
        var(--bg);
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
    border: 1px solid var(--border);
}
.login-accent {
    height: 4px;
    background: linear-gradient(90deg, var(--accent) 0%, var(--bordeaux) 100%);
}
.login-body-inner { padding: 40px 36px 36px; }
.login-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 36px;
    letter-spacing: -0.02em;
    margin: 0;
}
.login-sub {
    color: var(--text-dim);
    margin: 4px 0 28px;
    font-size: 13px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.field-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 6px;
}
.input {
    display: block;
    width: 100%;
    padding: 12px 14px;
    font: inherit;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    transition: border-color .15s, box-shadow .15s;
}
.input:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-weight: 500;
    transition: background .15s, color .15s, border-color .15s, transform .05s;
    white-space: nowrap;
    font-size: 13px;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
    background: var(--accent);
    color: #fff;
    padding: 12px 18px;
    margin-top: 18px;
    width: 100%;
    justify-content: center;
}
.btn-primary:hover { background: var(--accent-2); }
.btn-outline {
    background: var(--surface);
    border: 1px solid var(--border-strong);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost {
    padding: 6px 10px;
    color: var(--text-dim);
    font-size: 12px;
}
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }

.alert {
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 13px;
}
.alert-error { background: var(--error-soft); color: var(--error); }
.alert-warn { background: var(--warn-soft); color: var(--warn); }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- App shell ---------- */
.app-shell {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #141613;
    color: #e9e7e0;
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}
.brand {
    display: flex;
    flex-direction: column;
    padding: 0 8px 28px;
    margin-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.brand-mark {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 400;
    letter-spacing: -0.01em;
    color: #fff;
}
.brand-amp { color: var(--bordeaux); font-style: italic; }
.brand-sub {
    margin-top: 2px;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.55);
}
.nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-top: 20px;
    flex: 1;
}
.nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    transition: background .12s, color .12s;
}
.nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-link.is-active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

.nav-icon {
    width: 16px;
    height: 16px;
    display: inline-block;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    flex-shrink: 0;
}
.nav-icon[data-icon="grid"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.6'%3E%3Crect x='3' y='3' width='7' height='7' rx='1'/%3E%3Crect x='14' y='3' width='7' height='7' rx='1'/%3E%3Crect x='3' y='14' width='7' height='7' rx='1'/%3E%3Crect x='14' y='14' width='7' height='7' rx='1'/%3E%3C/svg%3E"); }
.nav-icon[data-icon="sun"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.6'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41'/%3E%3C/svg%3E"); }
.nav-icon[data-icon="moon"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.6'%3E%3Cpath d='M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z'/%3E%3C/svg%3E"); }
.nav-icon[data-icon="layers"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.6'%3E%3Cpath d='M12 2 2 7l10 5 10-5-10-5zM2 17l10 5 10-5M2 12l10 5 10-5'/%3E%3C/svg%3E"); }
.nav-icon[data-icon="chef"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.6'%3E%3Cpath d='M6 14a4 4 0 0 1-1-7.87A4.5 4.5 0 0 1 12 3a4.5 4.5 0 0 1 7 3.13A4 4 0 0 1 18 14v6H6v-6z'/%3E%3Cpath d='M6 17h12'/%3E%3C/svg%3E"); }
.nav-icon[data-icon="chat"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.6'%3E%3Cpath d='M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2z'/%3E%3C/svg%3E"); }
.nav-icon[data-icon="refresh"] { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='1.8'%3E%3Cpath d='M21 12a9 9 0 1 1-3-6.7L21 8'/%3E%3Cpath d='M21 3v5h-5'/%3E%3C/svg%3E"); }

.sidebar-foot {
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.sync-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
}
.sync-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(2, 122, 72, 0.2);
    flex-shrink: 0;
}
.sync-dot.warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(180, 83, 9, 0.22); }
.sync-label {
    font-size: 10px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
}
.sync-time { font-size: 12px; color: #fff; }
.sidebar-actions {
    display: flex;
    gap: 4px;
    margin-top: 4px;
    padding-left: 4px;
}
.sidebar-actions .btn-ghost { color: rgba(255, 255, 255, 0.65); }
.sidebar-actions .btn-ghost:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }

/* ---------- Main ---------- */
.main {
    padding: 28px 40px 60px;
    max-width: 1500px;
    min-width: 0;
}
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    margin-bottom: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border);
}
.page-kicker {
    margin: 0 0 4px;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
}
.page-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 38px;
    letter-spacing: -0.025em;
    margin: 0;
    line-height: 1.05;
}
.header-actions { display: flex; gap: 10px; }
.header-actions .nav-icon { color: currentColor; filter: none; }

/* ---------- Mobile toggle ---------- */
.mobile-toggle { display: none; }

/* ---------- Cards & stats ---------- */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
}
.stat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--accent);
}
.stat-card.is-bordeaux::before { background: var(--bordeaux); }
.stat-card.is-muted::before { background: var(--border-strong); }
.stat-label {
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.stat-value {
    font-family: var(--font-serif);
    font-size: 40px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: -0.02em;
}
.stat-hint {
    font-size: 12px;
    color: var(--text-dim);
    margin-top: 6px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 22px 24px;
    margin-bottom: 20px;
}
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 16px;
    gap: 12px;
}
.card-title {
    font-family: var(--font-serif);
    font-size: 22px;
    font-weight: 400;
    margin: 0;
    letter-spacing: -0.015em;
}
.card-sub {
    font-size: 12px;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Bars */
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
}
.bar-label {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    grid-column: 1 / -1;
}
.bar-label .bar-count { color: var(--text-dim); }
.bar-track {
    grid-column: 1 / -1;
    height: 8px;
    background: var(--surface-2);
    border-radius: 99px;
    overflow: hidden;
}
.bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 99px;
    transition: width .3s ease;
}
.bar-fill.is-bordeaux { background: var(--bordeaux); }
.bar-fill.is-soft { background: var(--border-strong); }

.recent-list { display: flex; flex-direction: column; }
.recent-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}
.recent-item:last-child { border-bottom: 0; }
.recent-name { font-weight: 500; }
.recent-meta { font-size: 12px; color: var(--text-dim); }
.recent-date { font-size: 12px; color: var(--text-muted); white-space: nowrap; }

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 10px;
    border-radius: 99px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.02em;
    white-space: nowrap;
    line-height: 1.6;
}
.badge-ok { background: var(--ok-soft); color: var(--ok); }
.badge-no { background: var(--error-soft); color: var(--error); }
.badge-dag { background: var(--accent-soft); color: var(--accent); }
.badge-avond { background: #e4ecf7; color: #1d4ed8; }
.badge-plus { background: var(--surface-2); color: var(--text-dim); }
.badge-dieet { background: var(--bordeaux-soft); color: var(--bordeaux); }

/* ---------- Filter bar ---------- */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 14px;
}
.filter-tabs {
    display: inline-flex;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}
.filter-tab {
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-dim);
    transition: background .12s, color .12s;
}
.filter-tab.is-active {
    background: var(--accent);
    color: #fff;
}
.filter-tab:not(.is-active):hover { color: var(--text); }

.filter-select,
.filter-search {
    padding: 8px 12px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    background: var(--surface);
    font: inherit;
    font-size: 13px;
    min-width: 160px;
}
.filter-search { min-width: 220px; }
.filter-search:focus,
.filter-select:focus {
    outline: 0;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

.toggle-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text-dim);
    cursor: pointer;
}
.toggle-wrap input { accent-color: var(--accent); }

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 6px;
    overflow: hidden;
}

/* ---------- Tabulator overrides ---------- */
.tabulator {
    border: 0 !important;
    background: transparent !important;
    font-family: var(--font-sans);
    font-size: 13px;
}
.tabulator .tabulator-header {
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid var(--border) !important;
    font-weight: 500;
}
.tabulator .tabulator-col {
    background: transparent !important;
    border-right: 0 !important;
}
.tabulator .tabulator-col-title {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 500;
}
.tabulator-row {
    background: transparent !important;
    border-bottom: 1px solid var(--border) !important;
}
.tabulator-row.tabulator-row-even {
    background: rgba(247, 243, 236, 0.5) !important;
}
.tabulator-row:hover { background: var(--surface-2) !important; }
.tabulator-row .tabulator-cell {
    border-right: 0 !important;
    padding: 12px 14px !important;
}
.tabulator .tabulator-footer {
    background: transparent !important;
    border: 0 !important;
    border-top: 1px solid var(--border) !important;
    color: var(--text-dim);
}
.tabulator-row.tabulator-group {
    background: var(--surface-2) !important;
    border: 0 !important;
    padding: 10px 14px !important;
    font-weight: 500;
    color: var(--accent);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-dim);
}
.empty-state h3 {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 22px;
    margin: 0 0 6px;
    color: var(--text);
}

/* ---------- Opmerkingen cards ---------- */
.opmerking-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 14px;
}
.opmerking-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 18px 20px;
}
.opmerking-card header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.opmerking-name { font-weight: 500; }
.opmerking-text {
    margin: 8px 0 0;
    color: var(--text);
    font-size: 13px;
}
.opmerking-dieet {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--border);
    font-size: 12px;
    color: var(--bordeaux);
}
.opmerking-dieet strong { color: var(--bordeaux); font-weight: 500; }

.section-heading {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: 26px;
    letter-spacing: -0.015em;
    margin: 30px 0 14px;
}
.section-heading:first-child { margin-top: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: -260px;
        top: 0;
        width: 240px;
        z-index: 50;
        transition: left .25s ease;
        box-shadow: 2px 0 20px rgba(0, 0, 0, 0.2);
    }
    .sidebar.is-open { left: 0; }
    .mobile-toggle {
        display: flex;
        position: fixed;
        top: 16px;
        right: 16px;
        width: 40px;
        height: 40px;
        background: var(--surface);
        border: 1px solid var(--border-strong);
        border-radius: var(--radius-sm);
        z-index: 40;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 4px;
        box-shadow: var(--shadow-sm);
    }
    .mobile-toggle span {
        display: block;
        width: 18px;
        height: 2px;
        background: var(--text);
    }
    .main {
        padding: 20px 16px 60px;
    }
    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding-right: 52px; /* ruimte voor hamburger */
    }
    .mobile-toggle {
        background: rgba(255, 255, 255, 0.92);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
    }
    .page-title { font-size: 28px; }
    .two-col { grid-template-columns: 1fr; }
    .card {
        padding: 18px 18px;
    }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }
    .card-title { font-size: 20px; }
    .card-sub { font-size: 11px; }
    .stat-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 10px;
    }
    .stat-card { padding: 14px 16px; }
    .stat-value { font-size: 32px; }
    .recent-item {
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        row-gap: 4px;
        padding: 12px 0;
    }
    .recent-item .badge {
        grid-row: 1;
        grid-column: 1;
    }
    .recent-item > div:nth-of-type(1) {
        grid-row: 1;
        grid-column: 2;
        min-width: 0;
    }
    .recent-item .recent-date {
        grid-row: 2;
        grid-column: 1 / -1;
        white-space: normal;
        font-size: 11px;
        color: var(--text-muted);
        padding-left: 2px;
    }
    .recent-name { word-break: break-word; }
    .recent-meta { word-break: break-word; }
    .filter-bar {
        gap: 8px;
    }
    .filter-bar .filter-tabs {
        width: 100%;
        overflow-x: auto;
        flex-wrap: nowrap;
    }
    .filter-tab { flex-shrink: 0; }
    .filter-select,
    .filter-search {
        width: 100%;
        min-width: 0;
    }
    .opmerking-grid { grid-template-columns: 1fr; }
    .section-heading { font-size: 22px; }
    .page-kicker { font-size: 10px; }
    .header-actions { width: 100%; }
    .header-actions .btn { flex: 1; justify-content: center; }
}

@media (max-width: 480px) {
    .main { padding: 18px 12px 60px; }
    .card { padding: 16px 14px; }
    .page-title { font-size: 26px; }
    .stat-value { font-size: 28px; }
    .stat-card { padding: 12px 14px; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}
