/* Walk-in Karte: eine Aufgabe pro Bildschirm. Die Karte ist der Held, das Blatt
   von unten die Hand. Alles Tippbare liegt unten, wo der Daumen ist. */
:root {
  --papier: #f7f6f2; --tinte: #1c1c1a; --grau: #6b6b66; --linie: #e3e1da;
  --offen: #a3a49e; --erledigt: #2f9e5b; --nochmal: #e6a700; --kein: #d24a43; --ich: #1a73e8;
  --akzent: #1c1c1a; --schatten: 0 8px 30px rgba(0,0,0,.14);
  --oben: env(safe-area-inset-top, 0px); --unten: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--papier); color: var(--tinte);
  font: 16px/1.4 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
input { font: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

#karte { position: fixed; inset: 0; background: #e9e7e0; }
.leaflet-container { font: inherit; }
.leaflet-control-attribution { font-size: 10px; background: rgba(247,246,242,.7); }

/* Kopf */
#kopf { position: fixed; top: calc(var(--oben) + 10px); left: 12px; right: 12px; z-index: 900;
  display: flex; align-items: center; gap: 8px; pointer-events: none; }
#kopf > * { pointer-events: auto; }
.chip { height: 36px; padding: 0 14px; border-radius: 18px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.10);
  font-weight: 600; font-size: 14px; white-space: nowrap; }
.chip.an { background: var(--tinte); color: #fff; }
.bilanz { flex: 1; height: 36px; display: flex; align-items: center; justify-content: center; padding: 0 12px;
  border-radius: 18px; background: rgba(255,255,255,.92); box-shadow: 0 2px 10px rgba(0,0,0,.10);
  font-size: 13px; color: var(--grau); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bilanz b { color: var(--tinte); margin: 0 3px; }
.rund { width: 44px; height: 44px; border-radius: 50%; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.12);
  display: grid; place-items: center; color: var(--tinte); }
.rund.gross { width: 56px; height: 56px; }
.rund.aktiv { color: var(--ich); }
#kopf .rund { width: 36px; height: 36px; }

#filter { position: fixed; top: calc(var(--oben) + 54px); left: 12px; right: 12px; z-index: 900;
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; pointer-events: none; }
#filter::-webkit-scrollbar { display: none; }
#filter .chip { pointer-events: auto; height: 30px; font-size: 13px; padding: 0 12px; font-weight: 500; }

#knoepfe { position: fixed; right: 14px; bottom: calc(var(--unten) + 22px); z-index: 900;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }

/* Punkte */
.punkt { width: 26px; height: 26px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35);
  display: grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--offen);
  text-shadow: 0 1px 1px rgba(0,0,0,.4); }
