:root {
  --bg: #f2f2f7;
  --karte: #ffffff;
  --karte2: #f2f2f7;
  --text: #111114;
  --text2: #6b6b73;
  --text3: #a9a9b2;
  --linie: #e2e2e8;
  --akzent: #0a6cff;
  --akzent-text: #ffffff;
  --rot: #d93a34;
  --gruen: #1f9d55;
  --orange: #e8890c;
  --tuerkis: #0e9aa7;
  --fuellung: rgba(118, 118, 128, .14);
  --schatten: 0 10px 40px rgba(0, 0, 0, .18);
  --unten: env(safe-area-inset-bottom, 0px);
  --oben: env(safe-area-inset-top, 0px);
  --radius: 14px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --karte: #1c1c1e;
    --karte2: #2c2c2e;
    --text: #f5f5f7;
    --text2: #a1a1aa;
    --text3: #6b6b73;
    --linie: #2e2e33;
    --akzent: #3d8bff;
    --rot: #ff5a52;
    --gruen: #34c26b;
    --orange: #ffa531;
    --tuerkis: #3cc3cf;
    --fuellung: rgba(118, 118, 128, .26);
    --schatten: 0 10px 40px rgba(0, 0, 0, .6);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: .4; cursor: default; }
.zahl { font-variant-numeric: tabular-nums; }
.icon { width: 22px; height: 22px; flex: none; }

#app { min-height: 100%; display: flex; flex-direction: column; }
.start-lade { margin: auto; color: var(--text3); font-weight: 600; }

/* ---- Seitenaufbau ------------------------------------------------------ */
.seite {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: calc(var(--oben) + 8px) 16px calc(var(--unten) + 84px);
}
.kopf { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 10px 2px 12px; min-height: 58px; }
.kopf h1 { margin: 0; font-size: 32px; line-height: 1.1; font-weight: 800; letter-spacing: -.02em; }
.kopf-knopf { color: var(--akzent); width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; }
.kopf-knopf:active { background: var(--fuellung); }
.kopf-knopf .icon { width: 26px; height: 26px; }

.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  padding-bottom: var(--unten);
  background: color-mix(in srgb, var(--karte) 86%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--linie);
}
.tabs-innen { display: flex; width: 100%; max-width: 720px; }
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 2px 6px; color: var(--text2); font-size: 11px; font-weight: 500; }
.tab .icon { width: 25px; height: 25px; }
.tab.aktiv { color: var(--akzent); }

/* ---- Karten und Gruppen ------------------------------------------------ */
.karte { background: var(--karte); border-radius: var(--radius); }
.gruppe { margin: 0 0 22px; }
.gruppe-titel { font-size: 13px; text-transform: uppercase; letter-spacing: .02em; color: var(--text2); padding: 0 14px 7px; }
.gruppe-karte { background: var(--karte); border-radius: var(--radius); overflow: hidden; }
.gruppe-fuss { font-size: 13px; color: var(--text2); padding: 7px 14px 0; white-space: pre-line; }
.zeile { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 6px 14px; position: relative; }
.zeile + .zeile::before, .gruppe-karte > * + *::before { content: ""; position: absolute; left: 14px; right: 0; top: 0; border-top: 1px solid var(--linie); }
.gruppe-karte > * { position: relative; }
.zeile-text { flex: 0 1 auto; max-width: 72%; display: flex; align-items: center; gap: 10px; }
.zeile-text .icon { color: var(--akzent); }
.zeile-wert { flex: 1 0 auto; max-width: 70%; min-width: 0; display: flex; justify-content: flex-end; align-items: center; gap: 8px; color: var(--text2); text-align: right; }
.zeile.voll { display: block; padding: 10px 14px; }
.zeile-knopf { width: 100%; text-align: left; color: var(--akzent); display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 6px 14px; }
.zeile-knopf.rot { color: var(--rot); justify-content: center; }
.zeile-knopf:active { background: var(--fuellung); }
.zeile-hinweis { font-size: 13px; color: var(--text2); padding: 8px 14px 10px; }

input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="number"],
input[type="date"], input[type="datetime-local"], select, textarea {
  background: transparent; border: 0; outline: 0; min-width: 0; padding: 6px 0; border-radius: 0;
  -webkit-appearance: none; appearance: none;
}
.zeile-wert input, .zeile-wert select { text-align: right; width: 100%; color: var(--text); }
.zeile-wert select { text-align-last: right; padding-right: 2px; }
.zeile-wert input[type="datetime-local"], .zeile-wert input[type="date"] { width: auto; color: var(--akzent); }
input::placeholder, textarea::placeholder { color: var(--text3); }
textarea { width: 100%; resize: none; min-height: 46px; display: block; field-sizing: content; }
.feld-voll { width: 100%; text-align: left !important; }

