/* Familien-Dashboard: Schriften */

@font-face {
  font-family: "Lexend";
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/lexend-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Lexend";
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/lexend-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Lexend";
  font-weight: 500;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/lexend-latin-500-normal.woff2") format("woff2");
}

@font-face {
  font-family: "Caveat";
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("/fonts/caveat-latin-600-normal.woff2") format("woff2");
}

/* Familien-Dashboard – warm, ruhig, viel Luft.
   Leinen-Rosé als Grund, Pflaume als Akzent, Honig für „heute“, Salbei für „erledigt“. */
:root {
  --paper: #fbf4ef;
  --sheet: #ffffff;
  --soft: #f5e9e2;
  --text: #3b2f36;
  --muted: #8e7c84;
  --line: #efe2da;
  --box: #dcc7bd;
  --accent: #8a4a6f;
  --accent-soft: #f3e3ea;
  --marker: #f6c86e;
  --done: #6f9a70;
  --warn: #c2492f;
  --focus: #8a4a6f;

  --fs-xs: 0.8125rem;
  --fs-s: 0.9375rem;
  --fs-m: 1.0625rem;
  --fs-l: 1.3125rem;
  --fs-xl: 1.875rem;
  --fs-clock: 3.25rem;

  --r-s: 10px;
  --r-m: 14px;
  --r-l: 26px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #221b20; --sheet: #2c232a; --soft: #372c34; --text: #f3e9ec; --muted: #b19fa8;
    --line: #3b2f37; --box: #5a4852; --accent: #e0a9c8; --accent-soft: #452f3d; --marker: #c9974a; --done: #8fc190;
    --warn: #f08b6e; --focus: #e0a9c8; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #221b20; --sheet: #2c232a; --soft: #372c34; --text: #f3e9ec; --muted: #b19fa8;
  --line: #3b2f37; --box: #5a4852; --accent: #e0a9c8; --accent-soft: #452f3d; --marker: #c9974a; --done: #8fc190;
  --warn: #f08b6e; --focus: #e0a9c8; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Lexend", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: var(--fs-m);
  font-weight: 400;
  line-height: 1.45;
  color: var(--text);
  background: var(--paper);
  font-variant-numeric: tabular-nums;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
button, input, select { font: inherit; color: inherit; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---------- Grundlayout ---------- */
.app {
  display: grid;
  grid-template-rows: auto auto 1fr;
  min-height: 100dvh;
  padding: 0 1.75rem 1.75rem;
  gap: 1rem;
}

.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; padding-top: 1.5rem; }
.topbar .date { margin: 0; font-size: var(--fs-l); font-weight: 500; }
.topbar .date small { display: block; font-size: var(--fs-s); font-weight: 400; color: var(--muted); }
.topbar .right { display: flex; flex-direction: column; align-items: flex-end; gap: 0.2rem; }
.logout { margin: 0; }
.head-actions { display: flex; align-items: center; gap: 0.15rem; }
.kiosk .head-actions { display: none; }
.head-btn[hidden] { display: none; }
.head-btn {
  width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 0; cursor: pointer;
  background: transparent; color: var(--muted); display: grid; place-items: center;
  transition: background-color 0.15s, color 0.15s;
}
.head-btn svg { width: 1.15rem; height: 1.15rem; }
.head-btn:hover, .head-btn:focus-visible { background: var(--accent-soft); color: var(--accent); }
.clock { font-size: var(--fs-clock); font-weight: 400; line-height: 1; letter-spacing: -0.02em; }
.linkbtn { background: none; border: 0; padding: 0.25rem; cursor: pointer; color: var(--muted); font-size: var(--fs-s); }
.linkbtn:hover { color: var(--accent); }

/* ---------- Kalender ---------- */
.calendar { min-height: 0; display: flex; flex-direction: column; }
.calendar > .week, .calendar > .month { flex: 1; min-height: 0; }

/* Kalender-Leiste: blättern, Ansicht, neuer Termin */
.cal-bar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.cal-nav { display: flex; align-items: center; gap: 0.35rem; min-width: 0; }
.cal-title { margin: 0 0.4rem; font-size: var(--fs-m); font-weight: 500; white-space: nowrap; }
.nav-btn {
  width: 2.25rem; height: 2.25rem; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--sheet); color: var(--text); font-size: 1.35rem; line-height: 1; display: grid; place-items: center;
}
.nav-btn:hover { color: var(--accent); }
#cal-today:disabled { visibility: hidden; }
.cal-actions { display: flex; align-items: center; gap: 0.5rem; }
.seg { display: inline-flex; background: var(--soft); border-radius: 999px; padding: 3px; }
.seg button {
  border: 0; background: transparent; cursor: pointer; border-radius: 999px;
  padding: 0.35rem 0.9rem; font-size: var(--fs-s); color: var(--muted);
}
.seg button[aria-pressed="true"] { background: var(--sheet); color: var(--text); font-weight: 500; }
.new-event {
  border: 0; cursor: pointer; border-radius: 999px; padding: 0.45rem 1rem;
  background: var(--accent); color: var(--sheet); font-weight: 500; font-size: var(--fs-s);
}
.new-event[hidden] { display: none; }
.day.past-day { opacity: 0.55; }

