:root {
  --balk: #0f172a;
  --paneel: #ffffff;
  --rand: #e2e8f0;
  --tekst: #0f172a;
  --zacht: #64748b;
  --accent: #16a34a;
  --schaduw: 0 8px 30px rgba(15, 23, 42, .18);
}

* { box-sizing: border-box; }

/* Het hidden-attribuut werkt via de browserstijl [hidden] { display: none },
 * en die verliest van elke eigen regel met een display. Zonder deze regel
 * blijven #login (display:flex) en .veld (display:block) gewoon staan als de
 * app ze verbergt - dus het inlogscherm bleef over de kaart heen liggen. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--tekst);
  -webkit-tap-highlight-color: transparent;
}

/* --- kopbalk ------------------------------------------------------------- */

#balk {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: max(8px, env(safe-area-inset-top)) 12px 8px;
  background: var(--balk);
  color: #fff;
}

#merk {
  font-weight: 700;
  letter-spacing: -.02em;
  white-space: nowrap;
}
#merk span { color: #4ade80; }

#zoekwrap { position: relative; flex: 1; min-width: 0; }

#zoek {
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 10px;
  background: #1e293b;
  color: #fff;
  font-size: 16px; /* voorkomt inzoomen op iOS */
}
#zoek::placeholder { color: #94a3b8; }
#zoek:focus { outline: 2px solid #4ade80; }

#suggesties {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--paneel);
  color: var(--tekst);
  border-radius: 10px;
  box-shadow: var(--schaduw);
  max-height: 55vh;
  overflow: auto;
}
#suggesties li {
  padding: 9px 10px;
  border-radius: 7px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  align-items: baseline;
}
#suggesties li:hover { background: #f1f5f9; }
#suggesties .type {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--zacht);
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  flex: none;
}

#btn-menu {
  flex: none;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 10px;
  background: #1e293b;
  color: #fff;
  font-size: 18px;
  cursor: pointer;
}
#btn-menu.let-op { background: var(--accent); }

/* --- kaart --------------------------------------------------------------- */

#kaart { position: absolute; inset: 0; }

#hint, #verbinding {
  position: absolute;
  z-index: 15;
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 13px;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--schaduw);
  pointer-events: none;
}
#hint   { top: 68px; left: 50%; transform: translateX(-50%); white-space: nowrap; }
#gebied {
  position: absolute;
  z-index: 15;
  top: 68px; left: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  background: rgba(255, 255, 255, .94);
  box-shadow: var(--schaduw);
  pointer-events: none;
}
#verbinding {
  top: 68px; right: 12px;
  background: #f59e0b;
  color: #fff;
  font-weight: 600;
}

/* --- panelen ------------------------------------------------------------- */

#detail, #menu {
  position: absolute;
  z-index: 25;
  background: var(--paneel);
  box-shadow: var(--schaduw);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 18px 18px calc(18px + env(safe-area-inset-bottom));
}

/* Telefoon: onderin, als een bottom sheet. */
@media (max-width: 720px) {
  #detail, #menu {
    left: 0; right: 0; bottom: 0;
    max-height: 72vh;
    border-radius: 16px 16px 0 0;
  }
}
/* Groter scherm: zijpaneel. */
@media (min-width: 721px) {
  #detail, #menu {
    top: 56px; bottom: 0; right: 0;
    width: 380px;
  }
}

.sluit {
  position: absolute;
  top: 10px; right: 12px;
  border: 0;
  background: #f1f5f9;
  width: 32px; height: 32px;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  color: var(--zacht);
}

#detail h2, #menu h2 { margin: 0 34px 2px 0; font-size: 19px; }
#detail h3, #menu h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--zacht); }
.sub { margin: 0 0 14px; color: var(--zacht); }

