/* Familien-Hub — "Modern Dark" Designsystem.
   Alle Farben laufen ueber semantische Tokens, die je Theme neu belegt werden:
   ein Wert pro Rolle, nie ein Hex direkt in einer Komponente. Dark ist die
   Leitvariante, Light ist gleichwertig ausgearbeitet (nicht bloss invertiert). */

:root {
  color-scheme: light;

  --brand: #2563EB;
  --brand-strong: #1D4ED8;
  /* Logofarbe: Petrol aus dem Markenexport, hell und dunkel getrennt. */
  --logo: #0F766E;
  --on-brand: #FFFFFF;
  --success: #047857;
  --accent: #B45309;
  --danger: #DC2626;

  --bg: #F7F8FC;
  --bg-elev: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F1F3F9;
  --ink: #0F172A;
  --ink-soft: #4A5568;
  --ink-faint: #5E6B7E;
  --line: #E4E8F2;
  --line-strong: #CBD5E1;

  --nav-bg: rgba(255, 255, 255, 0.82);
  --scrim: rgba(15, 23, 42, 0.45);
  --glow-a: rgba(37, 99, 235, 0.16);
  --glow-b: rgba(5, 150, 105, 0.13);

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px -4px rgba(15, 23, 42, 0.10);
  --shadow-lg: 0 18px 48px -12px rgba(15, 23, 42, 0.22);

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  /* Expo.out — das Standard-Easing des Designsystems */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --fast: 160ms;
  --base: 240ms;

  --nav-h: 62px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --brand: #60A5FA;
  --brand-strong: #3B82F6;
  --logo: #2DD4BF;
  --on-brand: #08111F;
  --success: #34D399;
  --accent: #FBBF24;
  --danger: #F87171;

  /* kein reines Schwarz — vermeidet OLED-Schlieren beim Scrollen */
  --bg: #0B0D12;
  --bg-elev: #12151D;
  --surface: #161A23;
  --surface-2: #1E2330;
  --ink: #F1F5F9;
  --ink-soft: #98A2B3;
  --ink-faint: #7C8797;
  --line: #252B38;
  --line-strong: #333B4C;

  --nav-bg: rgba(18, 21, 29, 0.82);
  --scrim: rgba(0, 0, 0, 0.62);
  --glow-a: rgba(59, 130, 246, 0.22);
  --glow-b: rgba(16, 185, 129, 0.14);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 20px -6px rgba(0, 0, 0, 0.55);
  --shadow-lg: 0 22px 56px -14px rgba(0, 0, 0, 0.7);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden muss jede display-Regel schlagen — sonst faengt ein unsichtbares
   Overlay (Sheet, Login-Form) weiter Klicks ab. */
[hidden] { display: none !important; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

body { min-height: 100dvh; }
.hidden { display: none !important; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -0.01em; margin: 0; }
button { font: inherit; color: inherit; }

.ico {
  width: 24px; height: 24px; flex: none;
  fill: none; stroke: currentColor;
  stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
}

:where(button, a, input, [tabindex]):focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

/* --- Login --- */
.login {
  position: relative; z-index: 1;
  min-height: 100dvh; display: grid; place-items: center;
  padding: var(--sp-5); overflow: hidden;
}
.login-glow {
  position: fixed; inset: -30% -20% auto -20%; height: 70vh; z-index: -1;
  background:
    radial-gradient(45% 55% at 22% 30%, var(--glow-a), transparent 70%),
    radial-gradient(40% 50% at 82% 18%, var(--glow-b), transparent 70%);
  filter: blur(18px);
}
.login-inner { width: 100%; max-width: 380px; text-align: center; }
.login-icon {
  width: 84px; height: 84px; border-radius: 19px;
  box-shadow: 0 8px 24px -8px rgba(15, 23, 42, 0.35);
}
.login h1 { font-size: 30px; font-weight: 700; margin: var(--sp-3) 0 var(--sp-1); }
.login-hint { color: var(--ink-soft); margin: 0 0 var(--sp-5); }
.login-personen { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
.login-person {
  display: flex; flex-direction: column; align-items: center; gap: var(--sp-2);
  padding: var(--sp-4); min-height: 100px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.login-person:active { transform: scale(0.97); border-color: var(--brand); }
.login-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600; font-size: 15px;
  background: var(--pcolor, var(--brand)); color: #fff;
}
#pin-form { display: grid; gap: var(--sp-3); margin-top: var(--sp-4); }
#pin {
  width: 100%; padding: 15px var(--sp-4); text-align: center;
  font-size: 20px; letter-spacing: 0.35em;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--r-md);
}
.login-error { color: var(--danger); font-size: 14px; margin-top: var(--sp-3); }

/* --- Buttons --- */
.btn-primary, .btn-check, .btn-ghost {
  border: none; border-radius: var(--r-md);
  padding: 13px var(--sp-4); min-height: 46px;
  font-weight: 600; font-size: 15px; cursor: pointer;
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease);
}
.btn-primary { background: var(--brand); color: var(--on-brand); box-shadow: var(--shadow-sm); }
.btn-check { background: var(--surface-2); color: var(--ink); border: 1px solid var(--line); }
.btn-check.undo { background: transparent; }
.btn-ghost { background: transparent; color: var(--ink-soft); }
.btn-primary:active, .btn-check:active, .btn-ghost:active { transform: scale(0.97); }
.btn-primary:disabled, .btn-check:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-danger-link {
  background: none; border: none; color: var(--danger);
  font-weight: 600; padding: var(--sp-3); cursor: pointer; min-height: 44px;
}
.iconbtn, .icon-btn {
  background: none; border: none; cursor: pointer;
  display: grid; place-items: center;
  min-width: 44px; min-height: 44px; border-radius: var(--r-md);
  color: var(--ink-soft); font-size: 17px;
  transition: background var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.iconbtn:active, .icon-btn:active { transform: scale(0.92); background: var(--surface-2); }

/* --- App shell --- */
/* Feste Hoehe statt min-height: sonst waechst die Huelle mit dem Inhalt, die
   Seite selbst scrollt und eine am Ende stehende Leiste (Chat-Eingabe) rutscht
   aus dem Bild. Gescrollt wird immer nur innerhalb einer View. */
.app { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }

.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-3);
  padding: calc(env(safe-area-inset-top) + var(--sp-3)) var(--sp-4) var(--sp-3);
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.top-logo { width: 26px; height: 26px; flex: none; color: var(--logo); }
.top-left { flex: 1; min-width: 0; }
.top-title { font-size: 21px; font-weight: 700; }
.top-sub { display: block; font-size: 12.5px; color: var(--ink-soft); }
.avatar-stack { display: flex; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff;
  background: var(--pcolor, var(--brand));
  border: 2px solid var(--bg); margin-left: -8px;
}
.avatar.big { width: 44px; height: 44px; font-size: 15px; margin: 0; }