/* Monatsansicht */
.month {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(var(--weeks, 5), minmax(0, 1fr));
  gap: 4px;
}
.mhead { font-size: var(--fs-xs); color: var(--muted); padding: 0 0.5rem 0.2rem; }
.mhead.weekend { opacity: 0.7; }
.mday {
  display: flex; flex-direction: column; align-items: stretch; gap: 3px; min-width: 0; min-height: 0; overflow: hidden;
  background: var(--sheet); border: 0; border-radius: var(--r-s); padding: 0.35rem 0.4rem; text-align: left; cursor: pointer;
}
.mday:hover { box-shadow: inset 0 0 0 2px var(--accent-soft); }
.mday.other { background: transparent; }
.mday.other .mnum { color: var(--muted); opacity: 0.6; }
.mday.weekend:not(.other) { background: color-mix(in srgb, var(--sheet) 70%, var(--paper)); }
.mday.past-day .mevs { opacity: 0.55; }
.mnum { font-size: var(--fs-s); font-weight: 500; width: 1.7em; height: 1.7em; display: grid; place-items: center; border-radius: 50%; flex: none; }
.mday.today .mnum { background: var(--marker); color: #3b2f36; }
.mevs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; min-height: 0; }
.mev {
  display: flex; gap: 0.3em; align-items: baseline; font-size: var(--fs-xs); line-height: 1.3;
  white-space: nowrap; overflow: hidden; border-radius: 5px; padding: 0 0.3em;
}
.mev .mn { overflow: hidden; text-overflow: ellipsis; }
.mev .mt { color: var(--muted); flex: none; }
.mev:not(.allday)::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--c); flex: none; align-self: center; }
.mev.allday { background: var(--c); color: #fff; }
.mmore { font-size: var(--fs-xs); color: var(--muted); padding: 0 0.3em; }

/* Dialog „Neuer Termin“ */
.ev-dialog {
  border: 0; border-radius: var(--r-l); padding: 0; width: min(92vw, 28rem);
  background: var(--sheet); color: var(--text);
  box-shadow: 0 24px 60px -20px rgba(59, 47, 54, 0.45);
}
.ev-dialog::backdrop { background: rgba(59, 47, 54, 0.35); }
.ev-dialog form { padding: 1.5rem 1.5rem 1.25rem; display: flex; flex-direction: column; gap: 0.85rem; }
.ev-dialog h2 { margin: 0 0 0.2rem; font-size: var(--fs-l); font-weight: 500; }
.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: var(--fs-s); font-weight: 500; flex: 1; min-width: 0; }
.field .opt { color: var(--muted); font-weight: 400; }
.field input, .field select {
  padding: 0.65rem 0.8rem; border: 0; border-radius: var(--r-s); background: var(--soft); font-weight: 400; font-size: var(--fs-m); min-width: 0;
}
.mx-status { display: flex; align-items: center; gap: 0.5rem; font-size: var(--fs-xs); color: var(--muted); margin-top: -0.3rem; }
.mx-status .mx-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.mx-status .mx-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--box); flex: none; }
.mx-status[data-state="ok"] .mx-dot { background: var(--done); }
.mx-status[data-state="wait"] .mx-dot { background: var(--marker); }
.mx-status[data-state="err"] .mx-dot { background: var(--warn); }
.mx-status[data-state="err"] .mx-text { color: var(--warn); }
.mx-status .tool { flex: none; }
.field input[readonly] { background: transparent; padding-left: 0; color: var(--muted); }
.ev-dialog .row { display: flex; gap: 0.75rem; align-items: flex-end; }
.ev-dialog .row[hidden], .ev-dialog .field[hidden] { display: none; }
.switch { display: flex; align-items: center; gap: 0.45rem; font-size: var(--fs-s); padding-bottom: 0.7rem; cursor: pointer; white-space: nowrap; }
.switch input { width: 1.2rem; height: 1.2rem; accent-color: var(--accent); }
.hint { margin: 0; font-size: var(--fs-s); color: var(--muted); display: flex; align-items: center; gap: 0.4rem; }
.hint::before { content: ""; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--marker); }
.ev-dialog .error { margin: 0; color: var(--warn); font-size: var(--fs-s); }
.ev-dialog .actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.3rem; }
.primary {
  border: 0; cursor: pointer; border-radius: 999px; padding: 0.65rem 1.3rem;
  background: var(--accent); color: var(--sheet); font-weight: 500;
}
.primary:disabled { opacity: 0.6; cursor: wait; }
.dlg-intro { margin: -0.3rem 0 0.1rem; color: var(--muted); font-size: var(--fs-s); }
.hint-small { margin: -0.45rem 0 0; font-size: var(--fs-xs); color: var(--muted); }
.hint-small a { color: var(--accent); }
.field .inline { display: flex; gap: 0.4rem; align-items: center; }
.field .inline input { flex: 1; }
.checks { border: 0; padding: 0; margin: 0.2rem 0 0; display: flex; flex-direction: column; gap: 0.1rem; }
.checks legend { font-size: var(--fs-s); font-weight: 500; margin-bottom: 0.3rem; padding: 0; }
.checks .switch { padding: 0.3rem 0; white-space: normal; font-size: var(--fs-s); }
.ok-msg { margin: 0; color: var(--done); font-size: var(--fs-s); }
.ev-dialog .actions .spacer { flex: 1; }
.cal-note { margin: 0 0 0.5rem; font-size: var(--fs-s); color: var(--warn); }
.week {
  display: grid;
  grid-template-columns: repeat(var(--days, 7), minmax(0, 1fr));
  gap: 0.5rem;
  height: 100%;
}
.day { display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 0.6rem 0.5rem 0.75rem; border-radius: var(--r-m); }
.day.today { background: var(--sheet); }
.day-head { display: flex; align-items: baseline; gap: 0.4rem; padding: 0 0.2rem 0.6rem; }
.day-name { font-weight: 500; font-size: var(--fs-l); position: relative; z-index: 0; }
.day-num { color: var(--muted); font-size: var(--fs-s); }
.day-rel { margin-left: auto; font-size: var(--fs-xs); color: var(--muted); }
.day.weekend .day-name { color: var(--muted); }

