/* Farben und Schriften wie auf wirgebenhilfe.de: Dunkelblau, Creme, Grün, Sonnengelb */
:root {
  color-scheme: light;
  --bg: #fffaf0; --card: #ffffff; --text: #10283d; --heading: #08294f; --muted: #5f7481;
  --line: rgba(16, 65, 94, 0.14);
  --navy: #08294f; --accent: #1e64bc; --accent-ink: #0c3c77; --accent-bg: #e7f0fc;
  --green: #2f7a36; --ok: #2f7a36; --ok-bg: #e7f4dc;
  --warn: #7a5200; --warn-bg: #fff3c4;
  --danger: #b3261e; --danger-bg: #fdeceb;
  --seg-bg: #f2ecdf;
  --shadow: 0 1px 2px rgba(8, 41, 79, 0.06), 0 8px 24px rgba(27, 84, 98, 0.09);
  --radius: 22px;
  --font-body: "Avenir Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --font-display: Georgia, "Times New Roman", serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 17px/1.45 var(--font-body); -webkit-tap-highlight-color: transparent; }
#app { max-width: 520px; margin: 0 auto; padding: calc(16px + env(safe-area-inset-top)) 16px calc(120px + env(safe-area-inset-bottom)); }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; padding: 0; }
button:focus-visible, input:focus-visible, textarea:focus-visible, a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
button:active { transform: scale(0.98); }
h1 { margin: 0; font: 400 28px/1.15 var(--font-display); color: var(--heading); letter-spacing: -0.01em; }
h1.sm { font-size: 23px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { text-align: center; }

.top { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.grow { flex: 1; min-width: 0; }
.iconbtn { width: 52px; height: 52px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow); color: var(--heading); display: grid; place-items: center; flex: none; }

/* Startseite: Bild der Häuser von der Website, oben bis an den Rand */
.hero { position: relative; margin: calc(-16px - env(safe-area-inset-top)) -16px 0; height: calc(min(60vw, 290px) + env(safe-area-inset-top)); overflow: hidden; border-radius: 0 0 30px 30px; background: #cfe9f7; }
.hero-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 50% 28%; }
.hero .glass { position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; background: rgba(255, 255, 255, 0.82); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
/* Karte der Orte (Bild von Codex), Knöpfe liegen auf dem Bild */
.hero.map { height: auto; padding-top: env(safe-area-inset-top); background: #fdedcb; }
.map-box { position: relative; aspect-ratio: 1 / 1; }
.map-box .hero-img { position: absolute; inset: 0; }
.pin { position: absolute; transform: translate(-50%, 6px); display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 11px; border-radius: 999px; background: rgba(255, 255, 255, 0.94); color: var(--heading); font-size: 14px; font-weight: 700; white-space: nowrap; box-shadow: 0 3px 10px rgba(8, 41, 79, 0.25); transition: background-color 0.15s ease, color 0.15s ease, transform 0.15s ease; }
.pin::before { content: ""; position: absolute; left: 50%; top: -6px; width: 12px; height: 12px; margin-left: -6px; background: inherit; transform: rotate(45deg); border-radius: 2px; }
.pin-name { position: relative; }
.pin-n { position: relative; display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 6px; border-radius: 999px; background: var(--navy); color: #fff; font-size: 13px; }
.pin[aria-pressed="true"] { background: var(--navy); color: #fff; transform: translate(-50%, 6px) scale(1.08); z-index: 2; }
.pin[aria-pressed="true"] .pin-n { background: #ffe58a; color: var(--navy); }
.pin:active { transform: translate(-50%, 6px) scale(0.96); }
.ghead { display: flex; align-items: center; gap: 8px; }
.allbtn { font-size: 14px; font-weight: 700; letter-spacing: 0; text-transform: none; color: var(--accent); min-height: 36px; padding: 0 4px; }

.hello { margin: 20px 4px 16px; }
.hello p { margin: 4px 0 0; color: var(--muted); font-size: 16px; }

.statusrow { margin: 0 0 14px; }
.statusrow:has(#status[hidden]) { display: none; }
.pill { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px; font-size: 15px; font-weight: 600; background: var(--card); box-shadow: var(--shadow); white-space: nowrap; color: var(--heading); }
.pill.wait { color: var(--warn); background: var(--warn-bg); box-shadow: none; }

.card { background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stack { display: flex; flex-direction: column; gap: 12px; }

.section { font-size: 13px; color: var(--green); margin: 26px 4px 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.hint { color: var(--muted); font-size: 15px; margin-top: 8px; }
.mt { margin-top: 10px; }
.mt2 { margin-top: 16px; }

.btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 58px; padding: 0 20px; border-radius: 999px; font-size: 18px; font-weight: 600; background: var(--card); color: var(--heading); box-shadow: inset 0 0 0 1px var(--line); }
.btn.primary { background: var(--navy); color: #fff; box-shadow: 0 8px 22px rgba(8, 41, 79, 0.25); }
.btn.soft { background: var(--accent-bg); color: var(--accent-ink); box-shadow: none; }
.btn.rec { background: var(--danger); color: #fff; box-shadow: none; }

/* Klienten: Suche, Gruppen nach Wohnort, Zeilen */
.searchbox { position: relative; display: block; margin: 4px 0 4px; }
.searchbox .ic { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search { width: 100%; min-height: 54px; padding: 0 18px 0 50px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; box-shadow: var(--shadow); -webkit-appearance: none; appearance: none; }
.search::placeholder { color: var(--muted); }
.clist { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.clients > .cgroup:first-child .clist:first-child { margin-top: 14px; }
.crow { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 66px; padding: 10px 14px; text-align: left; }
.crow:not([hidden]) ~ .crow:not([hidden]) { border-top: 1px solid var(--line); }
.crow .name { flex: 1; min-width: 0; font-weight: 600; font-size: 17px; color: var(--heading); }
.crow > .ic { color: #9fb0bb; }
.crow:active { background: var(--accent-bg); transform: none; }
.avatar { border-radius: 50%; display: grid; place-items: center; font-weight: 700; overflow: hidden; flex: none; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.ic { flex: none; display: inline-block; vertical-align: middle; }

/* Kacheln "Was ist passiert?": groß, 2 × 2; die gewählte dunkelblau */
.grid2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 118px; padding: 12px 6px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--heading); font-size: 17px; font-weight: 600; text-align: center; transition: background-color 0.15s ease, color 0.15s ease; }
.tile .ic { color: var(--accent); transition: color 0.15s ease; }
.tile[aria-pressed="true"] { background: var(--navy); color: #fff; }
.tile[aria-pressed="true"] .ic { color: #ffe58a; }

/* Eingabefeld unter den Kacheln */
.panel { margin-top: 14px; padding: 18px; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); scroll-margin: 16px 0 110px; }
.panel.enter { animation: panel-in 0.32s cubic-bezier(0.16, 1, 0.3, 1); }
@keyframes panel-in { from { opacity: 0; transform: translateY(-8px); } }
.panel-head { display: flex; align-items: center; gap: 10px; font-size: 19px; color: var(--heading); margin-bottom: 4px; min-height: 32px; }
.panel-head .ic { color: var(--accent); }
.lbl { font-size: 15px; color: var(--muted); font-weight: 600; margin: 14px 0 8px; }

/* Umschalter mit gleitender Markierung */
.seg { position: relative; display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); padding: 4px; border-radius: 16px; background: var(--seg-bg); }
.seg-thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc((100% - 8px) / var(--n)); border-radius: 12px; background: var(--card); box-shadow: 0 1px 3px rgba(8, 41, 79, 0.14); transform: translateX(calc(var(--i) * 100%)); transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1); }
.seg-opt { position: relative; min-height: 46px; padding: 0 4px; font-size: 16px; color: var(--muted); white-space: nowrap; transition: color 0.15s ease; }
.seg-opt[aria-checked="true"] { color: var(--heading); font-weight: 700; }

.seg-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 48px; padding: 0 16px; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); background: var(--card); font-size: 16px; color: var(--heading); }
.linkbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; margin-top: 12px; font-size: 16px; }
.linkbtn.danger { color: var(--danger); }

/* Speichern: die Bestätigung erscheint auf dem Knopf selbst */
.savebtn { display: grid; }
.savebtn .st { grid-area: 1 / 1; display: flex; align-items: center; justify-content: center; gap: 8px; transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1); }
.savebtn .st-b { opacity: 0; transform: translateY(8px); }
.savebtn.done { background: var(--ok); color: #fff; pointer-events: none; transition: background-color 0.2s ease; }
.savebtn.done .st-a { opacity: 0; transform: translateY(-8px); }
.savebtn.done .st-b { opacity: 1; transform: none; }

input[type=date], textarea { width: 100%; font: inherit; padding: 14px 16px; border-radius: 16px; border: 1px solid var(--line); background: #fffdf8; color: var(--text); }
input[type=date] { min-height: 52px; }
textarea { min-height: 110px; resize: vertical; }
.err { color: var(--danger); background: var(--danger-bg); padding: 10px 14px; border-radius: 14px; font-size: 16px; margin-top: 12px; }

/* Eingetragen */
.list { display: flex; flex-direction: column; background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list > p { margin: 0; padding: 18px; }
.item { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; width: 100%; text-align: left; transition: background-color 0.6s ease; }
.item + .item { border-top: 1px solid var(--line); }
.item.fresh { background: var(--accent-bg); }
.item-ic { display: grid; place-items: center; width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--accent-bg); color: var(--accent-ink); }
.item-ic.absent { background: var(--warn-bg); color: var(--warn); }
.item .body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.item .t { font-weight: 600; color: var(--heading); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tag { font-size: 13px; font-weight: 600; color: var(--warn); background: var(--warn-bg); padding: 1px 9px; border-radius: 999px; }
.item .n { color: var(--muted); font-size: 15px; overflow-wrap: anywhere; }
.item .m { color: var(--muted); font-size: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.item .m > span { display: inline-flex; align-items: center; gap: 4px; }
.item .m .pend { color: var(--warn); font-weight: 600; }

.recbox { display: flex; flex-direction: column; gap: 10px; }
audio { width: 100%; }
.dot { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.25; } }

.bottom { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: rgba(255, 250, 240, 0.9); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); z-index: 5; }
.bottom .in { max-width: 520px; margin: 0 auto; }

/* Eingang: Bild mit Logo von wirgebenhilfe.de, darunter „Anmelden“, danach das Code-Feld */
.gate { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: var(--bg); overflow: hidden; --foot: calc(232px + env(safe-area-inset-bottom)); }
.gate.code { --foot: calc(470px + env(safe-area-inset-bottom)); }
.gate-pic { flex: none; height: max(150px, calc(100vh - var(--foot))); height: max(150px, calc(100dvh - var(--foot))); overflow: hidden; border-radius: 0 0 34px 34px; background: #bfe3f7; box-shadow: 0 12px 32px rgba(8, 41, 79, 0.14); cursor: pointer; transition: height 0.55s cubic-bezier(0.16, 1, 0.3, 1); }
.gate-pic img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: 52% 30%; animation: gate-in 1.4s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes gate-in { from { opacity: 0; transform: scale(1.08); } }
.gate-foot { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; max-width: 440px; margin: 0 auto; padding: 18px 24px calc(18px + env(safe-area-inset-bottom)); text-align: center; animation: rise 0.7s 0.2s cubic-bezier(0.16, 1, 0.3, 1) both; }
.gate-foot h1 { font-size: 34px; }
.gate-foot p { margin: 0 0 18px; color: var(--muted); }
.gate-sheet { flex: 1; display: flex; flex-direction: column; align-items: center; width: 100%; max-width: 420px; margin: 0 auto; padding: 22px 24px calc(10px + env(safe-area-inset-bottom)); animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
@keyframes rise { from { opacity: 0; transform: translateY(28px); } }
.gate-sheet h2 { margin: 0; font: 400 24px/1.2 var(--font-display); color: var(--heading); outline: none; }
.dots { display: flex; gap: 20px; margin: 18px 0 24px; }
.dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--navy); transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.2s ease; }
.dots i.on { background: var(--navy); transform: scale(1.1); }
.dots.busy i { animation: pulse 0.8s infinite; }
.dots.ok i { background: var(--ok); border-color: var(--ok); transform: scale(1.2); }
.dots.bad { animation: shake 0.42s; }
.dots.bad i { background: var(--danger); border-color: var(--danger); }
@keyframes shake { 20%, 60% { transform: translateX(-10px); } 40%, 80% { transform: translateX(10px); } }
.keys { display: grid; grid-template-columns: repeat(3, 68px); gap: 12px 30px; justify-content: center; }
.key { width: 68px; height: 68px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: var(--shadow); color: var(--heading); font-size: 28px; font-weight: 500; font-variant-numeric: tabular-nums; transition: background-color 0.1s ease; }
.key:active { background: var(--accent-bg); }
.key.fn { background: none; box-shadow: none; color: var(--muted); }
.gate-msg { min-height: 22px; margin: 12px 0 0; color: var(--danger); font-size: 15px; font-weight: 600; text-align: center; }
@media (max-height: 700px) { .gate.code { --foot: calc(430px + env(safe-area-inset-bottom)); } .key { width: 60px; height: 60px; } .keys { grid-template-columns: repeat(3, 60px); gap: 10px 30px; } .dots { margin: 14px 0 18px; } }

/* Anmeldung (nur wenn mehrere Betreuer) */
.login-brand { display: grid; place-items: center; margin: 32px 0 18px; }
.login-brand img { width: 120px; height: 120px; }

.switch { display: flex; gap: 12px; align-items: center; min-height: 52px; font-size: 17px; }
.switch input { width: 26px; height: 26px; accent-color: var(--accent); }

.toast { position: fixed; left: 16px; right: 16px; margin: 0 auto; width: fit-content; max-width: 488px; bottom: calc(96px + env(safe-area-inset-bottom)); background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 999px; display: flex; gap: 18px; align-items: center; z-index: 10; font-size: 16px; box-shadow: 0 10px 30px rgba(8, 41, 79, 0.3); }
.toast button { color: #ffe58a; font-weight: 700; text-decoration: underline; min-height: 40px; }

/* Zum Spaß: Lola aus Mau-Mau lädt zu einer Runde ein */
.maumau { display: flex; align-items: center; gap: 14px; margin-top: 22px; padding: 12px 16px 12px 12px; border-radius: var(--radius); background: linear-gradient(135deg, #fff3c4, #ffdf9e); color: var(--heading); text-decoration: none; box-shadow: var(--shadow); }
.maumau img { width: 64px; height: 64px; border-radius: 50%; flex: none; box-shadow: 0 3px 10px rgba(122, 82, 0, 0.3); transform: rotate(-6deg); animation: lola 5s ease-in-out infinite; }
.maumau b { display: block; font: 400 19px/1.2 var(--font-display); }
.maumau small { display: block; margin-top: 2px; color: #7a5200; font-size: 14px; }
.maumau > .ic { color: #b07a1a; }
.maumau:active { transform: scale(0.98); }
@keyframes lola { 0%, 88%, 100% { transform: rotate(-6deg); } 92% { transform: rotate(8deg) scale(1.06); } 96% { transform: rotate(-10deg); } }

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  .dot, .maumau img, .gate-pic img, .gate-foot, .gate-sheet, .dots.bad, .dots.busy i { animation: none; }
  .gate-pic { transition: none; }
  button:active { transform: none; }
  .panel.enter { animation: none; }
  .seg-thumb, .savebtn .st, .tile, .item { transition: none; }
}
