/* =====================================================================
   VERPA — Urenregistratie Bestuurders
   Stijlblad
   ===================================================================== */

:root {
  --bg: #F0F2F5;
  --surface: #FFFFFF;
  --surface-2: #F7F8FA;
  --border: #E2E6EC;
  --border-strong: #C8D0DC;
  --text: #1A2233;
  --text-muted: #6B7A92;
  --text-light: #9BA8BB;
  --accent: #1B4FD8;
  --accent-hover: #1440B8;
  --accent-light: #EBF0FD;
  --green: #16A34A;
  --green-light: #DCFCE7;
  --orange: #D97706;
  --orange-light: #FEF3C7;
  --red: #DC2626;
  --red-light: #FEE2E2;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.10);
}

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

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

/* ── HEADER ─────────────────────────────────────────────────────────── */
header {
  background: #1A2233;
  color: white;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25);
}

.header-logo-img {
  height: 38px;
  width: auto;
  display: block;
}

.header-divider {
  width: 1px;
  height: 24px;
  background: rgba(255,255,255,0.18);
}

.header-title {
  font-size: 13px;
  color: rgba(255,255,255,0.55);
  font-weight: 400;
  letter-spacing: 0.01em;
}

/* ── TABS ───────────────────────────────────────────────────────────── */
.tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  display: flex;
  gap: 0;
}

.tab {
  padding: 14px 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
  user-select: none;
}

.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ── LAYOUT ─────────────────────────────────────────────────────────── */
main { max-width: 1200px; margin: 0 auto; padding: 24px; }

.panel { display: none; }
.panel.active { display: block; }

/* ── CARDS ──────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

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

.card-title { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }

/* ── GRID ───────────────────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }

/* ── STAT CARDS ─────────────────────────────────────────────────────── */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--text); line-height: 1; }
.stat-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; margin-top: 8px; }
.badge-green { background: var(--green-light); color: var(--green); }
.badge-orange { background: var(--orange-light); color: var(--orange); }
.badge-red { background: var(--red-light); color: var(--red); }
.badge-blue { background: var(--accent-light); color: var(--accent); }

/* ── FORMS ──────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group:last-child { margin-bottom: 0; }

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(27,79,216,0.12);
}

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

/* ── BUTTONS ────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; color: var(--text-muted); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-danger:hover { background: #FECACA; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 7px; }

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

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

th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}

th:first-child { border-radius: var(--radius) 0 0 0; }
th:last-child  { border-radius: 0 var(--radius) 0 0; }

td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface-2); }

/* ── OVERTIME PILL ──────────────────────────────────────────────────── */
.ot-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
}

/* ── DRIVER AVATAR ──────────────────────────────────────────────────── */
.driver-cell { display: flex; align-items: center; gap: 10px; }

.avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── PERIOD BAR ─────────────────────────────────────────────────────── */
.period-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 10px 16px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.period-bar label { margin: 0; text-transform: none; font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--text); }
.period-bar input, .period-bar select { width: auto; padding: 6px 10px; font-size: 13px; }

/* ── TOAST ──────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 9999;
  transform: translateY(8px);
  opacity: 0;
  transition: all 0.2s;
  pointer-events: none;
}

.toast.show { transform: translateY(0); opacity: 1; }

/* ── PROGRESS BAR ───────────────────────────────────────────────────── */
.progress-wrap { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-top: 6px; }
.progress-bar  { height: 100%; border-radius: 99px; transition: width 0.4s; }

/* ── EMPTY STATE ────────────────────────────────────────────────────── */
.empty { text-align: center; padding: 48px 20px; color: var(--text-muted); }
.empty-icon { font-size: 32px; margin-bottom: 8px; }
.empty p { font-size: 13px; }

/* ── MODAL ──────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.modal-backdrop.open { opacity: 1; pointer-events: all; }

.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 480px;
  max-width: calc(100vw - 32px);
  padding: 0;
  transform: scale(0.97) translateY(8px);
  transition: transform 0.2s;
}

.modal-backdrop.open .modal { transform: scale(1) translateY(0); }

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

.modal-header h3 { font-size: 15px; font-weight: 600; }
.modal-body   { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ── SECTION LABEL ──────────────────────────────────────────────────── */
.section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ── INFO ROW ───────────────────────────────────────────────────────── */
.info-row { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.info-row:last-child { border-bottom: none; }
.info-row .key { color: var(--text-muted); }
.info-row .val { font-weight: 600; }

/* ── DAY PICKER ─────────────────────────────────────────────────────── */
.day-picker-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 3px; margin-top: 8px; }

