:root {
  --ink: #0E2A2F;
  --muted: #4F6466;
  --ground: #F1F6F4;
  --card: #FFFFFF;
  --line: #C7D6D2;
  --line-soft: #E6EEEB;
  --teal: #1F7A8C;
  --teal-2: #1A6B7B;
  --teal-3: #155B69;
  --accent: #FFB547;
  --yellow-soft: #FFF0CC;
  --yellow-ink: #6B4A10;
  --aqua-soft: #DDF0EE;
  --aqua-ink: #1F5F6B;
  --water: #A9DCE3;
  --land: #DCEBD2;
  --danger: #8A2B2B;
  --danger-soft: #F6E3E3;
  --ok: #145C3C;
  --ok-soft: #E3F3EA;
  --shadow: 0 2px 10px rgba(14, 42, 47, .07);
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'Figtree', system-ui, sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--ground); color: var(--ink); font-family: var(--body); -webkit-text-size-adjust: 100%; }
body { min-height: 100dvh; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -0.01em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

.app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; background: var(--ground); }
@media (min-width: 520px) { .app { box-shadow: 0 0 0 1px var(--line-soft); } }

.screen { min-height: 100dvh; display: flex; flex-direction: column; }
.center-screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; flex-direction: column; gap: 16px; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--aqua-soft); border-top-color: var(--teal); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); background: var(--danger-soft); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; }

