/* ════════════════════════════════════════════════════════════════════════════
   ROUTLI — designsysteem "veldinstrument"
   Diep dennengroen · papier-witte vlakken · Space Grotesk (display) +
   Manrope (tekst) · smaragd/mint-accent · echte SVG-iconen i.p.v. emoji
   ════════════════════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

:root {
  /* Kern — koel teal-dennengroen, zoals de referentiefoto */
  --ink:     #0C201A;   /* diep teal-groen — schermen/topbar */
  --ink-2:   #143329;   /* opgelicht donker vlak */
  --slate:   #102019;   /* primaire tekst (groen-getint donker) */
  --muted:   #5C726A;   /* secundaire tekst (salie) */
  --paper:   #E3EEE7;   /* app-achtergrond — duidelijk zacht groen, geen wit */
  --surface: #FFFFFF;
  --border:  #D5E2D8;
  --hairline:#E0EBE3;

  /* Accent — smaragd/mint (var-namen blijven 'blue' zodat alle regels meelopen) */
  --blue:       #0F9D6B; /* smaragd — knoppen, witte tekst leesbaar */
  --blue-deep:  #0A7E55; /* hover/active + diepe groene tekst */
  --blue-tint:  #E4F6EE; /* lichte mint-tint achtergrond */
  --blue-soft:  #6EE7B7; /* helder mint — op donkere vlakken (accenten/icoon) */

  /* Semantisch (statussen — bewust ongewijzigd, kaart & UI delen deze) */
  --green: #16A34A; --orange: #EA580C; --red: #DC2626; --amber: #F59E0B;

  /* Typografie */
  --font-body:    'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Space Grotesk', var(--font-body);

  /* Vorm */
  --r-sm: 10px; --r-md: 14px; --r-lg: 20px; --r-xl: 26px;
  --shadow-card:  0 1px 2px rgba(10,15,30,.05), 0 8px 24px rgba(10,15,30,.06);
  --shadow-float: 0 12px 40px rgba(10,15,30,.22);
  --shadow-sheet: 0 -8px 40px rgba(10,15,30,.18);
}

html, body { font-family: var(--font-body); color: var(--slate); }

/* ── Iconen ─────────────────────────────────────────────────────────────────── */
.ic {
  width: 17px; height: 17px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -3px;
}
.ic-xs { width: 13px; height: 13px; stroke-width: 2.2; vertical-align: -2px; }
.ic-lg { width: 21px; height: 21px; }

/* ── Donkere schermen (org / login / registratie) ──────────────────────────── */
#org-screen, #login-screen, #register-screen {
  position: fixed; inset: 0;
  background:
    radial-gradient(110% 80% at 50% -10%, #143A28 0%, transparent 55%),
    radial-gradient(90% 60% at 90% 110%, rgba(46,200,140,.13) 0%, transparent 60%),
    var(--ink);
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
/* subtiel technisch raster — geeft de donkere schermen karakter */
#org-screen::before, #login-screen::before, #register-screen::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(80% 60% at 50% 40%, #000 30%, transparent 100%);
  -webkit-mask-image: radial-gradient(80% 60% at 50% 40%, #000 30%, transparent 100%);
}
#org-screen   { z-index: 9001; }
#login-screen { z-index: 9000; }
#register-screen { display: none; z-index: 9100; }
#register-screen.show { display: flex; }
#org-screen.hidden, #login-screen.hidden { display: none; }

#org-box, #login-box, #register-box {
  position: relative;
  background: var(--surface); border-radius: var(--r-xl); padding: 30px 26px;
  width: 100%; max-width: 384px;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 32px 80px rgba(0,0,0,.5);
}
#org-box { text-align: center; }

.login-logo {
  font-family: var(--font-display);
  font-size: 31px; font-weight: 600; color: var(--slate);
  margin-bottom: 22px; letter-spacing: -.8px;
}
.login-logo span { color: var(--blue); }
.login-logo-img { height: 44px; max-width: 200px; object-fit: contain; vertical-align: middle; }