.schalter {
  -webkit-appearance: none; appearance: none; width: 51px; height: 31px; border-radius: 16px; flex: none;
  background: var(--fuellung); position: relative; transition: background .18s; cursor: pointer; margin: 0;
}
.schalter::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: transform .18s;
}
.zeile-wert .schalter { width: 51px; }
.schalter:checked { background: var(--gruen); }
.schalter:checked::after { transform: translateX(20px); }

.stepper { display: inline-flex; align-items: center; gap: 0; }
.stepper-wert { color: var(--text2); margin-right: 10px; font-variant-numeric: tabular-nums; }
.stepper button { width: 46px; height: 32px; background: var(--fuellung); font-size: 20px; line-height: 1; color: var(--text); }
.stepper button:first-of-type { border-radius: 8px 0 0 8px; border-right: 1px solid var(--linie); }
.stepper button:last-of-type { border-radius: 0 8px 8px 0; }
.stepper button:active { background: var(--linie); }

.segment { display: flex; background: var(--fuellung); border-radius: 9px; padding: 2px; }
.segment button { flex: 1; padding: 6px 4px; border-radius: 7px; font-size: 14px; font-weight: 500; }
.segment button.aktiv { background: var(--karte); box-shadow: 0 1px 4px rgba(0, 0, 0, .14); font-weight: 600; }
@media (prefers-color-scheme: dark) { .segment button.aktiv { background: #636366; } }

.knopf {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  padding: 13px 16px; border-radius: 12px; background: var(--akzent); color: var(--akzent-text); font-weight: 700; font-size: 17px;
}
.knopf.rot { background: var(--rot); }
.knopf.leise { background: var(--fuellung); color: var(--akzent); }
.knopf:active { filter: brightness(.9); }

.leer { text-align: center; color: var(--text2); padding: 44px 24px; }
.leer .icon { width: 46px; height: 46px; color: var(--text3); margin-bottom: 10px; }
.leer b { display: block; color: var(--text); font-size: 20px; margin-bottom: 6px; }

/* ---- Sheets und Dialoge ------------------------------------------------ */
.kulisse {
  position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, 0); display: flex; align-items: flex-end; justify-content: center;
  transition: background .22s;
}
.kulisse.sichtbar { background: rgba(0, 0, 0, .4); }
.sheet {
  width: 100%; max-width: 640px; height: calc(100% - var(--oben) - 14px); background: var(--bg);
  border-radius: 16px 16px 0 0; display: flex; flex-direction: column; overflow: hidden;
  transform: translateY(100%); transition: transform .24s cubic-bezier(.2, .8, .2, 1); box-shadow: var(--schatten);
}
.kulisse.sichtbar .sheet { transform: none; }
.sheet-leiste { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: 12px 14px; background: var(--bg); border-bottom: 1px solid var(--linie); }
.sheet-titel { font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.leiste-knopf { color: var(--akzent); justify-self: start; padding: 4px 2px; }
.leiste-knopf.stark { font-weight: 700; justify-self: end; }
.sheet-koerper { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 16px calc(var(--unten) + 28px); }
@media (min-width: 700px) {
  .kulisse { align-items: center; }
  .sheet { height: min(86%, 820px); border-radius: 16px; }
}

.kulisse.aktion { align-items: flex-end; }
.aktionsblatt { width: 100%; max-width: 520px; padding: 0 8px calc(var(--unten) + 8px); transform: translateY(100%); transition: transform .2s; }
.kulisse.sichtbar .aktionsblatt { transform: none; }
.aktionsgruppe { background: var(--karte); border-radius: 14px; overflow: hidden; margin-top: 8px; }
.aktionstitel { padding: 13px 16px; font-size: 13px; color: var(--text2); text-align: center; border-bottom: 1px solid var(--linie); }
.aktion { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 16px; font-size: 18px; color: var(--akzent); }
.aktion + .aktion { border-top: 1px solid var(--linie); }
.aktion.rot { color: var(--rot); }
.aktion.stark { font-weight: 700; }
.aktion:active { background: var(--fuellung); }

.kulisse.mitte { align-items: center; padding: 24px; }
.meldung { background: var(--karte); border-radius: 14px; width: 100%; max-width: 300px; text-align: center; overflow: hidden; box-shadow: var(--schatten); }
.meldung-titel { font-weight: 700; padding: 18px 16px 4px; }
.meldung-text { font-size: 14px; padding: 0 16px 16px; color: var(--text); white-space: pre-line; }
.meldung-titel:last-of-type { padding-bottom: 16px; }
.meldung-knoepfe { display: flex; border-top: 1px solid var(--linie); }
.meldung-knoepfe button { flex: 1; padding: 12px; color: var(--akzent); font-size: 17px; }
.meldung-knoepfe button + button { border-left: 1px solid var(--linie); }
.meldung-knoepfe .stark { font-weight: 700; }
.meldung-knoepfe .rot { color: var(--rot); }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--unten) + 96px); transform: translate(-50%, 20px); z-index: 80;
  background: rgba(40, 40, 44, .94); color: #fff; padding: 10px 16px; border-radius: 22px; font-size: 14px; max-width: 86%;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; text-align: center;
}
.toast.sichtbar { opacity: 1; transform: translate(-50%, 0); }

