:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --bg: #f1f5f9;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --green: #16a34a;
    --red: #dc2626;
    --orange: #ea580c;
    --yellow: #f59e0b;
    --purple: #9333ea;
    --sidebar-bg: #0f172a;
    --sidebar-text: #cbd5e1;
    --sidebar-active: #2563eb;
}

.hidden { display: none; }

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 250px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    padding: 20px 24px;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-brand .icon { font-size: 24px; }
.sidebar-logo { max-height: 48px; max-width: 100%; object-fit: contain; border-radius: 4px; }
.login-logo { max-width: 240px; max-height: 240px; object-fit: contain; margin-bottom: 8px; }

.sidebar-mode {
    padding: 6px 24px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: rgba(255,255,255,0.6);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-nav { padding: 12px 0; flex: 1; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 24px;
    color: var(--sidebar-text);
    font-size: 14px;
    transition: all 0.15s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    text-decoration: none;
}

.sidebar-nav a.active {
    background: var(--sidebar-active);
    color: #fff;
}

.sidebar-nav .nav-icon { width: 20px; text-align: center; }
.sidebar-nav .nav-section {
    padding: 16px 24px 6px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #475569;
    font-weight: 600;
}

.main {
    flex: 1;
    margin-left: 250px;
    padding: 28px 32px;
    min-width: 0;
}

/* Topbar */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.topbar h1 {
    font-size: 24px;
    font-weight: 700;
}

.topbar-actions { display: flex; gap: 10px; align-items: center; }

/* Cards */
.card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
    overflow: hidden;
}

