/* Familienapp – Optik angelehnt an iOS (Systemschrift, gruppierte Listen, Tab-Leiste). Keine fremden Schriften. */
:root {
  --hg: #f2f2f7;
  --karte: #ffffff;
  --karte-2: #f2f2f7;
  --text: #000000;
  --text-2: rgba(60, 60, 67, .6);
  --text-3: rgba(60, 60, 67, .3);
  --linie: rgba(60, 60, 67, .2);
  --fuell: rgba(118, 118, 128, .12);
  --blau: #007aff;
  --rot: #ff3b30;
  --gruen: #34c759;
  --orange: #ff9500;
  --leiste: rgba(249, 249, 249, .86);
  --schatten: 0 10px 40px rgba(0, 0, 0, .18);
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-color-scheme: dark) {
  :root {
    --hg: #000000;
    --karte: #1c1c1e;
    --karte-2: #2c2c2e;
    --text: #ffffff;
    --text-2: rgba(235, 235, 245, .6);
    --text-3: rgba(235, 235, 245, .3);
    --linie: rgba(84, 84, 88, .6);
    --fuell: rgba(118, 118, 128, .24);
    --blau: #0a84ff;
    --rot: #ff453a;
    --gruen: #30d158;
    --orange: #ff9f0a;
    --leiste: rgba(22, 22, 24, .86);
    --schatten: 0 10px 40px rgba(0, 0, 0, .6);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px; line-height: 1.3; letter-spacing: -.01em;
  background: var(--hg); color: var(--text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
a { color: var(--blau); text-decoration: none; }
.versteckt { display: none !important; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

/* ---------- Gerüst */
#inhalt { max-width: 720px; margin: 0 auto; padding: env(safe-area-inset-top) 16px calc(96px + env(safe-area-inset-bottom)); }
.navleiste {
  position: sticky; top: 0; z-index: 10; margin: 0 -16px; padding: calc(env(safe-area-inset-top) + 6px) 16px 6px;
  display: flex; align-items: center; gap: 8px; min-height: 44px;
  background: var(--hg);
}
.navleiste.unscharf { background: var(--leiste); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px); border-bottom: .5px solid var(--linie); }
.navleiste .mitte { flex: 1; text-align: center; font-weight: 600; opacity: 0; transition: opacity .2s; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.navleiste.unscharf .mitte { opacity: 1; }
.navleiste .links, .navleiste .rechts { display: flex; gap: 4px; min-width: 70px; align-items: center; }
.navleiste .rechts { justify-content: flex-end; }
.gross { font-size: 34px; font-weight: 700; letter-spacing: .01em; margin: 2px 0 10px; line-height: 1.15; }
.untertitel { color: var(--text-2); font-size: 15px; margin: -8px 0 14px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: center;
  background: var(--leiste); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--linie); padding-bottom: env(safe-area-inset-bottom);
}
.tabs a {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 7px 0 5px; font-size: 10.5px; font-weight: 500; color: #8e8e93; position: relative; letter-spacing: 0;
}
.tabs a svg.i { width: 26px; height: 26px; stroke-width: 1.7; }
.tabs a.aktiv { color: var(--blau); }
.tabs a.aktiv svg.i { stroke-width: 2.1; }
.tabs .zahl { position: absolute; top: 2px; left: calc(50% + 6px); }

/* ---------- Knöpfe */
.knopf-text { background: none; border: 0; color: var(--blau); padding: 8px 6px; cursor: pointer; font-size: 17px; display: inline-flex; align-items: center; gap: 4px; }
.knopf-text:disabled { color: var(--text-3); }
.knopf-text.fett { font-weight: 600; }
.knopf-text.rot { color: var(--rot); }
.knopf-rund { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--fuell); color: var(--blau); display: inline-grid; place-items: center; cursor: pointer; padding: 0; }
.knopf-rund svg.i { width: 20px; height: 20px; stroke-width: 2.2; }
.knopf {
  display: flex; width: 100%; justify-content: center; align-items: center; gap: 6px; border: 0; cursor: pointer;
  background: var(--blau); color: #fff; font-weight: 600; font-size: 17px; border-radius: 12px; padding: 14px 16px; min-height: 50px;
}
.knopf:active { opacity: .75; }
.knopf.hell { background: var(--fuell); color: var(--blau); }
.knopf.rot { background: var(--fuell); color: var(--rot); }
.knopf:disabled { opacity: .45; }

/* ---------- Gruppierte Listen */
.abschnitt { margin: 22px 4px 6px 16px; font-size: 13px; color: var(--text-2); text-transform: uppercase; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.abschnitt .rechts { margin-left: auto; text-transform: none; font-size: 15px; letter-spacing: 0; }
.fuss-text { margin: 6px 16px 0; font-size: 13px; color: var(--text-2); }
.gruppe { background: var(--karte); border-radius: 12px; overflow: hidden; }
.zelle {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 10px 16px; position: relative;
  background: var(--karte); color: var(--text); width: 100%; border: 0; text-align: left; font-size: 17px;
}
button.zelle, a.zelle, .zelle.klickbar { cursor: pointer; }
button.zelle:active, a.zelle:active, .zelle.klickbar:active { background: var(--karte-2); }
.zelle + .zelle::before { content: ""; position: absolute; top: 0; right: 0; left: 16px; border-top: .5px solid var(--linie); }
.zelle.mit-icon + .zelle::before, .zelle + .zelle.mit-icon::before { left: 58px; }
.zelle .haupt { flex: 1; min-width: 0; }
.zelle .titel { overflow: hidden; text-overflow: ellipsis; }
.zelle .unter { color: var(--text-2); font-size: 15px; margin-top: 1px; }
.zelle .wert { color: var(--text-2); white-space: nowrap; }
.zelle .pfeil { color: var(--text-3); width: 14px; height: 14px; stroke-width: 2.6; }
.zelle.rot, .zelle.rot .titel { color: var(--rot); }
.zelle.blau, .zelle.blau .titel { color: var(--blau); }
.zelle.mittig { justify-content: center; }
.symbol { width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.symbol svg.i { width: 19px; height: 19px; stroke-width: 2; }
.leer { color: var(--text-2); text-align: center; padding: 28px 16px; font-size: 15px; }

.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 16px; flex-shrink: 0; letter-spacing: 0; }
.avatar.klein { width: 24px; height: 24px; font-size: 11px; }
.punkt { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.zahl { background: var(--rot); color: #fff; border-radius: 99px; font-size: 12px; font-weight: 600; min-width: 18px; height: 18px; padding: 0 5px; display: inline-grid; place-items: center; letter-spacing: 0; }
.marke { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: var(--fuell); color: var(--text-2); }
.marke.blau { background: color-mix(in srgb, var(--blau) 15%, transparent); color: var(--blau); }
.marke.orange { background: color-mix(in srgb, var(--orange) 18%, transparent); color: var(--orange); }

/* ---------- Formulare in Listen */
.zelle input[type=text], .zelle input[type=password], .zelle input[type=date], .zelle input[type=time],
.zelle input[type=number], .zelle select, .zelle textarea, .zelle input[type=search] {
  border: 0; background: none; outline: none; padding: 0; min-width: 0; font-size: 17px;
}
.zelle .eingabe { flex: 1; width: 100%; }
.zelle .eingabe-rechts { text-align: right; color: var(--text-2); flex: 1; }
.zelle select { -webkit-appearance: none; appearance: none; text-align: right; text-align-last: right; color: var(--text-2); cursor: pointer; flex: 1; }
.zelle textarea { flex: 1; min-height: 80px; resize: vertical; }
.zelle input[type=date], .zelle input[type=time] { background: var(--fuell); border-radius: 7px; padding: 5px 9px; color: var(--text); font-size: 17px; min-height: 34px; }
.zelle .beschriftung { min-width: 110px; }
input::placeholder, textarea::placeholder { color: var(--text-3); }

/* iOS-Schalter */
input.schalter { -webkit-appearance: none; appearance: none; width: 51px; height: 31px; border-radius: 99px; background: var(--fuell); position: relative; cursor: pointer; flex-shrink: 0; transition: background .2s; margin: 0; }
input.schalter::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15), 0 1px 1px rgba(0,0,0,.16); transition: transform .2s; }
input.schalter:checked { background: var(--gruen); }
input.schalter:checked::after { transform: translateX(20px); }

/* Segment-Auswahl */
.segmente { display: flex; background: var(--fuell); border-radius: 9px; padding: 2px; gap: 2px; margin: 4px 0 12px; }
.segmente button { flex: 1; border: 0; background: none; padding: 6px 4px; border-radius: 7px; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--text); }
.segmente button.aktiv { background: var(--karte); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 3px 1px rgba(0,0,0,.04); font-weight: 600; }
@media (prefers-color-scheme: dark) { .segmente button.aktiv { background: #636366; } }

/* Auswahl-Chips (Personen, Erinnerungen) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 16px 12px; }
.chip { border: 0; border-radius: 99px; padding: 7px 13px; background: var(--fuell); cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; color: var(--text); }
.chip.an { background: var(--blau); color: #fff; }
.farben { display: flex; gap: 12px; flex-wrap: wrap; padding: 12px 16px; }
.farben button { width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer; box-shadow: inset 0 0 0 0 transparent; }
.farben button.an { box-shadow: 0 0 0 3px var(--karte), 0 0 0 5px currentColor; }

/* ---------- Blatt (Sheet von unten) und Aktionsblatt */
.blatt-hg { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; animation: einblenden .25s ease; }
.blatt {
  background: var(--hg); width: 100%; max-width: 640px; max-height: calc(100vh - env(safe-area-inset-top) - 12px); overflow-y: auto;
  border-radius: 14px 14px 0 0; padding: 0 16px calc(28px + env(safe-area-inset-bottom)); animation: hoch .32s cubic-bezier(.2,.9,.3,1);
  overscroll-behavior: contain;
}
.blatt-kopf { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; margin: 0 -16px 8px; padding: 8px 8px; background: var(--hg); }
.blatt-kopf::before { content: ""; position: absolute; top: 5px; left: 50%; width: 36px; height: 5px; margin-left: -18px; border-radius: 3px; background: var(--text-3); }
.blatt-kopf .mitte { flex: 1; text-align: center; font-weight: 600; padding-top: 6px; }
.blatt-kopf .knopf-text { min-width: 90px; padding-top: 14px; }
.blatt-kopf .knopf-text:last-child { justify-content: flex-end; }
@media (min-width: 700px) {
  .blatt-hg { align-items: center; }
  .blatt { border-radius: 14px; max-height: 86vh; box-shadow: var(--schatten); }
  .blatt-kopf::before { display: none; }
}
.aktion-hg { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.35); display: flex; align-items: flex-end; justify-content: center; padding: 0 8px calc(8px + env(safe-area-inset-bottom)); animation: einblenden .2s ease; }
.aktion { width: 100%; max-width: 420px; animation: hoch .28s cubic-bezier(.2,.9,.3,1); }
.aktion .teil { background: var(--leiste); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); border-radius: 14px; overflow: hidden; margin-top: 8px; }
.aktion .frage { padding: 14px 16px; text-align: center; font-size: 13px; color: var(--text-2); border-bottom: .5px solid var(--linie); }
.aktion button { display: block; width: 100%; border: 0; background: none; padding: 17px; font-size: 20px; color: var(--blau); cursor: pointer; }
.aktion button + button { border-top: .5px solid var(--linie); }
.aktion button.rot { color: var(--rot); }
.aktion button.fett { font-weight: 600; }
@media (min-width: 700px) { .aktion-hg { align-items: center; } }
@keyframes hoch { from { transform: translateY(100%); } to { transform: none; } }
@keyframes einblenden { from { background: rgba(0,0,0,0); } }

.meldung {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 10px); transform: translateX(-50%); z-index: 80;
  background: var(--leiste); -webkit-backdrop-filter: blur(30px); backdrop-filter: blur(30px); color: var(--text);
  padding: 12px 18px; border-radius: 99px; font-size: 15px; font-weight: 500; box-shadow: var(--schatten); max-width: 92vw; text-align: center;
  animation: runter .3s cubic-bezier(.2,.9,.3,1);
}
.meldung.rot { color: var(--rot); }
@keyframes runter { from { transform: translate(-50%, -150%); } }

/* ---------- Anmeldung */
.login { max-width: 400px; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 9vh) 16px 40px; text-align: center; }
.login .app-icon { width: 88px; height: 88px; border-radius: 20px; box-shadow: 0 6px 20px rgba(0,0,0,.15); }
.login h1 { font-size: 28px; margin: 18px 0 6px; }
.login p { color: var(--text-2); margin: 0 0 24px; font-size: 15px; }
.login .gruppe { text-align: left; margin-bottom: 14px; }
.login .fehler { color: var(--rot); font-size: 15px; min-height: 22px; margin-bottom: 8px; }