/* organisatie-kiezer */
.org-item {
  display: flex; align-items: center; justify-content: center; width: 100%;
  border: 1.5px solid var(--border); border-radius: var(--r-md); padding: 17px;
  margin-bottom: 10px; background: var(--surface); cursor: pointer;
  font-size: 15px; font-weight: 600; color: var(--slate);
  transition: border-color .15s, background .15s, transform .1s;
}
.org-item:hover  { border-color: var(--blue); background: var(--blue-tint); }
.org-item:active { transform: scale(.985); }
.org-item-logo { font-size: 22px; }
.org-item-logo-img { height: 32px; max-width: 140px; object-fit: contain; }
.org-item-name { font-family: var(--font-display); font-weight: 600; }
.org-li { color: var(--blue); }
.org-muted { color: var(--muted); font-weight: 500; }

/* rol-tabs */
.role-tabs { display: flex; background: var(--paper); border-radius: var(--r-md); padding: 4px; margin-bottom: 22px; gap: 4px; }
.role-tab {
  flex: 1; padding: 11px 8px; border: none; border-radius: var(--r-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit;
  background: transparent; color: var(--muted); transition: all .18s;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.role-tab.active { background: var(--surface); color: var(--slate); box-shadow: 0 2px 8px rgba(10,15,30,.10); }
.role-tab.active.mgr { color: var(--blue-deep); }
.role-tab.active.vrk { color: var(--blue-deep); }

/* invoervelden */
.lfield { margin-bottom: 14px; }
.lfield label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .07em;
  margin-bottom: 6px; display: block;
}
.lfield input {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 13px 14px; font-size: 15px; font-family: inherit; color: var(--slate);
  outline: none; background: #FBFCFD;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.lfield input:focus {
  border-color: var(--blue); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(15,157,107,.16);
}

.login-btn {
  width: 100%; border: none; border-radius: var(--r-sm); padding: 15px;
  font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer;
  margin-top: 4px; letter-spacing: .01em;
  transition: transform .1s, filter .15s;
}
.login-btn:active { transform: scale(.985); filter: brightness(.92); }
.login-btn.mgr { background: var(--blue); color: #fff; }
.login-btn.vrk { background: var(--blue); color: #fff; }

.login-err, .reg-err {
  display: none; background: #FEECEC; color: var(--red); border: 1px solid #F8CFCF;
  border-radius: var(--r-sm); padding: 10px 14px; font-size: 13px;
  font-weight: 600; margin-top: 12px; text-align: center;
}
.login-switch { text-align: center; margin-top: 18px; font-size: 13px; color: var(--muted); }
.login-switch a { color: var(--blue); font-weight: 600; cursor: pointer; text-decoration: none; }

.reg-title { font-family: var(--font-display); font-size: 21px; font-weight: 600; color: var(--slate); margin-bottom: 4px; letter-spacing: -.3px; }
.reg-sub   { font-size: 13px; color: var(--muted); margin-bottom: 22px; }

/* ── App-basis ──────────────────────────────────────────────────────────────── */
#map { position: fixed; inset: 0; }
#app { display: none; }
#app.visible { display: block; }

/* ── Topbar ─────────────────────────────────────────────────────────────────── */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  background: rgba(12,32,26,.97);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.07);
  padding: 10px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 62px;
}
#topbar-left { display: flex; flex-direction: column; justify-content: center; gap: 3px; min-width: 0; flex: 1; }
#topbar-logo {
  font-family: var(--font-display);
  font-size: 20px; font-weight: 600; color: #fff;
  white-space: nowrap; letter-spacing: -.5px; line-height: 1;
}
#topbar-logo span { color: var(--blue-soft); }
#wijk-pill {
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.08);
  border-radius: 20px; padding: 2px 10px;
  font-size: 11px; color: rgba(255,255,255,.66); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px;
  display: inline-block; width: fit-content;
}
#topbar-center {
  display: flex; align-items: center; flex-shrink: 0;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.07);
  border-radius: var(--r-md); padding: 6px 14px;
}
.sstat { text-align: center; padding: 0 10px; }
.sstat-val {
  font-family: var(--font-display);
  font-size: 24px; font-weight: 600; color: #fff; line-height: 1;
  font-variant-numeric: tabular-nums;
}
.sstat-val#sc { color: var(--blue-soft); }
.sstat-lbl { font-size: 9.5px; color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .1em; margin-top: 3px; font-weight: 600; }
.sstat-divider { width: 1px; height: 32px; background: rgba(255,255,255,.13); flex-shrink: 0; }
#shift-toggle-btn {
  margin-left: 10px; border: none; border-radius: 9px; padding: 6px 11px;
  font-size: 11px; font-weight: 700; font-family: inherit; cursor: pointer; white-space: nowrap;
  letter-spacing: .03em; transition: filter .15s;
}
#shift-toggle-btn:active { filter: brightness(.9); }
#shift-toggle-btn.start { background: var(--green); color: #fff; }
#shift-toggle-btn.stop  { background: rgba(255,255,255,.14); color: rgba(255,255,255,.85); }
#topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
#mgr-topbar-btn {
  background: var(--blue); border: none; border-radius: var(--r-sm);
  padding: 9px 14px; color: #fff; font-size: 13px; font-weight: 700; font-family: inherit;
  cursor: pointer; transition: filter .15s, transform .1s;
}
#mgr-topbar-btn:active { transform: scale(.96); filter: brightness(.9); }
#user-btn {
  background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.09);
  border-radius: var(--r-sm); padding: 8px 11px;
  color: #fff; font-size: 13px; font-weight: 600; font-family: inherit;
  cursor: pointer; display: flex; align-items: center; gap: 6px;
}
.role-badge {
  font-size: 8.5px; font-weight: 700; border-radius: 5px; padding: 2.5px 6px;
  text-transform: uppercase; letter-spacing: .07em;
  background: var(--blue); color: #fff;
}
.role-badge.manager, .role-badge.verkoper { background: var(--blue); color: #fff; }

/* ── Zwevende kaart-elementen ───────────────────────────────────────────────── */
#locate-btn {
  position: fixed; bottom: 24px; left: 16px; z-index: 100;
  background: var(--ink); color: #fff; border: none; border-radius: 50%;
  width: 50px; height: 50px; cursor: pointer;
  box-shadow: var(--shadow-float);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s;
}
#locate-btn:active { transform: scale(.92); }