/* „Heute“ bekommt einen Honig-Textmarker */
.day.today .day-name::before {
  content: "";
  position: absolute; z-index: -1;
  left: -0.3em; right: -0.35em; top: 0.4em; bottom: 0;
  background: var(--marker);
  border-radius: 0.5em 0.35em 0.55em 0.3em;
  transform: rotate(-2deg);
}
:root[data-theme="dark"] .day.today .day-name { color: #221b20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .day.today .day-name { color: #221b20; } }

.events { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; overflow-y: auto; min-height: 0; scrollbar-width: none; }
.ev {
  background: color-mix(in srgb, var(--c) 11%, var(--sheet));
  border-radius: var(--r-s);
  padding: 0.45rem 0.65rem 0.5rem;
}
.day.today .ev { background: color-mix(in srgb, var(--c) 14%, var(--paper)); }
.ev .t { display: flex; align-items: center; gap: 0.35rem; font-size: var(--fs-xs); color: var(--muted); }
.ev .t::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--c); flex: none; }
.ev .n { display: block; font-size: var(--fs-s); overflow-wrap: anywhere; }
.ev .loc { display: block; font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.ev.allday, .day.today .ev.allday { background: var(--c); color: #fff; }
.ev.allday .n { font-weight: 500; }
.ev.past { opacity: 0.45; }
.ev[role="button"] { cursor: pointer; transition: transform 0.12s; -webkit-tap-highlight-color: transparent; }
.ev[role="button"]:active { transform: scale(0.98); }
.ev[role="button"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Termin-Details */
.ed-body { padding: 1.5rem 1.5rem 1.25rem; display: flex; flex-direction: column; gap: 0.55rem; }
.ed-color { width: 2.5rem; height: 0.4rem; border-radius: 999px; }
.ed-dialog h2 { margin: 0.1rem 0 0; font-size: var(--fs-l); font-weight: 500; overflow-wrap: anywhere; }
.ed-when { margin: 0; font-weight: 500; }
.ed-row, .ed-meta { margin: 0; color: var(--muted); font-size: var(--fs-s); overflow-wrap: anywhere; }
.ed-desc { margin: 0.2rem 0 0; padding: 0.7rem 0.85rem; background: var(--soft); border-radius: var(--r-s); white-space: pre-line; font-size: var(--fs-s); overflow-wrap: anywhere; max-height: 40vh; overflow-y: auto; }
.ed-row[hidden], .ed-desc[hidden], .ed-note[hidden] { display: none; }
.ed-note { margin: 0.2rem 0 0; }
.ed-dialog .actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }
.ed-dialog .actions .danger { margin-left: -0.5rem; } /* bündig mit dem Text darüber */
.ed-dialog .actions > * { flex: none; }
.ed-dialog .actions .spacer { flex: 1; }
.ed-dialog .error { margin: 0; color: var(--warn); font-size: var(--fs-s); }
.tool.danger { color: var(--warn); }
.tool.danger[data-confirm] { background: var(--warn); color: #fff; }
.ev.now { box-shadow: inset 0 0 0 2px var(--c); }
.day-free { font-size: var(--fs-s); color: var(--muted); padding: 0 0.2rem; opacity: 0.7; }
.cal-empty { font-size: var(--fs-m); color: var(--muted); max-width: 42ch; }
.cal-empty code { font-size: var(--fs-s); background: var(--sheet); padding: 0.1em 0.4em; border-radius: 6px; }

/* ---------- Drei Bereiche ---------- */
.sheet {
  display: grid;
  grid-template-columns: 1.1fr 1.1fr 0.9fr;
  gap: 1rem;
  min-height: 0;
}
.panel {
  background: var(--sheet);
  border-radius: var(--r-l);
  padding: 1.25rem 1.5rem 1.4rem;
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
}
.panel-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.panel-head h2 { font-size: var(--fs-l); font-weight: 500; margin: 0; line-height: 1.2; white-space: nowrap; }
.panel-head .count {
  font-size: var(--fs-xs); color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 0.1rem 0.55rem; white-space: nowrap;
}
.panel-head .count:empty { display: none; }
.panel-head .tools { margin-left: auto; display: flex; align-items: center; gap: 0.25rem; }
.tool { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: var(--fs-s); }
.tool.text { padding: 0.35rem 0.5rem; border-radius: 999px; }
.tool.text:hover, .tool.text[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.tool.icon-btn {
  width: 2.25rem; height: 2.25rem; border-radius: 50%; display: grid; place-items: center; color: var(--muted);
}
.tool.icon-btn svg { width: 1.1rem; height: 1.1rem; }
.tool.icon-btn:hover, .tool.icon-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.tool.add-btn {
  width: 2.25rem; height: 2.25rem; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent);
  font-size: 1.5rem; line-height: 1; display: grid; place-items: center;
  transition: transform 0.2s;
}
.tool.add-btn[aria-pressed="true"] { transform: rotate(45deg); }
.panel-body { overflow-y: auto; min-height: 0; scrollbar-width: thin; }

h3.group { font-size: var(--fs-xs); font-weight: 500; color: var(--muted); margin: 0.9rem 0 0.2rem; }
h3.group:first-child { margin-top: 0.1rem; }

.items { list-style: none; margin: 0; padding: 0; }
.item { display: flex; align-items: center; gap: 0.5rem; }
.check {
  flex: 1; display: flex; align-items: center; gap: 0.75rem; min-width: 0;
  background: none; border: 0; padding: 0.45rem 0; text-align: left; cursor: pointer;
}
.box {
  flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%;
  border: 2px solid var(--box); background: var(--sheet);
  display: grid; place-items: center;
  transition: background-color 0.2s, border-color 0.2s, transform 0.2s;
}
.check:hover .box { border-color: var(--muted); }
.box svg { width: 1rem; height: 1rem; opacity: 0; transition: opacity 0.15s; }
.check[aria-checked="true"] .box { background: var(--done); border-color: var(--done); }
.check[aria-checked="true"] .box svg { opacity: 1; }
.check:active .box { transform: scale(0.9); }
.check[aria-checked="true"] .label { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.label { min-width: 0; overflow-wrap: anywhere; }
.meta { display: block; font-size: var(--fs-xs); color: var(--muted); }
.meta.late { color: var(--warn); }
.subject { font-weight: 500; color: var(--accent); margin-right: 0.35em; }
.del {
  flex: none; width: 2rem; height: 2rem; border-radius: 50%;
  border: 0; background: var(--soft); cursor: pointer; color: var(--warn);
  font-size: 1.15rem; line-height: 1;
}
.empty { color: var(--muted); font-size: var(--fs-s); margin: 0.25rem 0; }
.clear-done { margin-top: 0.6rem; }

/* Checklisten */
.lists { --kc: var(--accent); }
.cl-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.cl-row { display: flex; align-items: center; gap: 0.4rem; }
.cl-open {
  flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 0.3rem;
  background: var(--soft); border: 0; border-radius: var(--r-m); padding: 0.65rem 0.85rem; text-align: left; cursor: pointer;
  color: var(--text); font: inherit;
}
.cl-open:hover { background: var(--accent-soft); }
.cl-open:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.cl-title { font-weight: 500; overflow-wrap: anywhere; }
.cl-sub { font-size: var(--fs-xs); color: var(--muted); }
/* Kennzeichen für private Listen */
.cl-lock {
  display: inline-flex; align-items: center; gap: 0.2rem; vertical-align: 0.1em;
  margin-left: 0.45rem; padding: 0.05rem 0.5rem 0.05rem 0.4rem; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent); font-size: var(--fs-xs); font-weight: 500; line-height: 1.5;
}
.cl-lock svg { width: 0.8rem; height: 0.8rem; }
.cl-kind .cl-lock { margin: 0 0.45rem 0 0; }
.cl-progress { display: flex; align-items: center; gap: 0.6rem; }
.cl-progress .bar { max-width: none; }
.cl-start { flex: none; color: var(--accent); font-weight: 500; }
.lists .progress-row .bar { max-width: none; }

/* Checkliste im Overlay */
.cl-dialog {
  --kc: var(--accent);
  border: 0; padding: 0; border-radius: var(--r-l); background: var(--sheet); color: var(--text);
  width: min(56rem, 94vw); height: min(88dvh, 54rem); max-width: none; max-height: none;
}
.cl-dialog::backdrop { background: rgba(59, 47, 54, 0.4); }
.cl-dialog[open] { display: flex; }
.cl-sheet { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cl-top { display: flex; align-items: flex-start; gap: 0.35rem; padding: 1.4rem 1.25rem 0.6rem 1.75rem; }
.cl-top-main { flex: 1; min-width: 0; }
.cl-top h2 {
  margin: 0; font-size: var(--fs-xl); font-weight: 500; line-height: 1.2; overflow-wrap: anywhere;
  position: relative; z-index: 0; width: fit-content; max-width: 100%;
}
.cl-top h2::before {
  content: ""; position: absolute; z-index: -1; left: -0.15em; right: -0.2em; top: 0.55em; bottom: 0.02em;
  background: var(--marker); border-radius: 0.5em 0.35em 0.55em 0.3em; transform: rotate(-1.5deg); opacity: 0.85;
}
.cl-rename {
  width: 100%; font: inherit; font-size: var(--fs-l); font-weight: 500;
  padding: 0.45rem 0.7rem; border: 0; border-radius: var(--r-s); background: var(--soft);
}
.cl-kind { margin: 0.3rem 0 0; font-size: var(--fs-s); color: var(--muted); }
.cl-close svg { width: 1.3rem; height: 1.3rem; }
.cl-progress-top { padding: 0 1.75rem; margin: 0.2rem 0 0.4rem; }
.cl-progress-top[hidden] { display: none; }
.cl-progress-top .bar { max-width: none; height: 0.55rem; }
.cl-progress-top .frac { font-size: var(--fs-s); }
.cl-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 0.3rem 1.75rem 1rem; overscroll-behavior: contain; }
.cl-items .check { padding: 0.6rem 0; font-size: var(--fs-m); }
.cl-items .cl-point { font-size: var(--fs-m); padding-top: 0.6rem; padding-bottom: 0.6rem; }
.cl-items .cl-point::before { top: 1.2em; }
/* Ab Tablet-Breite lange Listen zweispaltig */
@media (min-width: 760px) {
  .cl-items { columns: 2; column-gap: 2.5rem; }
  .cl-items > li { break-inside: avoid; }
}
.cl-bottom {
  padding: 0.85rem 1.75rem calc(1.1rem + env(safe-area-inset-bottom));
  background: var(--paper); border-radius: 0 0 var(--r-l) var(--r-l);
}
.cl-bottom .cl-add { margin-top: 0; }
.cl-bottom .cl-add input[name=text] { background: var(--sheet); }
.cl-bottom .cl-actions { margin-top: 0.6rem; }
.cl-bottom .cl-actions:empty { display: none; }
.cl-totpl[hidden] { display: none; }
@media (max-width: 700px) {
  /* Handy: Overlay füllt den ganzen Bildschirm */
  .cl-dialog { width: 100%; height: 100%; border-radius: 0; margin: 0; inset: 0; }
  .cl-top { padding: calc(1rem + env(safe-area-inset-top)) 0.75rem 0.5rem 1.1rem; }
  .cl-top h2 { font-size: var(--fs-l); }
  .cl-progress-top, .cl-scroll { padding-left: 1.1rem; padding-right: 1.1rem; }
  .cl-bottom { padding-left: 1.1rem; padding-right: 1.1rem; border-radius: 0; }
}
.cl-point { flex: 1; min-width: 0; padding: 0.45rem 0 0.45rem 1.1rem; position: relative; overflow-wrap: anywhere; }
.cl-point::before { content: ""; position: absolute; left: 0.2rem; top: 1.05em; width: 0.4rem; height: 0.4rem; border-radius: 50%; background: var(--box); }
.cl-hint { margin: 0.4rem 0 0; }
.cl-done { margin: 0.6rem 0; color: var(--done); font-weight: 500; }
.cl-done::before { content: "★ "; }
.cl-add { flex-wrap: wrap; }
.cl-add input[name=text] { flex: 1; min-width: 0; }
.cl-totpl { flex: 1 1 100%; padding: 0; font-size: var(--fs-xs); color: var(--muted); white-space: normal; }
.cl-add .cl-totpl input { flex: none; width: 1.1rem; height: 1.1rem; padding: 0; margin: 0; }
.add .switch input { flex: none; width: 1.2rem; height: 1.2rem; padding: 0; }
.cl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin-top: 0.9rem; }
.cl-actions .spacer { flex: 1; }
.tool.text.danger-on { background: var(--warn); color: #fff; }
/* Aufgaben „An bestimmten Tagen“: Wochentage als Pillen */
.weekdays { flex: 1 1 100%; display: flex; flex-wrap: wrap; gap: 0.3rem; border: 0; margin: 0; padding: 0; }
.weekdays[hidden] { display: none; }
.weekdays label { position: relative; }
.weekdays input { position: absolute; opacity: 0; pointer-events: none; }
.weekdays span {
  display: inline-grid; place-items: center; min-width: 2.6rem; padding: 0.4rem 0.6rem; border-radius: 999px;
  background: var(--soft); color: var(--muted); font-size: var(--fs-s); cursor: pointer; user-select: none;
}
.weekdays input:checked + span { background: var(--accent); color: var(--sheet); }
.weekdays input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
/* An anderen Tagen dran: nur zur Übersicht */
.items.later .item { padding: 0.25rem 0; }
.later-item { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 0.6rem; color: var(--muted); font-size: var(--fs-s); }
.later-days {
  flex: none; min-width: 2.6rem; text-align: center; padding: 0.05rem 0.45rem; border-radius: 999px;
  background: var(--soft); font-size: var(--fs-xs); font-weight: 500;
}
.add .switch { flex: 1 1 100%; padding: 0; font-size: var(--fs-s); white-space: normal; }

/* ---------- Zweite Seite: Fotos ---------- */
.photos-page { display: none; }
body.view-fotos .photos-page { display: flex; flex-direction: column; gap: 0.75rem; min-height: 0; }
body.view-fotos .calendar, body.view-fotos .sheet, body.view-fotos .today-page, body.view-fotos .mine-pill { display: none !important; }
.kiosk .head-actions { display: flex; }
.kiosk .head-actions > :not(#photos-btn) { display: none; }
#photos-btn[aria-pressed="true"] { color: var(--accent); background: var(--accent-soft); }
.ph-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.ph-bar h2 { margin: 0; font-size: var(--fs-l); font-weight: 500; position: relative; z-index: 0; }
.ph-bar h2::before {
  content: ""; position: absolute; z-index: -1; left: -0.2em; right: -0.25em; top: 0.5em; bottom: 0.05em;
  background: var(--marker); border-radius: 0.5em 0.35em 0.55em 0.3em; transform: rotate(-2deg);
}
.ph-back { margin-left: -0.5rem; }
.ph-album-pick { margin-left: auto; }
.ph-album-pick select {
  font: inherit; font-size: var(--fs-s); padding: 0.45rem 0.8rem; border: 0; border-radius: 999px;
  background: var(--sheet); color: var(--text); max-width: 60vw;
}
#ph-show { display: inline-flex; align-items: center; gap: 0.35rem; }
#ph-show svg { width: 1rem; height: 1rem; }
#ph-show:disabled { opacity: 0.5; cursor: default; }
.ph-note { margin: 0; font-size: var(--fs-s); color: var(--muted); }
/* Raster: einheitliche 3:2-Kacheln (Hoch- und Querformat werden zugeschnitten). Die Höhe kommt vom Bild selbst,
   damit die Zeilen in einem höhenbegrenzten Bereich nicht zusammengedrückt werden. */
.ph-grid {
  /* Kachelbreite wächst mit dem Bildschirm: große Monitore → weniger, größere Bilder */
  display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(11rem, 15vw, 22rem), 1fr)); grid-auto-rows: max-content;
  align-content: start; gap: 0.6rem; overflow-y: auto; min-height: 0; padding-bottom: 0.5rem;
}
.ph-tile {
  display: block; border: 0; padding: 0; background: none; border-radius: var(--r-m); cursor: zoom-in;
  transition: transform 0.15s; -webkit-tap-highlight-color: transparent;
}
.ph-tile:hover { transform: scale(1.015); }
.ph-tile:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.ph-tile img { display: block; width: 100%; height: var(--ph-h, auto); aspect-ratio: 3 / 2; object-fit: cover; border-radius: inherit; background: var(--soft); }
.ph-pager { display: flex; align-items: center; justify-content: center; gap: 0.75rem; padding: 0.25rem 0 0.5rem; }
.ph-pager[hidden] { display: none; }
.ph-pager .tool { font-weight: 500; color: var(--accent); }
.ph-pager .tool:disabled { color: var(--muted); opacity: 0.5; cursor: default; background: none; }
.ph-page-info { font-size: var(--fs-s); color: var(--muted); text-align: center; }
@media (min-width: 1100px) { body.view-fotos .app { grid-template-rows: auto minmax(0, 1fr); } }
@media (max-width: 700px) {
  .ph-grid { grid-template-columns: repeat(2, 1fr); gap: 0.4rem; }
  .ph-tile { border-radius: var(--r-s); }
  .ph-pager { gap: 0.25rem; }
  .ph-page-info { font-size: var(--fs-xs); }
  .ph-album-pick { margin-left: 0; flex: 1 1 100%; order: 3; }
  .ph-album-pick select { width: 100%; max-width: none; }
}

/* Foto-Betrachter */
.ph-dialog {
  border: 0; padding: 0; margin: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  background: #1d171b; color: #fff; overflow: hidden;
}
.ph-dialog::backdrop { background: #1d171b; }
.ph-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transition: opacity 0.9s ease; user-select: none; -webkit-user-drag: none;
}
.ph-img.on { opacity: 1; }
.ph-controls {
  position: absolute; top: 0; right: 0; left: 0; display: flex; align-items: center; justify-content: flex-end; gap: 0.5rem;
  padding: calc(0.8rem + env(safe-area-inset-top)) 1rem 0.8rem;
  background: linear-gradient(rgba(0, 0, 0, 0.45), transparent);
}
.ph-count { margin-right: auto; font-size: var(--fs-s); opacity: 0.85; }
.ph-btn {
  width: 2.75rem; height: 2.75rem; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255, 255, 255, 0.16); color: #fff; display: grid; place-items: center;
  -webkit-tap-highlight-color: transparent;
}
.ph-btn:hover { background: rgba(255, 255, 255, 0.28); }
.ph-btn:focus-visible { outline: 3px solid var(--marker); outline-offset: 2px; }
.ph-btn svg { width: 1.35rem; height: 1.35rem; }
.ph-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 3.25rem; height: 3.25rem; }
.ph-prev { left: 1rem; }
.ph-next { right: 1rem; }
/* Automatische Diashow am Wanddisplay: ohne Bedienelemente */
.ph-dialog.auto .ph-controls, .ph-dialog.auto .ph-nav { display: none; }
@media (hover: none) { .ph-nav { background: rgba(0, 0, 0, 0.25); } }

