/* Familien-App (iPhone). Gleiche Tokens wie das Tablet-Dashboard. */
:root {
  --bg: #E9EEE9; --surface: #FFFFFF; --surface-2: #F4F7F3; --ink: #18231F; --muted: #5B6862; --line: #D5DDD6;
  --accent: #18231F; --on-accent: #FFFFFF; --alle: #3F8A68; --alert: #CF4F1B; --alert-bg: #FCEBDF; --lia: #E0900E; --lia-bg: #FFF4DC;
  --ok: #2F8A5B; --rec: #D8412F;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", -apple-system, "Segoe UI", system-ui, sans-serif;
  --r: 18px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1513; --surface: #18201D; --surface-2: #1F2925; --ink: #E6EDE9; --muted: #96A59E; --line: #2A3631;
    --accent: #E6EDE9; --on-accent: #0F1513; --alle: #6CC198; --alert: #FF8A57; --alert-bg: #3A2218; --lia: #F6B544; --lia-bg: #2E2614;
    --ok: #6CC198; --rec: #FF6B5A; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0F1513; --surface: #18201D; --surface-2: #1F2925; --ink: #E6EDE9; --muted: #96A59E; --line: #2A3631;
  --accent: #E6EDE9; --on-accent: #0F1513; --alle: #6CC198; --alert: #FF8A57; --alert-bg: #3A2218; --lia: #F6B544; --lia-bg: #2E2614;
  --ok: #6CC198; --rec: #FF6B5A; color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 17px; line-height: 1.4; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--lia); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 640px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + 14px) max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 120px) max(16px, env(safe-area-inset-left, 0px)); }
h1 { font-family: var(--display); font-weight: 800; font-size: 30px; margin: 4px 0 2px; letter-spacing: -.01em; }
h2 { font-family: var(--display); font-weight: 700; font-size: 20px; margin: 0; }
.sub { color: var(--muted); font-size: 15px; }
.num { font-variant-numeric: tabular-nums; }

/* Karten & Listen */
.card { background: var(--surface); border-radius: var(--r); padding: 16px; display: grid; gap: 12px; }
.stack { display: grid; gap: 14px; }
.day { display: grid; gap: 6px; }
.day-h { font-family: var(--display); font-weight: 700; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 10px 2px 2px; }
.day-h.today { color: var(--ink); }
.ev { display: grid; grid-template-columns: 70px 1fr auto; gap: 10px; align-items: center; background: var(--surface); border: 0; border-radius: 14px; padding: 12px; text-align: left; width: 100%; }
.ev .t { font-weight: 700; font-size: 15px; }
.ev .t small { display: block; font-weight: 400; color: var(--muted); font-size: 13px; }
.ev .w { min-width: 0; }
.ev .w b { font-weight: 700; display: block; overflow-wrap: anywhere; }
.ev .w small { color: var(--muted); font-size: 13px; display: flex; gap: 8px; flex-wrap: wrap; }
.ev.type-abwesend { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.ev.type-geburtstag, .ev.type-kita { background: var(--surface-2); }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 7px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.badge.warn { background: var(--alert-bg); color: var(--alert); }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }

/* Personen */
.av { width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff; background: var(--alle); overflow: hidden; flex: none; border: 2px solid var(--surface); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.avs { display: flex; }
.avs .av + .av { margin-left: -8px; }

/* Untere Leiste */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--surface); border-top: 1px solid var(--line); padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 8px) max(16px, env(safe-area-inset-left, 0px)); }
.dock-in { max-width: 640px; margin: 0 auto; display: grid; grid-template-columns: 1fr 1fr auto 1fr 1fr; align-items: center; gap: 4px; }
.tab { background: none; border: 0; padding: 6px 0; display: grid; justify-items: center; gap: 2px; font-size: 12px; color: var(--muted); }
.tab svg { width: 24px; height: 24px; }
.tab[aria-current="page"] { color: var(--ink); font-weight: 700; }
.mic { width: 68px; height: 68px; border-radius: 50%; border: 0; background: var(--rec); color: #fff; display: grid; place-items: center; margin-top: -30px; box-shadow: 0 6px 18px rgba(0,0,0,.18); }
.mic svg { width: 30px; height: 30px; }

/* Buttons & Formulare */
.btn { border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 700; background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn.danger { background: var(--alert-bg); color: var(--alert); }
.btn.small { padding: 8px 12px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: .5; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > .grow { flex: 1; min-width: 0; }
label.f { display: grid; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 700; }
.inp { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; font-size: 17px; color: var(--ink); min-width: 0; }
textarea.inp { min-height: 80px; resize: vertical; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 8px 14px; font-size: 15px; display: inline-flex; align-items: center; gap: 8px; }
.chip[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.chip .av { width: 24px; height: 24px; font-size: 11px; border: 0; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 4px 0; font-size: 16px; }
.switch input { width: 50px; height: 30px; appearance: none; -webkit-appearance: none; background: var(--line); border-radius: 99px; position: relative; flex: none; transition: background .2s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--ok); }
.switch input:checked::after { transform: translateX(20px); }
.switch small { display: block; color: var(--muted); font-size: 13px; }

/* Bottom-Sheet */
.sheet { position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow-y: auto; -webkit-overflow-scrolling: touch; }
.sheet-h { position: sticky; top: 0; z-index: 2; background: var(--bg); display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: calc(env(safe-area-inset-top, 0px) + 10px) max(16px, env(safe-area-inset-right, 0px)) 10px max(16px, env(safe-area-inset-left, 0px)); border-bottom: 1px solid var(--line); }
.sheet-h h2 { font-size: 18px; }
.sheet-b { max-width: 640px; margin: 0 auto; padding: 16px max(16px, env(safe-area-inset-right, 0px)) calc(env(safe-area-inset-bottom, 0px) + 40px) max(16px, env(safe-area-inset-left, 0px)); display: grid; gap: 16px; }
.link { background: none; border: 0; color: var(--ink); font-weight: 700; padding: 8px 4px; }
.link.muted { color: var(--muted); font-weight: 400; }

/* Aufnahme */
.rec { display: grid; justify-items: center; gap: 16px; padding: 40px 0 10px; text-align: center; }
.pulse { width: 120px; height: 120px; border-radius: 50%; background: var(--rec); display: grid; place-items: center; color: #fff; border: 0; position: relative; }
.pulse svg { width: 48px; height: 48px; }
.pulse.on::before { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 4px solid var(--rec); opacity: .5; animation: ring 1.4s ease-out infinite; }
@keyframes ring { from { transform: scale(.9); opacity: .6; } to { transform: scale(1.3); opacity: 0; } }
.timer { font-family: var(--display); font-size: 34px; font-weight: 700; }
.hint { color: var(--muted); font-size: 15px; max-width: 34ch; }
.transcript { background: var(--surface-2); border-radius: 12px; padding: 12px; font-size: 15px; color: var(--muted); }
.draft { background: var(--surface); border-radius: 14px; padding: 14px; display: grid; gap: 8px; }
.draft.unsure { box-shadow: inset 0 0 0 2px var(--alert); }
.draft .meta { color: var(--muted); font-size: 14px; }
.draft .warn { color: var(--alert); font-size: 14px; }

/* Lia */
.stars-big { display: flex; flex-wrap: wrap; gap: 3px; }
.stars-big svg { width: 22px; height: 22px; }
.stars-big .off { opacity: .2; filter: grayscale(1); }
.task-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: center; background: var(--surface); border-radius: 14px; padding: 8px; }
.icon-btn { width: 52px; height: 52px; border-radius: 12px; border: 0; background: var(--lia-bg); display: grid; place-items: center; }
.icon-btn svg { width: 34px; height: 34px; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.icon-grid .icon-btn[aria-pressed="true"] { box-shadow: inset 0 0 0 3px var(--lia); }
.mini { background: none; border: 0; color: var(--muted); padding: 6px; font-size: 18px; line-height: 1; }

/* Personen-Verwaltung */
.person { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; background: var(--surface); border-radius: 14px; padding: 10px; border: 0; width: 100%; text-align: left; }
.person .av { width: 56px; height: 56px; font-size: 20px; border: 0; }
.avatar-edit { display: grid; justify-items: center; gap: 8px; }
.avatar-edit .av { width: 110px; height: 110px; font-size: 40px; border: 0; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors button { width: 38px; height: 38px; border-radius: 50%; border: 3px solid transparent; }
.colors button[aria-pressed="true"] { border-color: var(--ink); }
.code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 10px; border-radius: 10px; overflow-wrap: anywhere; }

/* Meldungen */
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom, 0px) + 110px); z-index: 60; background: var(--ink); color: var(--bg); padding: 12px 18px; border-radius: 14px; font-size: 15px; max-width: calc(100% - 32px); box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.error { background: var(--alert); color: #fff; }

.login { max-width: 380px; margin: 12vh auto 0; display: grid; gap: 14px; padding: 0 16px; }
.login h1 { font-size: 34px; }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
