/* === RESET & BASE === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 16px;
    color: #333;
    background: #f5f5f5;
    line-height: 1.4;
}

/* === NAVBAR === */
.navbar {
    background: #2c3e50;
    color: #fff;
    padding: 0.5rem 1rem;
    /* iOS PWA: respecteer notch / dynamic island / statusbar */
    padding-top: calc(0.5rem + env(safe-area-inset-top));
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.navbar-brand a { color: #fff; text-decoration: none; font-weight: bold; font-size: 1.1rem; }
.navbar-menu { display: flex; align-items: center; gap: 1rem; }
.navbar-user { color: #bdc3c7; }

/* === CONTAINER === */
.container {
    max-width: 1600px;
    margin: 0;
    padding: 1rem;
    /* iOS PWA: respecteer landscape-notch */
    padding-left: calc(1rem + env(safe-area-inset-left));
    padding-right: calc(1rem + env(safe-area-inset-right));
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}

/* === ALERTS === */
.alert { padding: 0.75rem 1rem; border-radius: 4px; margin-bottom: 1rem; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }

/* === BUTTONS === */
.btn {
    display: inline-block; padding: 0.5rem 1rem; border: none; border-radius: 4px;
    cursor: pointer; text-decoration: none; font-size: 0.875rem; color: #fff;
    background: #6c757d; transition: opacity 0.2s;
}
.btn:hover { opacity: 0.85; }
.btn-primary { background: #2c3e50; }
.btn-secondary { background: #7f8c8d; }
.btn-danger { background: #c0392b; }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

.inline-form { display: inline; }

/* === AUTH FORM === */
.auth-form { max-width: 400px; margin: 3rem auto; background: #fff; padding: 2rem; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,0.1); }
.auth-form h2 { margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: 0.25rem; font-weight: 500; }
.form-group input { width: 100%; padding: 0.5rem; border: 1px solid #ccc; border-radius: 4px; font-size: 0.95rem; }
.auth-link { margin-top: 1rem; text-align: center; color: #666; }
.auth-link a { color: #2c3e50; }

/* === DASHBOARD === */
.dashboard-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.data-table { width: 100%; border-collapse: collapse; background: #fff; border-radius: 4px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.data-table th, .data-table td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid #eee; }
.data-table th { background: #f8f9fa; font-weight: 600; }
.data-table .actions { display: flex; gap: 0.25rem; }
.empty-state { text-align: center; padding: 3rem; color: #999; }

/* === CHART === */
.chart-container {
    background: #fff;
    border-radius: 6px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    height: 350px;
}

/* === SPREADSHEET LAYOUT === */
.snapshot-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }
.snapshot-nav { display: flex; align-items: center; gap: 1rem; }
.snapshot-nav h2 { margin: 0; white-space: nowrap; }
.snapshot-actions { display: flex; gap: 0.5rem; align-items: center; }

.spreadsheet-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto;
    gap: 1.5rem;
}
.column-prive { grid-column: 1; grid-row: 1; }
.column-zakelijk { grid-column: 2; grid-row: 1 / 3; }
.column-totals { grid-column: 1; grid-row: 2; margin-top: 1rem; }

@media (max-width: 1200px) {
    .spreadsheet-columns { grid-template-columns: 1fr; }
    .column-prive { grid-column: 1; grid-row: 1; }
    .column-zakelijk { grid-column: 1; grid-row: 2; }
    .column-totals { grid-column: 1; grid-row: 3; margin-top: 0; }
}

.column-prive, .column-zakelijk, .column-totals {
    background: #fff;
    border-radius: 6px;
    padding: 1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.section-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #2c3e50;
}

/* === FINANCE TABLES === */
.finance-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.95rem;
}
.finance-table th, .finance-table td {
    padding: 0.3rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    white-space: nowrap;
}
.finance-table th {
    background: #f8f9fa;
    font-weight: 600;
    font-size: 0.85rem;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.finance-table h4 { margin: 0.75rem 0 0.25rem; }

h4 { margin: 1rem 0 0.5rem; color: #2c3e50; font-size: 0.95rem; }

.amount { text-align: right; font-variant-numeric: tabular-nums; }

/* === COLUMN WIDTH CLASSES === */
.col-label { text-align: left; }
.col-amount { text-align: right; width: 90px; }
.col-input { text-align: right; width: 100px; }
.col-input-sm { text-align: right; width: 60px; }
.col-pct { text-align: right; width: 50px; }
.col-date { text-align: left; width: 100px; }

/* === INPUT FIELDS (lichtgrijs zoals Excel) === */
.input-field {
    background: #f0f0f0;
    border: 1px solid #ccc;
    padding: 0.2rem 0.4rem;
    text-align: right;
    font-size: 0.95rem;
    font-family: inherit;
    width: 110px;
    border-radius: 2px;
    font-variant-numeric: tabular-nums;
    -moz-appearance: textfield;
}
.input-field::-webkit-outer-spin-button,
.input-field::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}
.input-field:focus {
    outline: none;
    border-color: #2c3e50;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(44, 62, 80, 0.15);
}
.input-sm { max-width: 60px; }
.input-label { text-align: left; width: 180px; font-size: 0.85rem; font-weight: normal; vertical-align: middle; }
input[type="date"].input-field { text-align: left; }

/* === LOCKED FIELDS (expired snapshots) === */
.input-field.field-locked {
    background: #e9ecef;
    color: #999;
    cursor: not-allowed;
    border-color: #ddd;
}
.btn-warning { background: #e67e22; color: #fff; }
.btn-warning:hover { background: #d35400; }

/* === CALCULATED FIELDS === */
.calc-field {
    font-weight: 600;
    color: #2c3e50;
}

/* === TOTALS ROW === */
.totals-row {
    background: #f8f9fa;
    border-top: 2px solid #dee2e6;
}
.totals-row td { font-weight: 600; }

/* === HIGHLIGHTS === */
.highlight { color: #e67e22; font-weight: 700; }
.highlight-green { color: #27ae60; font-weight: 700; }
.highlight-blue { color: #2980b9; font-weight: 700; }

/* === PREVIOUS / DIFF COLUMNS === */
.col-prev, .col-diff { width: 80px; }
.prev-value { color: #999; font-size: 0.85rem; }
.prev-row td { border-bottom: none; padding-top: 0; font-size: 0.8rem; }
.prev-label { color: #999; font-style: italic; font-size: 0.8rem; }
.diff-value { font-size: 0.85rem; }
.diff-pos { color: #27ae60; }
.diff-neg { color: #c0392b; }

/* === BADGES === */
.factor-badge {
    background: #e8daef;
    color: #6c3483;
    padding: 0.1rem 0.3rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.25rem;
}

.label-sm { font-size: 0.75rem; color: #999; text-align: right; }

/* === TOTALS SECTION === */
.totals-section {
    padding: 0;
    margin-top: 1.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.totals-table { max-width: 600px; }

/* === SUMMARY TABLE === */
.summary-table { margin-top: 0.5rem; }

/* === SAVE INDICATOR === */
.save-indicator {
    position: fixed;
    top: 0.5rem;
    right: 1rem;
    background: #27ae60;
    color: #fff;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
    font-size: 0.8rem;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 1000;
}
.save-indicator.visible { opacity: 1; }
.save-indicator.error { background: #c0392b; }

/* === CALC FIELDS CLICKABLE === */
.calc-field[data-calc] { cursor: pointer; }
.calc-field[data-calc]:hover { text-decoration: underline; }

/* === SOURCE HIGHLIGHTING === */
.source-highlight {
    background-color: #fff3cd !important;
    box-shadow: 0 0 0 2px #ffc107;
    border-radius: 2px;
}
td.source-highlight { background-color: #fff3cd !important; }
input.source-highlight { background-color: #fff3cd !important; border-color: #ffc107 !important; }

/* === CALCULATION MODAL (draggable) === */
.calc-modal {
    position: fixed;
    top: 100px;
    left: 100px;
    min-width: 280px;
    max-width: 450px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
    z-index: 2000;
    font-size: 0.9rem;
}
.calc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 1rem;
    background: #2c3e50;
    color: #fff;
    border-radius: 8px 8px 0 0;
    cursor: move;
    user-select: none;
}
.calc-modal-header span { font-weight: 600; }
#calc-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.3rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
}
#calc-modal-close:hover { opacity: 0.7; }
.calc-modal-body {
    padding: 1rem;
}
.calc-modal-body .calc-line {
    padding: 0.15rem 0;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.calc-modal-body .calc-line:last-child {
    font-weight: 700;
    border-top: 1px solid #dee2e6;
    margin-top: 0.3rem;
    padding-top: 0.4rem;
}

/* === NAVBAR LINKS === */
.navbar-link {
    color: #ecf0f1;
    text-decoration: none;
    padding: 0.4rem 0.6rem;
    border-radius: 4px;
    font-size: 0.9rem;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.navbar-link:hover { background: rgba(255,255,255,0.1); }

/* === FIXED EXPENSES (mobile-first) === */
.fl-page { padding-bottom: 5rem; }

.fl-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.fl-header-titles h2 { margin: 0; font-size: 1.4rem; }
.fl-history-link {
    display: inline-block;
    margin-top: 0.25rem;
    color: #2c3e50;
    text-decoration: none;
    font-size: 0.85rem;
}
.fl-history-link:hover { text-decoration: underline; }

/* "+ Toevoegen"-knop in header: verberg op mobiel (FAB doet dit), toon op desktop */
.fl-add-btn { display: none; min-height: 44px; }

.fl-summary {
    background: #fff;
    border-radius: 8px;
    padding: 1rem 1.25rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    margin-bottom: 1.25rem;
}
.fl-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.25rem 0;
}
.fl-summary-label { color: #555; font-size: 0.95rem; }
.fl-summary-value {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: #2c3e50;
}
.fl-summary-value-big {
    font-size: 1.75rem;
    font-weight: 700;
}
.fl-summary-secondary { font-size: 0.9rem; color: #666; padding-top: 0; border-top: 1px dashed #eee; margin-top: 0.4rem; padding-top: 0.4rem; }
.fl-summary-secondary .fl-summary-value { font-size: 0.95rem; font-weight: 500; }

.fl-empty {
    background: #fff;
    border-radius: 8px;
    padding: 2rem 1rem;
    text-align: center;
    color: #888;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.fl-empty p { margin-bottom: 1rem; }

.fl-cards { display: flex; flex-direction: column; gap: 0.6rem; }

.fl-category-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #888;
    margin: 0 0 0.4rem 0.25rem;
    font-weight: 600;
}

/* === CATEGORIE-SAMENVATTING (collapsible <details>) === */
.fl-cat-section {
    background: #eaf3fb;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    overflow: hidden;
}
.fl-cat-summary {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    min-height: 56px;
}
.fl-cat-summary::-webkit-details-marker { display: none; }
.fl-cat-summary::marker { display: none; }
.fl-cat-chevron {
    color: #888;
    font-size: 0.95rem;
    transition: transform 0.18s ease;
    width: 14px;
    flex-shrink: 0;
    text-align: center;
}
.fl-cat-section[open] .fl-cat-chevron { transform: rotate(90deg); }

.fl-cat-name {
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
    font-size: 1rem;
}
.fl-cat-meta {
    color: #888;
    font-size: 0.75rem;
    background: #ecf0f1;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-variant-numeric: tabular-nums;
}
.fl-cat-total {
    font-weight: 700;
    color: #2c3e50;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-size: 1rem;
}
.fl-cat-total small {
    font-weight: 500;
    color: #888;
    font-size: 0.75rem;
    margin-left: 0.15rem;
}

.fl-cat-items {
    padding: 0.4rem 0.5rem 0.6rem;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.fl-cat-items .fl-card {
    margin: 0;
    box-shadow: none;
    border: 1px solid #ececec;
    background: #fff;
}

.fl-card {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}
.fl-card.fl-inactive { opacity: 0.55; }

.fl-card-main {
    flex: 1;
    background: none;
    border: none;
    text-align: left;
    padding: 0.85rem 0.9rem;
    cursor: pointer;
    font: inherit;
    color: inherit;
    min-height: 60px;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.fl-card-main:hover { background: #f8f9fa; }
.fl-card-main:focus { outline: 2px solid #2c3e50; outline-offset: -2px; }

.fl-card-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}
.fl-card-label { font-weight: 600; font-size: 1rem; color: #2c3e50; }
.fl-card-amount-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 0.1rem;
    text-align: right;
}
.fl-card-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1rem;
    color: #2c3e50;
    white-space: nowrap;
    line-height: 1.15;
}
.fl-card-amount-sub {
    font-size: 0.75rem;
    color: #888;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-weight: 500;
}

.fl-card-bottom {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    font-size: 0.8rem;
    color: #666;
}
.fl-card-note {
    font-size: 0.8rem;
    color: #888;
    font-style: italic;
    margin-top: 0.15rem;
}

.fl-chip {
    display: inline-block;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
    font-size: 0.75rem;
    background: #ecf0f1;
    color: #555;
    font-weight: 500;
}
.fl-chip-freq { background: #d6eaf8; color: #1f6391; }
.fl-chip-off { background: #fadbd8; color: #922b21; }
.fl-chip-create { background: #d4efdf; color: #196f3d; }
.fl-chip-update { background: #d6eaf8; color: #1f6391; }
.fl-chip-delete { background: #fadbd8; color: #922b21; }

.fl-delete-form { display: flex; }
.fl-delete-btn {
    background: none;
    border: none;
    border-left: 1px solid #f0f0f0;
    color: #c0392b;
    font-size: 1.5rem;
    cursor: pointer;
    width: 48px;
    min-height: 60px;
    line-height: 1;
}
.fl-delete-btn:hover { background: #fdecea; }

.fl-fab {
    position: fixed;
    right: calc(1rem + env(safe-area-inset-right));
    /* Boven de bottom-nav blijven (60px + safe area) */
    bottom: calc(72px + env(safe-area-inset-bottom));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #2c3e50;
    color: #fff;
    border: none;
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.25);
    z-index: 900;
}
@media (min-width: 768px) {
    .fl-fab { bottom: calc(1rem + env(safe-area-inset-bottom)); }
}
.fl-fab:hover { background: #34495e; }

/* === FL MODAL (native <dialog>) === */
.fl-modal {
    border: none;
    padding: 0;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    width: 100%;
    max-width: 100%;
    max-height: 100vh;
    margin: 0;
}
.fl-modal::backdrop { background: rgba(0,0,0,0.4); }

.fl-modal[open] {
    /* mobiel: full-screen */
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
    max-width: none;
    max-height: none;
    border-radius: 0;
    display: flex;
    flex-direction: column;
}
.fl-modal form { display: flex; flex-direction: column; height: 100%; }

.fl-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    /* iOS PWA: modal full-screen header onder de notch */
    padding-top: calc(1rem + env(safe-area-inset-top));
    padding-left: calc(1.25rem + env(safe-area-inset-left));
    padding-right: calc(1.25rem + env(safe-area-inset-right));
    background: #2c3e50;
    color: #fff;
}
.fl-modal-header h3 { margin: 0; font-size: 1.1rem; }
.fl-modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    min-width: 44px;
    min-height: 44px;
}
.fl-modal-close:hover { opacity: 0.75; }

.fl-modal-body {
    padding: 1rem 1.25rem;
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
}

.fl-field { display: flex; flex-direction: column; gap: 0.3rem; }
.fl-field-label {
    font-size: 0.85rem;
    color: #555;
    font-weight: 500;
}
.fl-field input,
.fl-field select,
.fl-field textarea {
    padding: 0.65rem 0.7rem;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1rem;
    font-family: inherit;
    width: 100%;
    background: #fff;
    min-height: 44px;
}
.fl-field input:focus,
.fl-field select:focus,
.fl-field textarea:focus {
    outline: none;
    border-color: #2c3e50;
    box-shadow: 0 0 0 3px rgba(44,62,80,0.15);
}
.fl-field textarea { resize: vertical; min-height: 60px; }

.fl-field-row { display: flex; gap: 0.6rem; }
.fl-field-grow { flex: 2; }
.fl-field-shrink { flex: 1; }

.fl-field-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0;
    cursor: pointer;
    font-size: 0.95rem;
}
.fl-field-toggle input {
    width: 22px;
    height: 22px;
    cursor: pointer;
}

.fl-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0.85rem 1.25rem;
    /* iOS PWA: home-indicator */
    padding-bottom: calc(0.85rem + env(safe-area-inset-bottom));
    padding-left: calc(1.25rem + env(safe-area-inset-left));
    padding-right: calc(1.25rem + env(safe-area-inset-right));
    border-top: 1px solid #eee;
    background: #fafafa;
}
.fl-modal-footer .btn { min-height: 44px; }

/* === HISTORY === */
.fl-history { display: flex; flex-direction: column; gap: 0.5rem; }
.fl-history-row {
    background: #fff;
    border-radius: 6px;
    padding: 0.75rem 0.9rem;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border-left: 3px solid #ccc;
}
.fl-history-create { border-left-color: #27ae60; }
.fl-history-update { border-left-color: #2980b9; }
.fl-history-delete { border-left-color: #c0392b; }
.fl-history-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.3rem;
}
.fl-history-time { font-variant-numeric: tabular-nums; }
.fl-history-main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
}
.fl-history-label { font-weight: 600; color: #2c3e50; }
.fl-history-amount {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    white-space: nowrap;
}
.fl-history-amount small { color: #888; font-weight: normal; font-size: 0.8rem; }
.fl-history-extra {
    margin-top: 0.35rem;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
}
.fl-history-note { color: #888; font-style: italic; }

/* === DESKTOP OVERRIDES === */
@media (min-width: 768px) {
    .fl-add-btn { display: inline-flex; align-items: center; }
    .fl-fab { display: none; }

    .fl-page { padding-bottom: 2rem; }

    .fl-summary {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1rem;
        align-items: center;
    }
    .fl-summary-row {
        flex-direction: column;
        align-items: flex-start;
        padding: 0;
        border: none !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }
    .fl-summary-secondary { font-size: 0.95rem; }
    .fl-summary-secondary .fl-summary-value { font-size: 1.2rem; font-weight: 600; }

    .fl-modal[open] {
        position: fixed;
        inset: auto;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 520px;
        max-width: 92vw;
        height: auto;
        max-height: 90vh;
        border-radius: 12px;
    }

    .fl-card-main { padding: 0.9rem 1rem; }
    .fl-delete-btn { width: 56px; }
}

/* === BEHEER === */
.beheer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
}
.beheer-tile {
    background: #fff;
    border-radius: 8px;
    padding: 1rem 1.1rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    text-decoration: none;
    color: inherit;
    display: block;
    border-left: 3px solid #2c3e50;
    min-height: 64px;
}
.beheer-tile:hover { background: #f8f9fa; }
.beheer-tile-title { font-weight: 600; color: #2c3e50; font-size: 1.05rem; }
.beheer-tile-desc { color: #666; font-size: 0.85rem; margin-top: 0.2rem; }

.fl-card-count {
    color: #888;
    font-size: 0.95rem;
    font-weight: 500;
}
.fl-card-count small { font-size: 0.75rem; color: #aaa; }

@media (min-width: 768px) {
    .beheer-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* === BOTTOM NAV (mobiel) === */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top: 1px solid #e6e6e6;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.05);
    display: flex;
    z-index: 1100;
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}
.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.25rem;
    color: #888;
    text-decoration: none;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    min-height: 56px;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.15s;
}
.bottom-nav-item:hover { color: #2c3e50; }
.bottom-nav-item.is-active { color: #2c3e50; }
.bottom-nav-item.is-active .bottom-nav-icon { stroke-width: 2.4; }
.bottom-nav-icon {
    width: 24px;
    height: 24px;
    margin-bottom: 0.2rem;
}
.bottom-nav-label {
    font-size: 0.7rem;
    line-height: 1.1;
    font-weight: 500;
    letter-spacing: 0.2px;
}

/* Reserveer ruimte onderin zodat content niet onder bottom-nav valt */
body { padding-bottom: calc(60px + env(safe-area-inset-bottom)); }

/* Desktop versie: navbar-menu inline tonen */
.navbar-menu-desktop { display: none; }

.nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 1500;
}
.nav-backdrop.is-open {
    opacity: 1;
    pointer-events: auto;
}

.nav-drawer {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 84vw;
    max-width: 320px;
    background: #fff;
    box-shadow: 2px 0 16px rgba(0,0,0,0.15);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 1600;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.nav-drawer.is-open { transform: translateX(0); }

.nav-drawer-header {
    background: #2c3e50;
    color: #fff;
    padding: 1.25rem 1.25rem 1rem;
    /* iOS PWA: drawer-header doorloopt onder de notch */
    padding-top: calc(1.25rem + env(safe-area-inset-top));
    padding-left: calc(1.25rem + env(safe-area-inset-left));
}
.nav-drawer-name {
    font-weight: 600;
    font-size: 1.05rem;
    line-height: 1.3;
}
.nav-drawer-email {
    color: #bdc3c7;
    font-size: 0.85rem;
    margin-top: 0.15rem;
    word-break: break-all;
}

.nav-drawer-links {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 0;
    flex: 1;
}
.nav-drawer-links a {
    display: block;
    padding: 0.85rem 1.25rem;
    color: #2c3e50;
    text-decoration: none;
    border-bottom: 1px solid #f3f3f3;
    font-size: 1rem;
    min-height: 48px;
    line-height: 1.3;
}
.nav-drawer-links a:active,
.nav-drawer-links a:hover { background: #f8f9fa; }
.nav-drawer-links a:first-child { border-top: 1px solid #f3f3f3; }

.nav-drawer-logout {
    padding: 1rem 1.25rem;
    /* iOS PWA: home-indicator-ruimte */
    padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    padding-left: calc(1.25rem + env(safe-area-inset-left));
    border-top: 1px solid #eee;
}

.nav-drawer-links a {
    padding-left: calc(1.25rem + env(safe-area-inset-left));
}
.nav-drawer-logout button {
    width: 100%;
    background: #c0392b;
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    cursor: pointer;
    min-height: 48px;
}
.nav-drawer-logout button:hover { background: #a93226; }

/* Body scroll-lock wanneer drawer open */
body.drawer-open { overflow: hidden; }

@media (min-width: 768px) {
    .bottom-nav { display: none; }
    body { padding-bottom: 0; }
    .navbar-menu-desktop { display: flex; align-items: center; gap: 1rem; }
}