#legend {
  position: fixed; bottom: 88px; left: 16px; z-index: 100;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: var(--r-md); padding: 10px 13px;
  box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 6px;
}
.leg-title { font-size: 9.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
.leg { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 600; color: var(--slate); }
.ldot { width: 11px; height: 11px; border-radius: 4px; flex-shrink: 0; }

/* ── Gebruikersmarker ───────────────────────────────────────────────────────── */
.user-dot-wrap {
  position: relative; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  transform: translateZ(0);
}
.user-ring {
  position: absolute; width: 56px; height: 56px; border-radius: 50%;
  background: rgba(46,91,255,.18); pointer-events: none;
  animation: rpulse 2.4s ease-out infinite;
}
@keyframes rpulse {
  0%   { transform: scale(.35); opacity: 1; }
  100% { transform: scale(1.8); opacity: 0; }
}
.user-arrow-wrap {
  position: relative; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  /* géén CSS-transition: rotatie wordt gesmoothd door de animatielus in map.js */
}
.user-cone {
  position: absolute; bottom: calc(100% - 2px); left: 50%;
  transform: translateX(-50%);
  width: 0; height: 0;
  border-left: 22px solid transparent; border-right: 22px solid transparent;
  border-top: 40px solid rgba(46,91,255,.40);
  pointer-events: none;
}
.user-dot {
  width: 24px; height: 24px; background: var(--blue); border: 3px solid #fff;
  border-radius: 50%; box-shadow: 0 2px 10px rgba(0,0,0,.4);
  position: relative; z-index: 1; flex-shrink: 0;
}

/* ── Bottom sheet (huis-paneel) ─────────────────────────────────────────────── */
#sheet-overlay { display: none; position: fixed; inset: 0; background: rgba(8,12,24,.42); z-index: 200; }
#sheet {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 201;
  background: var(--paper); border-radius: var(--r-xl) var(--r-xl) 0 0;
  max-height: 78dvh; overflow-y: auto;
  box-shadow: var(--shadow-sheet);
  padding-bottom: env(safe-area-inset-bottom, 16px);
}
.sh-handle { width: 40px; height: 4.5px; background: #D4DAE3; border-radius: 3px; margin: 11px auto 0; }

/* Kruisje rechtsboven om het huis-paneel snel weg te klikken */
#sheet-close-x {
  position: absolute; top: 12px; right: 14px; z-index: 5;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card); transition: transform .1s, background .15s;
}
#sheet-close-x:active { transform: scale(.9); background: var(--paper); }