/* Startseite „Heute“: Foto-Karte */
.t-photos { grid-column: 1 / -1; }
.t-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.35rem; margin-top: 0.35rem; }
.t-strip img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--r-s); display: block; }

/* Startseite „Heute“: Karte für aktive Checklisten */
.t-checklists { grid-column: 1 / -1; gap: 0.45rem; }
.t-cl { display: flex; flex-direction: column; gap: 0.2rem; }
.t-cl-name { font-weight: 500; overflow-wrap: anywhere; }
.t-cl-bar { display: flex; align-items: center; gap: 0.6rem; --kc: var(--accent); }
.t-cl-bar .bar { max-width: none; }

/* Kinderaufgaben: große Tippflächen, jedes Kind mit eigener Farbe */
.kids .check { padding: 0.55rem 0; }
.kids .box { width: 2.1rem; height: 2.1rem; }
.kids .box svg { width: 1.25rem; height: 1.25rem; }
.kids .check[aria-checked="true"] .box { background: var(--kc, var(--done)); border-color: var(--kc, var(--done)); }
.kid-block { --kc: var(--done); }
.kid-block + .kid-block { margin-top: 1.25rem; }
@media (min-width: 1100px) { .kids .panel-body.multi .kid-block + .kid-block { margin-top: 0; } }
.kid-head { display: flex; align-items: center; gap: 0.55rem; margin: 0.2rem 0 0.4rem; }
.avatar {
  width: 2rem; height: 2rem; border-radius: 50%; flex: none;
  background: var(--kc); color: #fff; font-weight: 500; display: grid; place-items: center; font-size: var(--fs-s);
}
h3.kid { font-size: var(--fs-m); font-weight: 500; margin: 0; }
.progress-row { display: flex; align-items: center; gap: 0.6rem; margin: 0.3rem 0 0.2rem; }
.progress-row h3.group { margin: 0; }
.bar { flex: 1; height: 0.4rem; background: var(--soft); border-radius: 999px; overflow: hidden; max-width: 10rem; }
.bar > span { display: block; height: 100%; background: var(--kc); border-radius: 999px; transition: width 0.4s ease; }
.frac { font-size: var(--fs-xs); color: var(--muted); }