/* --- Pager: horizontal wischbar, ein Screen pro Snap-Punkt --- */
.pager {
  flex: 1; min-height: 0;
  display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.pager::-webkit-scrollbar { display: none; }
.view {
  flex: 0 0 100%; width: 100%;
  scroll-snap-align: start; scroll-snap-stop: always;
  overflow-y: auto; -webkit-overflow-scrolling: touch;
  padding: var(--sp-4) var(--sp-4) calc(var(--nav-h) + env(safe-area-inset-bottom) + 84px);
}

/* --- Bottom navigation --- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; align-items: stretch;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--line);
}
.navitem {
  flex: 1; background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; padding: 0; min-height: 44px;
  color: var(--ink-faint); font-size: 10.5px; font-weight: 600; letter-spacing: 0.01em;
  transition: color var(--base) var(--ease);
}
.navitem .ico { width: 22px; height: 22px; transition: transform var(--base) var(--ease); }
.navitem.active { color: var(--brand); }
.navitem.active .ico { transform: translateY(-1px) scale(1.06); }
.navitem:active .ico { transform: scale(0.9); }
.nav-indicator {
  position: absolute; top: 0; height: 2.5px; width: 20%;
  background: var(--brand); border-radius: 0 0 3px 3px;
  transition: transform var(--base) var(--ease);
}

/* --- FAB --- */
.fab {
  position: fixed; right: var(--sp-4); z-index: 25;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--sp-4));
  width: 54px; height: 54px; border-radius: 18px;
  display: grid; place-items: center;
  background: var(--brand); color: var(--on-brand);
  border: none; box-shadow: var(--shadow-lg); cursor: pointer;
  transition: transform var(--base) var(--ease), opacity var(--fast) var(--ease);
}
.fab:active { transform: scale(0.92); }
.fab.hidden { display: none; }