#sheet-header {
  padding: 16px 20px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
}
#sheet-address {
  font-family: var(--font-display);
  font-size: 21px; font-weight: 600; color: var(--slate); letter-spacing: -.3px;
}
#sheet-city { font-size: 13px; color: var(--muted); margin-top: 3px; font-weight: 600; }
#sheet-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.sh-meta-tag {
  background: var(--paper); border: 1px solid var(--border);
  border-radius: 9px; padding: 6px 12px;
  font-size: 13px; font-weight: 600; color: #44506A;
}
.sh-meta-tag.label-A { background: #F3F5F7; border-color: #E3E8EE; color: #15803D; box-shadow: 0 2px 8px rgba(21,128,61,0.30); }
.sh-meta-tag.label-B { background: #F3F5F7; border-color: #E3E8EE; color: #15803D; box-shadow: 0 2px 8px rgba(34,197,94,0.30); }
.sh-meta-tag.label-C { background: #F3F5F7; border-color: #E3E8EE; color: #4D7C0F; box-shadow: 0 2px 8px rgba(132,204,22,0.32); }
.sh-meta-tag.label-D { background: #F3F5F7; border-color: #E3E8EE; color: #92400E; box-shadow: 0 2px 8px rgba(234,179,8,0.34); }
.sh-meta-tag.label-E { background: #F3F5F7; border-color: #E3E8EE; color: #9A3412; box-shadow: 0 2px 8px rgba(249,115,22,0.32); }
.sh-meta-tag.label-F { background: #F3F5F7; border-color: #E3E8EE; color: #9A3412; box-shadow: 0 2px 8px rgba(220,74,15,0.32); }
.sh-meta-tag.label-G { background: #F3F5F7; border-color: #E3E8EE; color: #991B1B; box-shadow: 0 2px 8px rgba(220,38,38,0.32); }

#sale-form-btn {
  width: 100%; margin-top: 12px;
  background: var(--green); border: none; border-radius: var(--r-sm); padding: 14px;
  font-size: 14px; font-weight: 700; font-family: inherit; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, filter .15s;
}
#sale-form-btn:active { transform: scale(.985); filter: brightness(.92); }

#unit-nav { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.unit-nav-btn {
  background: var(--paper); border: 1px solid var(--border); border-radius: 9px;
  width: 34px; height: 34px; font-size: 20px; line-height: 1;
  cursor: pointer; color: #44506A; display: flex; align-items: center; justify-content: center;
}
.unit-nav-btn:active { background: var(--border); }
#unit-indicator { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }

.sh-section { padding: 14px 20px; border-bottom: 1px solid var(--border); }
.sh-section:last-of-type { border-bottom: none; }
.sh-label {
  font-size: 11px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .09em; margin-bottom: 10px;
  display: flex; align-items: center; gap: 6px;
}
.tag-row { display: flex; gap: 8px; flex-wrap: wrap; }

/* status-hoofdknop + opties */
.status-main-btn {
  width: 100%; padding: 14px 16px; border-radius: var(--r-md);
  border: 1.5px solid var(--border); background: var(--surface);
  display: flex; align-items: center; justify-content: space-between;
  font-size: 15px; font-weight: 600; font-family: inherit; color: var(--slate);
  cursor: pointer; transition: border-color .15s, background .15s;
  box-shadow: var(--shadow-card);
}
.status-main-btn.has-status { border-color: var(--blue); background: var(--blue-tint); color: var(--blue-deep); }

#status-picker { display: none; flex-direction: column; gap: 6px; margin-top: 8px; }
#status-picker.open { display: flex !important; }
.status-option {
  width: 100%; padding: 13px 16px; border-radius: var(--r-sm);
  border: 1.5px solid var(--border); background: var(--surface);
  text-align: left; font-size: 14px; font-weight: 600; font-family: inherit; color: var(--slate);
  cursor: pointer; transition: background .12s, border-color .12s, transform .08s;
  display: flex; align-items: center;
}
.status-option:hover  { background: #FAFBFD; }
.status-option:active { transform: scale(.99); }
.status-option.active[data-status="niet_thuis"]     { background: #FDF3DC; border-color: var(--amber);  color: #92400E; }
.status-option.active[data-status="terugkomen"]     { background: #E7EDFF; border-color: var(--blue);   color: var(--blue-deep); }
.status-option.active[data-status="afspraak"]       { background: #E5F8EC; border-color: #22C55E;       color: #15803D; }
.status-option.active[data-status="geen_interesse"] { background: #FDE7E7; border-color: #EF4444;       color: #991B1B; }
.status-option-divider { height: 1px; background: var(--border); margin: 4px 0; }
.so-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex-shrink: 0; margin-right: 11px; }
#note-input-row { display: flex; align-items: center; }

/* notities */
.note-item { padding: 9px 0; border-bottom: 1px solid var(--hairline); }
.note-item:last-child { border-bottom: none; }
.note-meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.note-text { font-size: 14px; color: var(--slate); line-height: 1.45; font-weight: 500; }
.ni-row { display: flex; gap: 8px; margin-top: 8px; }
.ni-row input {
  flex: 1; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 13px; font-size: 14px; font-family: inherit; color: var(--slate);
  outline: none; background: var(--surface); transition: border-color .15s, box-shadow .15s;
}
.ni-row input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(15,157,107,.16); }
.ni-row button {
  background: var(--blue); color: #fff; border: none; border-radius: var(--r-sm);
  padding: 10px 17px; font-size: 16px; font-weight: 600; font-family: inherit; cursor: pointer;
  transition: filter .15s;
}
.ni-row button:active { filter: brightness(.88); }
.private-bg { background: #F0F2F6; }

/* historie-tijdlijn */
.history-item {
  display: flex; gap: 12px; padding: 11px 14px;
  border-radius: var(--r-sm); background: var(--surface);
  border: 1px solid var(--hairline);
  margin-bottom: 6px;
}
.history-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; }
.history-meta { font-size: 11px; color: var(--muted); margin-bottom: 3px; font-weight: 600; }
.history-text { font-size: 14px; font-weight: 600; color: var(--slate); line-height: 1.4; }

#close-sheet-btn {
  width: calc(100% - 40px); margin: 14px 20px 16px;
  background: var(--ink); border: none; border-radius: var(--r-sm); padding: 14px;
  font-size: 14px; font-weight: 700; font-family: inherit; color: #fff; cursor: pointer;
  transition: transform .1s, filter .15s;
}
#close-sheet-btn:active { transform: scale(.985); filter: brightness(1.3); }

/* ── Gebruikersmenu ─────────────────────────────────────────────────────────── */
#user-menu {
  display: none; position: fixed; top: 70px; right: 12px; z-index: 400;
  background: var(--surface); border-radius: var(--r-md); padding: 7px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-float); min-width: 216px;
}
#user-menu.open { display: block; }
.umenu-name { font-size: 12px; color: var(--muted); padding: 9px 13px 6px; font-weight: 600; }
.umenu-item {
  padding: 11px 13px; border-radius: 9px; font-size: 14px; font-weight: 600;
  color: var(--slate); cursor: pointer; display: flex; align-items: center; gap: 10px;
}
.umenu-item:hover { background: var(--paper); }
.umenu-item.danger { color: var(--red); }
.umenu-item .ic { color: var(--muted); }
.umenu-item.danger .ic { color: var(--red); }

/* ── Manager-paneel ─────────────────────────────────────────────────────────── */
#manager-panel { display: none; position: fixed; inset: 0; z-index: 800; background: var(--paper); flex-direction: column; }
#manager-panel.open { display: flex; }
#mp-topbar {
  background: var(--ink); padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
#mp-title {
  font-family: var(--font-display);
  font-size: 17px; font-weight: 600; color: #fff; letter-spacing: -.2px;
  display: flex; align-items: center; gap: 9px;
}
#mp-close-btn {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-sm); padding: 8px 14px;
  color: #fff; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer;
}
.mp-tabs { display: flex; background: var(--surface); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.mp-tab {
  flex: 1; padding: 14px 8px; border: none; background: transparent;
  font-size: 13.5px; font-weight: 600; font-family: inherit; color: var(--muted);
  cursor: pointer; border-bottom: 2.5px solid transparent; transition: color .15s, border-color .15s;
  display: flex; align-items: center; justify-content: center; gap: 7px;
}
.mp-tab.active { color: var(--blue-deep); border-bottom-color: var(--blue); background: var(--blue-tint); }
.mp-content {
  flex: 1; overflow-y: auto; padding: 16px;
  /* zachte groene gloed bovenin zodat het paneel groen ademt, geen wit vlak */
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(15,157,107,.10) 0%, transparent 60%),
    var(--paper);
}
.mp-section {
  background: var(--surface); border-radius: var(--r-lg); padding: 18px;
  margin-bottom: 12px; border: 1px solid var(--hairline);
  border-top: 3px solid var(--blue);
  box-shadow: var(--shadow-card);
}
.mp-section-title {
  font-family: var(--font-display);
  font-size: 14px; font-weight: 600; color: var(--blue-deep); margin-bottom: 14px;
  display: flex; align-items: center; justify-content: space-between; letter-spacing: -.1px;
}
.mp-section-title .ic { color: var(--blue); }
.mp-btn {
  background: var(--blue); color: #fff; border: none; border-radius: var(--r-sm);
  padding: 12px 18px; font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer;
  transition: transform .1s, filter .15s;
  display: flex; align-items: center; gap: 8px;
}
.mp-btn:active { transform: scale(.98); filter: brightness(.9); }
.mp-btn.amber { background: var(--blue); }
.mp-btn.green { background: var(--green); }
.mp-btn.red   { background: var(--red); }
.mp-field { margin-bottom: 12px; }
.mp-field label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 6px; display: block; }
.mp-field input, .mp-field select {
  width: 100%; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  padding: 11px 12px; font-size: 14px; font-family: inherit; color: var(--slate);
  outline: none; transition: border-color .15s; background: var(--surface);
}
.mp-field input:focus, .mp-field select:focus { border-color: var(--blue); }

.team-member { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--hairline); }
.team-member:last-child { border-bottom: none; }
.tm-avatar {
  width: 40px; height: 40px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 16px; font-weight: 600; color: #fff; flex-shrink: 0;
}
.tm-info { flex: 1; min-width: 0; }
.tm-name { font-size: 14px; font-weight: 600; color: var(--slate); }
.tm-email { font-size: 12px; color: var(--muted); margin-top: 1px; }
.tm-role { font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: 7px; flex-shrink: 0; text-transform: uppercase; letter-spacing: .05em; }
.tm-role.manager  { background: var(--ink); color: #fff; }
.tm-role.verkoper { background: var(--blue-tint); color: var(--blue-deep); }

#invite-code-box {
  display: none; background: var(--blue-tint); border: 1.5px dashed #B9C8FF;
  border-radius: var(--r-md); padding: 18px; margin-top: 12px; text-align: center;
}
#invite-code-box.show { display: block; }
#invite-code {
  font-family: var(--font-display);
  font-size: 34px; font-weight: 600; letter-spacing: 9px; color: var(--blue-deep); margin: 8px 0;
}
.invite-hint { font-size: 12px; color: var(--muted); font-weight: 600; }
.invite-copy-btn {
  background: var(--blue); color: #fff; border: none; border-radius: var(--r-sm);
  padding: 9px 20px; font-size: 13px; font-weight: 700; font-family: inherit;
  cursor: pointer; margin-top: 12px;
  display: inline-flex; align-items: center; gap: 7px;
}
.inv-item { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-bottom: 1px solid var(--hairline); font-size: 13px; }
.inv-item:last-child { border-bottom: none; }
.inv-code { font-family: var(--font-display); font-weight: 600; color: var(--blue-deep); letter-spacing: 2.5px; font-size: 15px; }
.inv-used { color: var(--green); font-weight: 600; }
.inv-open { color: var(--blue-deep); font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }

/* ── Toast ──────────────────────────────────────────────────────────────────── */
#toast {
  display: none; position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; border: 1px solid rgba(255,255,255,.1);
  border-radius: var(--r-md); padding: 11px 20px;
  font-size: 13px; font-weight: 600; z-index: 9999; white-space: nowrap;
  box-shadow: var(--shadow-float);
}

/* ── Wijk-beheer ────────────────────────────────────────────────────────────── */
#wijk-panel { display: none; position: fixed; inset: 0; z-index: 800; flex-direction: column; background: var(--ink); }
#wijk-panel.open { display: flex; }
#wijk-ptopbar {
  background: var(--ink); padding: 12px 16px;
  display: flex; align-items: center; gap: 10px; flex-shrink: 0;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
#wijk-back-btn {
  background: rgba(255,255,255,.1); border: 1px solid rgba(255,255,255,.08); border-radius: var(--r-sm);
  color: #fff; padding: 8px 13px; font-size: 13px; font-weight: 600; font-family: inherit; cursor: pointer; flex-shrink: 0;
}
#wijk-ptitle { font-family: var(--font-display); font-size: 15px; font-weight: 600; color: #fff; flex: 1; }
#wijk-hint-top { font-size: 11px; color: rgba(255,255,255,.5); text-align: right; flex-shrink: 0; font-weight: 600; }
#wijk-map-wrap { flex: 1; position: relative; min-height: 0; }
#wijk-map { width: 100%; height: 100%; }
#wijk-loading {
  display: none; position: absolute; inset: 0; z-index: 10;
  background: rgba(10,15,30,.6); align-items: center; justify-content: center;
  gap: 12px; color: #fff; font-size: 14px; font-weight: 600;
}
#wijk-loading.show { display: flex; }
.wijk-spinner {
  width: 28px; height: 28px; border: 3px solid rgba(255,255,255,.25);
  border-top-color: #fff; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Onderschuif-panelen (wijk / wervers / adressen) ───────────────────────── */
#wijk-sheet-overlay, #worker-picker-overlay, #unit-picker-overlay {
  display: none; position: fixed; inset: 0; background: rgba(8,12,24,.45); z-index: 820;
}
#wijk-sheet-overlay { z-index: 810; }
#wijk-sheet-overlay.show, #worker-picker-overlay.show, #unit-picker-overlay.show { display: block; }