.stamp {
  display: none;
  margin: 0.6rem 0 0.25rem; width: fit-content;
  font-weight: 500; font-size: var(--fs-s);
  color: #fff; background: var(--kc);
  border-radius: 999px; padding: 0.35rem 0.9rem;
}
.stamp::before { content: "★ "; }
.kid-block.all-done .stamp { display: block; }
.kid-block.celebrate .stamp { animation: pop 0.55s cubic-bezier(.2, 1.6, .4, 1) both; }
@keyframes pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Formulare */
.add { display: none; flex-wrap: wrap; gap: 0.5rem; padding: 0.4rem 0 1rem; }
.panel.adding .add { display: flex; }
.add input, .add select, .quick input {
  flex: 1 1 8rem; min-width: 0; padding: 0.6rem 0.8rem;
  border: 0; border-radius: var(--r-s); background: var(--soft);
}
.add input::placeholder, .quick input::placeholder { color: var(--muted); }
.add input[type="date"] { flex: 0 1 10rem; }
.add .wide { flex-basis: 100%; }
.add button, .quick button {
  padding: 0.6rem 1.1rem; border: 0; border-radius: 999px;
  background: var(--accent); color: var(--sheet); font-weight: 500; cursor: pointer;
}
.quick { display: flex; gap: 0.5rem; margin-top: 0.75rem; }

