:root {
  --teal: #0d7377;
  --teal-dark: #0a5c5f;
  --teal-light: #e0f2f1;
  --teal-bg: #f0fafa;
  --dark: #1a2332;
  --gray-100: #f8f9fa;
  --gray-200: #e9ecef;
  --gray-300: #dee2e6;
  --gray-400: #ced4da;
  --gray-500: #adb5bd;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --white: #ffffff;
  --danger: #dc3545;
  --warning: #ffc107;
  --success: #28a745;
  --info: #17a2b8;
  --sidebar-width: 240px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--gray-100); color: var(--gray-800); font-size: 14px; }
a { text-decoration: none; color: var(--teal); }
input, select, textarea { font-family: inherit; font-size: 14px; }
.hidden { display: none !important; }

/* ─── LOGIN ──────────────────────────────────────────── */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--teal-dark) 0%, var(--teal) 100%); }
.login-card { background: var(--white); border-radius: 12px; padding: 40px; width: 400px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { text-align: center; margin-bottom: 30px; }
.login-logo img { width: 70px; height: 70px; margin-bottom: 10px; }
.login-logo h1 { color: var(--teal); font-size: 24px; margin-bottom: 4px; }
.login-logo p { color: var(--gray-600); font-size: 13px; }
.test-login { display:inline-block; padding:5px 10px; background:var(--gray-100); border:1px solid var(--gray-200); border-radius:6px; font-size:12px; color:var(--gray-700); cursor:pointer; transition:all .15s; user-select:none; }
.test-login:hover { background:var(--teal-light); border-color:var(--teal); color:var(--teal-dark); }
.test-login small { color:var(--gray-500); }

/* ─── FORMS ──────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 500; margin-bottom: 4px; color: var(--gray-700); font-size: 13px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 8px 12px; border: 1px solid var(--gray-300); border-radius: 6px; outline: none; transition: border .2s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13,115,119,.1); }
.form-group textarea { resize: vertical; min-height: 60px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ─── BUTTONS ────────────────────────────────────────── */
.btn { padding: 8px 16px; border: none; border-radius: 6px; cursor: pointer; font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; transition: all .2s; }
.btn i { font-size: 12px; }
.btn-primary { background: var(--teal); color: white; }
.btn-primary:hover { background: var(--teal-dark); }
.btn-success { background: var(--success); color: white; }
.btn-success:hover { background: #218838; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #c82333; }
.btn-warning { background: var(--warning); color: var(--gray-800); }
.btn-secondary { background: var(--gray-200); color: var(--gray-700); }
.btn-secondary:hover { background: var(--gray-300); }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; padding: 10px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; }

/* ─── LAYOUT ─────────────────────────────────────────── */
#main-app { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-width); background: var(--dark); color: white; display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; bottom: 0; z-index: 100; overflow-y: auto;
}
.sidebar-header { padding: 20px; text-align: center; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-header h2 { font-size: 18px; color: var(--teal-light); }
.nav-menu { list-style: none; flex: 1; padding: 10px 0; }
.nav-menu li a { display: flex; align-items: center; gap: 10px; padding: 10px 20px; color: rgba(255,255,255,.7); transition: all .2s; font-size: 13px; }
.nav-menu li a:hover, .nav-menu li a.active { background: rgba(13,115,119,.3); color: white; }
.nav-menu li a.active { border-left: 3px solid var(--teal); }
.nav-menu li a i { width: 18px; text-align: center; }
.nav-divider { border-top: 1px solid rgba(255,255,255,.1); margin: 8px 0; }
.sidebar-footer { padding: 15px 20px; border-top: 1px solid rgba(255,255,255,.1); }
.user-info { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }
.sidebar-footer .btn { width: 100%; justify-content: center; background: rgba(255,255,255,.1); color: rgba(255,255,255,.7); }
.sidebar-footer .btn:hover { background: rgba(255,255,255,.2); color: white; }

/* ─── CONTENT ────────────────────────────────────────── */
#content { margin-left: var(--sidebar-width); flex: 1; padding: 24px; min-height: 100vh; }
.page-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.page-header h1 { font-size: 22px; color: var(--gray-800); }
.page-header .badge { background: var(--teal); color: white; padding: 2px 8px; border-radius: 10px; font-size: 12px; margin-left: 8px; }

/* ─── CARDS ──────────────────────────────────────────── */
.card { background: var(--white); border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); margin-bottom: 16px; }
.card-header { padding: 14px 18px; border-bottom: 1px solid var(--gray-200); font-weight: 600; font-size: 14px; display: flex; justify-content: space-between; align-items: center; }
.card-body { padding: 18px; }
.card-body.no-pad { padding: 0; }