/* --- Karten und Abschnitte --- */
.sect { margin-bottom: var(--sp-5); }
.sect-head {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: 12.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-faint);
  margin-bottom: var(--sp-3);
}
.sect-head .count {
  margin-left: auto; font-weight: 700; letter-spacing: 0;
  color: var(--ink-soft); font-variant-numeric: tabular-nums;
}
.top-date { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.top-greet { color: var(--ink-soft); font-size: 14px; }

.stat-row { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.stat-tile {
  text-align: left; cursor: pointer;
  padding: var(--sp-4); border-radius: var(--r-lg);
  background: var(--surface); border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform var(--fast) var(--ease);
}
.stat-tile:active { transform: scale(0.98); }
.goal-count { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; }
.goal-hint { font-size: 12.5px; color: var(--ink-soft); }

.task, .day-card, .poll, .essen-tag, .goal, .einkauf-datum {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  margin-bottom: var(--sp-3);
}
.task {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border-left: 4px solid var(--pcolor, var(--line));
  transition: transform var(--fast) var(--ease), opacity var(--base) var(--ease);
}
.task:active { transform: scale(0.99); }
.task.done .task-body { opacity: 0.45; text-decoration: line-through; }
.task-check {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  border: 2px solid var(--line-strong); background: transparent;
  color: transparent; cursor: pointer; font-size: 15px;
  display: grid; place-items: center;
  transition: all var(--fast) var(--ease);
}
/* Der Kreis bleibt optisch 30px, die Trefferflaeche waechst auf 44 — sonst
   liegt das Ziel unter dem Minimum fuer Touch. */
.task-check { position: relative; }
.task-check::after { content: ''; position: absolute; inset: -7px; }
.task-check.checked { background: var(--success); border-color: var(--success); color: #fff; }
.task-check:active { transform: scale(0.88); }
.task-body { flex: 1; min-width: 0; }
.task-title { font-weight: 600; font-size: 15px; }
.task-meta { display: flex; flex-wrap: wrap; gap: var(--sp-2); font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.task-meta .late { color: var(--danger); font-weight: 600; }
.task-actions { display: flex; gap: var(--sp-1); }

.chip, .pchip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 12.5px; font-weight: 600; color: var(--ink-soft);
}
.pchip { cursor: pointer; min-height: 34px; }
.pchip.sel { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.person-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }

.empty {
  text-align: center; padding: var(--sp-7) var(--sp-4);
  color: var(--ink-soft); font-size: 14.5px;
}
.empty .big { display: block; font-size: 40px; margin-bottom: var(--sp-3); opacity: 0.8; }

/* --- Termine --- */
.day-card { padding: var(--sp-1) var(--sp-4); }
.day-card.heute { border-left: 4px solid var(--brand); }
.termin { display: flex; gap: var(--sp-3); align-items: baseline; padding: var(--sp-3) 0; border-bottom: 1px solid var(--line); }
.termin:last-child { border-bottom: none; }
.termin-zeit { flex: none; width: 62px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.termin-body { flex: 1; min-width: 0; }
.termin-titel { font-weight: 600; font-size: 15px; }
.termin-ort { font-size: 12.5px; color: var(--ink-soft); }

.cal-head { display: flex; align-items: center; gap: var(--sp-1); padding-bottom: var(--sp-3); }
.cal-titel { font-weight: 700; font-size: 17px; }
.cal-spacer { flex: 1; }
.cal-heute { font-size: 13px; font-weight: 700; color: var(--brand); }
.cal-wtage {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--ink-faint); text-align: center;
  text-transform: uppercase; letter-spacing: 0.05em; padding-bottom: var(--sp-2);
}
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.cal-tag {
  aspect-ratio: 1; min-height: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border: none; background: none; border-radius: var(--r-sm);
  cursor: pointer; color: var(--ink);
  transition: transform var(--fast) var(--ease), background var(--fast) var(--ease);
}
.cal-tag:active { transform: scale(0.94); }
.cal-num { font-size: 14.5px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; }
.cal-tag.aus .cal-num { color: var(--ink-faint); opacity: 0.5; }
.cal-tag.heute .cal-num {
  background: var(--brand); color: var(--on-brand);
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
}
.cal-tag.sel { background: var(--surface-2); box-shadow: inset 0 0 0 1.5px var(--brand); }
/* Ein Punkt je Termin (max. 3) — die <i> kommen aus zelle() in app.js. */
.cal-dots { display: flex; gap: 2px; height: 5px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }
.cal-tag.aus .cal-dots i { opacity: 0.4; }
.cal-geb { font-size: 10px; line-height: 5px; height: 5px; }
.vdot, .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }

/* --- Abstimmungen --- */
.poll { padding: var(--sp-4); }
.poll-head { display: flex; align-items: flex-start; gap: var(--sp-2); }
.poll-frage { font-weight: 700; font-size: 16px; flex: 1; }
.poll-label { font-size: 12.5px; color: var(--ink-soft); }
.poll-opt {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left; cursor: pointer;
  padding: var(--sp-3); margin-top: var(--sp-2);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md); min-height: 46px;
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.poll-opt:active { transform: scale(0.99); }
.poll-opt.sel { border-color: var(--brand); }
.poll-votes { display: flex; gap: 3px; margin-left: auto; }
.poll-count { font-size: 12.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.poll-foot { display: flex; flex-wrap: wrap; gap: var(--sp-2); align-items: center; margin-top: var(--sp-3); font-size: 12.5px; color: var(--ink-soft); }
.poll-zu { opacity: 0.6; }
.poll-datum { font-weight: 600; }
.opt-row { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.opt-emoji { width: 62px; text-align: center; }
.opt-text { flex: 1; }

/* --- Notizen / Einkauf --- */
.notiz-composer { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.notiz-composer input { flex: 1; }
.einkauf-datum { padding: var(--sp-4); }
.einkauf-datum-text { font-weight: 600; }
.einkauf-datum-text.heute { color: var(--accent); }

/* --- Essen (Speiseplan) --- */
.essen-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--sp-3); }
.essen-woche { font-weight: 700; font-variant-numeric: tabular-nums; }
.essen-tag { padding: var(--sp-2) var(--sp-4); }
.essen-tag.heute { border-left: 4px solid var(--brand); }
.essen-tag-kopf { font-size: 12.5px; font-weight: 700; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.05em; margin: var(--sp-2) 0 var(--sp-1); }
.essen-feld {
  display: flex; align-items: baseline; gap: var(--sp-3); width: 100%;
  background: none; border: none; border-top: 1px solid var(--line);
  padding: var(--sp-3) 0; text-align: left; min-height: 46px;
  transition: transform var(--fast) var(--ease);
}
.essen-feld:first-of-type { border-top: none; }
.essen-feld:not(.nur-lesen) { cursor: pointer; }
.essen-feld:not(.nur-lesen):active { transform: scale(0.99); }
.essen-mahlzeit { flex: none; width: 62px; font-size: 12.5px; font-weight: 700; color: var(--ink-soft); }
.essen-inhalt { flex: 1; min-width: 0; font-size: 15px; }
.essen-leer { color: var(--ink-faint); }
.essen-pool { margin-top: var(--sp-5); }
.essen-pool > summary { font-weight: 700; padding: var(--sp-3) 0; cursor: pointer; }
.essen-pool-form { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-3); }
.essen-pool-form #gericht-emoji { width: 62px; text-align: center; }
.essen-pool-form #gericht-name { flex: 1; }
.essen-pool-zeile { display: flex; align-items: center; justify-content: space-between; padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
.essen-pool-zeile:last-child { border-bottom: none; }
.essen-wahl { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-4); }
.essen-wahl-chip { cursor: pointer; min-height: 40px; padding: var(--sp-2) var(--sp-3); }
.essen-aktionen { display: grid; gap: var(--sp-2); }

/* --- Ziele (nur sichtbar, wenn das Feature an ist) --- */
.goal { padding: var(--sp-4); }
.goal-top { display: flex; align-items: center; gap: var(--sp-3); }
.goal-emoji { font-size: 22px; }
.goal-name { font-weight: 600; flex: 1; }
.goal-dots { display: flex; gap: 5px; margin-top: var(--sp-3); }
.goal-dots .dot { width: 11px; height: 11px; background: var(--line-strong); }
.goal-dots .dot.on { background: var(--success); }
.goal-foot { margin-top: var(--sp-3); font-size: 12.5px; color: var(--ink-soft); }

/* --- Formulare --- */
.form { display: grid; gap: var(--sp-3); }
.form label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.form-row { display: flex; gap: var(--sp-2); }
input, select, textarea {
  font: inherit; color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line); border-radius: var(--r-md);
  padding: 12px var(--sp-3); min-height: 46px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); }