/* ---- Stempeln ---------------------------------------------------------- */
.timer { text-align: center; padding: 26px 18px; margin-bottom: 20px; }
.timer-punkt { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.timer-kt { font-size: 20px; font-weight: 700; margin: 8px 0 2px; }
.timer-zeit { font-size: 54px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.timer-info { color: var(--text2); font-size: 15px; margin: 4px 0 16px; }
.timer .icon.gross { width: 46px; height: 46px; color: var(--text3); }
.timer-leer-titel { font-weight: 600; margin: 8px 0 4px; }
.abschnitt-titel { font-size: 15px; font-weight: 600; color: var(--text2); margin: 0 2px 10px; }
.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 600px) { .kacheln { grid-template-columns: repeat(3, 1fr); } }
.kachel { text-align: left; padding: 14px; background: var(--karte); border-radius: var(--radius); border: 2px solid transparent; min-height: 104px; display: flex; flex-direction: column; gap: 3px; }
.kachel:active { filter: brightness(.94); }
.kachel-oben { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.kachel-punkt { width: 14px; height: 14px; border-radius: 50%; }
.kachel-laeuft { width: 12px; height: 12px; border-radius: 50%; background: var(--rot); box-shadow: 0 0 0 3px color-mix(in srgb, var(--rot) 25%, transparent); }
.kachel-nr { font-size: 20px; font-weight: 700; }
.kachel-bez { font-size: 15px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kachel-ort { font-size: 12px; color: var(--text3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Einträge ---------------------------------------------------------- */
.filter { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.suche { display: flex; align-items: center; gap: 6px; background: var(--fuellung); border-radius: 10px; padding: 0 10px; color: var(--text2); }
.suche input { flex: 1; padding: 8px 0; color: var(--text); }
.suche .icon { width: 18px; height: 18px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; padding: 6px 12px; border-radius: 16px; background: var(--fuellung); font-size: 15px; font-weight: 500; }
.chip.aktiv { color: #fff; }
.summe-zeile { display: flex; justify-content: space-between; color: var(--text2); font-size: 15px; padding: 2px 6px 10px; }

.periode { background: var(--karte); border-radius: var(--radius); margin-bottom: 14px; overflow: hidden; }
.periode-kopf { display: flex; align-items: center; gap: 8px; padding: 12px 8px 12px 12px; width: 100%; }
.periode-auf { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; text-align: left; }
.periode-pfeil { color: var(--text3); transition: transform .18s; width: 16px; height: 16px; }
.periode.offen .periode-pfeil { transform: rotate(90deg); }
.periode-titel { font-size: 15px; font-weight: 600; }
.periode-unter { font-size: 12px; color: var(--text2); }
.periode-rechts { text-align: right; margin-left: auto; flex: none; }
.periode-summe { font-size: 17px; font-weight: 700; font-variant-numeric: tabular-nums; }
.periode-extra { font-size: 12px; font-variant-numeric: tabular-nums; }
.plus { color: var(--gruen); } .minus { color: var(--rot); } .urlaubfarbe { color: var(--tuerkis); }
.periode-menue { color: var(--akzent); width: 38px; height: 38px; display: grid; place-items: center; flex: none; border-radius: 50%; }
.periode-menue:active { background: var(--fuellung); }
.periode-inhalt { border-top: 1px solid var(--linie); }

.eintrag { display: flex; align-items: center; gap: 12px; padding: 9px 6px 9px 12px; position: relative; width: 100%; text-align: left; }
.eintrag + .eintrag::before { content: ""; position: absolute; left: 30px; right: 0; top: 0; border-top: 1px solid var(--linie); }
.eintrag:active { background: var(--fuellung); }
.eintrag-balken { width: 6px; height: 38px; border-radius: 4px; flex: none; }
.eintrag-mitte { flex: 1; min-width: 0; overflow: hidden; }
.eintrag-titel { font-weight: 500; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eintrag-spesen { width: 7px; height: 7px; border-radius: 50%; background: var(--gruen); flex: none; }
.eintrag-unter { display: block; font-size: 12px; color: var(--text2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.eintrag-stunden { font-weight: 600; font-variant-numeric: tabular-nums; }
.eintrag-mehr { width: 36px; height: 36px; display: grid; place-items: center; color: var(--text3); flex: none; border-radius: 50%; }
.eintrag-mehr:active { background: var(--fuellung); }

.kalender { padding: 10px 10px 12px; border-top: 1px solid var(--linie); }
.kal-kopf, .kal-gitter { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.kal-kopf { font-size: 11px; color: var(--text2); text-align: center; margin-bottom: 6px; }
.kal-zelle { height: 36px; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.kal-tag { font-size: 11px; color: var(--text2); }
.kal-std { font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.kal-zelle.frei .kal-tag { color: var(--text3); }
.kal-zelle.heute .kal-tag { color: var(--akzent); font-weight: 700; }
.kal-zelle.hat { background: var(--fuellung); }
.kal-zelle.fehlt { background: color-mix(in srgb, var(--rot) 13%, transparent); }
.kal-zelle.fehlt .kal-std { color: var(--rot); }
.kal-zelle.urlaub { background: color-mix(in srgb, var(--tuerkis) 16%, transparent); }
.kal-zelle.urlaub .kal-tag, .kal-zelle.urlaub .kal-std { color: var(--tuerkis); }
.kal-zelle.krank { background: color-mix(in srgb, var(--orange) 16%, transparent); }
.kal-zelle.krank .kal-tag, .kal-zelle.krank .kal-std { color: var(--orange); }
.kal-zelle.markiert { background: color-mix(in srgb, var(--tuerkis) 38%, transparent); outline: 2px solid var(--tuerkis); }
.kal-zelle.waehlbar { outline: 1px dashed var(--text3); }
.kal-leiste { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.kal-leiste .knopf-klein { padding: 7px 12px; border-radius: 9px; background: var(--fuellung); color: var(--akzent); font-size: 14px; font-weight: 600; }
.kal-leiste .knopf-klein.voll { background: var(--tuerkis); color: #fff; }
.kal-leiste .knopf-klein.krank { background: var(--orange); color: #fff; }
.kal-hinweis { font-size: 12px; color: var(--text2); flex: 1; min-width: 120px; }

/* ---- Kostenträger ------------------------------------------------------ */
.kt-zeile { display: flex; align-items: center; gap: 12px; padding: 10px 6px 10px 14px; width: 100%; text-align: left; }
.kt-farbe { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.kt-name { font-weight: 500; }
.kt-ort { font-size: 12px; color: var(--text2); }
.farben { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; padding: 12px 14px; justify-items: center; }
.farbe { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; }
.farbe.aktiv { border-color: var(--text); box-shadow: inset 0 0 0 2px var(--karte); }

/* ---- Einstellungen / Anmeldung ----------------------------------------- */
.unterschrift-bild { display: block; height: 84px; width: 100%; object-fit: contain; background: #fff; border-radius: 8px; }
.sync-status { display: flex; align-items: center; gap: 8px; }
.sync-punkt { width: 9px; height: 9px; border-radius: 50%; background: var(--text3); flex: none; }
.sync-punkt.ok { background: var(--gruen); } .sync-punkt.fehler { background: var(--rot); } .sync-punkt.laeuft { background: var(--orange); }

.anmeldung { margin: auto; width: 100%; max-width: 380px; padding: calc(var(--oben) + 24px) 20px calc(var(--unten) + 24px); }
.anmeldung h1 { font-size: 30px; font-weight: 800; margin: 0 0 4px; letter-spacing: -.02em; }
.anmeldung p { color: var(--text2); margin: 0 0 22px; }
.anmeldung .gruppe-karte input { width: 100%; padding: 13px 14px; }
.anmeldung .fehler { color: var(--rot); font-size: 14px; min-height: 20px; margin: -10px 4px 12px; }
.anmeldung .klein { font-size: 13px; color: var(--text2); text-align: center; margin-top: 16px; }
.banner { background: color-mix(in srgb, var(--orange) 18%, var(--karte)); border-radius: 12px; padding: 10px 12px; font-size: 14px; display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.banner button { color: var(--akzent); font-weight: 600; margin-left: auto; flex: none; }