#wijk-sheet, #worker-picker, #unit-picker {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 821;
  background: var(--surface); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-sheet);
  padding-bottom: env(safe-area-inset-bottom, 12px);
}
#wijk-sheet { z-index: 811; }
#wijk-sheet.show, #worker-picker.show, #unit-picker.show { display: block; }
#ws-workers { font-size: 13px; color: var(--slate); line-height: 1.7; }

.unit-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 10px; border-bottom: 1px solid var(--hairline);
  cursor: pointer; border-radius: var(--r-sm);
}
.unit-item:hover { background: var(--paper); }
.unit-item:last-child { border-bottom: none; }
.unit-number {
  width: 42px; height: 42px; border-radius: 12px; background: var(--blue-tint);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--blue-deep); flex-shrink: 0;
}
.unit-addr { flex: 1; }
.unit-addr-main { font-size: 14px; font-weight: 600; color: var(--slate); }
.unit-addr-sub  { font-size: 12px; color: var(--muted); margin-top: 1px; font-weight: 500; }

.wp-item { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px solid var(--hairline); cursor: pointer; }
.wp-item:last-child { border-bottom: none; }
.wp-check {
  width: 23px; height: 23px; border-radius: 7px;
  border: 2px solid #C6CEDB; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff; transition: all .15s;
}
.wp-check.on { background: var(--blue); border-color: var(--blue); }
.wp-name { font-size: 14px; font-weight: 600; color: var(--slate); }
.wp-role { font-size: 11px; color: var(--muted); }

