/* Familienkalender – Gestaltung nach dem Mockup (helle Flächen, Personenfarben als Akzent) */

@font-face {
  font-family: 'Figtree';
  src: url('../fonts/figtree.woff2') format('woff2');
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --grund: #F3F4F6;
  --flaeche: #FFFFFF;
  --text: #172033;
  --text-2: #5B6474;
  --text-3: #4B5563;
  --linie: #E3E6EB;
  --linie-2: #EEF0F3;
  --rahmen: #DDE1E7;
  --feld: #F1F3F6;
  --akzent: #1E3A8A;
  --gefahr: #A3261B;
  --gefahr-hell: #FFF6F5;
  --gold-hell: #FDF1D6;
  --gold: #7A4A00;
  --radius: 16px;
  --tabs-h: 64px;
  --unten: env(safe-area-inset-bottom, 0px);
  --oben: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--grund);
  color: var(--text);
  font-family: 'Figtree', system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
body.sheet-offen { overflow: hidden; }
a { color: var(--akzent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #2563EB; outline-offset: 2px; }
h1, h2 { margin: 0; }

.leise { color: var(--text-2); font-weight: 500; }
.klein { font-size: 13px; margin: 0; }
.leer { padding: 32px 16px; text-align: center; color: var(--text-2); }

.ansicht { padding-bottom: calc(var(--tabs-h) + var(--unten) + 24px); min-height: 100vh; max-width: 720px; margin: 0 auto; }

/* ---------- Kopf ---------- */
.kopf {
  position: sticky; top: 0; z-index: 10;
  background: var(--flaeche);
  border-bottom: 1px solid var(--linie);
  padding: calc(var(--oben) + 14px) 16px 12px;
  display: flex; flex-direction: column; gap: 12px;
}
.kopf-zeile { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.kopf-titel { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kopf h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; white-space: nowrap; }
.kopf h1 .leise { font-size: 18px; }
.ueber { font-size: 13px; font-weight: 600; color: var(--text-2); }
.kopf-knoepfe { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* ---------- Knöpfe ---------- */
.icon-knopf {
  width: 44px; height: 44px; border-radius: 12px; border: none; background: none;
  display: inline-flex; align-items: center; justify-content: center; color: var(--text); text-decoration: none; flex-shrink: 0;
}
.icon-knopf.rahmen { border: 1px solid var(--rahmen); background: var(--flaeche); }
.icon-knopf.klein { width: 40px; height: 40px; color: var(--text-2); }
.icon-knopf.klein svg { width: 20px; height: 20px; }
.knopf {
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: none;
  background: var(--text); color: #fff; font-weight: 700; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none;
}
.knopf.rahmen { background: var(--flaeche); color: var(--text); border: 1px solid var(--rahmen); padding: 0 14px; }
.knopf.breit { width: 100%; min-height: 50px; border-radius: 14px; font-size: 16px; }
.knopf.leise { background: var(--flaeche); color: var(--text); border: 1px solid var(--rahmen); }
.knopf.gefahr { background: var(--flaeche); color: var(--gefahr); }
.knopf.gefahr-voll { background: var(--gefahr); color: #fff; }
.knopf:disabled { opacity: 0.55; }
.knopf-stapel { display: flex; flex-direction: column; gap: 10px; }

/* ---------- Filter-Chips ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  height: 36px; padding: 0 12px 0 10px; border-radius: 18px; border: 1px solid var(--rahmen);
  background: var(--flaeche); font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; flex-shrink: 0;
}
.chip:first-child { padding: 0 14px; }
.chip.an { background: var(--text); color: #fff; border-color: var(--text); }
.punkt { width: 12px; height: 12px; border-radius: 6px; display: inline-block; flex-shrink: 0; }

/* ---------- Woche ---------- */
.tage { padding: 8px 12px; display: flex; flex-direction: column; gap: 10px; }
.tag { background: var(--flaeche); border-radius: var(--radius); padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 8px; scroll-margin-top: 140px; }
.tag.heute { box-shadow: inset 0 0 0 2px var(--text); }
.tag-kopf { display: flex; justify-content: space-between; align-items: center; margin-right: -6px; }
.tag-kopf h2 { font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.heute-marke { background: var(--text); color: #fff; border-radius: 8px; padding: 2px 8px; }
.heute-text { font-size: 13px; color: var(--text-2); font-weight: 700; }
.keine { margin: 0; font-size: 14px; color: var(--text-2); }

.streifen {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
}
.streifen svg { flex-shrink: 0; }
.streifen.geburtstag { background: var(--gold-hell); color: var(--gold); }

.termin { display: flex; gap: 10px; text-decoration: none; color: var(--text); }
.termin-zeit { width: 44px; flex-shrink: 0; padding-top: 10px; font-size: 13px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; }
.termin-karte { flex: 1; min-width: 0; border-radius: 12px; padding: 9px 12px; display: flex; flex-direction: column; gap: 3px; }
.termin-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.termin-titel { font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.termin-meta { font-size: 13px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.fehlt {
  display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 8px; background: #fff;
  border: 1.5px dashed var(--gefahr); color: var(--gefahr); font-weight: 700;
}
.sync-warnung { color: var(--gefahr); display: inline-flex; }
.sync-laeuft { color: var(--text-2); display: inline-flex; opacity: 0.8; }
.alle-pill { font-size: 12px; font-weight: 800; color: #fff; background: var(--text); border-radius: 11px; padding: 3px 8px; flex-shrink: 0; }

.avatar {
  border-radius: 50%; color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; line-height: 1; text-transform: uppercase;
}
.avatar-stapel { display: inline-flex; flex-shrink: 0; }
.avatar-stapel .avatar + .avatar { margin-left: -6px; }
.avatar-stapel .avatar { box-shadow: 0 0 0 2px #fff !important; }
.leer-avatar { background: var(--feld); color: var(--text-2); }

.fab {
  position: fixed; right: max(16px, calc(50vw - 344px)); bottom: calc(var(--tabs-h) + var(--unten) + 16px);
  width: 58px; height: 58px; border-radius: 29px; background: var(--text); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(23, 32, 51, 0.28); z-index: 5;
}

/* ---------- Tab-Leiste ---------- */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--tabs-h) + var(--unten)); padding-bottom: var(--unten);
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--linie);
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--text-2); font-size: 12px; font-weight: 600; }
.tabs a.aktiv { color: var(--text); font-weight: 800; }

/* ---------- Seiten (Detail, Editor) ---------- */
.seite { padding: 0 12px 24px; display: flex; flex-direction: column; gap: 12px; }
.leiste {
  position: sticky; top: 0; z-index: 10; margin: 0 -12px; padding: calc(var(--oben) + 8px) 8px 8px;
  background: var(--flaeche); display: flex; justify-content: space-between; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--linie);
}
.zurueck { height: 44px; padding: 0 8px; display: inline-flex; align-items: center; gap: 2px; text-decoration: none; color: var(--text); font-size: 16px; font-weight: 600; }
.leiste-aktion { height: 44px; padding: 0 12px; border: none; background: none; display: inline-flex; align-items: center; text-decoration: none; color: var(--akzent); font-size: 16px; font-weight: 800; }
.leiste-aktion.leicht { font-weight: 600; }
.leiste-aktion:disabled { opacity: 0.5; }
.leiste-titel { font-size: 17px; font-weight: 800; }

.detail-kopf { background: var(--flaeche); margin: -12px -12px 0; padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--linie); }
.detail-kopf h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.thema-chip { align-self: flex-start; font-size: 12px; font-weight: 800; color: var(--text-3); background: var(--feld); border-radius: 6px; padding: 3px 8px; }
.detail-zeit { margin: 0; font-size: 16px; color: #374151; }
.detail-serie { margin: 0; font-size: 14px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }

.hinweis-box { margin: 0; display: flex; gap: 8px; align-items: flex-start; background: var(--flaeche); border-radius: 12px; padding: 10px 12px; font-size: 14px; color: var(--text-3); }
.hinweis-box svg { flex-shrink: 0; margin-top: 1px; }
.hinweis-box.warnung { background: var(--gefahr-hell); color: var(--gefahr); }

.karte { background: var(--flaeche); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 10px; border: none; margin: 0; min-width: 0; }
.karte.liste { padding: 4px 14px; gap: 0; }
.zeile { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; border-bottom: 1px solid var(--linie-2); }
.zeile:last-child { border-bottom: none; }
.zeile-label { font-size: 15px; color: var(--text-2); flex-shrink: 0; }
.zeile-wert { font-size: 15px; font-weight: 600; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 12px; text-align: right; min-width: 0; }
.zeile-wert.link { color: var(--akzent); text-decoration: none; overflow-wrap: anywhere; }
.person-mini { display: inline-flex; align-items: center; gap: 6px; }
.abschnitt { font-size: 13px; font-weight: 800; color: var(--text-2); letter-spacing: 0.04em; text-transform: uppercase; }
.fahrten { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.fahrt {
  min-height: 72px; border-radius: 12px; border: 1px solid var(--rahmen); background: var(--flaeche);
  text-align: left; padding: 10px 12px; display: flex; flex-direction: column; gap: 4px;
}
.fahrt.offen { border: 2px dashed var(--gefahr); background: var(--gefahr-hell); }
.fahrt.offen .fahrt-wert { color: var(--gefahr); }
.fahrt-label { font-size: 13px; color: var(--text-2); font-weight: 600; }
.fahrt-wert { font-size: 16px; font-weight: 800; display: flex; align-items: center; gap: 6px; }
.notiz { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.hinweis { margin: 0 0 16px; color: var(--text-3); }

/* ---------- Formulare ---------- */
.feld { display: flex; flex-direction: column; gap: 6px; }
.feld-label { font-size: 12px; font-weight: 700; color: var(--text-2); padding: 0; }
.feld-label.abstand { margin-top: 6px; }
.eingabe {
  width: 100%; min-height: 44px; border-radius: 10px; border: 1px solid var(--rahmen); background: var(--flaeche);
  padding: 8px 12px; font-size: 16px;
}
.eingabe.gross { border: none; padding: 2px 0; font-size: 20px; font-weight: 700; min-height: 36px; }
.eingabe.gross:focus { outline: none; }
.eingabe.klein { width: auto; min-height: 36px; border: none; background: var(--feld); font-weight: 600; padding: 4px 10px; }
textarea.eingabe { resize: vertical; }
.zeit-paar { display: inline-flex; align-items: center; gap: 6px; }
.schalter { width: 24px; height: 24px; accent-color: var(--text); }
.feld-karte { padding: 12px 14px 14px; }
fieldset.karte legend, fieldset.ohne-rahmen legend { float: left; width: 100%; margin-bottom: 8px; }
fieldset.ohne-rahmen { border: none; margin: 0; padding: 0; min-width: 0; }
.personen-raster { clear: both; display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; }
.person-wahl {
  min-height: 64px; border-radius: 12px; border: 1px solid var(--rahmen); background: var(--flaeche);
  font-size: 13px; font-weight: 600; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 6px;
}
.person-wahl.an { border-width: 2px; background: var(--feld); font-weight: 800; }
.segmente { clear: both; display: flex; flex-wrap: wrap; gap: 4px; background: var(--feld); border-radius: 12px; padding: 4px; }
.segmente button { flex: 1 1 auto; min-height: 40px; border-radius: 9px; border: none; background: transparent; font-size: 14px; font-weight: 600; color: #374151; padding: 0 10px; }
.segmente button.an { background: var(--flaeche); font-weight: 800; color: var(--text); box-shadow: 0 1px 3px rgba(23, 32, 51, 0.15); }
.formular { display: flex; flex-direction: column; gap: 14px; }
.zwei-spalten { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.drei-spalten { display: grid; grid-template-columns: 0.8fr 1.6fr 1fr; gap: 10px; }
.fehler { color: var(--gefahr); margin: 0; font-weight: 600; }
.fehler-leiste { margin: 8px 12px; padding: 10px 12px; border-radius: 12px; background: var(--gefahr-hell); color: var(--gefahr); font-weight: 600; }
.info-leiste { margin: 0; padding: calc(var(--oben) + 8px) 16px 8px; background: var(--gold-hell); color: var(--gold); font-size: 13px; font-weight: 600; }

/* ---------- Auswahl-Listen (Sheets) ---------- */
.auswahl-liste { display: flex; flex-direction: column; gap: 6px; }
.auswahl { min-height: 52px; border-radius: 12px; border: 1px solid var(--rahmen); background: var(--flaeche); display: flex; align-items: center; gap: 12px; padding: 8px 12px; font-size: 16px; font-weight: 600; text-align: left; }
.auswahl.an { border: 2px solid var(--text); font-weight: 800; }

/* ---------- Monat ---------- */
.raster-kopf, .raster { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.raster-kopf { padding: 10px 8px 4px; font-size: 12px; font-weight: 700; color: var(--text-2); text-align: center; }
.raster { gap: 4px; padding: 0 8px 8px; }
.zelle {
  min-height: 64px; background: var(--flaeche); border-radius: 10px; padding: 6px 4px; text-decoration: none; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.zelle.anders { background: transparent; color: #9AA2AF; }
.zelle.heute .zahl { background: var(--text); color: #fff; }
.zahl { font-size: 14px; font-weight: 700; width: 26px; height: 26px; border-radius: 13px; display: flex; align-items: center; justify-content: center; }
.punkte { display: flex; gap: 3px; flex-wrap: wrap; justify-content: center; }
.punkte .punkt { width: 7px; height: 7px; }
.zelle-band { display: flex; gap: 2px; color: var(--gold); }
.zelle-band svg { width: 12px; height: 12px; }

/* ---------- Familie ---------- */
.familie .kopf h1 { font-size: 26px; }
.seite-inhalt { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.personen-uebersicht { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.person-gross { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; text-align: center; }
.liste-karte { gap: 0; padding: 14px 6px 6px 14px; }
.abschnitt-kopf { display: flex; justify-content: space-between; align-items: center; padding-bottom: 4px; }
.abschnitt-kopf .icon-knopf { color: var(--akzent); }
.listen-zeile {
  display: flex; align-items: center; gap: 12px; min-height: 58px; border: none; border-top: 1px solid var(--linie-2);
  background: none; text-align: left; padding: 6px 8px 6px 0; width: 100%;
}
.balken { display: flex; flex-direction: column; gap: 2px; width: 6px; height: 36px; flex-shrink: 0; }
.balken span { flex: 1; border-radius: 3px; }
.listen-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 15px; }
.listen-text .leise { font-size: 13px; }
.datum-block { width: 44px; flex-shrink: 0; text-align: center; display: flex; flex-direction: column; font-size: 18px; }
.datum-block span { font-size: 11px; font-weight: 700; color: var(--text-2); }
.wann { font-size: 12px; font-weight: 600; color: var(--text-2); flex-shrink: 0; }
.wann.bald { font-weight: 800; color: var(--gold); background: var(--gold-hell); border-radius: 8px; padding: 4px 8px; }
.konto { display: flex; flex-direction: column; gap: 10px; padding: 8px 0; }

/* ---------- Anmeldung ---------- */
.login { max-width: 400px; margin: 0 auto; padding: calc(var(--oben) + 48px) 20px 32px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.login form { display: flex; flex-direction: column; gap: 14px; text-align: left; margin-top: 8px; }
.login-logo { border-radius: 18px; align-self: center; }
.login h1 { font-size: 28px; font-weight: 800; }
.login p { margin: 0; color: var(--text-2); }

/* ---------- Sheet, Toast, Update ---------- */
.sheet-hintergrund { position: fixed; inset: 0; z-index: 50; background: rgba(23, 32, 51, 0.35); display: flex; align-items: flex-end; justify-content: center; }
.sheet {
  background: var(--grund); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 8px 16px calc(20px + var(--unten));
  animation: hoch 0.18s ease-out;
}
@keyframes hoch { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-kopf { display: flex; justify-content: space-between; align-items: center; padding: 4px 0 8px; position: sticky; top: -8px; background: var(--grund); }
.sheet-kopf h2 { font-size: 18px; font-weight: 800; }
.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabs-h) + var(--unten) + 12px); z-index: 60; max-width: 520px; margin: 0 auto;
  background: var(--text); color: #fff; border-radius: 14px; padding: 12px 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  font-weight: 600; box-shadow: 0 8px 24px rgba(23, 32, 51, 0.3);
}
.toast button { border: none; background: none; color: #A9C4FF; font-weight: 800; min-height: 36px; }
.update-hinweis {
  position: fixed; left: 12px; right: 12px; top: calc(var(--oben) + 8px); z-index: 70; max-width: 520px; margin: 0 auto;
  background: var(--flaeche); border: 1px solid var(--rahmen); border-radius: 14px; padding: 8px 8px 8px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px; font-weight: 600; box-shadow: 0 8px 24px rgba(23, 32, 51, 0.15);
}
.update-hinweis button { border: none; background: var(--text); color: #fff; border-radius: 10px; min-height: 40px; padding: 0 14px; font-weight: 700; }

@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } }

/* ---------- Verwaltung ---------- */
.seiten-kopf { background: var(--flaeche); margin: -12px -12px 0; padding: 0 16px 16px; border-bottom: 1px solid var(--linie); display: flex; flex-direction: column; gap: 4px; }
.seiten-kopf h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; }
.seiten-kopf p { margin: 0; font-size: 14px; }
.block { display: flex; flex-direction: column; gap: 6px; }
.einzug { padding: 0 6px; }
.link-zeile { text-decoration: none; color: var(--text); min-height: 68px; }
.zeile-text { flex: 1; display: flex; flex-direction: column; gap: 2px; min-width: 0; font-size: 15px; }
.zeile-text .leise { font-size: 13px; overflow-wrap: anywhere; }
.pfeil { color: #9AA2AF; display: inline-flex; }
.pfeil svg { width: 18px; height: 18px; }
.status { font-size: 12px; font-weight: 700; border-radius: 8px; padding: 3px 8px; flex-shrink: 0; }
.status.gruen { color: #0A5A52; background: #DDF3F0; }
.status.gelb { color: var(--gold); background: var(--gold-hell); }
.status.grau { color: var(--text-3); background: var(--feld); }
.status.rot { color: var(--gefahr); background: var(--gefahr-hell); }
.knopf.gestrichelt { background: transparent; color: var(--akzent); border: 1.5px dashed #9AA2AF; }
.foto-bereich { background: var(--flaeche); margin: -12px -12px 0; padding: 16px 16px 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; border-bottom: 1px solid var(--linie); }
.foto-gross { width: 112px; height: 112px; border-radius: 56px; object-fit: cover; }
.foto-knoepfe { display: flex; gap: 8px; }
.klein-knopf { min-height: 40px; font-size: 14px; padding: 0 14px; }
.foto-bereich .klein { text-align: center; }
.unsichtbar { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.farben { clear: both; display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.farbe { height: 38px; border-radius: 19px; border: none; display: flex; align-items: center; justify-content: center; padding: 0; }
.farbe:disabled { cursor: not-allowed; }
.rollen-liste { padding-left: 18px; display: flex; flex-direction: column; gap: 3px; }
.knopf-reihe { gap: 8px; justify-content: flex-start; padding: 8px 0; }
.knopf-reihe .knopf { flex: 1; }
.karte.liste .zeile > .knopf.breit { margin: 8px 0; }
.login-avatar { width: 72px; height: 72px; font-size: 32px; align-self: center; }

/* ---------- Mitteilungen ---------- */
.zeile.ohne-linie { border-bottom: none; min-height: 44px; }
.zeile-label.dunkel { color: var(--text); font-weight: 600; }

/* ---------- Claude-Zugang ---------- */
.adresse { display: block; background: var(--feld); border-radius: 10px; padding: 10px 12px; font-size: 13px; overflow-wrap: anywhere; color: var(--text-3); }