.day-picker-head {
  text-align: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  padding: 3px 0;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.day-picker-cell {
  text-align: center; padding: 5px 2px; border-radius: 5px; cursor: pointer;
  font-size: 12px; font-weight: 500; border: 1px solid transparent;
  transition: all .1s; user-select: none;
}

.day-picker-cell:hover:not(.dp-other):not(.dp-weekend) { background: var(--accent-light); color: var(--accent); }
.day-picker-cell.dp-selected { background: var(--accent); color: white; font-weight: 700; }
.day-picker-cell.dp-weekend  { color: var(--text-light); cursor: default; }
.day-picker-cell.dp-other    { color: var(--border-strong); cursor: default; }
.day-picker-cell.dp-today    { border-color: var(--accent); }

/* ── MAANDOVERZICHT ─────────────────────────────────────────────────── */
.maandoverzicht-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.maandoverzicht-table th { font-size: 10px; padding: 8px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.maandoverzicht-table td { padding: 7px 12px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.maandoverzicht-table td:last-child { white-space: normal; overflow: visible; }

.col-date  { white-space: nowrap; }
.day-num   { font-weight: 700; font-size: 13px; }
.day-name  { color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.col-worked { font-weight: 600; }
.col-cum    { font-size: 12px; }
.type-tag   { display: inline-block; padding: 1px 7px; border-radius: 99px; font-size: 10px; font-weight: 700; text-transform: uppercase; background: var(--accent-light); color: var(--accent); letter-spacing: .04em; }

.row-weekend td  { background: var(--surface-2); color: var(--text-light); }
.row-empty td    { color: var(--text-light); }
.row-missing td  { background: #FFF3CD; }
.row-missing .col-date { font-weight: 700; }

.row-week-total td {
  background: #F0F4FF;
  border-top: 2px solid var(--border-strong);
  border-bottom: 2px solid var(--border-strong);
}
.row-week-total:hover td { background: #E8EEFB; }

.row-month-total td {
  background: var(--text);
  color: white;
  border-top: 3px solid var(--accent);
}
.row-month-total:hover td { background: #2a3448; }
.row-month-total .ot-pill { font-weight: 800; }

.driver-month-card { margin-bottom: 24px; }

/* ── VERLOFKALENDER ─────────────────────────────────────────────────── */
.vl-cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.vl-cal-head { text-align: center; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); padding: 4px 0; }

.vl-cal-day {
  min-height: 52px; border-radius: 6px; padding: 4px 6px; font-size: 12px;
  border: 1px solid var(--border); background: var(--surface); position: relative;
}

.vl-cal-day.other-month { background: var(--surface-2); border-color: transparent; opacity: .5; }
.vl-cal-day.today       { border-color: var(--accent); }
.vl-cal-day.weekend     { background: var(--surface-2); }
.vl-cal-day-num         { font-weight: 600; font-size: 12px; margin-bottom: 2px; }

.vl-chip {
  display: block; border-radius: 3px; padding: 1px 4px; font-size: 10px; font-weight: 600;
  margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.vl-item {
  display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); gap: 12px;
}
.vl-item:last-child { border-bottom: none; }
.vl-item-bar { width: 4px; border-radius: 99px; align-self: stretch; flex-shrink: 0; }
.vl-badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; }

/* ── LOCATION BADGE ─────────────────────────────────────────────────── */
.loc-badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 7px; border-radius: 99px; font-size: 10px; font-weight: 700; }
.loc-baan     { background: #EBF0FD; color: #2563EB; }
.loc-magazijn { background: #DCFCE7; color: #16A34A; }
.loc-beide    { background: #FEF3C7; color: #D97706; }

/* ── FIELD ERROR ────────────────────────────────────────────────────── */
.field-error input, .field-error select {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(220,38,38,0.12) !important;
}
.field-error-msg { font-size: 11px; color: var(--red); font-weight: 600; margin-top: 4px; display: none; }
.field-error .field-error-msg { display: block; }

/* ── PRINT ──────────────────────────────────────────────────────────── */
@media print {
  header, .tabs, .period-bar, .btn { display: none !important; }
  main { padding: 0; max-width: 100%; }
  .card { border: none; box-shadow: none; break-inside: avoid; }
  .driver-month-card { page-break-after: always; }
  body { background: white; font-size: 11px; }
  .maandoverzicht-table td, .maandoverzicht-table th { padding: 4px 8px; }
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  main { padding: 12px; }
  .input-row, .input-row-3 { grid-template-columns: 1fr; }
}