.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-header h2 { font-size: 16px; font-weight: 600; }
.card-body { padding: 20px; }

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 16px;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.stat-icon.blue { background: #dbeafe; color: #2563eb; }
.stat-icon.green { background: #dcfce7; color: #16a34a; }
.stat-icon.orange { background: #fed7aa; color: #ea580c; }
.stat-icon.purple { background: #f3e8ff; color: #9333ea; }
.stat-icon.red { background: #fee2e2; color: #dc2626; }
.stat-icon.yellow { background: #fef3c7; color: #d97706; }

.stat-value { font-size: 28px; font-weight: 700; line-height: 1.2; }
.stat-label { color: var(--text-muted); font-size: 13px; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}

.btn:hover { text-decoration: none; opacity: 0.9; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e2e8f0; color: var(--text); }
.btn-secondary:hover { background: #cbd5e1; }
.btn-danger { background: var(--red); color: #fff; }
.btn-success { background: var(--green); color: #fff; }
.btn-warning { background: var(--orange); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

/* Tables */
.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
}

table.data-table th {
    text-align: left;
    padding: 12px 16px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    background: #f8fafc;
    white-space: nowrap;
}

table.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

table.data-table tbody tr:hover td { background: #f8fafc; }
table.data-table tbody tr:last-child td { border-bottom: none; }
table.data-table tbody tr.planbord-sectie-header:hover td { background: #2563eb !important; }

/* Badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-green { background: #dcfce7; color: #15803d; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-orange { background: #fed7aa; color: #c2410c; }
.badge-gray { background: #e2e8f0; color: #475569; }
.badge-blank { background: #fff; color: #64748b; border: 1px solid var(--border); }
.badge-yellow { background: #fef3c7; color: #b45309; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }

/* Forms */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 14px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

select.form-control { cursor: pointer; }
textarea.form-control { min-height: 80px; resize: vertical; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 16px;
}

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

/* Flash messages */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
}
.alert-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }

/* Search bar */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    align-items: center;
}

.search-bar input { flex: 1; max-width: 400px; }

/* Detail view */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 32px;
}

.detail-item { }
.detail-item dt {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
    font-weight: 600;
    margin-bottom: 2px;
}
.detail-item dd { font-size: 14px; }

/* Page header with back link */
.page-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.back-link { font-size: 14px; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

/* Responsive */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.3s; }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; padding: 16px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .topbar h1 { font-size: 20px; }
}

/* Mobile menu toggle */
.menu-toggle {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 18px;
}

@media (max-width: 768px) {
    .menu-toggle { display: inline-block; }
}

/* Roster table */
.roster-table td.col-name { font-weight: 500; }
.roster-table select { padding: 4px 8px; font-size: 13px; }

/* Utility */
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }

/* Tabs */
.tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    border-bottom: 2px solid var(--border);
}
.tab {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
    cursor: pointer;
    transition: all 0.15s;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* Stat row (used in detail views) */
.stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 14px;
}

/* Stat card variant (facturen) */
.stat-card.stat-red { border-left: 4px solid var(--red); }
.stat-card.stat-green { border-left: 4px solid var(--green); }
.stat-card.stat-blue { border-left: 4px solid var(--primary); }
.stat-card.stat-orange { border-left: 4px solid var(--orange); }
.stat-card .stat-value { margin-left: 0; }
.stat-card .stat-label { margin-bottom: 4px; }

/* Inline form (for compact table forms) */
.inline-form { display: inline; }

/* Small form controls */
.form-control-sm { padding: 5px 8px; font-size: 13px; }

/* Items utility */
.items-start { align-items: flex-start; }
.flex-wrap { flex-wrap: wrap; }

/* Login page */
.login-body {
    margin: 0;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-container {
    width: 100%;
    max-width: 400px;
    padding: 20px;
}
.login-card {
    background: var(--surface);
    border-radius: 12px;
    padding: 40px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.login-brand {
    text-align: center;
    margin-bottom: 32px;
}
.login-brand .login-icon {
    font-size: 48px;
    color: var(--primary);
    display: block;
    margin-bottom: 8px;
}
.login-brand h1 {
    font-size: 24px;
    margin: 0;
    color: var(--text);
}
.login-form .form-group {
    margin-bottom: 20px;
}
.login-form .form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}
.login-form .form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    box-sizing: border-box;
}
.btn-block {
    width: 100%;
    padding: 12px;
    font-size: 15px;
}
.user-info {
    font-size: 14px;
    color: var(--text-muted);
    margin-right: 8px;
}
.mededeling-text {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.6;
}
.mededeling-text a {
    color: var(--primary);
}
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-weight: normal;
}
.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
}
.filter-buttons {
    display: flex;
    gap: 4px;
}
.legend {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.planbord-wrap {
    overflow: auto;
    max-width: 100%;
    max-height: calc(100vh - 200px);
}
.planbord-table {
    min-width: 100%;
    border-collapse: collapse;
}
.planbord-table th,
.planbord-table td {
    border: 1px solid var(--border);
}
.planbord-table thead th {
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 2;
}
.planbord-table .sticky-col {
    position: sticky;
    left: 0;
    background: var(--surface);
    z-index: 1;
}
.planbord-table .col-instrument {
    min-width: 120px;
    left: 0;
}
.planbord-table .col-naam {
    min-width: 180px;
    left: 120px;
    z-index: 1;
    font-weight: 500;
}
.planbord-table thead th.col-instrument,
.planbord-table thead th.col-naam {
    z-index: 3;
}
.planbord-opt {
    text-align: center;
    min-width: 70px;
    max-width: 90px;
    font-size: 12px;
}
.planbord-opt a {
    text-decoration: none;
    font-weight: 600;
}
.planbord-cell {
    text-align: center;
    padding: 4px !important;
}
.planbord-cell .badge {
    min-width: 22px;
}
.planbord-sectie-header td {
    background: #2563eb !important;
    color: #fff !important;
    font-weight: 800;
    text-transform: uppercase;
    font-size: 16px;
    letter-spacing: 0.5px;
    padding: 10px 12px;
}
.planbord-sectie-divider td {
    border: none;
    padding: 0;
    height: 4px;
}
.sectie-header td {
    background: #e2e8f0 !important;
    font-weight: 700;
    font-size: 14px;
    padding: 8px 12px;
}

@media print {
    .sidebar, .topbar, .search-bar, .tabs { display: none !important; }
    .main { margin: 0 !important; padding: 0 !important; }
    body { background: white !important; }
    .card { border: 1px solid #333 !important; box-shadow: none !important; }
    .data-table th, .data-table td { border: 1px solid #333 !important; font-size: 11px; }
    .badge { border: 1px solid #333 !important; }
}
.balielijst th, .balielijst td { font-size: 12px; }
.balielijst input[type="checkbox"] { width: 18px; height: 18px; }