.check-label { display: flex; align-items: center; gap: var(--sp-2); font-weight: 500; }
.check-label input { width: auto; min-height: auto; }
.sheet-hint { font-size: 13.5px; color: var(--ink-soft); margin: var(--sp-2) 0; }
.pin-fremd { margin-top: var(--sp-3); }

/* --- Bottom sheet --- */
.sheet {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-end;
  background: var(--scrim);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  animation: fade var(--base) var(--ease);
}
.sheet-panel {
  width: 100%; max-height: 88dvh; overflow-y: auto;
  background: var(--bg-elev);
  border-radius: var(--r-xl) var(--r-xl) 0 0;
  border-top: 1px solid var(--line);
  padding: var(--sp-2) var(--sp-5) calc(env(safe-area-inset-bottom) + var(--sp-5));
  box-shadow: var(--shadow-lg);
  animation: sheet-up 340ms var(--ease);
}
.sheet-grip {
  width: 40px; height: 4px; border-radius: 999px;
  background: var(--line-strong); margin: var(--sp-2) auto var(--sp-4);
}
.sheet h2 { font-size: 19px; margin-bottom: var(--sp-4); }

/* Mehr-Menue im Sheet */
.mehr-liste { display: grid; gap: var(--sp-1); }
.mehr-item {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; padding: var(--sp-3) var(--sp-2); min-height: 52px;
  background: none; border: none; cursor: pointer;
  border-radius: var(--r-md); font-size: 15.5px; font-weight: 600;
  transition: background var(--fast) var(--ease);
}
.mehr-item .ico { color: var(--ink-soft); }
.mehr-item:active { background: var(--surface-2); }
.mehr-item.active { color: var(--brand); }
.mehr-item.active .ico { color: var(--brand); }