/* ---------- Start */
.hinweis-karte { background: var(--karte); border-radius: 12px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 4px; }
.hinweis-karte b { display: block; margin-bottom: 2px; }
.hinweis-karte .unter { color: var(--text-2); font-size: 15px; }
.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kachel { background: var(--karte); border-radius: 12px; padding: 12px 14px; display: block; color: var(--text); }
.kachel .oben { display: flex; justify-content: space-between; align-items: flex-start; }
.kachel .gross-zahl { font-size: 28px; font-weight: 700; }
.kachel .name { color: var(--text-2); font-weight: 600; font-size: 15px; margin-top: 6px; }

/* ---------- Einkaufsliste */
.eingabe-zeile { display: flex; gap: 8px; align-items: center; background: var(--karte); border-radius: 12px; padding: 6px 6px 6px 16px; }
.eingabe-zeile input { flex: 1; border: 0; background: none; outline: none; font-size: 17px; min-width: 0; padding: 8px 0; }
.eingabe-zeile input.menge { flex: 0 0 74px; text-align: right; color: var(--text-2); }
.kreis { width: 24px; height: 24px; border-radius: 50%; border: 1.6px solid var(--text-3); flex-shrink: 0; display: grid; place-items: center; background: none; padding: 0; cursor: pointer; transition: all .15s; }
.kreis svg { width: 14px; height: 14px; stroke: #fff; stroke-width: 3; fill: none; opacity: 0; }
.erledigt .kreis { background: var(--blau); border-color: var(--blau); }
.erledigt .kreis svg { opacity: 1; }
.erledigt .titel { color: var(--text-2); text-decoration: line-through; }
.artikel .menge { color: var(--text-2); font-size: 15px; white-space: nowrap; }

/* ---------- Kalender */
.monat-kopf { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 6px; }
.monat-kopf h2 { margin: 0; font-size: 22px; font-weight: 700; }
.monat-kopf h2 span { color: var(--rot); }
.monat { background: var(--karte); border-radius: 12px; padding: 8px 6px 10px; }
.monat .wt { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; font-size: 12px; color: var(--text-2); font-weight: 600; padding-bottom: 4px; }
.monat .tage { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 2px; }
.monat .tag { border: 0; background: none; padding: 3px 0 4px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: 48px; color: var(--text); }
.monat .tag .nr { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 19px; }
.monat .tag.fremd .nr { color: var(--text-3); }
.monat .tag.we .nr { color: var(--text-2); }
.monat .tag.heute .nr { color: var(--rot); font-weight: 600; }
.monat .tag.gewaehlt .nr { background: var(--text); color: var(--karte); font-weight: 600; }
.monat .tag.heute.gewaehlt .nr { background: var(--rot); color: #fff; }
.monat .punkte { display: flex; gap: 3px; height: 6px; }
.monat .punkte i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.termin-zeile .balken { width: 4px; align-self: stretch; border-radius: 2px; flex-shrink: 0; }
.termin-zeile .zeit { width: 54px; flex-shrink: 0; font-size: 14px; color: var(--text-2); text-align: right; line-height: 1.25; font-variant-numeric: tabular-nums; }
.termin-zeile .zeit b { color: var(--text); font-weight: 500; display: block; }
.personen { display: flex; gap: 3px; }
.detail-titel { font-size: 24px; font-weight: 700; margin: 6px 4px 4px; }
.detail-unter { color: var(--text-2); margin: 0 4px 14px; font-size: 16px; line-height: 1.4; }

/* ---------- Druckansicht der Einkaufsliste */
#druck { display: none; }
@media print {
  @page { size: A4; margin: 15mm; }
  body { background: #fff; color: #000; }
  body > *:not(#druck) { display: none !important; }
  #druck { display: block !important; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; font-size: 12pt; }
  #druck h1 { font-size: 20pt; margin: 0 0 2mm; }
  #druck .datum { color: #555; margin-bottom: 6mm; }
  #druck .spalten { column-count: 2; column-gap: 12mm; }
  #druck h2 { font-size: 11pt; text-transform: uppercase; letter-spacing: .05em; color: #555; margin: 4mm 0 2mm; break-after: avoid; }
  #druck .posten { display: flex; gap: 3mm; align-items: center; padding: 1.6mm 0; border-bottom: .2mm solid #ddd; break-inside: avoid; }
  #druck .box { width: 4.5mm; height: 4.5mm; border: .35mm solid #000; border-radius: .8mm; flex-shrink: 0; }
  #druck .m { margin-left: auto; color: #555; }
}