.feiten { display: grid; grid-template-columns: auto 1fr; gap: 7px 14px; margin: 0; }
.feiten dt { color: var(--zacht); }
.feiten dd { margin: 0; font-weight: 500; }
.feiten a { color: #2563eb; }

.eigendom {
  padding: 11px 13px;
  border-radius: 10px;
  background: #f8fafc;
  border-left: 4px solid var(--kleur);
}
.eigendom > b { color: var(--kleur); }
.eigendom .uitleg { margin: 6px 0 0; }
.eigendom .uitleg.klein { font-size: 11px; opacity: .8; }

.eigendom-balk {
  display: flex;
  height: 8px;
  margin-top: 9px;
  border-radius: 999px;
  overflow: hidden;
  background: #dc2626;
}
.eigendom-balk span { background: #16a34a; }
.eigendom-schaal {
  display: flex;
  justify-content: space-between;
  margin-top: 4px;
  font-size: 11px;
  color: var(--zacht);
}

.knop-link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 500;
  color: #2563eb;
  cursor: pointer;
  text-align: left;
}

.label-badge {
  display: inline-block;
  min-width: 30px;
  padding: 2px 9px;
  border-radius: 4px;
  color: #fff;
  font-weight: 700;
  text-align: center;
  text-shadow: 0 1px 2px rgba(0,0,0,.25);
}
.geen-label, .waarschuwing { color: var(--zacht); font-style: italic; font-weight: 400; }
.waarschuwing { color: #b45309; }

.statusknoppen { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.statusknoppen button {
  padding: 11px 9px;
  border: 1.5px solid var(--rand);
  border-radius: 9px;
  background: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  border-left: 4px solid var(--kleur);
}
.statusknoppen button.actief {
  background: var(--kleur);
  border-color: var(--kleur);
  color: #fff;
}

.notitie-label, .veld { display: block; margin-top: 14px; font-size: 13px; color: var(--zacht); }
#notitie, .veld input {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 9px 10px;
  border: 1.5px solid var(--rand);
  border-radius: 9px;
  font: inherit;
  font-size: 16px;
  color: var(--tekst);
  resize: vertical;
}

.meta { margin-top: 14px; font-size: 12px; color: var(--zacht); }
.uitleg { font-size: 13px; color: var(--zacht); margin: 6px 0; }
.uitleg code { background: #f1f5f9; padding: 1px 5px; border-radius: 4px; font-size: 12px; }

.schakel { display: flex; align-items: center; gap: 9px; margin-top: 14px; cursor: pointer; }
.schakel input { width: 18px; height: 18px; }

.legenda-lijst { list-style: none; padding: 0; margin: 6px 0; font-size: 13px; }
.legenda-lijst li { display: flex; align-items: center; gap: 9px; padding: 3px 0; }
.legenda-lijst i { width: 13px; height: 13px; border-radius: 50%; flex: none; }

.knop-vol {
  width: 100%;
  margin-top: 18px;
  padding: 12px;
  border: 0;
  border-radius: 10px;
  background: var(--balk);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.maplibregl-ctrl-bottom-right { margin-bottom: 46px; }

/* --- statusknoppen, notitie ---------------------------------------------- */

.statusknoppen { grid-template-columns: 1fr; }

#notitie { margin-top: 0; }
.notitie-knoppen { display: flex; gap: 8px; margin-top: 8px; }
.notitie-knoppen .klein { margin-top: 0; flex: 1; padding: 9px; font-size: 13px; }
.notitie-melding {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--accent);
  font-weight: 600;
}

.knop-rand {
  width: 100%;
  margin-top: 8px;
  padding: 11px;
  border: 1.5px solid var(--rand);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-weight: 600;
  color: var(--tekst);
  cursor: pointer;
}
.knop-rand:disabled { opacity: .45; cursor: default; }

.woz-waarde { font-size: 17px; }
.woz-historie { margin-top: 3px; font-size: 12px; color: var(--zacht); font-weight: 400; }
.waarschuwing-klein { display: block; font-size: 11px; color: #b45309; }

/* --- mijn activiteit ------------------------------------------------------ */

.badge {
  display: inline-block;
  background: var(--rand);
  color: var(--zacht);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 11px;
  vertical-align: middle;
}

.activiteit { list-style: none; padding: 0; margin: 0; }
.activiteit li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--rand);
  cursor: pointer;
}
.activiteit li:hover { background: #f8fafc; }
.activiteit li.leeg { color: var(--zacht); font-style: italic; cursor: default; }
.activiteit .stip { width: 11px; height: 11px; border-radius: 50%; flex: none; margin-top: 5px; }
.activiteit .regel { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.activiteit .regel small { color: var(--zacht); font-size: 12px; }
.activiteit .regel em { color: var(--zacht); font-size: 12px; margin-top: 2px; }
.activiteit .wis {
  flex: none;
  border: 0;
  background: none;
  color: var(--zacht);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  padding: 2px 5px;
}
.activiteit .wis:hover { color: #dc2626; }

/* --- inlogscherm ---------------------------------------------------------- */

#login {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--balk);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-kaart {
  width: 100%;
  max-width: 380px;
  background: var(--paneel);
  border-radius: 16px;
  padding: 26px 22px;
  box-shadow: var(--schaduw);
}
.login-kaart h1 { margin: 0 0 18px; font-size: 24px; letter-spacing: -.02em; }
.login-kaart h1 span { color: var(--accent); }

.uitnodigen { margin-top: 4px; }
.uitnodigen input {
  display: block;
  width: 100%;
  margin-top: 6px;
  padding: 9px 10px;
  border: 1.5px solid var(--rand);
  border-radius: 9px;
  font: inherit;
  font-size: 16px;
  color: var(--tekst);
}
.uitnodigen .veld { margin-top: 8px; }
.uitnodigen .login-fout { margin-top: 8px; }

.knop-tekst {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 4px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13px;
  color: #2563eb;
  cursor: pointer;
}

.login-voet {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--rand);
}

.login-fout {
  margin: 12px 0 0;
  padding: 9px 11px;
  border-radius: 9px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 13px;
}
.login-fout.gelukt { background: #f0fdf4; color: #15803d; }

/* --- tabbladen in het menu ------------------------------------------------ */

.menu-tabs {
  display: flex;
  gap: 5px;
  margin: 14px 0 4px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rand);
}
.menu-tabs button {
  flex: 1;
  padding: 8px 4px;
  border: 0;
  border-radius: 8px;
  background: #f1f5f9;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--zacht);
  cursor: pointer;
}
.menu-tabs button.actief { background: var(--balk); color: #fff; }

/* --- locatieknop ---------------------------------------------------------- */

#btn-locatie {
  position: absolute;
  z-index: 15;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .97);
  box-shadow: var(--schaduw);
  font-size: 28px;
  line-height: 1;
  color: var(--zacht);
  cursor: pointer;
}
#btn-locatie.aan   { background: #2563eb; color: #fff; }
#btn-locatie.loper { background: #16a34a; color: #fff; }
#btn-locatie.loper #locatie-icoon { display: inline-block; transform: rotate(-90deg); }