/* --- Toast --- */
.toast {
  position: fixed; left: 50%; z-index: 80;
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--sp-4));
  transform: translateX(-50%);
  padding: var(--sp-3) var(--sp-4); max-width: min(92vw, 420px);
  background: var(--ink); color: var(--bg);
  border-radius: var(--r-md); font-size: 14px; font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in var(--base) var(--ease);
}

@keyframes fade { from { opacity: 0; } }
@keyframes sheet-up { from { transform: translateY(14%); opacity: 0; } }
@keyframes toast-in { from { transform: translate(-50%, 12px); opacity: 0; } }

/* Eintretende Listen gestaffelt — 40ms pro Element, danach ohne Verzoegerung */
.stagger > * { animation: rise 320ms var(--ease) backwards; }
.stagger > *:nth-child(1) { animation-delay: 0ms; }
.stagger > *:nth-child(2) { animation-delay: 40ms; }
.stagger > *:nth-child(3) { animation-delay: 80ms; }
.stagger > *:nth-child(4) { animation-delay: 120ms; }
.stagger > *:nth-child(5) { animation-delay: 160ms; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } }

@media (min-width: 720px) {
  .view { padding-left: max(var(--sp-5), calc((100% - 680px) / 2)); padding-right: max(var(--sp-5), calc((100% - 680px) / 2)); }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .pager { scroll-snap-type: none; }
}