/* ── Topbar mobiel: 2 rijen ─────────────────────────────────────────────────── */
@media (max-width: 600px) {
  #topbar { flex-wrap: wrap; padding: 8px 12px 7px; min-height: unset; gap: 6px 8px; }
  #topbar-left  { flex: 1; min-width: 80px; }
  #topbar-right { order: 2; flex-shrink: 0; }
  #topbar-center { order: 3; width: 100%; justify-content: center; padding: 5px 12px; border-radius: var(--r-sm); }
  #topbar-logo { font-size: 17px; }
  .sstat { padding: 0 10px; }
  .sstat-val { font-size: 20px; }
  .sstat-lbl { font-size: 9px; }
  #wijk-pill { max-width: 110px; font-size: 10px; }
  #user-btn { padding: 6px 9px; font-size: 12px; }
  #mgr-topbar-btn { padding: 7px 11px; font-size: 12px; }
  #shift-toggle-btn { margin-left: 8px; font-size: 11px; padding: 5px 9px; }

  /* Legenda compacter op mobiel */
  #legend { bottom: 80px; left: 12px; padding: 7px 9px; gap: 4px; border-radius: var(--r-sm); }
  .leg { gap: 6px; font-size: 9.5px; }
  .ldot { width: 9px; height: 9px; border-radius: 3px; }
}

