:root {
    --primary: #2c3e50;
    --success: #27ae60;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --bg: #f3f4f6;
    --card: #ffffff;
    --text: #1f2937;
    --subtext: #6b7280;
    --border: #e5e7eb;
}

body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: var(--bg); margin: 0; padding: 15px; color: var(--text); -webkit-font-smoothing: antialiased; }
.container { max-width: 800px; margin: 0 auto; padding-bottom: 100px; /* Extra ruimte voor balk */ }

/* Header & Nav */
header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; background: var(--card); padding: 15px 20px; border-radius: 16px; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.03); }
.header-title { margin: 0; font-size: 18px; font-weight: 800; color: var(--primary); display: flex; align-items: center; gap: 8px; }
.btn-nav { background: var(--primary); color: white; padding: 10px 16px; border-radius: 10px; text-decoration: none; font-weight: 600; font-size: 14px; display: inline-flex; align-items: center; gap: 6px; transition: 0.2s; border: none; cursor: pointer; }
.btn-logout { color: var(--subtext); text-decoration: none; font-size: 13px; font-weight: 600; padding: 8px; display: flex; align-items: center; gap: 5px; }
.btn-logout:hover { color: var(--danger); }

/* Saldo & Zoek */
.saldo-header { background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%); color: white; text-align: center; padding: 30px; border-radius: 20px; margin-bottom: 25px; box-shadow: 0 10px 20px rgba(39, 174, 96, 0.2); }
.saldo-label { opacity: 0.9; display: block; margin-bottom: 5px; font-weight: 600; font-size: 14px; text-transform: uppercase; letter-spacing: 1px; }
.saldo-bedrag { margin: 0; font-size: 42px; font-weight: 800; letter-spacing: -1px; }