/* ─── STATS ──────────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat-card { background: var(--white); border-radius: 8px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.08); display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 20px; }
.stat-icon.teal { background: var(--teal-light); color: var(--teal); }
.stat-icon.green { background: #d4edda; color: var(--success); }
.stat-icon.red { background: #f8d7da; color: var(--danger); }
.stat-icon.orange { background: #fff3cd; color: #856404; }
.stat-icon.blue { background: #d1ecf1; color: var(--info); }
.stat-value { font-size: 22px; font-weight: 700; color: var(--gray-800); }
.stat-label { font-size: 12px; color: var(--gray-600); }

/* ─── TABLES ─────────────────────────────────────────── */
.table-container { overflow-x: auto; }
.rates-overview-table td, .rates-overview-table th { white-space: nowrap; }
table { width: 100%; border-collapse: collapse; }
table th { background: var(--gray-100); color: var(--gray-700); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 14px; text-align: left; border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
table td { padding: 10px 14px; border-bottom: 1px solid var(--gray-200); font-size: 13px; vertical-align: middle; }
table tr:hover { background: var(--gray-100); }
table .actions { white-space: nowrap; }

/* ─── BADGES ─────────────────────────────────────────── */
.badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.badge-concept { background: var(--gray-200); color: var(--gray-700); }
.badge-ingediend { background: #cce5ff; color: #004085; }
.badge-goedgekeurd { background: #d4edda; color: #155724; }
.badge-afgekeurd { background: #f8d7da; color: #721c24; }
.badge-gereed { background: #d1ecf1; color: #0c5460; }
.badge-gefactureerd { background: var(--teal-light); color: var(--teal-dark); }
.badge-verstuurd { background: #cce5ff; color: #004085; }
.badge-betaald { background: #d4edda; color: #155724; }
.badge-deels { background: #fff3cd; color: #856404; }
.badge-vervallen { background: #f8d7da; color: #721c24; }
.badge-actief { background: #d4edda; color: #155724; }
.badge-afgerond { background: var(--gray-200); color: var(--gray-700); }

/* ─── TIMESHEET MATRIX ───────────────────────────────── */
.timesheet-controls { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.timesheet-controls select { padding: 6px 10px; border: 1px solid var(--gray-300); border-radius: 6px; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav button { background: var(--gray-200); border: none; padding: 6px 10px; border-radius: 4px; cursor: pointer; }
.month-nav button:hover { background: var(--gray-300); }
.month-nav span { font-weight: 600; min-width: 140px; text-align: center; }

.matrix-table { font-size: 12px; }
.matrix-table th { padding: 6px 4px; font-size: 10px; text-align: center; min-width: 38px; }
.matrix-table td { padding: 4px; text-align: center; }
.matrix-table .project-col { text-align: left; min-width: 200px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 250px; }
.matrix-table .weekend { background: var(--gray-200) !important; }
.matrix-table .today { background: rgba(13,115,119,.1) !important; }
.matrix-table input[type="number"] {
  width: 38px; padding: 3px 2px; border: 1px solid var(--gray-300); border-radius: 3px;
  text-align: center; font-size: 12px; -moz-appearance: textfield;
}
.matrix-table input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; }
.matrix-table input[type="number"]:focus { border-color: var(--teal); outline: none; }
.cell-wrapper { position: relative; display: inline-block; }
.cell-indicator { position: absolute; top: -3px; right: -3px; font-size: 7px; color: var(--teal); line-height: 1; }
.matrix-table .total-row td { font-weight: 700; background: var(--teal-light); border-top: 2px solid var(--teal); }
.matrix-table .total-col { font-weight: 600; color: var(--teal); }
.matrix-table .status-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; }
.status-concept { background: var(--gray-400); }
.status-ingediend { background: #007bff; }
.status-goedgekeurd { background: var(--success); }
.status-afgekeurd { background: var(--danger); }
.status-gereed { background: var(--info); }
.status-gefactureerd { background: var(--teal); }

.add-project-row { cursor: pointer; color: var(--teal); font-size: 12px; }
.add-project-row:hover { text-decoration: underline; }

/* ─── APPROVAL TABS ──────────────────────────────────── */
.tabs { display: flex; gap: 0; margin-bottom: 16px; border-bottom: 2px solid var(--gray-200); }
.tab { padding: 10px 20px; cursor: pointer; font-weight: 500; color: var(--gray-600); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; }
.tab:hover { color: var(--teal); }
.tab.active { color: var(--teal); border-bottom-color: var(--teal); }
.tab .count { background: var(--teal); color: white; padding: 1px 6px; border-radius: 8px; font-size: 11px; margin-left: 6px; }

/* ─── TOAST ──────────────────────────────────────────── */
.toast { position: fixed; bottom: 20px; right: 20px; padding: 12px 20px; border-radius: 8px; color: white; font-size: 13px; z-index: 10000; transition: all .3s; box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--teal); }

/* ─── MODAL ──────────────────────────────────────────── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal { background: white; border-radius: 10px; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-wide { max-width: 800px; }
.modal-header { padding: 16px 20px; border-bottom: 1px solid var(--gray-200); display: flex; justify-content: space-between; align-items: center; }
.modal-header h3 { font-size: 16px; }
.modal-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--gray-600); }
.modal-body { padding: 20px; }
.modal-footer { padding: 12px 20px; border-top: 1px solid var(--gray-200); display: flex; justify-content: flex-end; gap: 8px; }

/* ─── MISC ───────────────────────────────────────────── */
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--gray-600); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.empty-state { text-align: center; padding: 40px; color: var(--gray-500); }
.empty-state i { font-size: 40px; margin-bottom: 12px; }
.empty-state p { margin-top: 8px; }

.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.checkbox-label input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--teal); }

.select-all-bar { display: flex; align-items: center; gap: 12px; padding: 8px 14px; background: var(--teal-light); border-radius: 6px; margin-bottom: 12px; }

@media (max-width: 768px) {
  #sidebar { width: 200px; }
  #content { margin-left: 200px; padding: 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