.punkt.viel { width: 30px; height: 30px; font-size: 12px; }
.punkt.leer { background: #fff; color: var(--grau); text-shadow: none; opacity: .7; }
.marker-cluster { background: rgba(255,255,255,.7); border-radius: 50%; }
.marker-cluster div { background: #fff; color: var(--tinte); font-weight: 700; border-radius: 50%; box-shadow: 0 1px 6px rgba(0,0,0,.25);
  font: 700 12px/30px inherit; width: 30px; height: 30px; margin: 5px; text-align: center; }
.ich-punkt { width: 18px; height: 18px; border-radius: 50%; background: var(--ich); border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(26,115,232,.35), 0 2px 6px rgba(0,0,0,.3); }
.ich-kreis { stroke: var(--ich); fill: var(--ich); fill-opacity: .08; stroke-opacity: .35; }

/* Blatt von unten */
.blatt { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1000; background: #fff; border-radius: 18px 18px 0 0;
  box-shadow: 0 -4px 30px rgba(0,0,0,.18); max-height: 72vh; display: flex; flex-direction: column;
  padding-bottom: var(--unten); animation: hoch .22s ease-out; }
@keyframes hoch { from { transform: translateY(40px); opacity: .6; } to { transform: none; opacity: 1; } }
.griff { width: 40px; height: 5px; border-radius: 3px; background: var(--linie); margin: 8px auto 4px; }
.blatt-kopf { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 6px 18px 10px; }
.blatt-kopf h2 { margin: 0; font-size: 19px; font-weight: 700; line-height: 1.25; }
.unter { color: var(--grau); font-size: 13px; margin-top: 2px; }
.schliessen { width: 34px; height: 34px; border-radius: 50%; background: var(--papier); font-size: 22px; line-height: 1; color: var(--grau); flex: none; }
.blatt-inhalt { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 12px 16px; }

/* Firmen im Gebäude */
.firma { border-top: 1px solid var(--linie); padding: 12px 6px; }
.firma-zeile { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 0; }
.status-punkt { width: 12px; height: 12px; border-radius: 50%; flex: none; background: var(--offen); }
.s-erledigt { background: var(--erledigt); } .s-nochmal { background: var(--nochmal); } .s-kein_interesse { background: var(--kein); }
.firma-name { font-weight: 600; flex: 1; min-width: 0; }
.firma-name small { display: block; font-weight: 400; color: var(--grau); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.firma-stand { font-size: 12px; color: var(--grau); text-align: right; flex: none; max-width: 40%; }
.firma-stand b { display: block; color: var(--tinte); font-weight: 600; }
.firma-detail { padding-top: 12px; }
.zweck { font-size: 13px; color: var(--grau); margin: 0 0 12px; }
.status-knoepfe { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-knoepfe button { height: 52px; border-radius: 12px; font-weight: 700; font-size: 15px; color: #fff; display: flex; align-items: center; justify-content: center; gap: 8px; }
.status-knoepfe .k-erledigt { background: var(--erledigt); }
.status-knoepfe .k-nochmal { background: var(--nochmal); }
.status-knoepfe .k-kein_interesse { background: var(--kein); }
.status-knoepfe .k-offen { background: var(--papier); color: var(--tinte); border: 1px solid var(--linie); }
.status-knoepfe button.ist { outline: 3px solid var(--tinte); outline-offset: 2px; }
.notiz { display: flex; gap: 8px; margin-top: 10px; }
.notiz input { flex: 1; height: 44px; border: 1px solid var(--linie); border-radius: 10px; padding: 0 12px; font-size: 16px; background: var(--papier); }
.notiz button { height: 44px; padding: 0 14px; border-radius: 10px; background: var(--tinte); color: #fff; font-weight: 600; }
.verlauf { margin: 12px 0 0; padding: 0; list-style: none; font-size: 13px; color: var(--grau); }
.verlauf li { padding: 4px 0; border-top: 1px dashed var(--linie); }
.verlauf b { color: var(--tinte); font-weight: 600; }
.leise { display: flex; gap: 14px; margin-top: 12px; }
.leise button { font-size: 13px; color: var(--grau); text-decoration: underline; padding: 6px 0; }
.gruppe { margin: 10px 6px 0; font-size: 13px; color: var(--grau); }
.gruppe button { color: var(--tinte); font-weight: 600; text-decoration: underline; }
.hinzu { margin: 14px 6px 4px; height: 48px; width: calc(100% - 12px); border-radius: 12px; border: 1.5px dashed var(--grau); color: var(--tinte); font-weight: 600; }
.hinzu-form { display: flex; gap: 8px; margin: 12px 6px 0; }
.hinzu-form input { flex: 1; height: 46px; border: 1px solid var(--linie); border-radius: 10px; padding: 0 12px; font-size: 16px; }
.hinzu-form button { height: 46px; padding: 0 16px; border-radius: 10px; background: var(--tinte); color: #fff; font-weight: 600; }

/* Listen (Nähe, Suche) */
.suchzeile { padding: 0 18px 10px; }
.suchzeile input { width: 100%; height: 46px; border: 1px solid var(--linie); border-radius: 12px; padding: 0 14px; font-size: 16px; background: var(--papier); }
.eintrag { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 6px; border-top: 1px solid var(--linie); }
.eintrag .punkt { flex: none; }
.eintrag-text { flex: 1; min-width: 0; }
.eintrag-text b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eintrag-text span { font-size: 13px; color: var(--grau); }
.eintrag .dist { font-size: 13px; color: var(--grau); flex: none; }
.leer-hinweis { padding: 24px 18px; color: var(--grau); text-align: center; }

/* Meldung */
#meldung { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--unten) + 96px); z-index: 1200;
  background: var(--tinte); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--schatten); max-width: 90vw; }
#meldung.warn { background: var(--kein); }

/* Start */
.voll { position: fixed; inset: 0; z-index: 2000; background: var(--papier); display: grid; place-items: center; padding: 20px; }
.start-karte { width: 100%; max-width: 380px; }
.start-logo { font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--grau); font-weight: 600; }
.start-karte h1 { font-size: 30px; margin: 8px 0 6px; }
.start-karte p { color: var(--grau); margin: 0 0 20px; }
.namen { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.name { height: 60px; border-radius: 14px; background: #fff; border: 1.5px solid var(--linie); font-weight: 700; font-size: 18px; }
.name.gewaehlt { border-color: var(--tinte); background: var(--tinte); color: #fff; }
.feld { display: block; font-size: 13px; font-weight: 600; color: var(--grau); }
.feld input { display: block; width: 100%; height: 50px; margin-top: 6px; border: 1.5px solid var(--linie); border-radius: 12px; padding: 0 14px; font-size: 18px; background: #fff; letter-spacing: .04em; }
.haupt { width: 100%; height: 54px; margin-top: 18px; border-radius: 14px; background: var(--tinte); color: #fff; font-weight: 700; font-size: 17px; }
.haupt:disabled { opacity: .35; }
.klein { font-size: 12px; text-align: center; margin-top: 12px !important; }

input:focus { outline: none; border-color: var(--tinte) !important; }