.search-container { margin-bottom: 20px; position: relative; }
.search-box { width: 100%; padding: 14px 15px 14px 45px; border-radius: 12px; border: 2px solid var(--border); font-size: 16px; box-sizing: border-box; outline: none; transition: 0.2s; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'%3E%3C/circle%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'%3E%3C/line%3E%3C/svg%3E") no-repeat 15px center; }
.search-box:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(44, 62, 80, 0.1); }
.form-input { width: 100%; padding: 12px; border-radius: 10px; border: 2px solid var(--border); font-size: 15px; box-sizing: border-box; background: #fff; }

.filter-bar { display: flex; gap: 8px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 5px; -webkit-overflow-scrolling: touch; }
.btn-filter { background: white; border: 1px solid var(--border); color: var(--subtext); padding: 8px 16px; border-radius: 20px; font-size: 13px; font-weight: 600; white-space: nowrap; text-decoration: none; transition: 0.2s; }
.btn-filter.active { background: var(--primary); color: white; border-color: var(--primary); }

/* Transacties */
.transactie-item { background: var(--card); border-radius: 16px; margin-bottom: 12px; box-shadow: 0 2px 6px rgba(0,0,0,0.02); overflow: hidden; border: 1px solid var(--border); transition: transform 0.1s; cursor: pointer; position: relative; }
.transactie-headline { padding: 16px; display: flex; justify-content: space-between; align-items: center; }

/* Checkbox Styling */
.check-wrapper { margin-right: 15px; display: flex; align-items: center; }
.custom-check { width: 24px; height: 24px; border: 2px solid var(--border); border-radius: 6px; appearance: none; cursor: pointer; position: relative; transition: 0.2s; }
.custom-check:checked { background: var(--primary); border-color: var(--primary); }
.custom-check:checked::after { content: '✓'; color: white; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 16px; font-weight: bold; }

.t-left { display: flex; align-items: center; gap: 15px; flex: 1; overflow: hidden; }
.t-icon { width: 40px; height: 40px; border-radius: 12px; background: #f3f4f6; display: flex; align-items: center; justify-content: center; font-size: 20px; flex-shrink: 0; }
.t-info { display: flex; flex-direction: column; overflow: hidden; flex: 1; }
.t-title { font-size: 15px; font-weight: 700; color: var(--primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.t-meta { font-size: 12px; color: var(--subtext); margin-top: 3px; display: flex; align-items: center; gap: 6px; }

.t-amount { font-weight: 800; font-size: 16px; padding: 8px 12px; border-radius: 10px; display: inline-block; white-space: nowrap; }
.amount-in { color: var(--success); background: #ecfdf5; }
.amount-out { color: var(--text); background: #f3f4f6; }
.oud-bedrag { color: #9ca3af; text-decoration: line-through; font-size: 14px; display: block; text-align: right; }
.klaar-tekst { display: block; font-size: 11px; color: var(--success); font-weight: 800; margin-top: 2px; text-transform: uppercase; text-align: right; }

.transactie-details { display: none; padding: 20px; background: #f9fafb; border-top: 1px solid var(--border); }
.transactie-details p { margin: 0 0 15px 0; color: var(--subtext); line-height: 1.5; font-size: 14px; }

/* Status Badges */
.status-badge { font-size: 10px; font-weight: 800; text-transform: uppercase; padding: 3px 8px; border-radius: 5px; display: inline-block; }
.status-paid { background: #d1fae5; color: #065f46; }
.status-open { background: #fee2e2; color: #b91c1c; }

/* Admin Bulk Bar */
.bulk-bar { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--primary); color: white; padding: 15px 25px; border-radius: 50px; display: none; align-items: center; gap: 15px; box-shadow: 0 10px 25px rgba(0,0,0,0.3); z-index: 990; width: 90%; max-width: 400px; justify-content: space-between; }
.bulk-bar.active { display: flex; animation: slideUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.bulk-count { font-weight: bold; background: rgba(255,255,255,0.2); padding: 5px 12px; border-radius: 20px; font-size: 14px; }
.btn-bulk { background: white; color: var(--primary); border: none; padding: 10px 20px; border-radius: 20px; font-weight: 700; cursor: pointer; font-size: 14px; text-decoration: none; display: flex; align-items: center; gap: 5px; }
@keyframes slideUp { from { transform: translate(-50%, 100px); } to { transform: translate(-50%, 0); } }

/* Admin Forms */
.form-sectie { background: var(--card); border-radius: 16px; margin-bottom: 25px; box-shadow: 0 4px 10px rgba(0,0,0,0.03); overflow: hidden; border: 1px solid var(--border); }
.sectie-header { padding: 15px 20px; border-bottom: 1px solid var(--border); background: #f9fafb; }
.sectie-header h3 { margin: 0; font-size: 15px; font-weight: 700; color: var(--primary); }
.sectie-body { padding: 20px; }
.grid-form { display: grid; grid-template-columns: 1fr; gap: 15px; }
@media(min-width:600px) { .grid-form { grid-template-columns: 1fr 1fr; } .full-width { grid-column: span 2; } }
label { font-size: 11px; font-weight: 700; color: var(--subtext); display: block; margin-bottom: 5px; text-transform: uppercase; }
input, select { width: 100%; padding: 12px; border: 2px solid var(--border); border-radius: 10px; font-size: 15px; background: #fff; box-sizing: border-box; }
.btn-save { background: var(--success); color: white; border: none; padding: 14px; width: 100%; border-radius: 10px; font-weight: 700; font-size: 15px; cursor: pointer; }
.btn-action { padding: 10px; border-radius: 8px; font-size: 13px; font-weight: 600; text-decoration: none; text-align: center; border: none; cursor: pointer; display: block; width: 100%; transition: 0.2s; }
.btn-bon { background: #dbeafe; color: #1e40af; }
.btn-icon { width: 36px; height: 36px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-size: 16px; margin-left: 5px; }
.btn-edit { background: #e0f2fe; color: #0284c7; }
.btn-delete { background: #fee2e2; color: #dc2626; }
.btn-cancel { background: #f3f4f6; color: #6b7280; font-size: 18px; }
.income-row { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media(min-width: 600px) { .income-row { grid-template-columns: auto 1fr 1fr 1fr auto; align-items: end; } }
.item-inkomsten { border-left: 4px solid var(--success) !important; }
.upload-zone { border: 2px dashed #d1d5db; padding: 20px; text-align: center; border-radius: 12px; background: #f9fafb; color: var(--subtext); cursor: pointer; }
.date-chip { background: #f3f4f6; padding: 3px 8px; border-radius: 5px; font-size: 11px; font-weight: 600; color: #4b5563; }
.user-table { width: 100%; border-collapse: collapse; }
.user-table td { padding: 10px 0; border-bottom: 1px solid var(--border); }

/* Mail Modal */
#mailModal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 2000; justify-content: center; align-items: flex-end; }
@media(min-width: 600px) { #mailModal { align-items: center; } }
#mailModal.active { display: flex; }
.modal-content { background: white; width: 100%; max-width: 500px; padding: 25px; border-radius: 20px 20px 0 0; animation: slideUp 0.3s; box-sizing: border-box; }
@media(min-width: 600px) { .modal-content { border-radius: 20px; } }
.modal-title { margin-top: 0; font-size: 18px; color: var(--primary); display: flex; justify-content: space-between; align-items: center; }
.close-modal { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--subtext); }

/* Lightbox */
#lightbox { display: none; position: fixed; z-index: 9999; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.95); flex-direction: column; justify-content: center; align-items: center; overflow: hidden; }
#lightbox.active { display: flex; }
.lb-container { width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; overflow: hidden; touch-action: none; }
#lb-img { max-width: 95%; max-height: 90%; transition: transform 0.1s linear; cursor: grab; transform-origin: center center; }
.lb-controls { position: absolute; bottom: 30px; display: flex; gap: 20px; background: rgba(255,255,255,0.1); padding: 10px 20px; border-radius: 30px; backdrop-filter: blur(5px); z-index: 10000; }
.lb-btn { background: white; border: none; width: 50px; height: 50px; border-radius: 50%; font-size: 24px; cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 10px rgba(0,0,0,0.3); }
.lb-close { color: var(--danger); }

/* Login */
body.login-body { background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: rgba(255, 255, 255, 0.95); padding: 40px 30px; border-radius: 24px; width: 100%; max-width: 380px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); text-align: center; }
.code-input { letter-spacing: 12px; font-size: 28px; text-align: center; font-weight: 800; color: #1e3c72; border: 2px solid var(--border); border-radius: 12px; padding: 15px; width: 100%; box-sizing: border-box; margin-bottom: 15px; }
.melding { background: #fee2e2; color: #b91c1c; padding: 12px; border-radius: 10px; margin-bottom: 20px; font-size: 14px; font-weight: 600; }