/* ── Knoppen & velden ── */
.btn { height: 54px; border-radius: 16px; border: 0; background: var(--accent); color: var(--ink); font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; width: 100%; }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary { background: var(--card); border: 1.5px solid var(--line); }
.btn.teal { background: var(--teal); color: #fff; }
.btn.danger { background: var(--card); border: 1.5px solid #E2B8B8; color: var(--danger); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--card); color: var(--ink); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; text-decoration: none; }
.label { font-size: 14px; font-weight: 700; }
.field { display: flex; flex-direction: column; gap: 6px; }
.input { height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); padding: 0 16px; font-size: 17px; width: 100%; }
.input.pin { font-size: 22px; letter-spacing: .4em; }
.unit-input { display: flex; align-items: center; height: 52px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--card); padding: 0 12px 0 14px; gap: 8px; }
.unit-input input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-family: var(--display); font-weight: 700; font-size: 22px; }
.unit { font-size: 14px; font-weight: 700; border-radius: 8px; padding: 3px 8px; }
.unit.y { background: var(--yellow-soft); }
.unit.a { background: var(--aqua-soft); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 44px; padding: 0 16px; border-radius: 22px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; font-size: 15px; }
.chip[aria-pressed="true"] { background: var(--chip, var(--teal)); border-color: var(--chip, var(--teal)); color: #fff; }
.chips.small .chip { height: 40px; padding: 0 14px; font-size: 14px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 0 -20px; padding: 0 20px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chips.scroll .chip { flex-shrink: 0; }

/* ── Avatar ── */
.av { width: var(--s, 44px); height: var(--s, 44px); border-radius: 50%; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-family: var(--display); font-weight: 800; font-size: calc(var(--s, 44px) * .42); overflow: hidden; background: var(--c, var(--teal)); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.badge { font-size: 12px; font-weight: 700; color: #fff; border-radius: 9px; padding: 3px 8px; background: var(--c, var(--teal)); white-space: nowrap; }

/* ── Inloggen ── */
.hero { flex: 1; min-height: 300px; background: var(--teal); color: #fff; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: calc(24px + var(--safe-t)) 28px 40px; }
.hero svg.waves { position: absolute; left: 0; bottom: 0; width: 100%; height: auto; }
.hero .copy { position: relative; display: flex; flex-direction: column; gap: 10px; }
.kicker { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #FFD58A; }
.hero h1 { font-weight: 800; font-size: 44px; line-height: 1.02; letter-spacing: -0.02em; }
.hero p { margin: 0; font-size: 16px; line-height: 1.5; color: #E2F2F4; }
.sheet { background: var(--ground); border-radius: 28px 28px 0 0; margin-top: -28px; position: relative; padding: 28px 24px calc(32px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; }
.people { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.person { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px; min-height: 96px; border-radius: 18px; background: var(--card); border: 2px solid var(--line); text-decoration: none; color: var(--ink); }
.person span.n { font-weight: 700; font-size: 15px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person[aria-pressed="true"] { border-color: var(--c); background: var(--soft, var(--card)); }
.person.new { background: transparent; border-style: dashed; border-color: #9FB8B4; color: var(--aqua-ink); }
.person.new .av { background: var(--aqua-soft); color: var(--aqua-ink); }

/* ── Kop & lijst ── */
.topbar { padding: calc(16px + var(--safe-t)) 16px 8px; display: flex; align-items: center; gap: 12px; }
.topbar h1 { font-weight: 800; font-size: 26px; }
.page-head { padding: calc(20px + var(--safe-t)) 20px 12px; display: flex; flex-direction: column; gap: 14px; }
.hello { display: flex; align-items: center; justify-content: space-between; }
.hello h1 { font-weight: 800; font-size: 32px; letter-spacing: -0.02em; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat { border-radius: 18px; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--display); font-weight: 800; font-size: 26px; }
.stat b small { font-size: 14px; font-weight: 600; }
.stat span { font-size: 12px; font-weight: 600; }
.stat.t { background: var(--teal); color: #fff; }
.stat.t span { color: #E2F2F4; }
.stat.y { background: var(--yellow-soft); }
.stat.y span { color: var(--yellow-ink); }
.stat.a { background: var(--aqua-soft); }
.stat.a span { color: var(--aqua-ink); }

.list { padding: 4px 20px 120px; display: flex; flex-direction: column; gap: 12px; }
.catch { display: flex; gap: 12px; padding: 10px; background: var(--card); border-radius: 20px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); }
.thumb { width: 104px; height: 104px; flex-shrink: 0; border-radius: 14px; background: #3A9BAA; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.catch .info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; padding: 2px 0; }
.catch .row1 { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.catch .sp { font-family: var(--display); font-weight: 700; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catch .date { font-size: 12px; color: var(--muted); white-space: nowrap; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { font-size: 13px; font-weight: 700; border-radius: 9px; padding: 4px 8px; }
.pill.y { background: var(--yellow-soft); }
.pill.a { background: var(--aqua-soft); }
.catch .row3 { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.catch .row3 .pl { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { text-align: center; padding: 48px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* ── Navigatie ── */
.nav { position: fixed; left: 50%; transform: translateX(-50%); bottom: 0; width: 100%; max-width: 480px; background: var(--card); border-top: 1px solid #DCE6E3; height: calc(76px + var(--safe-b)); padding: 10px 0 var(--safe-b); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; z-index: 1000; }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); text-decoration: none; min-height: 44px; }
.nav a[aria-current="page"] { color: var(--teal); font-weight: 700; }
.nav .fab { justify-self: center; margin-top: -34px; width: 64px; height: 64px; border-radius: 50%; background: var(--accent); color: var(--ink); border: 4px solid var(--ground); box-shadow: 0 6px 16px rgba(14, 42, 47, .2); justify-content: center; }

/* ── Kaart ── */
.map-screen { position: relative; height: 100dvh; overflow: hidden; }
.map-full { position: absolute; inset: 0; bottom: calc(76px + var(--safe-b)); background: var(--land); }
.map-overlay { position: absolute; left: 16px; right: 16px; top: calc(16px + var(--safe-t)); z-index: 500; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.map-overlay > * { pointer-events: auto; }
.map-title { background: var(--card); border-radius: 20px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; box-shadow: 0 4px 14px rgba(14, 42, 47, .12); }
.legend { display: flex; gap: 8px; flex-wrap: wrap; }
.legend span { display: flex; align-items: center; gap: 6px; background: var(--card); border-radius: 14px; padding: 6px 12px; font-size: 13px; font-weight: 700; }
.legend i { width: 11px; height: 11px; border-radius: 50%; background: var(--c); }
.map-card { position: absolute; left: 16px; right: 16px; bottom: calc(102px + var(--safe-b)); z-index: 500; background: var(--card); border-radius: 22px; padding: 12px; display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); box-shadow: 0 8px 22px rgba(14, 42, 47, .18); }
.map-card .thumb { width: 72px; height: 72px; }
.pin-icon { background: none; border: 0; }
.leaflet-container { font-family: var(--body); }
.mini-map { height: 150px; border-radius: 18px; overflow: hidden; background: var(--land); position: relative; z-index: 0; }

/* ── Formulier ── */
.form { padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.photo-pick { height: 160px; border-radius: 22px; border: 2px dashed #3A9BAA; background: #E3F2F2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer; overflow: hidden; position: relative; text-align: center; padding: 8px; }
.photo-pick.has { border-style: solid; padding: 0; height: 220px; }
.photo-pick img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.photo-pick .change { position: absolute; right: 10px; bottom: 10px; background: var(--card); border-radius: 12px; padding: 6px 10px; font-size: 13px; font-weight: 700; }
.cam { width: 56px; height: 56px; border-radius: 50%; background: var(--teal); color: #fff; display: flex; align-items: center; justify-content: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sticky-foot { position: sticky; bottom: 0; padding: 12px 20px calc(20px + var(--safe-b)); background: linear-gradient(rgba(241, 246, 244, 0), var(--ground) 30%); display: flex; flex-direction: column; gap: 10px; }

/* ── Profiel aanmaken ── */
.profile-top { background: var(--teal); color: #fff; padding: calc(16px + var(--safe-t)) 16px 72px; }
.profile-top h1 { font-weight: 800; font-size: 26px; }
.avatar-pick { margin-top: -60px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.avatar-pick label { position: relative; width: 128px; height: 128px; border-radius: 50%; border: 5px solid var(--ground); cursor: pointer; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--c); }
.avatar-pick label img { width: 100%; height: 100%; object-fit: cover; }
.av-wrap { position: relative; width: 128px; height: 128px; }
.avatar-pick .cam-badge { position: absolute; right: -2px; bottom: 2px; width: 42px; height: 42px; border-radius: 50%; background: var(--accent); border: 3px solid var(--ground); display: flex; align-items: center; justify-content: center; pointer-events: none; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 44px; height: 44px; border-radius: 50%; padding: 0; border: 3px solid var(--sw); background: var(--sw); }
.swatch[aria-pressed="true"] { border-color: var(--ground); box-shadow: 0 0 0 3px var(--ink); }
.preview-row { display: flex; align-items: center; gap: 12px; background: var(--card); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); }

/* ── Detail ── */
.detail-photo { position: relative; height: 360px; background: #3A9BAA; display: flex; align-items: center; justify-content: center; }
.detail-photo img { width: 100%; height: 100%; object-fit: cover; }
.detail-photo .bar { position: absolute; left: 16px; right: 16px; top: calc(16px + var(--safe-t)); display: flex; justify-content: space-between; }
.detail-body { margin-top: -28px; position: relative; background: var(--ground); border-radius: 28px 28px 0 0; padding: 24px 20px calc(32px + var(--safe-b)); display: flex; flex-direction: column; gap: 16px; }
.detail-body h1 { font-weight: 800; font-size: 40px; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.big-stat { border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; }
.big-stat span { font-size: 13px; font-weight: 700; }
.big-stat b { font-family: var(--display); font-weight: 800; font-size: 32px; }
.big-stat b small { font-size: 16px; font-weight: 600; }
.record { display: flex; align-items: center; gap: 10px; background: var(--accent); border-radius: 16px; padding: 10px 14px; font-weight: 700; font-size: 15px; }

/* ── Beheer / status ── */
.section { padding: 8px 20px; display: flex; flex-direction: column; gap: 12px; }
.section h2 { font-weight: 700; font-size: 19px; display: flex; align-items: center; gap: 8px; }
.count { font-family: var(--body); font-size: 12px; font-weight: 700; background: var(--accent); border-radius: 10px; padding: 2px 8px; }
.card { background: var(--card); border-radius: 20px; padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; }
.member { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.member:last-child { border-bottom: 0; }
.status { align-self: flex-start; font-size: 13px; font-weight: 700; border-radius: 10px; padding: 5px 10px; }
.status.ok { background: var(--ok-soft); color: var(--ok); }
.status.no { background: var(--danger-soft); color: var(--danger); }
.steps { display: flex; flex-direction: column; gap: 10px; text-align: left; align-self: stretch; }
.step { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; }
.dot { width: 26px; height: 26px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }

.toast { position: fixed; left: 50%; bottom: calc(100px + var(--safe-b)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600; font-size: 15px; z-index: 2000; max-width: calc(100% - 32px); box-shadow: 0 8px 22px rgba(14, 42, 47, .25); }
