/* SpotKlok — gedeelde design tokens & componenten
   Licht = "Helder & zakelijk" (blauw), Donker = "Donker & operationeel" (lime/amber). */

:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --border: #e3e8f1;
  --text: #0b1b3f;
  --text-2: #4a5874;
  --muted: #7a869e;

  --primary: #3b7a1e;
  --primary-hover: #326a18;
  --on-primary: #ffffff;
  --primary-soft: #eaf4e2;

  --cta: #3b7a1e;          /* grote actieknop werknemer */
  --cta-hover: #326a18;
  --on-cta: #ffffff;

  --green: #16a34a;
  --green-soft: #e7f7ec;
  --green-border: #bfe8cc;
  --amber: #d97706;
  --amber-soft: #fff4de;
  --blue: #1463ff;
  --blue-soft: #e8f0ff;
  --red: #dc2626;
  --red-soft: #fdecec;
  --red-border: #f6c5c5;
  --on-red: #ffffff;        /* tekst op een rode knop (Stop, wissen) */
  --gray: #64748b;
  --gray-soft: #eef1f6;

  --sidebar: #13291c;
  --sidebar-text: #c9d8c8;
  --sidebar-active: #21402c;

  --shadow-sm: 0 1px 2px rgba(11, 27, 63, .06);
  --shadow: 0 2px 10px rgba(11, 27, 63, .07);
  --shadow-lg: 0 12px 32px rgba(11, 27, 63, .16);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111310;
    --surface: #1a1d18;
    --surface-2: #20241e;
    --border: #2b2f28;
    --text: #eef1ea;
    --text-2: #b9c0b2;
    --muted: #8a9284;

    --primary: #b5d98a;
    --primary-hover: #c6e49f;
    --on-primary: #13180e;
    --primary-soft: #26301d;

    --cta: #f6b73c;
    --cta-hover: #ffc75a;
    --on-cta: #1a1406;

    --green: #8fd46a;
    --green-soft: #1f2b19;
    --green-border: #3d5a2c;
    --amber: #f6b73c;
    --amber-soft: #2e2512;
    --blue: #7fb2ff;
    --blue-soft: #1a2436;
    --red: #ff7b72;
    --red-soft: #341a19;
    --red-border: #5e2b28;
    --on-red: #1f0d0b;      /* na review: wit op #ff7b72 was ± 2,5:1; donker ± 7:1 */
    --gray: #9aa294;
    --gray-soft: #262a23;

    --sidebar: #141712;
    --sidebar-text: #c3cabb;
    --sidebar-active: #252b21;

    --shadow-sm: none;
    --shadow: none;
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
  .leaflet-tile-pane { filter: brightness(.62) invert(1) contrast(3) hue-rotate(200deg) saturate(.3) brightness(.7); }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img, svg { display: block; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -.01em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

.icon { flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Layout helpers ---------- */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-sm { display: flex; flex-direction: column; gap: 6px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1 1 auto; min-width: 0; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.small { font-size: 14px; }
.xsmall { font-size: 12.5px; }
.bold { font-weight: 700; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tabular { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pre { white-space: pre-wrap; word-break: break-word; overflow-wrap: break-word; overflow-wrap: anywhere; }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; font-size: 22px; letter-spacing: -.02em; color: var(--text); }
.brand img, .brand svg { width: 30px; height: 30px; }
.brand-logo-mark { color: var(--primary); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 16px;
}
.card-tight { padding: 12px; }
.card-flush { padding: 0; overflow: hidden; }
.card-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; margin-bottom: 8px; }
.card-title .icon { color: var(--text-2); }

.info-list { display: flex; flex-direction: column; gap: 10px; }
.info-row { display: flex; align-items: flex-start; gap: 12px; color: var(--text-2); }
.info-row .icon { color: var(--muted); margin-top: 2px; }
.info-row strong { color: var(--text); font-weight: 600; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border-radius: var(--radius); border: 1px solid transparent;
  font-weight: 600; font-size: 15px; line-height: 1;
  cursor: pointer; user-select: none; text-decoration: none !important;
  transition: background .15s, border-color .15s, transform .05s, opacity .15s;
  background: var(--surface); color: var(--text); border-color: var(--border);
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-cta { background: var(--cta); color: var(--on-cta); border-color: var(--cta); }
.btn-cta:hover { background: var(--cta-hover); border-color: var(--cta-hover); }
.btn-outline { background: transparent; color: var(--primary); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.btn-outline:hover { background: var(--primary-soft); }
.btn-soft { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-soft); }
.btn-danger { background: var(--red); color: var(--on-red); border-color: var(--red); }
.btn-danger-outline { background: transparent; color: var(--red); border-color: var(--red-border); }
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn-lg { min-height: 56px; padding: 0 22px; font-size: 18px; font-weight: 700; border-radius: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: 44px; padding: 0; }
.btn-icon.btn-sm { width: 36px; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid currentColor; border-right-color: transparent;
  animation: sk-spin .7s linear infinite; flex: none;
}
@keyframes sk-spin { to { transform: rotate(360deg); } }

/* ---------- Pills / status ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  font-size: 13px; font-weight: 600; white-space: nowrap;
  background: var(--gray-soft); color: var(--gray);
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.no-dot::before { display: none; }
.pill-green { background: var(--green-soft); color: var(--green); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-red { background: var(--red-soft); color: var(--red); }
.pill-gray { background: var(--gray-soft); color: var(--gray); }

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 6px; font-size: 12.5px; font-weight: 600;
  background: var(--gray-soft); color: var(--text-2);
}
.chip .icon { width: 14px; height: 14px; }
.chip-red { background: var(--red-soft); color: var(--red); }
.chip-amber { background: var(--amber-soft); color: var(--amber); }
.chip-green { background: var(--green-soft); color: var(--green); }
.chip-blue { background: var(--blue-soft); color: var(--blue); }

/* ---------- Avatar ---------- */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; flex: none;
  display: inline-grid; place-items: center;
  font-weight: 700; font-size: 14px; letter-spacing: .02em;
  background: var(--primary-soft); color: var(--primary);
}
.avatar-sm { width: 30px; height: 30px; font-size: 12px; }
.avatar-lg { width: 48px; height: 48px; font-size: 17px; }
.avatar-green { background: var(--green); color: #fff; }

/* ---------- Banners ---------- */
.banner {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
}
.banner .icon { margin-top: 1px; }
.banner-green { background: var(--green-soft); border-color: var(--green-border); }
.banner-green > .icon { color: var(--green); }
.banner-red { background: var(--red-soft); border-color: var(--red-border); }
.banner-red > .icon { color: var(--red); }
.banner-amber { background: var(--amber-soft); border-color: color-mix(in srgb, var(--amber) 35%, transparent); }
.banner-amber > .icon { color: var(--amber); }
.banner-blue { background: var(--blue-soft); border-color: color-mix(in srgb, var(--blue) 30%, transparent); }
.banner-blue > .icon { color: var(--blue); }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: 14px; font-weight: 600; color: var(--text); }
.hint { font-size: 13px; color: var(--muted); }
.input, .select, .textarea {
  width: 100%; min-height: 48px; padding: 11px 14px;
  border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font-size: 16px; /* voorkomt iOS zoom */
  transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent);
}
.input[aria-invalid="true"] { border-color: var(--red); }
.field-error { font-size: 13px; color: var(--red); }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } }

.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-weight: 600; font-size: 15px; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch .track { width: 44px; height: 26px; border-radius: 999px; background: var(--border); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.switch input:checked + .track { background: var(--primary); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--primary) 55%, transparent); outline-offset: 2px; }

/* ---------- Map ---------- */
.map { width: 100%; height: 190px; border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); z-index: 0; }
.map-lg { height: 300px; }
.leaflet-container { font-family: var(--font); }
.sk-marker { background: none !important; border: 0 !important; }

/* ---------- Toasts ---------- */
.toast-host {
  position: fixed; z-index: 1000; left: 50%; transform: translateX(-50%);
  bottom: calc(16px + var(--safe-bottom)); width: min(420px, calc(100vw - 24px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--text); color: var(--surface); box-shadow: var(--shadow-lg);
  font-size: 15px; font-weight: 500; animation: sk-toast-in .2s ease-out;
}
.toast .icon { margin-top: 1px; }
.toast-success .icon { color: #4ade80; }
.toast-error .icon { color: #f87171; }
.toast-warn .icon { color: #fbbf24; }
@keyframes sk-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Dialog ---------- */
.dialog-backdrop {
  position: fixed; inset: 0; z-index: 900; background: rgba(5, 10, 25, .45);
  display: flex; align-items: flex-end; justify-content: center; padding: 12px;
  animation: sk-fade .15s ease-out;
}
@media (min-width: 640px) { .dialog-backdrop { align-items: center; } }
.dialog {
  width: min(440px, 100%); background: var(--surface); color: var(--text);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 20px;
  padding-bottom: calc(20px + var(--safe-bottom));
  display: flex; flex-direction: column; gap: 14px;
}
@keyframes sk-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Skeleton / empty ---------- */
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk-shimmer 1.2s infinite; border-radius: 8px; }
@keyframes sk-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); }
.empty .icon { margin: 0 auto 10px; width: 36px; height: 36px; color: var(--border); }

.divider { height: 1px; background: var(--border); border: 0; margin: 4px 0; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