/* ── Afspraak datum/tijd-formulier (in huis-paneel) ──────────────────────────── */
#afspraak-form { margin-top: 10px; padding: 14px; background: var(--blue-tint); border: 1.5px solid #BFE6D4; border-radius: var(--r-md); }
.af-label { font-size: 12px; font-weight: 700; color: var(--blue-deep); margin-bottom: 8px; }
.af-row { display: flex; gap: 8px; }
.af-row input { flex: 1; border: 1.5px solid var(--border); border-radius: var(--r-sm); padding: 11px 12px; font-size: 15px; font-family: inherit; color: var(--slate); background: var(--surface); outline: none; }
.af-row input:focus { border-color: var(--blue); }
.af-actions { display: flex; gap: 8px; margin-top: 10px; }
.af-save { flex: 1; background: var(--blue); color: #fff; border: none; border-radius: var(--r-sm); padding: 12px; font-size: 14px; font-weight: 700; font-family: inherit; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 7px; }
.af-cancel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px 16px; font-size: 14px; font-weight: 600; font-family: inherit; color: #44506A; cursor: pointer; }

/* ── Mijn afspraken (onderschuif-paneel) ─────────────────────────────────────── */
#appt-overlay { display: none; position: fixed; inset: 0; background: rgba(8,12,24,.42); z-index: 400; }
#appt-overlay.show { display: block; }
#appt-sheet {
  display: none; position: fixed; bottom: 0; left: 0; right: 0; z-index: 401;
  background: var(--paper); border-radius: var(--r-xl) var(--r-xl) 0 0;
  box-shadow: var(--shadow-sheet); padding-bottom: env(safe-area-inset-bottom, 16px);
}
#appt-sheet.show { display: block; }
#appt-close-x {
  position: absolute; top: 12px; right: 14px; z-index: 5;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--muted); cursor: pointer; display: flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-card);
}
.appt-item {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--hairline);
  border-radius: var(--r-md); padding: 13px 14px; margin-bottom: 8px;
}
.appt-when {
  flex-shrink: 0; width: 56px; text-align: center;
  background: var(--blue-tint); border-radius: 10px; padding: 7px 4px;
}
.appt-day { font-family: var(--font-display); font-size: 19px; font-weight: 700; color: var(--blue-deep); line-height: 1; }
.appt-mon { font-size: 10px; font-weight: 700; color: var(--blue-deep); text-transform: uppercase; letter-spacing: .04em; }
.appt-info { flex: 1; min-width: 0; }
.appt-addr { font-size: 14px; font-weight: 700; color: var(--slate); }
.appt-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.appt-ics { flex-shrink: 0; background: var(--blue-tint); border: none; border-radius: 9px; width: 38px; height: 38px; color: var(--blue-deep); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.appt-ics:active { transform: scale(.92); }
.appt-empty { color: var(--muted); font-size: 14px; text-align: center; padding: 30px 0; }