/* --- Start (Dashboard) --- */
.dash-kopf { margin-bottom: var(--sp-5); }
.dash-hallo { font-size: 27px; font-weight: 700; letter-spacing: -0.025em; }
.dash-datum { color: var(--ink-soft); font-size: 14.5px; margin-top: 2px; }
.dash-wetter {
  margin-top: var(--sp-3); padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  font-size: 14.5px; font-weight: 500;
}
.stat-row { margin-bottom: var(--sp-5); }
.dash-karte {
  display: block; width: 100%; text-align: left; cursor: pointer;
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-2);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  transition: transform var(--fast) var(--ease);
}
.dash-karte:active { transform: scale(0.99); }
.dash-karte.statisch { cursor: default; }
.dash-karte.statisch:active { transform: none; }
.dash-zeile { display: block; font-size: 15px; }
.dash-zeile b { font-weight: 600; margin-right: var(--sp-2); }
.dash-sub { display: block; font-size: 12.5px; color: var(--ink-soft); margin-top: 2px; }
.dash-chips { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.dash-chips .chip { background: transparent; }
.dash-leer {
  padding: var(--sp-4); text-align: center;
  color: var(--ink-soft); font-size: 14px;
  background: var(--surface); border: 1px dashed var(--line);
  border-radius: var(--r-lg);
}
.dash-mehr {
  margin-left: auto; width: auto; min-width: 44px; padding: 0 var(--sp-2);
  font-size: 12.5px; font-weight: 700; color: var(--brand);
  text-transform: none; letter-spacing: 0;
}

/* --- Punkte (Routine-Taetigkeiten) --- */
.seg {
  display: flex; gap: 3px; padding: 3px; margin-bottom: var(--sp-4);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.seg-btn {
  flex: 1; background: none; border: none; cursor: pointer;
  padding: var(--sp-2) var(--sp-2); min-height: 40px;
  border-radius: 11px; font-size: 13px; font-weight: 600;
  color: var(--ink-soft); white-space: nowrap;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.seg-btn.sel { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.seg.gross .seg-btn { min-height: 46px; font-size: 14px; }

.scoreboard {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  padding: var(--sp-2) var(--sp-4); margin-bottom: var(--sp-5);
}
.score-zeile {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--line);
}
.score-zeile:last-child { border-bottom: none; }
.score-zeile.ich .score-name { font-weight: 700; }
.score-platz { width: 26px; font-size: 15px; text-align: center; font-variant-numeric: tabular-nums; }
.score-name { flex: 1; min-width: 0; font-size: 15px; }
.score-streak {
  font-size: 12.5px; font-weight: 700; color: var(--accent);
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  padding: 2px 8px; border-radius: 999px;
}
.score-punkte {
  font-size: 19px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums; min-width: 44px; text-align: right;
}

.akt-liste { display: grid; gap: var(--sp-2); }
.akt {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left; cursor: pointer;
  padding: var(--sp-3) var(--sp-4); min-height: 56px;
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--success);
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.akt:active { transform: scale(0.985); }
.akt.minus { border-left-color: var(--danger); }
.akt-emoji { font-size: 21px; flex: none; }
.akt-titel { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; }
.akt-wert {
  font-size: 16px; font-weight: 700; color: var(--success);
  font-variant-numeric: tabular-nums;
}
.akt.minus .akt-wert { color: var(--danger); }
.akt-weg {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border-radius: 50%;
  color: var(--ink-faint); font-size: 15px;
}
.aktion-wert-feld { width: 72px; text-align: center; }

/* Wochenziel: Fortschritt und Guthaben je Person */
.ziel-zeile {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--line);
}
.ziel-zeile:last-child { border-bottom: none; }
.ziel-name { font-size: 15px; min-width: 62px; }
.ziel-balken {
  flex: 1; min-width: 40px; height: 8px; border-radius: 999px;
  background: color-mix(in oklab, var(--ink-faint) 24%, transparent);
  overflow: hidden;
}
.ziel-balken i {
  display: block; height: 100%; border-radius: 999px;
  background: var(--pcolor, var(--accent));
  transition: width var(--fast) var(--ease);
}
.ziel-zahl {
  font-size: 13.5px; font-variant-numeric: tabular-nums;
  color: var(--ink-soft); min-width: 52px; text-align: right;
}
.ziel-geld {
  font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums;
  min-width: 76px; text-align: right;
}
/* Als Knopf (nur Eltern) darf das Guthaben nicht nach Browser-Default aussehen. */
button.ziel-geld {
  font: inherit; font-weight: 700; color: inherit; cursor: pointer;
  background: color-mix(in oklab, var(--ink-faint) 12%, transparent);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 6px 8px; min-height: 40px;
}
button.ziel-geld:active { transform: scale(0.97); }
.ziel-zeile.geschafft .ziel-geld { color: var(--success); }
.ziel-zeile.geschafft .ziel-balken i { background: var(--success); }
.ziel-fuss { padding-top: var(--sp-3); font-size: 14px; color: var(--ink-soft); }

/* Monatswertung und Belohnungswahl */
.monat-zeile {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--line);
}
.monat-zeile:last-child { border-bottom: none; }
.monat-wochen { font-size: 13.5px; color: var(--ink-soft); }
.monat-sieger {
  display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap;
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-3);
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--pcolor, var(--accent));
  border-radius: var(--r-md);
}
.monat-wahl { font-size: 14.5px; color: var(--ink-soft); }
.monat-wahl.offen { font-style: italic; }
.belohnungen { display: grid; gap: var(--sp-2); }
.belohnung {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left; cursor: pointer;
  padding: var(--sp-3) var(--sp-4); min-height: 52px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.belohnung:active { transform: scale(0.985); }

.verlauf {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-2);
  background: var(--surface); border: 1px solid var(--line);
  border-left: 4px solid var(--pcolor, var(--line));
  border-radius: var(--r-md);
}
.verlauf-text { flex: 1; min-width: 0; font-size: 14.5px; }
.verlauf-wert {
  font-weight: 700; color: var(--success); font-variant-numeric: tabular-nums;
}
.verlauf-wert.minus { color: var(--danger); }