.toast {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  background: var(--text); color: var(--sheet); padding: 0.6rem 1.1rem; border-radius: 999px;
  font-size: var(--fs-s); display: none; z-index: 10;
}
.toast.show { display: block; }

/* ---------- Pinnwand ---------- */
:root {
  --n0: #fce6a4; --n1: #f8d3de; --n2: #d9e8cf; --n3: #d5e3f4; --n4: #fbd9c4;
  --note-ink: #3b2f36;
}
:root[data-theme="dark"] { --n0: #6e5a2a; --n1: #6a3f4d; --n2: #445a40; --n3: #3d4f68; --n4: #6d4a36; --note-ink: #f6ecef; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --n0: #6e5a2a; --n1: #6a3f4d; --n2: #445a40; --n3: #3d4f68; --n4: #6d4a36; --note-ink: #f6ecef; }
}
.board {
  list-style: none; margin: 0; padding: 0.35rem 0.15rem 0.5rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); gap: 0.9rem;
}
.note {
  --bg: var(--n0);
  position: relative; background: var(--bg); color: var(--note-ink);
  border-radius: 3px 3px 14px 3px;
  padding: 0.9rem 0.8rem 0.55rem; min-height: 7.5rem;
  display: flex; flex-direction: column; gap: 0.35rem;
  transform: rotate(var(--tilt, 0deg));
  box-shadow: 0 1px 1px rgba(59, 47, 54, 0.08), 0 8px 14px -10px rgba(59, 47, 54, 0.35);
  transition: transform 0.35s ease, opacity 0.35s ease;
}
.note::before { /* Klebestreifen */
  content: ""; position: absolute; top: -7px; left: 50%; width: 2.6rem; height: 0.8rem;
  transform: translateX(-50%) rotate(-2deg);
  background: color-mix(in srgb, var(--sheet) 70%, transparent); border-radius: 2px;
  box-shadow: 0 1px 1px rgba(59, 47, 54, 0.08);
}
.note.c1 { --bg: var(--n1); } .note.c2 { --bg: var(--n2); } .note.c3 { --bg: var(--n3); } .note.c4 { --bg: var(--n4); }
.note.for-me { box-shadow: 0 0 0 2px var(--accent), 0 8px 14px -10px rgba(59, 47, 54, 0.35); }
.note.peel { transform: rotate(14deg) translateY(-14px) scale(0.92); opacity: 0; }
.note-to-tag {
  align-self: flex-start; font-size: var(--fs-xs); font-weight: 500;
  background: color-mix(in srgb, var(--note-ink) 10%, transparent); border-radius: 999px; padding: 0.05rem 0.5rem;
}
.note.for-me .note-to-tag { background: var(--accent); color: #fff; }
.note-text {
  margin: 0; flex: 1;
  font-family: "Caveat", "Segoe Print", "Comic Sans MS", cursive; font-weight: 600;
  font-size: 1.45rem; line-height: 1.15; overflow-wrap: anywhere; white-space: pre-line;
}
.note-foot { display: flex; align-items: center; gap: 0.4rem; }
.note-avatar {
  width: 1.35rem; height: 1.35rem; border-radius: 50%; flex: none; background: var(--uc); color: #fff;
  display: grid; place-items: center; font-size: 0.7rem; font-weight: 500;
}
.note-meta { font-size: var(--fs-xs); opacity: 0.7; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-done {
  flex: none; width: 1.9rem; height: 1.9rem; border-radius: 50%; border: 0; cursor: pointer;
  background: color-mix(in srgb, var(--note-ink) 9%, transparent); color: var(--note-ink); font-size: 0.95rem;
  opacity: 0.65; transition: opacity 0.15s, background-color 0.15s;
}
.note-done:hover, .note-done:focus-visible { opacity: 1; background: var(--done); color: #fff; }

/* Zwei Bereiche teilen sich eine Spalte: Tabs statt Überschrift */
.panel[hidden] { display: none; }
.panel.tabbed .panel-head > h2, .panel.tabbed .panel-head > .count { display: none; }
.tabs { display: flex; align-items: center; gap: 0.9rem; min-width: 0; flex: 1; }
.panel-head .tools { flex: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 0.4rem;
  background: none; border: 0; padding: 0.1rem 0 0.2rem; cursor: pointer; white-space: nowrap;
  font-size: 1.15rem; font-weight: 500; color: var(--muted); z-index: 0;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] { color: var(--text); }
.tab[aria-selected="true"] .tab-label::before { /* Honig-Textmarker wie bei „heute“ */
  content: ""; position: absolute; z-index: -1; left: -0.2em; right: -0.25em; top: 0.6em; bottom: 0;
  background: var(--marker); border-radius: 0.5em 0.35em 0.55em 0.3em; transform: rotate(-1.5deg); opacity: 0.8;
}
.tab-label { position: relative; z-index: 0; }
.tab-count {
  font-size: var(--fs-xs); font-weight: 400; color: var(--accent); background: var(--accent-soft);
  border-radius: 999px; padding: 0.1rem 0.5rem;
}
.tab-count:empty { display: none; }
.tab-count.hot { background: var(--accent); color: var(--sheet); }
@media (max-width: 700px) { .tab { font-size: 1.05rem; } .tabs { gap: 0.8rem; } }

/* Hinweis „Zettel für dich“ (nur auf kleinen Bildschirmen, dort liegt die Pinnwand weiter unten) */
.mine-pill { display: none; }
@media (max-width: 1099px) {
  .mine-pill:not([hidden]) {
    display: flex; align-items: center; gap: 0.5rem; width: fit-content;
    background: var(--n0); color: var(--note-ink); text-decoration: none;
    border-radius: 999px; padding: 0.45rem 0.95rem; font-size: var(--fs-s); font-weight: 500;
  }
  .mine-pill::after { content: "↓"; }
}
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* Zettel-Formular */
.note-form textarea {
  flex: 1 1 100%; min-width: 0; resize: vertical; padding: 0.65rem 0.8rem; border: 0; border-radius: var(--r-s);
  background: var(--soft); font-family: "Caveat", cursive; font-weight: 600; font-size: 1.4rem; line-height: 1.2;
}
.note-opts { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem; flex: 1 1 100%; }
.note-to { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.note-to[hidden] { display: none; }
.to-opt input, .note-colors input { position: absolute; opacity: 0; pointer-events: none; }
.to-opt span {
  display: inline-block; padding: 0.3rem 0.7rem; border-radius: 999px; font-size: var(--fs-xs);
  background: var(--soft); color: var(--muted); cursor: pointer;
}
.to-opt input:checked + span { background: var(--accent); color: var(--sheet); }
.to-opt input:focus-visible + span, .note-colors input:focus-visible + .swatch { outline: 3px solid var(--focus); outline-offset: 2px; }
.note-colors { display: flex; gap: 0.35rem; }
.swatch { display: block; width: 1.5rem; height: 1.5rem; border-radius: 50%; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(59, 47, 54, 0.12); }
.swatch.c0 { background: var(--n0); } .swatch.c1 { background: var(--n1); } .swatch.c2 { background: var(--n2); }
.swatch.c3 { background: var(--n3); } .swatch.c4 { background: var(--n4); }
.note-colors input:checked + .swatch { box-shadow: 0 0 0 2px var(--sheet), 0 0 0 4px var(--accent); }

/* ---------- Wanddisplay ---------- */
.kiosk .logout { display: none; }
@media (min-width: 1100px) {
  .app { height: 100dvh; grid-template-rows: auto minmax(13rem, 0.8fr) minmax(0, 1.2fr); }
  .app.month-mode { grid-template-rows: auto minmax(0, 1.9fr) minmax(0, 1fr); }
  .sheet { grid-template-columns: 1.3fr 1.15fr 0.8fr; }
  .sheet[data-role="kind"] { grid-template-columns: 1.15fr 1fr 1.15fr; }
  .kids .panel-body.multi { display: grid; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); column-gap: 1.75rem; align-content: start; }
}
@media (min-width: 1700px) { html { font-size: 19px; } }

/* ---------- Tablet / schmaler ---------- */
@media (max-width: 1099px) {
  .sheet { grid-template-columns: 1fr 1fr; }
  .week { grid-template-columns: repeat(auto-fill, minmax(9.5rem, 1fr)); height: auto; }
  .month { grid-auto-rows: minmax(4.75rem, auto); grid-template-rows: auto; }
  .events { overflow: visible; }
}

/* ---------- Handy ---------- */
@media (max-width: 700px) {
  :root { --fs-clock: 2.25rem; --fs-l: 1.2rem; }
  .app { padding: 0 0.75rem 1rem; gap: 0.75rem; }
  .topbar { padding: 1rem 0.35rem 0; }
  .week { display: flex; flex-direction: column; gap: 0.15rem; }
  .day { flex-direction: row; gap: 0.75rem; padding: 0.55rem 0.6rem; }
  .day-head { flex-direction: column; gap: 0; width: 3.25rem; flex: none; padding: 0.05rem 0 0; }
  .day-rel { margin: 0; }
  .events { flex: 1; }
  .day-free { padding: 0.15rem 0; }
  .cal-bar { gap: 0.5rem; }
  .cal-nav { flex: 1 1 100%; }
  .cal-title { flex: 1; margin: 0 0.25rem; }
  .cal-actions { flex: 1 1 100%; justify-content: space-between; }
  .month { gap: 2px; grid-auto-rows: 3.4rem; }
  .mday { padding: 0.25rem; align-items: center; }
  .mhead { text-align: center; padding: 0; }
  .mevs { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 3px; }
  .mev { padding: 0; width: 0.45rem; height: 0.45rem; border-radius: 50%; background: var(--c); }
  .mev::before, .mev .mt, .mev .mn, .mmore { display: none; }
  .ev-dialog .row { flex-wrap: wrap; }
  .sheet { grid-template-columns: 1fr; gap: 0.75rem; }
  .panel { padding: 1.1rem 1.1rem 1.2rem; border-radius: 22px; }
  .board { grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); }

  /* Seiten: Kalender nur auf „Kalender“, Bereiche nur auf ihrer Seite (siehe applyPhone in app.js) */
  body:not(.kiosk) .app { padding-bottom: calc(5.25rem + env(safe-area-inset-bottom)); }
  body[data-page]:not([data-page="kalender"]) .calendar { display: none; }
  body[data-page="kalender"] .sheet, body[data-page="heute"] .sheet { display: none; }
  body[data-page] .mine-pill { display: none; } /* Zähler an der Leiste + Karte auf „Heute“ übernehmen das */
  /* Kopfzeile auf den Unterseiten schlanker: Uhr klein */
  body[data-page]:not([data-page="kalender"]):not([data-page="heute"]) .clock { font-size: var(--fs-l); }

  /* Startseite „Heute“ */
  body[data-page="heute"] .today-page { display: flex; }
  .today-page { flex-direction: column; gap: 0.75rem; }
  .today-events { padding: 1.1rem 1.1rem 1rem; border-radius: 22px; }
  .today-events .panel-head h2 { position: relative; z-index: 0; width: fit-content; }
  .today-events .panel-head h2::before {
    content: ""; position: absolute; z-index: -1; left: -0.2em; right: -0.25em; top: 0.5em; bottom: 0.05em;
    background: var(--marker); border-radius: 0.5em 0.35em 0.55em 0.3em; transform: rotate(-2deg);
  }
  .today-events .events { overflow: visible; }
  .today-events .ev { background: color-mix(in srgb, var(--c) 12%, var(--sheet)); }
  .today-events .ev.allday { background: var(--c); }
  .t-more { display: block; width: fit-content; margin: 0.8rem 0 0 auto; text-decoration: none; }
  .today-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
  .t-card {
    display: flex; flex-direction: column; gap: 0.15rem; min-width: 0;
    background: var(--sheet); border-radius: 22px; padding: 0.95rem 1rem 1rem;
    color: var(--text); text-decoration: none; -webkit-tap-highlight-color: transparent;
    transition: transform 0.12s;
  }
  .t-card:active { transform: scale(0.98); }
  .t-card:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
  .t-aufgaben { grid-column: 1 / -1; }
  .t-title { font-size: var(--fs-xs); color: var(--muted); font-weight: 500; }
  .t-big { font-size: var(--fs-xl); font-weight: 500; line-height: 1.15; }
  .t-line { font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
  .t-card.hot .t-big { color: var(--accent); }
  .t-note {
    display: block; margin-top: 0.3rem; color: var(--text);
    font-family: "Caveat", "Segoe Print", cursive; font-weight: 600; font-size: 1.2rem; line-height: 1.15;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  body[data-page="pinnwand"] .panel, body[data-page="einkaufen"] .panel { min-height: calc(100dvh - 12rem); }
  /* Lange Überschriften („Aufgaben für Emma“) dürfen umbrechen, Knöpfe bleiben im Bild */
  .panel-head h2 { white-space: normal; min-width: 0; }
  .panel-head .count { white-space: nowrap; }

  .bottom-nav {
    position: fixed; z-index: 20; left: 0; right: 0; bottom: 0;
    grid-template-columns: repeat(5, 1fr);
    padding: 0.4rem 0.5rem calc(0.4rem + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--sheet) 92%, transparent);
    -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
    box-shadow: 0 -6px 24px rgba(59, 47, 54, 0.08);
  }
  .bottom-nav a {
    position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.2rem;
    padding: 0.45rem 0 0.35rem; border-radius: var(--r-m);
    color: var(--muted); text-decoration: none; font-size: var(--fs-xs); font-weight: 500;
    -webkit-tap-highlight-color: transparent;
  }
  .bottom-nav svg { width: 1.5rem; height: 1.5rem; }
  .bottom-nav a[aria-current="page"] { color: var(--accent); }
  /* Honig-Textmarker unter dem aktiven Bereich */
  .bottom-nav a[aria-current="page"] .bn-label { position: relative; z-index: 0; }
  .bottom-nav a[aria-current="page"] .bn-label::before {
    content: ""; position: absolute; z-index: -1; left: -0.3em; right: -0.3em; top: 0.55em; bottom: -0.05em;
    background: var(--marker); border-radius: 0.5em 0.35em 0.55em 0.3em; transform: rotate(-2deg); opacity: 0.85;
  }
  .bottom-nav a:focus-visible { outline: 3px solid var(--focus); outline-offset: -3px; }
  .bn-badge:empty { display: none; }
  .bn-badge {
    position: absolute; top: 0.15rem; left: calc(50% + 0.45rem);
    min-width: 1.2rem; height: 1.2rem; padding: 0 0.3rem; border-radius: 999px;
    background: var(--soft); color: var(--text); font-size: 0.7rem; line-height: 1.2rem; text-align: center; font-weight: 600;
  }
  .bn-badge.hot { background: var(--accent); color: var(--sheet); }
}
.bottom-nav, .today-page { display: none; }
@media (max-width: 700px) { body:not(.kiosk) .bottom-nav { display: grid; } }

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

/* ---------- Login ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem; }
.login form { background: var(--sheet); padding: 2.25rem 2rem 2rem; border-radius: var(--r-l); width: min(100%, 22rem); }
.login h1 { margin: 0 0 0.35rem; font-size: var(--fs-xl); font-weight: 500; position: relative; z-index: 0; width: fit-content; }
.login h1::before {
  content: ""; position: absolute; z-index: -1; left: -0.2em; right: -0.25em; top: 0.5em; bottom: 0.05em;
  background: var(--marker); border-radius: 0.5em 0.35em 0.55em 0.3em; transform: rotate(-2deg);
}
.login p { margin: 0 0 1.4rem; color: var(--muted); }
.login label { display: block; font-weight: 500; margin-bottom: 0.4rem; font-size: var(--fs-s); }
.login input { width: 100%; padding: 0.75rem 0.9rem; border: 0; border-radius: var(--r-s); background: var(--soft); margin-bottom: 1.1rem; }
.login button { width: 100%; padding: 0.8rem; border: 0; border-radius: 999px; background: var(--accent); color: var(--sheet); font-weight: 500; cursor: pointer; }
.login .error { color: var(--warn); margin: 0 0 1rem; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.who { border: 0; padding: 0; margin: 0 0 1.4rem; display: flex; gap: 0.75rem; flex-wrap: wrap; }
.who-opt { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; cursor: pointer; margin: 0; font-weight: 400; }
.who-opt input { position: absolute; opacity: 0; pointer-events: none; }
.who-avatar {
  width: 3.5rem; height: 3.5rem; border-radius: 50%;
  background: color-mix(in srgb, var(--uc) 22%, var(--sheet)); color: var(--uc);
  display: grid; place-items: center; font-size: 1.35rem; font-weight: 500;
  transition: background-color 0.15s, color 0.15s, transform 0.15s;
}
.who-name { font-size: var(--fs-s); color: var(--muted); }
.who-opt:hover .who-avatar { transform: scale(1.05); }
.who-opt input:checked + .who-avatar { background: var(--uc); color: #fff; }
.who-opt input:checked ~ .who-name { color: var(--text); font-weight: 500; }
.who-opt input:focus-visible + .who-avatar { outline: 3px solid var(--focus); outline-offset: 2px; }