/* Eigene Termine (in der App angelegt) tragen die Farbe ihres Erstellers */
.termin.eigen { border-left: 3px solid var(--pcolor, var(--brand)); padding-left: var(--sp-3); margin-left: -3px; }
.termin { align-items: center; }
.termin .iconbtn { min-width: 36px; min-height: 36px; font-size: 14px; }

/* --- Podium (Punkte-Treppchen) --- */
.podium {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2);
  align-items: end; margin-bottom: var(--sp-5);
}
.podest { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.podest-punkte {
  font-size: 20px; font-weight: 700; letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.podest-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 14px; font-weight: 700; color: #fff;
  background: var(--pcolor, var(--brand));
  box-shadow: var(--shadow-sm);
}
.podest.ich .podest-avatar { outline: 2.5px solid var(--brand); outline-offset: 2px; }
.podest-streak { font-size: 11px; font-weight: 700; color: var(--accent); }
.podest-stufe {
  width: 100%; margin-top: var(--sp-1);
  display: grid; place-items: center; font-size: 19px;
  background: color-mix(in oklab, var(--pcolor, var(--brand)) 20%, var(--surface));
  border: 1px solid var(--line); border-bottom: none;
  border-radius: var(--r-sm) var(--r-sm) 0 0;
}
.podest.p1 .podest-stufe { height: 76px; }
.podest.p2 .podest-stufe { height: 56px; }
.podest.p3 .podest-stufe { height: 40px; }
.podest.null .podest-stufe { height: 26px; background: var(--surface-2); }

.podium.klein { margin: 0; gap: var(--sp-1); }
.podium.klein .podest-avatar { width: 34px; height: 34px; font-size: 12px; }
.podium.klein .podest-punkte { font-size: 16px; }
.podium.klein .podest.p1 .podest-stufe { height: 42px; }
.podium.klein .podest.p2 .podest-stufe { height: 30px; }
.podium.klein .podest.p3 .podest-stufe { height: 22px; }
.podium.klein .podest.null .podest-stufe { height: 16px; }
.podium-karte { padding: var(--sp-4) var(--sp-4) 0; }

/* --- Wochenziel als Ringreihe auf der Startseite --- */
.wz-karte { padding: var(--sp-4); }
.wz-reihe {
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  gap: var(--sp-2); margin-bottom: var(--sp-2);
}
.wz-ring { position: relative; display: grid; justify-items: center; }
.wz-ring svg { width: 100%; max-width: 62px; aspect-ratio: 1; transform: rotate(-90deg); }
.wz-spur {
  fill: none; stroke-width: 7;
  stroke: color-mix(in oklab, var(--ink-faint) 22%, transparent);
}
.wz-bogen {
  fill: none; stroke-width: 7; stroke-linecap: round;
  stroke: var(--pcolor, var(--accent));
  transition: stroke-dasharray 320ms var(--ease);
}
.wz-ring.voll .wz-bogen { stroke: var(--success); }
.wz-mitte {
  position: absolute; top: 0; left: 0; right: 0;
  height: min(62px, 100%); display: grid; place-items: center;
  font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.wz-ring.voll .wz-mitte { color: var(--success); font-size: 17px; }
.wz-name { font-size: 12.5px; margin-top: 4px; }
.wz-zahl { font-size: 11.5px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.termin-wer { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.termin-wer .chip { padding: 2px 8px; font-size: 11.5px; border-color: var(--pcolor, var(--line)); }
.task-punkte { font-weight: 700; color: var(--success); }

/* --- Aufgaben je Person auf der Startseite (2x2) --- */
.pbox-raster { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); }
.pbox {
  background: var(--surface); border: 1px solid var(--line);
  border-top: 3px solid var(--pcolor, var(--line));
  border-radius: var(--r-md); box-shadow: var(--shadow-sm);
  padding: var(--sp-3); min-width: 0;
}
.pbox-kopf { display: flex; align-items: center; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.pbox-kopf .avatar { width: 24px; height: 24px; font-size: 10px; margin: 0; border: none; }
.pbox-name { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pbox-zahl {
  font-size: 12px; font-weight: 700; color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.pbox-zeile { display: flex; align-items: flex-start; gap: 7px; padding: 3px 0; }
.pbox-check {
  flex: none; position: relative; width: 20px; height: 20px; margin-top: 1px;
  border-radius: 50%; border: 2px solid var(--line-strong);
  background: transparent; color: transparent; cursor: pointer;
  font-size: 11px; display: grid; place-items: center;
  transition: all var(--fast) var(--ease);
}
.pbox-check::after { content: ''; position: absolute; inset: -12px; }
.pbox-check:active { transform: scale(0.85); background: var(--success); border-color: var(--success); color: #fff; }
.pbox-check:disabled { opacity: 0.4; }
.pbox-punkt {
  flex: none; width: 5px; height: 5px; margin: 8px 7px 0 7px;
  border-radius: 50%; background: var(--line-strong);
}
.pbox-titel {
  flex: 1; min-width: 0; font-size: 12.5px; line-height: 1.35;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.pbox-titel.spaet { color: var(--danger); font-weight: 600; }
.pbox-punkte { font-size: 11.5px; font-weight: 700; color: var(--success); }
.pbox-mehr { font-size: 11.5px; color: var(--ink-faint); padding-top: var(--sp-1); }
.pbox-leer { font-size: 12.5px; color: var(--ink-faint); padding: var(--sp-2) 0; }

/* --- Chat --- */
/* Der Chat fuellt den Bildschirm: Reiter oben, Verlauf scrollt, Eingabe unten. */
.view.chat-view { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-reiter-leiste {
  display: flex; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4);
  overflow-x: auto; scrollbar-width: none;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.chat-reiter-leiste::-webkit-scrollbar { display: none; }
.chat-reiter {
  display: flex; align-items: center; gap: 6px; flex: none;
  padding: var(--sp-2) var(--sp-3); min-height: 40px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  transition: all var(--fast) var(--ease);
}
.chat-reiter .avatar { width: 22px; height: 22px; font-size: 9px; margin: 0; border: none; }
.chat-reiter.sel { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.chat-badge {
  min-width: 18px; height: 18px; padding: 0 5px;
  display: grid; place-items: center; border-radius: 999px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 700;
}

.chat-verlauf {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  display: flex; flex-direction: column; gap: var(--sp-3);
}
.blase-zeile { display: flex; gap: var(--sp-2); align-items: flex-end; max-width: 88%; }
.blase-zeile.ich { align-self: flex-end; flex-direction: row-reverse; }
.blase-zeile.andere { align-self: flex-start; }
.blase-zeile .avatar { width: 28px; height: 28px; font-size: 10px; margin: 0; border: none; flex: none; }
.blase-block { min-width: 0; }
.blase-autor { font-size: 11.5px; font-weight: 700; color: var(--ink-soft); margin-bottom: 3px; }
.blase {
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
  word-break: break-word;
}
.blase-zeile.ich .blase {
  background: color-mix(in oklab, var(--brand) 14%, var(--surface));
  border-color: color-mix(in oklab, var(--brand) 30%, var(--line));
  border-bottom-right-radius: var(--r-sm);
}
.blase-zeile.andere .blase { border-bottom-left-radius: var(--r-sm); border-left: 3px solid var(--pcolor, var(--line)); }
.blase-text { font-size: 15px; white-space: pre-wrap; }
.blase-zeit { display: block; font-size: 10.5px; color: var(--ink-soft); margin-top: 3px; text-align: right; }
.blase-fuss { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.blase-zeile.ich .blase-fuss { justify-content: flex-end; }
.reak {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 2px 8px; min-height: 28px;
  font-size: 12px; font-weight: 600; cursor: pointer; color: var(--ink-soft);
  transition: transform var(--fast) var(--ease);
}
.reak:active { transform: scale(0.9); }
.reak.meine { border-color: var(--brand); color: var(--brand); }
.reak-neu { opacity: 0.5; }
.reak-wahl { display: flex; flex-wrap: wrap; gap: var(--sp-2); justify-content: center; }
.reak-gross {
  font-size: 28px; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-md); width: 60px; height: 60px; cursor: pointer;
}
.reak-gross:active { transform: scale(0.92); }

.chat-eingabe {
  display: flex; gap: var(--sp-2); align-items: center;
  padding: var(--sp-3) var(--sp-4) calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--sp-3));
  border-top: 1px solid var(--line); background: var(--bg);
}
.chat-eingabe input { flex: 1; border-radius: 999px; }
.chat-eingabe .btn-primary {
  flex: none; width: 46px; padding: 0; border-radius: 50%;
  font-size: 20px; line-height: 1;
}
/* Fremde Aufgaben sind sichtbar, aber nicht abhakbar */
.task-check.leer { border-style: dashed; cursor: default; }
.task.fremd .task-title { font-weight: 500; }
/* Ortsvermerk am Essen (unten bei den Schwiegereltern) */
.essen-ort {
  margin-left: 8px; padding: 1px 7px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 11px; font-weight: 700; color: var(--ink-soft);
}
