/* Familien-Seite (Wand-iPad): Startseite, Monatskalender, Pinnwand, Ruhemodus.
   Baut auf style.css auf (Farben, .btn, .flash, Formularfelder). Alles ist für Finger gebaut:
   Tippflächen mind. 44 px, Details per Antippen statt Tooltip, keine Hover-Abhängigkeit. */

body.family {
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px; line-height: 1.4;
  -webkit-tap-highlight-color: transparent; -webkit-touch-callout: none;
  --line: color-mix(in oklch, var(--border) 75%, transparent);
  --pad-x: max(1rem, env(safe-area-inset-left)); --pad-r: max(1rem, env(safe-area-inset-right));
  --kita-bg: oklch(0.94 0.05 65); --kita-line: oklch(0.82 0.09 60); --kita-ink: oklch(0.44 0.12 50);
  --hol-ink: oklch(0.5 0.17 5); --school: oklch(0.62 0.11 250); --school-ink: oklch(0.45 0.12 255);
  --tone-brown: oklch(0.5 0.08 55); --tone-blue: oklch(0.56 0.14 250); --tone-yellow: oklch(0.72 0.15 90);
  --tone-dark: oklch(0.38 0.01 70); --tone-red: oklch(0.56 0.19 25); --tone-green: oklch(0.56 0.14 150);
}
[data-mode="dark"] body.family {
  --kita-bg: oklch(0.3 0.055 60); --kita-line: oklch(0.45 0.09 55); --kita-ink: oklch(0.86 0.11 65);
  --hol-ink: oklch(0.8 0.12 5); --school: oklch(0.66 0.11 250); --school-ink: oklch(0.8 0.09 250);
  --tone-brown: oklch(0.66 0.08 55); --tone-blue: oklch(0.7 0.12 250); --tone-yellow: oklch(0.84 0.14 92);
  --tone-dark: oklch(0.72 0.01 70); --tone-red: oklch(0.72 0.15 25); --tone-green: oklch(0.74 0.14 150);
}
body.family :where(h1, h2, button, a, summary, .fam-clock, .cal-day, .tile-head) { -webkit-user-select: none; user-select: none; }
body.family h1, body.family h2 { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Bausteine ---------------------------------------------------------------- */
.ic { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; vertical-align: -.22em; }
.ibtn { width: 44px; height: 44px; flex: none; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px;
        background: transparent; color: var(--muted); font: inherit; cursor: pointer; text-decoration: none;
        transition: background .15s, color .15s, transform .1s; }
.ibtn .ic { width: 22px; height: 22px; }
.ibtn:active { background: var(--surface-2); color: var(--text); transform: scale(.94); }
.ibtn.solid { background: var(--primary); color: var(--primary-text); }
.ibtn.solid:active { background: var(--primary); color: var(--primary-text); opacity: .85; }
.ibtn.sm { width: 36px; height: 36px; border-radius: 10px; }
.ibtn.sm .ic { width: 19px; height: 19px; }
.ibtn form { display: contents; }
@media (hover: hover) { .ibtn:not(.solid):hover { background: var(--surface-2); color: var(--text); } }
.text-btn { font: inherit; font-size: .82rem; font-weight: 600; color: var(--muted); background: none; border: 0; cursor: pointer;
            padding: .5rem .2rem; min-height: 36px; text-decoration: none; }
.text-btn:active { color: var(--text); }

.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: .7rem .85rem .8rem;
        box-shadow: var(--shadow); min-width: 0; }
.tile-head { display: flex; align-items: center; gap: .45rem; min-height: 30px; margin-bottom: .3rem; color: var(--muted); }
.tile-head h2 { flex: 1; min-width: 0; font-size: .8rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-head .ibtn { margin: -7px -6px -7px 0; }
.empty { color: var(--muted); font-size: .88rem; margin: .2rem 0; }

.kid { display: inline-flex; align-items: baseline; gap: .3rem; padding: .05rem .5rem; border-radius: 999px; font-size: .8rem; font-weight: 650;
       color: color-mix(in oklch, var(--kid) 72%, var(--text)); background: color-mix(in oklch, var(--kid) 16%, transparent); }
.kid small { font-weight: 500; font-size: .92em; opacity: .85; }

/* --- Kopf: Uhr, Datum, Wetter ------------------------------------------------- */
.fam-head { flex: none; display: flex; align-items: center; gap: 1rem 1.6rem; flex-wrap: wrap;
            padding: max(.45rem, env(safe-area-inset-top)) var(--pad-r) .45rem var(--pad-x); }
.fam-now { display: flex; align-items: center; gap: .8rem; }
.fam-clock { font-size: 2.9rem; font-weight: 700; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.fam-date { display: flex; flex-direction: column; justify-content: center; min-height: 44px; line-height: 1.2; padding: 0; border: 0; background: none;
            color: inherit; font: inherit; text-align: left; cursor: pointer; }
.fam-date:active { opacity: .7; }
.fam-date b { font-size: 1.05rem; font-weight: 650; }
.fam-date span { color: var(--muted); font-size: .95rem; }
.fam-weather { display: flex; align-items: center; gap: .6rem; padding-left: 1.6rem; border-left: 1px solid var(--line); }
.fam-weather .ic.big { width: 34px; height: 34px; stroke-width: 1.6; color: var(--muted); }
.fam-weather .temp { font-size: 1.9rem; font-weight: 650; line-height: 1; font-variant-numeric: tabular-nums; }
.fam-weather .more { display: flex; flex-direction: column; font-size: .85rem; line-height: 1.3; color: var(--muted); }
.fam-weather .more b { color: var(--text); font-weight: 600; }
/* Anzieh-Hinweis: Symbole mit einem Wort, Antippen zeigt die Begründung */
.fam-wear { position: relative; flex: 1 1 11rem; min-width: 0; padding-left: 1.6rem; border-left: 1px solid var(--line); }
.wear-btn { display: flex; align-items: center; align-content: center; flex-wrap: wrap; gap: .05rem .8rem; width: 100%; min-height: 44px; max-height: 2.95rem;
            overflow: hidden; padding: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: .85rem; line-height: 1.5;
            text-align: left; cursor: pointer; }
.wear-day { font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.wear-chip { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; white-space: nowrap; }
.wear-chip .ic { width: 19px; height: 19px; stroke-width: 1.6; color: var(--muted); }
.wear-why { position: absolute; z-index: 20; top: calc(100% + .35rem); left: 1.6rem; margin: 0; width: max-content; max-width: min(23rem, 78vw);
            padding: .5rem .75rem; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
            font-size: .85rem; color: var(--muted); }
.wear-why[hidden] { display: none; }
.fam-actions { margin-left: auto; display: flex; align-items: center; gap: .15rem; }
.fam-toast { position: fixed; z-index: 450; left: 50%; bottom: max(1.2rem, env(safe-area-inset-bottom)); transform: translateX(-50%); margin: 0;
             max-width: min(30rem, 90vw); padding: .6rem .95rem; border-radius: 12px; background: var(--text); color: var(--bg); font-size: .9rem; box-shadow: var(--shadow); }
.fam-toast[hidden] { display: none; }
.fam-actions form { margin: 0; }
.fam-flash { padding: 0 var(--pad-r) 0 var(--pad-x); }
.fam-flash .flash { margin-bottom: .6rem; }

/* --- Aufbau: Kacheln auf einem festen Raster (Spalten × Zeilen aus layout.py) ------------------
   Jede Kachel trägt --x/--y (ab 1) und --w/--h in Rasterschritten. Im Querformat füllt das Raster genau
   den Bildschirm, darunter stapeln sich die Kacheln in der Reihenfolge ihres Platzes. */
.fam-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: .6rem;
            padding: 0 var(--pad-r) max(.8rem, env(safe-area-inset-bottom)) var(--pad-x); }
.fam-grid > .tile { order: calc(var(--y, 1) * 100 + var(--x, 1)); }
.fam-grid > .fam-month, .fam-grid > .fam-none { grid-column: 1 / -1; }
.fam-month { display: flex; flex-direction: column; gap: .5rem; padding: .6rem .7rem .7rem; height: 58vh; height: 58dvh; min-height: 380px; }
.le-open, .le-bar { display: none; }

/* Querformat (iPad an der Wand, Desktop): eine feste Bildschirmseite, Kacheln scrollen in sich */
@media (min-width: 1000px) and (min-aspect-ratio: 1/1) {
  body.family.fam-home { height: 100vh; height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
  .fam-home .fam-grid { flex: 1; min-height: 0; align-items: stretch;
                        grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); grid-template-rows: repeat(var(--rows), minmax(0, 1fr)); }
  .fam-home .fam-grid > .tile { grid-column: var(--x) / span var(--w); grid-row: var(--y) / span var(--h); order: 0;
                                min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .fam-home .fam-grid > .tile::-webkit-scrollbar { display: none; }
  .fam-home .fam-grid > .fam-none { grid-column: 1 / -1; grid-row: 1 / span 3; }
  .fam-home .fam-month { height: auto; min-height: 0; overflow: hidden; }
  /* Inhalte, die ihre Kachel ausfüllen */
  .fam-home #draw { display: flex; flex-direction: column; }
  .fam-home #draw .draw-latest, .fam-home #draw .draw-open { flex: 1 1 0; min-height: 0; }
  .fam-home #draw .draw-latest img { height: 100%; aspect-ratio: auto; }
  .fam-home .memory img { height: 100%; max-height: none; }
  .fam-home .tile.day { display: flex; flex-direction: column; }
  .fam-home .tile.day .day-body { flex: 1 0 auto; }
  /* es geht unten weiter: Inhalt läuft weich aus (Klasse setzt die Seite, solange die Kachel nicht am Ende steht) */
  .fam-home .fam-grid > .tile.more { -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent);
                                     mask-image: linear-gradient(to bottom, #000 calc(100% - 26px), transparent); }
  .fam-home .le-open { display: grid; }
}
@media (max-width: 640px) {
  .fam-grid { grid-template-columns: minmax(0, 1fr); }
  .fam-month { height: auto; min-height: 0; }
  .fam-head { gap: .6rem 1rem; }
  .fam-clock { font-size: 2.4rem; }
  .fam-weather { padding-left: 0; border-left: 0; order: 3; flex-basis: 100%; }
  .fam-wear { padding-left: 0; border-left: 0; order: 4; flex-basis: 100%; }
  .wear-btn { max-height: none; }
  .wear-why { left: 0; }
}

/* --- Monatsraster (Startseite und Kalender-Seite) ------------------------------- */
.month-head { display: flex; align-items: center; gap: .2rem .4rem; flex-wrap: wrap; }
.month-head h1, .month-head h2 { font-size: 1.15rem; font-weight: 700; min-width: 8.2em; text-align: center; }
.month-head h2 a { color: inherit; text-decoration: none; }
.cal-legend { display: flex; flex-wrap: wrap; gap: .2rem .8rem; list-style: none; margin: 0 0 0 auto; padding: 0 .2rem 0 0; font-size: .76rem; color: var(--muted); }
.cal-legend li { display: flex; align-items: center; gap: .35rem; }
.lg { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.lg.kita { border-radius: 3px; background: var(--kita-bg); box-shadow: inset 0 0 0 1px var(--kita-line); }
.lg.public { background: var(--hol-ink); }
.lg.school { width: 14px; height: 4px; border-radius: 2px; background: var(--school); }

.cal-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr));
            grid-template-rows: auto repeat(var(--weeks, 5), minmax(0, 1fr)); gap: 1px;
            background: var(--line); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cal-wd { background: var(--surface); font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em;
          color: var(--muted); padding: .25rem .4rem; }
.cal-wd.we { color: color-mix(in oklch, var(--muted) 70%, transparent); }
.cal-day { font: inherit; color: var(--text); text-align: left; text-decoration: none; cursor: pointer; border: 0; border-radius: 0;
           min-width: 0; min-height: 0; overflow: hidden; padding: .25rem .3rem .3rem; background: var(--surface);
           display: flex; flex-direction: column; gap: .12rem; position: relative; }
.cal-day.we { background: color-mix(in oklch, var(--surface) 55%, var(--bg)); }
.cal-day.out { background: var(--bg); }
.cal-day.out > * { opacity: .5; }
.cal-day.kita { background: var(--kita-bg); }
.cal-day.school::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--school); opacity: .75; }
.cal-day:active { background: var(--surface-2); }
.cal-day.sel { box-shadow: inset 0 0 0 2.5px var(--focus); }
.cal-day:focus-visible { outline: 0; box-shadow: inset 0 0 0 2.5px var(--focus); }
.cal-top { display: flex; align-items: center; gap: .25rem; min-width: 0; flex: none; }
.cal-num { flex: none; min-width: 1.55rem; height: 1.55rem; padding: 0 .25rem; display: grid; place-items: center; border-radius: 999px;
           font-size: .88rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.cal-day.today .cal-num { background: var(--primary); color: var(--primary-text); }
.cal-day.public:not(.today) .cal-num { color: var(--hol-ink); }
.cal-kids { margin-left: auto; display: flex; gap: 3px; padding-right: .1rem; }
.cal-kids i { width: 8px; height: 8px; border-radius: 50%; background: var(--kid); }
.cal-tag { flex: none; font-size: .66rem; font-weight: 650; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 .15rem; }
.cal-tag.kita { color: var(--kita-ink); }
.cal-tag.public { color: var(--hol-ink); }
.cal-tag.school { color: var(--school-ink); }
.cal-evs { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cal-ev { display: flex; align-items: center; gap: .25rem; font-size: .72rem; line-height: 1.3; min-width: 0; padding: 0 .1rem; }
.cal-ev[hidden] { display: none; }
.cal-ev i { width: 6px; height: 6px; border-radius: 50%; flex: none; }
.cal-ev span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-more { flex: none; font-size: .66rem; font-weight: 650; color: var(--muted); padding: 0 .15rem; }
@media (max-width: 640px) {
  .cal-grid { grid-template-rows: auto; grid-auto-rows: minmax(52px, auto); }
  .cal-ev span, .cal-more, .cal-tag { display: none; }
  .cal-evs { flex-direction: row; flex-wrap: wrap; gap: 3px; padding: 0 .2rem; }
  .cal-legend { margin-left: 0; }
}

/* --- Termine --------------------------------------------------------------------- */
.kita-soon { display: flex; align-items: baseline; gap: .35rem; min-height: 36px; margin: 0 0 .35rem; padding: .4rem .65rem; border-radius: 10px;
             font-size: .88rem; text-decoration: none; white-space: nowrap; overflow: hidden;
             color: var(--kita-ink); background: var(--kita-bg); }
.kita-soon span { overflow: hidden; text-overflow: ellipsis; opacity: .85; }
.agenda-day { font-size: .68rem; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .55rem 0 .05rem; }
.agenda-day:first-of-type { margin-top: .15rem; }
.agenda-row { display: grid; grid-template-columns: 3.1rem minmax(0, 1fr); column-gap: .5rem; align-items: center; width: 100%; min-height: 34px;
              padding: .15rem .3rem; margin: 0 -.3rem; border: 0; border-radius: 9px; background: none; color: var(--text); font: inherit; text-align: left; }
button.agenda-row { cursor: pointer; width: calc(100% + .6rem); }
button.agenda-row:active, .agenda-row.open { background: var(--surface-2); }
.agenda-time { font-size: .82rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.agenda-what { display: flex; align-items: center; gap: .4rem; min-width: 0; font-size: .92rem; }
.agenda-what i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.agenda-what b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agenda-row.open .agenda-what b { white-space: normal; }
.agenda-more { grid-column: 2; display: none; flex-direction: column; gap: .1rem; padding: .1rem 0 .25rem 1.15rem; font-size: .82rem; color: var(--muted); }
.agenda-row.open .agenda-more { display: flex; }
.agenda-more span { display: flex; gap: .35rem; align-items: baseline; }
.agenda-more .ic { width: 14px; height: 14px; vertical-align: -.15em; }
.kita-row .agenda-time { color: var(--text); font-weight: 600; }
.kita-row .agenda-what { flex-wrap: wrap; gap: .25rem; padding: .15rem 0; }

/* --- Pinnwand ----------------------------------------------------------------------- */
/* Die Kachel ist der Zettel selbst: nur das Bild, randlos. Weiß wie das gemalte Bild, damit keine Kante entsteht. */
.tile.note { position: relative; padding: 0; overflow: hidden; background: #fff; }
.note .draw-latest img { border: 0; border-radius: 0; }
.note .draw-open { height: 100%; min-height: 140px; justify-content: center; border: 0; border-radius: 0; color: oklch(0.25 0.012 70); }
.note .draw-open small, .note .draw-open .ic { color: oklch(0.5 0.012 70); }
.note .draft-btn { position: absolute; left: 8px; top: 8px; z-index: 2; background: oklch(0.22 0.01 70 / .6); color: oklch(0.98 0.004 85); }
.note-new { position: absolute; right: 4px; bottom: 4px; z-index: 2; width: 40px; height: 40px; display: grid; place-items: center; padding: 0;
            border: 0; background: none; color: oklch(0.98 0.004 85); cursor: pointer; }
.note-new::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: oklch(0.22 0.01 70 / .6); }
.note-new .ic { position: relative; width: 16px; height: 16px; stroke-width: 2; pointer-events: none; }
.note-new:active::before { background: oklch(0.22 0.01 70 / .85); }
.draw-latest { position: relative; margin: 0; cursor: pointer; }
.draw-latest[hidden], .draw-open[hidden], .draft-btn[hidden] { display: none; }
.draw-latest img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain; background: #fff; border-radius: 12px;
                   border: 1px solid var(--line); }
.draw-latest figcaption { position: absolute; left: 8px; bottom: 8px; padding: .1rem .5rem; border-radius: 999px; font-size: .7rem; font-weight: 600;
                          background: oklch(0.22 0.01 70 / .6); color: oklch(0.98 0.004 85); }
.draw-latest .del, .draw-gallery .del { position: absolute; top: 4px; right: 4px; width: 40px; height: 40px; display: grid; place-items: center;
                    border: 0; background: none; padding: 0; cursor: pointer; color: oklch(0.98 0.004 85); }
.draw-latest .del::before, .draw-gallery .del::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: oklch(0.22 0.01 70 / .6); }
.draw-latest .del .ic, .draw-gallery .del .ic { position: relative; width: 16px; height: 16px; stroke-width: 2.2; pointer-events: none; }
.draw-latest .del:active::before, .draw-gallery .del:active::before { background: oklch(0.22 0.01 70 / .85); }
.draft-btn { font: inherit; font-size: .78rem; font-weight: 650; color: var(--text); background: var(--surface-2); border: 0; border-radius: 999px;
             padding: 0 .7rem; height: 30px; cursor: pointer; }
.draw-open { display: flex; gap: .7rem; align-items: center; width: 100%; min-height: 64px; text-align: left; font: inherit; color: var(--text); cursor: pointer;
             padding: .7rem .9rem; border-radius: 12px; border: 1.5px dashed var(--border); background: none; }
.draw-open:active { background: var(--surface-2); }
.draw-open .ic { width: 26px; height: 26px; color: var(--muted); }
.draw-open small { display: block; color: var(--muted); font-size: .82rem; }
.draw-gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: .4rem; padding-top: .5rem; }
.draw-gallery:empty, .draw-gallery[hidden] { display: none; }
.draw-gallery figure { position: relative; margin: 0; }
.draw-gallery figure:nth-child(n+9) { display: none; }
.draw-gallery img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; display: block; }
.draw-gallery .del { top: -4px; right: -4px; }
/* frühere Notizen in der Mal-Ansicht (nur Admin) */
.draw-bar .draw-gallery { grid-template-columns: repeat(2, 48px); justify-content: center; gap: .45rem; padding-top: 0; }
.draw-bar .draw-gallery figure:nth-child(n+9) { display: block; }
.draw-bar .draw-gallery img { aspect-ratio: 1; border-radius: 10px; }
.draw-bar .draw-gallery .del { top: -8px; right: -8px; width: 32px; height: 32px; }
.draw-bar .draw-gallery .del .ic { width: 12px; height: 12px; }

/* --- Müll, Geburtstage -------------------------------------------------------------- */
.waste { display: flex; align-items: center; gap: .6rem; min-height: 40px; padding: .2rem .35rem; margin: 0 -.35rem; border-radius: 10px; }
.waste-ic { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 9px;
            color: var(--tone); background: color-mix(in oklch, var(--tone) 15%, transparent); }
.waste-ic .ic { width: 19px; height: 19px; }
.waste b { display: block; font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.waste span.when { font-size: .8rem; color: var(--muted); }
.waste > div { min-width: 0; line-height: 1.25; }
.waste.tomorrow, .waste.today { background: var(--warn-bg); }
.waste.tomorrow .when, .waste.today .when { color: var(--warn); font-weight: 650; }
.tone-brown { --tone: var(--tone-brown); } .tone-blue { --tone: var(--tone-blue); } .tone-yellow { --tone: var(--tone-yellow); }
.tone-dark { --tone: var(--tone-dark); } .tone-red { --tone: var(--tone-red); } .tone-green { --tone: var(--tone-green); }
.tone-muted { --tone: var(--muted); }
.bday { display: flex; align-items: baseline; gap: .5rem; min-height: 32px; font-size: .92rem; }
.bday b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bday .age { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.bday .when { margin-left: auto; color: var(--muted); font-size: .82rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bday.today .when { color: var(--kita-ink); font-weight: 650; }

/* --- Zuhause (Home Assistant): Werte, offene Fenster, Schalter ---------------------------- */
.ha-body { display: flex; flex-direction: column; gap: .55rem; }
.ha-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(5.6rem, 1fr)); gap: .45rem .7rem; }
.ha-values:empty, .ha-controls:empty, .ha-open[hidden] { display: none; }
.ha-val { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.ha-val span { font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ha-val b { font-size: 1.12rem; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ha-val small { font-size: .7rem; color: var(--muted); }
.ha-val.dim b { color: var(--muted); font-weight: 500; }
.ha-open { display: flex; align-items: center; gap: .45rem; margin: 0; min-height: 34px; padding: .3rem .6rem; border-radius: 10px; font-size: .88rem;
           color: var(--muted); background: var(--surface-2); }
.ha-open .ic { width: 17px; height: 17px; }
.ha-open.warn { color: var(--warn); background: var(--warn-bg); font-weight: 600; }
.ha-controls { display: flex; flex-wrap: wrap; gap: .4rem; }
.ha-btn { display: inline-flex; align-items: center; gap: .4rem; max-width: 100%; min-height: 44px; padding: 0 .9rem 0 .7rem; border-radius: 999px;
          border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
          transition: background .15s, border-color .15s, color .15s, transform .1s; }
.ha-btn span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ha-btn .ic { width: 18px; height: 18px; color: var(--muted); }
.ha-btn:active { transform: scale(.96); }
.ha-btn.on { background: color-mix(in oklch, var(--tone-yellow) 24%, var(--surface)); border-color: color-mix(in oklch, var(--tone-yellow) 60%, var(--border)); }
.ha-btn.on .ic { color: color-mix(in oklch, var(--tone-yellow) 70%, var(--text)); }
.ha-btn.done { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.ha-btn.done .ic { color: inherit; }
.ha-btn.busy { opacity: .65; }
.ha-btn:disabled { opacity: .45; cursor: default; }
#zuhause .empty { margin: 0; }
#zuhause .empty[hidden] { display: none; }

/* --- Einkaufsliste, Aufgaben ---------------------------------------------------------- */
.add-row { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 .25rem; }
.add-row input, .add-row select { font: inherit; font-size: 16px; min-height: 44px; min-width: 0; border-radius: 12px; border: 1px solid var(--border);
                                  background: var(--bg); color: var(--text); padding: 0 .75rem; }
.add-row input { flex: 1; width: auto; }
.add-row select { display: none; order: 3; flex: 1 1 100%; padding: 0 .6rem; }           /* „für wen“ erscheint erst beim Tippen */
.add-row:has(input:not(:placeholder-shown)) select, .add-row select:focus { display: block; }
.add-row input::placeholder { color: color-mix(in oklch, var(--muted) 80%, transparent); }
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li + li { border-top: 1px solid var(--line); }
.check-btn { display: flex; align-items: center; gap: .6rem; width: 100%; min-height: 44px; padding: .3rem .1rem; border: 0; background: none;
             color: var(--text); font: inherit; font-size: .95rem; text-align: left; cursor: pointer; }
.check-btn .box { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 8px; border: 1.8px solid var(--border);
                  color: transparent; transition: background .15s, border-color .15s; }
.check-btn .box .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.check-btn .txt { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.check-btn .who { font-size: .74rem; font-weight: 650; color: var(--muted); background: var(--surface-2); border-radius: 999px; padding: .05rem .5rem; }
.checklist li.done .box { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.checklist li.done .txt { color: var(--muted); text-decoration: line-through; }
.list-foot { display: flex; justify-content: flex-end; margin-bottom: -.4rem; }
.list-foot[hidden] { display: none; }

/* --- WoW (antippen klappt Details auf) -------------------------------------------------- */
.wow summary { list-style: none; display: flex; align-items: center; gap: .4rem .7rem; flex-wrap: wrap; cursor: pointer; padding: 0; min-height: 30px; }
.wow summary::-webkit-details-marker { display: none; }
.wow-title { display: flex; align-items: center; gap: .4rem; font-size: .8rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.wow-title img { width: 20px; height: 20px; border-radius: 5px; }
.wow-chips { display: flex; gap: .35rem; margin-left: auto; }
.wow-icon { position: relative; display: block; width: 28px; height: 28px; flex: none; }
.wow-icon img { display: block; width: 28px; height: 28px; border-radius: 7px; }
.wow-icon i { position: absolute; right: -3px; bottom: -3px; width: 11px; height: 11px; border-radius: 50%; border: 2px solid var(--surface); background: var(--muted); }
.wow-icon.up i { background: oklch(0.68 0.17 150); }
.wow-icon.down i { background: oklch(0.62 0.2 25); }
.wow-icon.down img { filter: grayscale(1) brightness(.75); }
.wow-list { margin: .5rem 0 0; padding: 0; list-style: none; }
.wow-list li { display: flex; align-items: center; gap: .6rem; min-height: 40px; font-size: .9rem; }
.wow-list li + li { border-top: 1px solid var(--line); }
.wow-list b { flex: 1; font-weight: 600; }
.wow-list .state { font-size: .82rem; font-weight: 650; }
.wow-list .state.up { color: var(--ok); } .wow-list .state.down { color: var(--err); }
.wow-list small { display: block; color: var(--muted); font-size: .78rem; font-weight: 400; }
.wow-at { margin: .3rem 0 0; font-size: .76rem; color: var(--muted); }

/* --- Foto-Rückblick -------------------------------------------------------------------- */
.memory { padding: 0; overflow: hidden; position: relative; }
.memory img { width: 100%; max-height: 300px; object-fit: cover; display: block; transition: opacity .4s; }

/* --- Malen (Vollbild) -------------------------------------------------------------------- */
body.drawing-open { overflow: hidden; }
.draw-view { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .7rem;
             padding: max(.7rem, env(safe-area-inset-top)) max(.7rem, env(safe-area-inset-right)) max(.7rem, env(safe-area-inset-bottom)) max(.7rem, env(safe-area-inset-left)); }
.draw-view[hidden] { display: none; }
.draw-bar { display: flex; flex-direction: column; gap: .9rem; width: 108px; overflow-y: auto; }
.draw-group { display: grid; grid-template-columns: repeat(2, 48px); gap: .45rem; justify-content: center; }
.draw-actions { display: flex; flex-direction: column; gap: .45rem; }
.draw-btn { display: flex; align-items: center; justify-content: center; gap: .4rem; min-height: 48px; padding: 0 .5rem; border-radius: 13px;
            border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; }
.draw-btn .ic { width: 19px; height: 19px; }
.draw-btn:active { transform: scale(.96); }
.draw-btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.draw-btn[aria-pressed="true"] { background: var(--text); border-color: var(--text); color: var(--bg); }
.draw-btn:disabled { opacity: .6; }
.swatch { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--border); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 3px var(--bg), 0 0 0 5.5px var(--text); }
.size { width: 48px; height: 48px; display: grid; place-items: center; padding: 0; border-radius: 13px; border: 1px solid var(--border);
        background: var(--surface); color: var(--text); cursor: pointer; }
.size i { display: block; border-radius: 50%; background: currentColor; }
.size.on { background: var(--text); border-color: var(--text); color: var(--bg); }
.draw-status { margin: 0; min-height: 1.2em; font-size: .82rem; text-align: center; color: var(--muted); }
.draw-canvas { display: block; width: 100%; height: 100%; min-height: 0; background: #fff; border-radius: 16px; border: 1px solid var(--border);
               touch-action: none; cursor: crosshair; }
@media (max-aspect-ratio: 1/1) {          /* Hochformat: Werkzeuge oben */
  .draw-view { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .draw-bar { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; overflow: visible; gap: .5rem .8rem; }
  .draw-group, .draw-actions { display: flex; flex-direction: row; flex-wrap: wrap; gap: .4rem; }
  .draw-bar .draw-gallery { display: flex; flex-wrap: wrap; gap: .5rem; }
  .draw-bar .draw-gallery figure { width: 48px; }
  .draw-btn { padding: 0 .8rem; }
  .draw-status { flex-basis: 100%; text-align: left; }
}

/* --- Fotorahmen: Vollbild, Hochformat zu zweit, unscharfe Kopie füllt die Ränder -------------- */
.frame { position: fixed; inset: 0; z-index: 400; background: #000; overflow: hidden; visibility: hidden; opacity: 0;
         transition: opacity .7s ease, visibility 0s .7s; }
.frame.on { visibility: visible; opacity: 1; transition: opacity .7s ease; cursor: pointer; }
.frame-slide { position: absolute; inset: 0; display: flex; opacity: 0; transition: opacity 1.4s ease; will-change: opacity; }
.frame-slide.show { opacity: 1; }
.frame-cell { position: relative; flex: 1 1 0; min-width: 0; overflow: hidden; }
.frame-cell + .frame-cell { margin-left: 3px; }
.frame-cell img { position: absolute; inset: 0; width: 100%; height: 100%; }
.frame-cell .back { object-fit: cover; filter: blur(26px) brightness(.5); transform: scale(1.18); }
.frame-cell .front { object-fit: contain; }
.frame-cell .front.fill { object-fit: cover; }
.frame-cap, .frame-clock { position: absolute; color: oklch(0.98 0.004 85); text-shadow: 0 1px 6px oklch(0 0 0 / .65), 0 0 2px oklch(0 0 0 / .5); }
.frame-cap { left: max(1rem, env(safe-area-inset-left)); bottom: max(.8rem, env(safe-area-inset-bottom)); max-width: calc(100% - 2rem);
             font-size: .92rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame-cell + .frame-cell .frame-cap { left: 1rem; max-width: calc(100% - 8.5rem); }
.frame-clock { right: max(1.1rem, env(safe-area-inset-right)); bottom: max(.6rem, env(safe-area-inset-bottom)); font-size: 2rem; font-weight: 650;
               line-height: 1; font-variant-numeric: tabular-nums; }

/* --- Ruhemodus ------------------------------------------------------------------------------ */
.sleep-veil { position: fixed; inset: 0; z-index: 500; background: #000; opacity: 0; pointer-events: none;
              transition: opacity 1.2s cubic-bezier(.16, 1, .3, 1); }
.sleep-veil.on { opacity: 1; pointer-events: auto; cursor: none; }
.sleep-veil.cover { pointer-events: auto; }                 /* „ausgegraut“: unsichtbar, fängt den Tipp ab, der nur wecken soll */
.sleep-veil.quick { transition-duration: .5s; }
/* Ruhemodus „ausgegraut“: dunkel (data-mode), ohne Farben, wenig Helligkeit – alles bleibt lesbar */
html.dim { filter: grayscale(1) brightness(.6); }
/* Prüfanzeige: Zeit bis zur Ruhe, Kamera, Bewegung. Liegt über dem schwarzen Bild, damit man sie auch dann sieht. */
.dbg { position: fixed; z-index: 600; left: max(.6rem, env(safe-area-inset-left)); bottom: max(.6rem, env(safe-area-inset-bottom)); pointer-events: none;
       display: grid; gap: .1rem; min-width: 15.5rem; padding: .5rem .7rem; border-radius: 12px; font-size: .78rem; line-height: 1.35;
       background: oklch(0.2 0.01 70 / .88); color: oklch(0.93 0.008 85); font-variant-numeric: tabular-nums; }
.dbg div { display: flex; align-items: center; gap: .5rem; }
.dbg span:first-child { flex: none; width: 6.4rem; color: oklch(0.72 0.012 80); }
.dbg b { font-weight: 600; }
.dbg-dot { width: 11px; height: 11px; flex: none; border-radius: 50%; background: oklch(0.42 0.01 70); }
.dbg-dot.on { background: oklch(0.78 0.19 145); box-shadow: 0 0 0 3px oklch(0.78 0.19 145 / .3); }
.dbg-bar { position: relative; flex: 1; height: 8px; border-radius: 4px; overflow: hidden; background: oklch(0.34 0.01 70); }
.dbg-bar i { display: block; height: 100%; width: 0; border-radius: 4px; background: oklch(0.8 0.14 85); transition: width .3s; }
.dbg-bar::after { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: oklch(0.93 0.008 85); }   /* Schwelle */

/* --- Kalender-Seite: Raster füllt den Bildschirm, rechts Tag und Kita-Einträge ---------------- */
body.cal-page { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.cal-head { flex: none; display: flex; align-items: center; gap: .3rem 1rem; flex-wrap: wrap;
            padding: max(.4rem, env(safe-area-inset-top)) var(--pad-r) .4rem var(--pad-x); }
.cal-head .month-head h1 { font-size: 1.35rem; min-width: 8.5em; }
.cal-main { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) clamp(290px, 27vw, 370px); gap: .75rem;
            padding: 0 var(--pad-r) max(.8rem, env(safe-area-inset-bottom)) var(--pad-x); }
.cal-side { min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; display: flex; flex-direction: column; gap: .7rem; }
.cal-detail h2 { font-size: 1.05rem; font-weight: 700; margin-bottom: .4rem; }
.cal-note { display: flex; align-items: baseline; gap: .4rem; flex-wrap: wrap; margin: .3rem 0; padding: .45rem .65rem; border-radius: 10px; font-size: .92rem; }
.cal-note.kita { background: var(--kita-bg); color: var(--kita-ink); }
.cal-note.public { color: var(--hol-ink); background: color-mix(in oklch, var(--hol-ink) 11%, transparent); }
.cal-note.school { color: var(--school-ink); background: color-mix(in oklch, var(--school) 14%, transparent); }
.cal-note.kidnote { background: color-mix(in oklch, var(--kid) 13%, transparent); }
.cal-note.kidnote b { color: color-mix(in oklch, var(--kid) 72%, var(--text)); }
.cal-detail .agenda-row { cursor: default; }
.cal-detail .agenda-more { display: flex; }
.cal-mark { margin-top: .5rem; width: 100%; }
.cal-box > summary { cursor: pointer; display: flex; align-items: center; gap: .45rem; min-height: 44px; margin: -.5rem 0; list-style: none;
                     font-size: .8rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; color: var(--muted); }
.cal-box > summary::-webkit-details-marker { display: none; }
.cal-box > summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
                            transform: rotate(45deg) translateY(-3px); transition: transform .2s; }
.cal-box[open] > summary::after { transform: rotate(225deg) translateY(-3px); }
.cal-box[open] > summary { margin-bottom: .3rem; }
.cal-box .count { font-weight: 500; text-transform: none; letter-spacing: 0; }
.kita-form { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem .6rem; align-items: end; margin-top: .6rem; }
.kita-form label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; font-weight: 600; color: var(--muted); margin: 0; min-width: 0; }
.kita-form .wide { grid-column: 1 / -1; }
.kita-form input, .kita-form select { font: inherit; font-size: 16px; min-height: 44px; min-width: 0; width: 100%; border-radius: 11px; border: 1px solid var(--border);
                                      background: var(--bg); color: var(--text); padding: 0 .6rem; }
.kita-form .btn { min-height: 46px; border-radius: 12px; }
.weekday-pick { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.weekday-pick legend { font-size: .8rem; font-weight: 600; color: var(--muted); padding: 0 0 .2rem; }
.weekday-pick .wd { position: relative; display: block; margin: 0; }
.weekday-pick .wd input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; min-height: 0; cursor: pointer; }
.weekday-pick .wd span { display: grid; place-items: center; min-height: 44px; border-radius: 11px; border: 1px solid var(--border);
                         color: var(--text); font-size: .88rem; font-weight: 650; }
.weekday-pick .wd input:checked + span { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.weekday-pick .wd input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.kita-list { list-style: none; margin: .2rem 0 0; padding: 0; }
.kita-list li { display: flex; align-items: center; justify-content: space-between; gap: .5rem; min-height: 48px; padding: .25rem 0; font-size: .92rem; }
.kita-list li + li { border-top: 1px solid var(--line); }
.kita-list form { margin: 0; }
.kita-list small { display: block; color: var(--muted); font-size: .8rem; }
.row-actions { display: flex; align-items: center; flex: none; }
.cal-hint { font-size: .8rem; color: var(--muted); margin: .5rem 0 0; }
@media (max-aspect-ratio: 1/1) and (min-width: 641px) {     /* Tablet hochkant: Raster oben, Details unten */
  .cal-main { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 36%); }
}
@media (max-width: 640px) {                                 /* Handy: normale Seite zum Scrollen */
  body.cal-page { height: auto; overflow: visible; display: block; }
  .cal-main { display: block; }
  .cal-main .cal-grid { margin-bottom: .75rem; }
  .cal-side { overflow: visible; }
  .cal-head .month-head h1 { min-width: 0; font-size: 1.2rem; }
}

/* --- Wer bringt, wer holt ------------------------------------------------------------------------ */
.handover { display: flex; flex-wrap: wrap; gap: .3rem; padding: .1rem 0 .35rem; }
.cal-detail .handover { padding-left: 0; margin: .3rem 0 .5rem; }
.ho-btn { display: inline-flex; align-items: baseline; gap: .35rem; min-height: 36px; padding: 0 .7rem; border-radius: 999px; cursor: pointer;
          border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .88rem; }
.ho-btn small { color: var(--muted); font-size: .8rem; }
.ho-btn b { font-weight: 650; }
.ho-btn.unset { border-style: dashed; }
.ho-btn.unset b { color: var(--kita-ink); }
.ho-btn:active, .ho-btn.on { background: var(--surface-2); }
.ho-btn.on { border-color: var(--text); }
.ho-choose { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: .35rem; padding: .25rem 0 .1rem; font-size: .82rem; color: var(--muted); }
.ho-choose[hidden] { display: none; }
.ho-chip { min-height: 40px; padding: 0 .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--bg); color: var(--text);
           font: inherit; font-size: .9rem; font-weight: 600; cursor: pointer; }
.ho-chip:active { transform: scale(.96); }
.ho-chip.cur { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.ho-chip:last-child { font-weight: 500; color: var(--muted); border-style: dashed; }
.ho-chip.cur:last-child { color: var(--primary-text); border-style: solid; }
.handover.failed .ho-btn { border-color: var(--err); }
.ho-week { display: flex; flex-direction: column; gap: .6rem; margin-top: .6rem; }
.ho-people { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; font-weight: 600; color: var(--muted); margin: 0; }
.ho-week input, .ho-week select { font: inherit; font-size: 16px; min-height: 44px; min-width: 0; width: 100%; border-radius: 11px;
                                  border: 1px solid var(--border); background: var(--bg); color: var(--text); padding: 0 .6rem; }
.ho-grid { display: grid; grid-template-columns: 2rem minmax(0, 1fr) minmax(0, 1fr); gap: .35rem .5rem; align-items: center; }
.ho-col { font-size: .76rem; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding-left: .2rem; }
.ho-wd { font-size: .88rem; font-weight: 650; }
.ho-week .btn { min-height: 46px; border-radius: 12px; }

/* --- Termin anlegen: Vollbild-Blatt, Felder oben (die Bildschirmtastatur verdeckt sonst die Hälfte) ----- */
body.event-open { overflow: hidden; }
.ev-view { position: fixed; inset: 0; z-index: 120; overflow-y: auto; background: var(--bg);
           padding: max(1rem, env(safe-area-inset-top)) var(--pad-r) 1rem var(--pad-x); }
.ev-view[hidden], .ev-times[hidden], .ev-error[hidden] { display: none; }
.ev-form { max-width: 40rem; margin: 0 auto; display: grid; gap: .85rem; }
.ev-head { display: flex; align-items: center; gap: .8rem; }
.ev-head h2 { flex: 1; font-size: 1.3rem; }
.ev-cal { display: inline-flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); }
.ev-cal i { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.ev-form fieldset { border: 0; margin: 0; padding: 0; min-width: 0; display: grid; gap: .55rem; }
.ev-form label, .ev-form legend { display: grid; gap: .25rem; margin: 0; padding: 0; font-size: .8rem; font-weight: 600; color: var(--muted); min-width: 0; }
.ev-form input:not([type="checkbox"]) { font: inherit; font-size: 16px; font-weight: 400; min-height: 48px; width: 100%; min-width: 0; padding: 0 .8rem;
                                        border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.ev-form input.ev-title { font-size: 1.15rem; font-weight: 600; min-height: 54px; }
.ev-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.ev-chip { min-height: 44px; padding: 0 .9rem; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text);
           font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer; }
.ev-chip:active { transform: scale(.96); }
.ev-chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.theme-bunt .ev-chip.on { background: var(--wd); border-color: var(--wd); color: var(--wd-on); }
.ev-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .7rem; align-items: end; }
.ev-form label.ev-allday { display: flex; flex-direction: row; align-items: center; gap: .6rem; min-height: 48px; font-size: .95rem; color: var(--text); cursor: pointer; }
.ev-allday input { width: 22px; height: 22px; margin: 0; accent-color: var(--primary); }
.ev-error { margin: 0; color: var(--err); font-weight: 600; }
.ev-actions { display: flex; justify-content: flex-end; gap: .6rem; }
.ev-actions .draw-btn { min-width: 8.5rem; }
.agenda-act { display: none; padding: 0 0 .2rem 3.6rem; }
.agenda-row.open + .agenda-act { display: block; }
.ev-del { color: var(--err); }
.agenda-more .ev-del { padding: .2rem 0; min-height: 32px; text-align: left; }

/* --- Aufbau bearbeiten: Leiste statt Kopfzeile, Griff-Fläche über jeder Kachel ---------------------- */
.layout-edit .fam-head { display: none; }
.layout-edit .le-bar { display: flex; }
.le-bar { flex: none; align-items: center; gap: .6rem; padding: max(.45rem, env(safe-area-inset-top)) var(--pad-r) .45rem var(--pad-x); }
.le-bar > b { font-size: 1.05rem; white-space: nowrap; }
.le-hint { min-width: 0; font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.le-hint.warn { color: var(--err); font-weight: 600; }
.le-add { flex: 1; min-width: 0; display: flex; justify-content: flex-end; gap: .35rem; overflow-x: auto; scrollbar-width: none; }
.le-add::-webkit-scrollbar { display: none; }
.le-chip { flex: none; min-height: 40px; padding: 0 .8rem; border-radius: 999px; border: 1.5px dashed var(--border); background: var(--surface);
           color: var(--text); font: inherit; font-size: .85rem; font-weight: 600; white-space: nowrap; cursor: pointer; }
.le-chip:active { transform: scale(.96); }
.le-chip:disabled { opacity: .5; cursor: default; }
.le-bar .draw-btn { flex: none; min-height: 44px; padding: 0 .9rem; }
.layout-edit .fam-grid { background-image: radial-gradient(circle, color-mix(in oklab, var(--text) 32%, transparent) 1.5px, transparent 2px); }
.layout-edit .fam-grid > .tile { position: relative; overflow: hidden; -webkit-user-select: none; user-select: none; -webkit-mask-image: none; mask-image: none; }
.layout-edit .fam-grid > .tile > :not(.le-cover) { opacity: .28; pointer-events: none; }
.le-cover { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .05rem;
            border-radius: inherit; border: 2px dashed color-mix(in oklab, var(--text) 42%, transparent); color: var(--text);
            background: color-mix(in oklab, var(--surface) 40%, transparent); touch-action: none; cursor: grab; }
.le-name { max-width: 100%; padding: 0 2.7rem; font-size: .95rem; font-weight: 700; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.le-size { font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.le-del { position: absolute; top: 1px; right: 1px; width: 40px; height: 40px; display: grid; place-items: center; padding: 0; border: 0; background: none;
          color: var(--text); cursor: pointer; }
.le-del::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); border: 1px solid var(--border); }
.le-del .ic { position: relative; width: 14px; height: 14px; stroke-width: 2.6; pointer-events: none; }
.le-grip { position: absolute; right: 0; bottom: 0; width: 40px; height: 40px; cursor: nwse-resize; }
.le-grip::after { content: ""; position: absolute; right: 7px; bottom: 7px; width: 13px; height: 13px; border-radius: 0 0 5px 0;
                  border-right: 3px solid var(--text); border-bottom: 3px solid var(--text); }
.le-active { z-index: 20; }
.le-active .le-cover { cursor: grabbing; border-style: solid; border-color: var(--focus); box-shadow: 0 10px 30px oklch(0.2 0.02 70 / .28); }
.le-clash .le-cover { border-color: var(--err); background: color-mix(in oklab, var(--err-bg) 88%, transparent); }

/* --- Tagesbild: der Tag in Bildern. Kachel und Vollbild teilen sich die Karte; alles hängt an einer Größe (--u),
       die die Seite so wählt, dass die Karte in ihren Platz passt. ---------------------------------------- */
.tile.day { cursor: pointer; }
.day-wd { flex: none; font-size: .8rem; font-weight: 650; color: var(--muted); }
.day-body, .day-card { --u: 52px; display: flex; flex-wrap: wrap; align-items: center; align-content: center; justify-content: center;
                       gap: calc(var(--u) * .22) calc(var(--u) * .4); }
.day-a, .day-b { flex: 1 1 calc(var(--u) * 3.7); min-width: 0; display: flex; flex-direction: column; gap: calc(var(--u) * .16); }
.day-a { flex-basis: calc(var(--u) * (.5 + 1.6 * var(--n, 2))); }
.day-body > .empty { flex: 1 1 100%; }
.day-kids { display: flex; flex-wrap: wrap; justify-content: center; gap: calc(var(--u) * .16); }
.day-kid { flex: 1 1 0; min-width: calc(var(--u) * 1.5); max-width: calc(var(--u) * 3.6); display: flex; flex-direction: column; align-items: center; text-align: center;
           padding: calc(var(--u) * .12) .3rem calc(var(--u) * .1); border-radius: calc(var(--u) * .3); background: color-mix(in oklab, var(--kid) 13%, transparent); }
.day-pic { display: grid; }
.day-pic .ic { width: var(--u); height: var(--u); stroke-width: 1.4; color: color-mix(in oklab, var(--kid) 76%, var(--text)); fill: color-mix(in oklab, var(--kid) 20%, transparent); }
.day-kid b { max-width: 100%; font-size: clamp(.86rem, calc(var(--u) * .3), 2.1rem); font-weight: 700; line-height: 1.2; overflow: hidden; text-overflow: ellipsis;
             color: color-mix(in oklab, var(--kid) 62%, var(--text)); }
.day-kid small { font-size: clamp(.72rem, calc(var(--u) * .21), 1.35rem); font-weight: 600; line-height: 1.25; color: var(--muted); }
.day-kid.off small { color: var(--kita-ink); }
.day-ho { display: flex; flex-wrap: wrap; justify-content: center; gap: .3rem calc(var(--u) * .4); }
.day-who { display: inline-flex; align-items: center; gap: calc(var(--u) * .13); min-width: 0; }
.day-who > i { flex: none; width: calc(var(--u) * .6); height: calc(var(--u) * .6); display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line);
               background: var(--surface-2); font-style: normal; font-weight: 700; font-size: calc(var(--u) * .28); line-height: 1; }
.day-who > span { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.day-who small { font-size: clamp(.68rem, calc(var(--u) * .18), 1.1rem); color: var(--muted); }
.day-who b { font-size: clamp(.84rem, calc(var(--u) * .25), 1.6rem); font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-who.unset > i { border-style: dashed; background: none; color: var(--kita-ink); }
.day-who.unset b { color: var(--kita-ink); }
.day-out { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: center; gap: calc(var(--u) * .14) calc(var(--u) * .22); }
.day-wx { display: inline-flex; align-items: center; gap: calc(var(--u) * .1); margin-right: calc(var(--u) * .1); }
.day-wx .ic { width: calc(var(--u) * .72); height: calc(var(--u) * .72); stroke-width: 1.5; color: var(--muted); }
.day-wx > span { display: flex; flex-direction: column; line-height: 1.1; }
.day-wx b { font-size: clamp(1rem, calc(var(--u) * .36), 2.5rem); font-weight: 650; font-variant-numeric: tabular-nums; }
.day-wx small { font-size: clamp(.68rem, calc(var(--u) * .18), 1.1rem); color: var(--muted); white-space: nowrap; }
.day-thing { display: inline-flex; flex-direction: column; align-items: center; width: calc(var(--u) * 1.5); min-width: 4.7rem; text-align: center; }
.tiny .day-thing { width: auto; min-width: 0; }
.tiny .day-thing small { display: none; }
.day-thing .ic { width: calc(var(--u) * .6); height: calc(var(--u) * .6); stroke-width: 1.5; color: var(--muted); }
.day-thing small { max-width: 100%; font-size: clamp(.66rem, calc(var(--u) * .17), 1.05rem); font-weight: 600; line-height: 1.15;
                   -webkit-hyphens: auto; hyphens: auto; overflow-wrap: anywhere; }
.day-specials { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: calc(var(--u) * .07); }
.day-specials li { display: flex; align-items: center; gap: calc(var(--u) * .16); min-width: 0; font-size: clamp(.88rem, calc(var(--u) * .26), 1.55rem);
                   font-weight: 600; line-height: 1.3; }
.day-specials .ic { width: max(20px, calc(var(--u) * .46)); height: max(20px, calc(var(--u) * .46)); stroke-width: 1.6; color: var(--muted); }
.day-specials li > span { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day-specials small { font-size: .85em; font-weight: 500; color: var(--muted); font-variant-numeric: tabular-nums; }
.sp-event .ic { color: var(--cal, var(--muted)); }
.sp-holiday .ic { color: var(--hol-ink); }
.sp-waste .ic { color: var(--tone); }
/* Vollbild: dieselbe Karte, groß */
body.day-open { overflow: hidden; }
.day-view { position: fixed; inset: 0; z-index: 110; display: flex; flex-direction: column; gap: .8rem; overflow-y: auto; background: var(--bg);
            padding: max(.8rem, env(safe-area-inset-top)) var(--pad-r) max(1rem, env(safe-area-inset-bottom)) var(--pad-x); }
.day-view[hidden], .day-card[hidden] { display: none; }
.day-top { flex: none; display: flex; align-items: center; gap: .6rem; }
.day-tabs { flex: 1; display: flex; gap: .5rem; min-width: 0; }
.day-tab { display: flex; flex-direction: column; justify-content: center; min-height: 54px; min-width: 0; padding: .25rem 1.15rem; border-radius: 16px;
           border: 1px solid var(--line); background: var(--surface); color: var(--muted); font: inherit; line-height: 1.15; text-align: left; cursor: pointer; }
.day-tab small { font-size: .7rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; }
.day-tab b { font-size: 1.15rem; font-weight: 700; }
.day-tab.on { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.day-tab:active { transform: scale(.97); }
.day-top .ibtn { width: 54px; height: 54px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); }
.day-card { flex: 1 0 auto; width: 100%; max-width: 72rem; margin: 0 auto; gap: calc(var(--u) * .35) calc(var(--u) * .6); }
.day-card .day-specials { align-self: center; max-width: 100%; }
.day-card > .empty { flex: 1 1 100%; text-align: center; font-size: 1.2rem; }

/* --- Einkaufen (Handy, /einkauf/) ------------------------------------------------------
   Eine Spalte, einhändig: Liste in der Mitte, Eingabe unten am Daumen. Zeilen 52 px, alles per Antippen. */
body.shop-page { min-height: 100dvh; }
.shop-head { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .25rem;
             padding: max(.4rem, env(safe-area-inset-top)) var(--pad-r) .35rem var(--pad-x);
             background: color-mix(in oklab, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.shop-head h1 { flex: 1; min-width: 0; display: flex; align-items: center; gap: .5rem; font-size: 1.3rem; font-weight: 750; padding-left: .2rem; }
.shop-head h1 .ic { width: 26px; height: 26px; }
.shop-count { font-size: .88rem; font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; padding: 0 .3rem; white-space: nowrap; }
.shop-head .ibtn.on { color: var(--text); }
.shop-me { display: flex; gap: .5rem; padding: 0 var(--pad-r) .5rem var(--pad-x); max-width: 40rem; margin: 0 auto; width: 100%; }
.shop-me[hidden] { display: none; }
.shop-me input, .shop-add input { flex: 1; min-width: 0; font: inherit; font-size: 16px; min-height: 48px; border-radius: 14px;
                                  border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 0 .9rem; }
.shop-note { display: flex; align-items: center; gap: .5rem; margin: 0 auto .5rem; width: calc(100% - var(--pad-x) - var(--pad-r)); max-width: 40rem;
             padding: .55rem .8rem; border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: .88rem; }
.shop-note[hidden] { display: none; }
.shop-main { flex: 1; width: 100%; max-width: 40rem; margin: 0 auto; padding: .1rem var(--pad-r) 1.2rem var(--pad-x); }
.shop-tile { padding: .2rem .9rem .4rem; }
.shop-list .check-btn { min-height: 52px; gap: .8rem; padding: .45rem .1rem; font-size: 1.06rem; }
.shop-list .check-btn .box { width: 28px; height: 28px; border-radius: 9px; }
.shop-list .check-btn .box .ic { width: 18px; height: 18px; }
.shop-list .txt { display: flex; flex-direction: column; }
.shop-list .txt b { font-weight: 600; }
.shop-list .txt small { font-size: .82rem; color: var(--muted); }
.shop-list li.done .txt { text-decoration: none; }
.shop-list li.done .txt b { text-decoration: line-through; }
.shop-list li.wait .box { border-style: dashed; }
.shop-list li.done.wait .box { opacity: .7; }
.shop-list .check-btn:disabled { cursor: default; }
.shop-list li.shop-cat { padding: .75rem .1rem .1rem; font-size: .74rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
                        color: var(--muted); -webkit-user-select: none; user-select: none; }
.shop-list li.shop-cat:first-child { padding-top: .45rem; border-top: 0; }
.shop-list li.shop-cat + li { border-top: 0; }
.shop-da { border-top: 1px solid var(--line); }
.shop-da[hidden] { display: none; }
.shop-da summary { list-style: none; display: flex; align-items: center; gap: .35rem; min-height: 44px; cursor: pointer; color: var(--muted);
                   font-size: .8rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; -webkit-user-select: none; user-select: none; }
.shop-da summary::-webkit-details-marker { display: none; }
.shop-da summary .ic { width: 16px; height: 16px; transition: transform .15s; }
.shop-da[open] summary .ic { transform: rotate(90deg); }
.shop-tile > .empty { padding: .9rem 0; text-align: center; }
.shop-tile > .empty[hidden] { display: none; }
.shop-done-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .4rem; padding-top: .5rem;
                  border-top: 1px solid var(--line); color: var(--muted); }
.shop-done-head[hidden] { display: none; }
.shop-done-head h2 { font-size: .8rem; font-weight: 650; letter-spacing: .03em; text-transform: uppercase; }
.shop-done-head .text-btn { min-height: 44px; }
.shop-add { position: sticky; bottom: 0; z-index: 5; display: flex; gap: .5rem; width: 100%;
            padding: .55rem max(var(--pad-r), calc((100% - 40rem) / 2)) max(.6rem, env(safe-area-inset-bottom)) max(var(--pad-x), calc((100% - 40rem) / 2));
            background: color-mix(in oklab, var(--bg) 92%, transparent); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
            border-top: 1px solid var(--line); }
.shop-add .ibtn, .shop-me .ibtn { width: 48px; height: 48px; border-radius: 14px; }
.shop-login { display: grid; place-items: center; padding: 1rem var(--pad-r) 1rem var(--pad-x); }
.shop-login form { width: min(22rem, 100%); display: flex; flex-direction: column; gap: 1rem; padding: 1.2rem; }
.shop-login h1 { display: flex; align-items: center; gap: .5rem; font-size: 1.3rem; font-weight: 750; }
.shop-login input { font-size: 16px; min-height: 48px; border-radius: 12px; }
.shop-login .btn { min-height: 48px; border-radius: 12px; }
/* Laden wählen (Knopf über der Liste) und „Einkauf fertig“ */
.shop-bar { padding: 0 0 .5rem; }
.shop-bar[hidden] { display: none; }
.shop-chip { display: inline-flex; align-items: center; gap: .45rem; max-width: 100%; min-height: 44px; padding: 0 .75rem 0 .7rem; border-radius: 999px;
             border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .95rem; font-weight: 650; cursor: pointer; }
.shop-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-chip .ic { width: 20px; height: 20px; color: var(--muted); }
.shop-chip .ic.chev { width: 16px; height: 16px; }
.shop-chip.none { color: var(--muted); font-weight: 600; }
.shop-chip:active { background: var(--surface-2); }
.shop-finish { display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; min-height: 52px; margin: .6rem 0 .5rem;
               border: 0; border-radius: 14px; background: var(--primary); color: var(--primary-text); font: inherit; font-size: 1.02rem; font-weight: 650; cursor: pointer; }
.shop-finish[hidden] { display: none; }
.shop-finish .ic { width: 20px; height: 20px; stroke-width: 2.2; }
.shop-finish:active { opacity: .85; }
.shop-toast { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%); bottom: calc(max(.6rem, env(safe-area-inset-bottom)) + 4.6rem);
              display: flex; align-items: center; gap: .6rem; width: max-content; max-width: calc(100% - 2rem); margin: 0;
              padding: .3rem .35rem .3rem .95rem; border-radius: 14px; background: var(--text); color: var(--bg); font-size: .92rem; box-shadow: var(--shadow); }
.shop-toast[hidden], .shop-toast [hidden] { display: none; }
.shop-toast .text-btn { flex: none; min-height: 44px; padding: 0 .65rem; color: inherit; font-size: .9rem; font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
/* Laden-Blatt: Vollbild wie „Termin anlegen“ (die Bildschirmtastatur verdeckt sonst die Hälfte) */
body.view-open { overflow: hidden; }
.shop-view { position: fixed; inset: 0; z-index: 50; overflow-y: auto; overscroll-behavior: contain; background: var(--bg);
             padding: 0 var(--pad-r) max(1.2rem, env(safe-area-inset-bottom)) var(--pad-x); }
.shop-view[hidden], .shop-view [hidden] { display: none; }
.sv-in { max-width: 40rem; margin: 0 auto; display: grid; gap: .8rem; }
.sv-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: .3rem;
           min-height: 52px; margin: 0 0 0 -.4rem; padding-top: max(.4rem, env(safe-area-inset-top)); background: var(--bg); }
.sv-head h2 { flex: 1; min-width: 0; font-size: 1.3rem; font-weight: 750; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-intro { margin: 0; font-size: .9rem; color: var(--muted); }
#sv-pick:not([hidden]), .sv-edit:not([hidden]) { display: grid; gap: .8rem; }
.shop-view .tile { padding: .1rem .9rem; }
.sv-list, .sv-order { list-style: none; margin: 0; padding: 0; }
.sv-list li, .sv-order li { display: flex; align-items: center; gap: .25rem; border-top: 1px solid var(--line); }
.sv-list li:first-child, .sv-order li:first-child { border-top: 0; }
.sv-pick { flex: 1; min-width: 0; display: flex; align-items: center; gap: .8rem; min-height: 60px; padding: .45rem 0; border: 0; background: none;
           color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.sv-pick .txt { display: flex; flex-direction: column; min-width: 0; }
.sv-pick b { font-size: 1.05rem; font-weight: 600; }
.sv-pick small { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sv-pick .sv-dot { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--border); color: transparent; }
.sv-pick .sv-dot .ic { width: 16px; height: 16px; stroke-width: 2.6; }
.sv-pick[aria-pressed="true"] .sv-dot { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.sv-new { display: flex; align-items: center; justify-content: center; gap: .45rem; min-height: 52px; border-radius: 14px; border: 1.5px dashed var(--border);
          background: none; color: var(--muted); font: inherit; font-size: .98rem; font-weight: 650; cursor: pointer; }
.sv-new .ic { width: 20px; height: 20px; }
.sv-edit label { display: grid; gap: .3rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.sv-edit input { font: inherit; font-size: 16px; font-weight: 400; min-height: 48px; border-radius: 14px; border: 1px solid var(--border);
                 background: var(--surface); color: var(--text); padding: 0 .9rem; }
.sv-order li { min-height: 52px; }
.sv-order .n { width: 1.5rem; flex: none; font-size: .85rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.sv-order .cat { flex: 1; min-width: 0; font-weight: 600; }
.sv-order .ibtn:disabled { opacity: .3; cursor: default; }
.sv-actions { display: flex; gap: .6rem; }
.sv-actions .btn { flex: 1; min-height: 50px; border-radius: 14px; font-size: 1rem; }
.sv-actions .btn[hidden] { display: none; }

/* === Thema „Bunt“ ====================================================================================
   Farbe hat zwei Aufgaben: Jeder Bereich hat seinen Ton (Kachel, rundes Symbol), jeder Wochentag seine
   Farbe (Kalenderkopf, Datum oben, „Heute“). Inhalte bleiben dunkel auf hell – bunt ist der Rahmen.
   Kacheln setzen nur --hue (bei Bedarf --al/--ac/--on); daraus entstehen Akzent, Fläche und Schriftton.
   Gemischt wird hier in oklab: in oklch wandert der Farbton beim Mischen zweier Töne (Blau + Creme wird grünlich). */
body.family.theme-bunt {
  --bg: oklch(0.968 0.026 88); --surface: oklch(0.995 0.008 90); --surface-2: oklch(0.94 0.032 88);
  --text: oklch(0.27 0.035 275); --muted: oklch(0.5 0.035 275); --border: oklch(0.875 0.03 85);
  --primary: oklch(0.52 0.19 268); --primary-text: oklch(0.99 0.01 268); --focus: oklch(0.62 0.19 268);
  --shadow: 0 1px 2px oklch(0.45 0.08 60 / .07), 0 6px 18px oklch(0.45 0.08 60 / .06);
  --wd0: oklch(0.63 0.2 25);   --wd0-on: oklch(0.99 0.012 25);       /* Montag: Rot */
  --wd1: oklch(0.76 0.16 58);  --wd1-on: oklch(0.27 0.06 55);        /* Dienstag: Orange */
  --wd2: oklch(0.88 0.16 96);  --wd2-on: oklch(0.3 0.06 92);         /* Mittwoch: Gelb */
  --wd3: oklch(0.71 0.17 148); --wd3-on: oklch(0.24 0.06 150);       /* Donnerstag: Grün */
  --wd4: oklch(0.62 0.15 245); --wd4-on: oklch(0.99 0.012 245);      /* Freitag: Blau */
  --wd5: oklch(0.58 0.18 300); --wd5-on: oklch(0.99 0.012 300);      /* Samstag: Lila */
  --wd6: oklch(0.71 0.18 352); --wd6-on: oklch(0.27 0.07 352);       /* Sonntag: Rosa */
  --hue: 225; --al: .62; --ac: .17; --tl: .967; --tc: .03; --il: .4; --ic: .13; --wl: .6;
}
[data-mode="dark"] body.family.theme-bunt {
  --bg: oklch(0.185 0.03 275); --surface: oklch(0.235 0.03 275); --surface-2: oklch(0.29 0.035 275);
  --text: oklch(0.94 0.015 90); --muted: oklch(0.74 0.03 275); --border: oklch(0.35 0.035 275);
  --primary: oklch(0.76 0.13 268); --primary-text: oklch(0.18 0.04 268); --focus: oklch(0.76 0.13 268);
  --shadow: none;
  --al: .72; --ac: .15; --tl: .262; --tc: .04; --il: .88; --ic: .085; --wl: .78;
}
body.family.theme-bunt, .theme-bunt .tile {
  --accent: oklch(var(--al) var(--ac) var(--hue)); --on: oklch(0.99 0.012 var(--hue));
  --tint: oklch(var(--tl) var(--tc) var(--hue)); --ink: oklch(var(--il) var(--ic) var(--hue));
}
.theme-bunt .wd-0 { --wd: var(--wd0); --wd-on: var(--wd0-on); } .theme-bunt .wd-1 { --wd: var(--wd1); --wd-on: var(--wd1-on); }
.theme-bunt .wd-2 { --wd: var(--wd2); --wd-on: var(--wd2-on); } .theme-bunt .wd-3 { --wd: var(--wd3); --wd-on: var(--wd3-on); }
.theme-bunt .wd-4 { --wd: var(--wd4); --wd-on: var(--wd4-on); } .theme-bunt .wd-5 { --wd: var(--wd5); --wd-on: var(--wd5-on); }
.theme-bunt .wd-6 { --wd: var(--wd6); --wd-on: var(--wd6-on); }

/* Bereiche und ihre Töne */
.theme-bunt #agenda, .theme-bunt .cal-detail { --hue: 250; }
.theme-bunt #zuhause, .theme-bunt #plan { --hue: 152; }
.theme-bunt #waste { --hue: 195; --ac: .12; }
.theme-bunt #birthdays { --hue: 352; --al: .66; }
.theme-bunt #draw { --hue: 94; --al: .87; --ac: .16; --tc: .055; --on: oklch(0.3 0.06 92); }
.theme-bunt #shopping, .theme-bunt #kita { --hue: 28; --al: .64; --ac: .19; }
body.family.theme-bunt.shop-page { --hue: 28; --al: .64; --ac: .19; }
[data-mode="dark"] body.family.theme-bunt.shop-page { --al: .72; --ac: .15; }
.theme-bunt.shop-page .shop-head h1 .ic, .theme-bunt.shop-login h1 .ic { box-sizing: border-box; width: 34px; height: 34px; padding: 7px; border-radius: 50%;
                                                                       background: var(--accent); color: var(--on); stroke-width: 2.1; }
.theme-bunt.shop-page .shop-head h1, .theme-bunt .shop-done-head, .theme-bunt .shop-list li.shop-cat, .theme-bunt .shop-da summary { color: var(--ink); }
.theme-bunt.shop-page .shop-add .ibtn.solid, .theme-bunt.shop-page .shop-me .ibtn.solid,
.theme-bunt.shop-login .btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on); }
.theme-bunt.shop-page :is(.shop-add, .shop-me) input, .theme-bunt .sv-edit input { border-color: color-mix(in oklab, var(--accent) 38%, var(--border)); }
.theme-bunt .shop-finish, .theme-bunt .sv-actions .btn.primary,
.theme-bunt .sv-pick[aria-pressed="true"] .sv-dot { background: var(--accent); border-color: var(--accent); color: var(--on); }
.theme-bunt .shop-chip { border-color: color-mix(in oklab, var(--accent) 45%, var(--border)); }
.theme-bunt .shop-chip:not(.none) .ic:first-child { color: var(--ink); }
.theme-bunt .sv-pick .sv-dot { border-color: color-mix(in oklab, var(--accent) 60%, var(--border)); }
.theme-bunt .sv-new { border-color: color-mix(in oklab, var(--accent) 55%, var(--border)); color: var(--ink); }
.theme-bunt .sv-head h2 { color: var(--ink); }
.theme-bunt #tasks { --hue: 302; --al: .6; }
.theme-bunt #handover, .theme-bunt #day { --hue: 62; --al: .77; --ac: .15; --on: oklch(0.27 0.06 58); }
.theme-bunt #wow { --hue: 275; --tc: .02; }
.theme-bunt .fam-month { --hue: 225; --tc: .024; }
[data-mode="dark"] .theme-bunt #draw { --il: .9; }

.theme-bunt .tile { background: var(--tint); border-color: color-mix(in oklab, var(--accent) 30%, transparent);
                    --line: color-mix(in oklab, var(--accent) 24%, transparent);
                    --surface-2: color-mix(in oklab, var(--accent) 17%, var(--tint)); }
.theme-bunt .tile.memory { background: var(--surface); }
.theme-bunt .tile.note { background: #fff; border-color: var(--border); }
.theme-bunt .tile-head { min-height: 32px; margin-bottom: .4rem; color: var(--ink); }
.theme-bunt .tile-head > .ic { box-sizing: border-box; width: 30px; height: 30px; padding: 6px; border-radius: 50%;
                               background: var(--accent); color: var(--on); stroke-width: 2.1; }
.theme-bunt .tile-head h2 { font-size: .84rem; font-weight: 750; }
.theme-bunt .tile-head .ibtn { color: var(--ink); }
.theme-bunt .cal-box > summary, .theme-bunt .wow-title { color: var(--ink); }
.theme-bunt .tile .ibtn.solid { background: var(--accent); color: var(--on); }
.theme-bunt .tile :is(.add-row input, .add-row select, .kita-form input, .kita-form select, .ho-week input, .ho-week select) {
  background: var(--surface); border-color: color-mix(in oklab, var(--accent) 38%, var(--border)); }
.theme-bunt .check-btn .box { border-color: color-mix(in oklab, var(--accent) 60%, var(--border)); background: var(--surface); }
.theme-bunt .checklist li.done .box { background: var(--accent); border-color: var(--accent); color: var(--on); }
.theme-bunt .draw-open { border-color: color-mix(in oklab, var(--accent) 70%, var(--border)); background: color-mix(in oklab, var(--surface) 60%, transparent); }
.theme-bunt .draw-open .ic { color: var(--ink); }
.theme-bunt .ha-open:not(.warn) { color: var(--ink); }
.theme-bunt .ha-val b { color: var(--ink); }
.theme-bunt .ha-val.dim b { color: var(--muted); }

/* Kopfzeile: Wochentag in seiner Farbe, Wetter und Kleidung farbig */
.theme-bunt .fam-date b { align-self: flex-start; padding: 0 .6rem; border-radius: 999px; background: var(--wd); color: var(--wd-on); }
.theme-bunt .fam-date span { padding-left: .1rem; }
.theme-bunt .fam-actions .ibtn, .theme-bunt .cal-head .ibtn { color: color-mix(in oklab, var(--primary) 75%, var(--muted)); }
.theme-bunt .fam-weather .ic.big, .theme-bunt .wear-chip .ic { color: var(--c); fill: color-mix(in oklab, var(--c) 24%, transparent); stroke-width: 1.7; }
.theme-bunt .wx-sun, .theme-bunt .wx-partly { --c: oklch(0.76 0.17 78); }
.theme-bunt .wx-cloud, .theme-bunt .wx-fog { --c: oklch(var(--wl) 0.06 250); }
.theme-bunt .wx-rain { --c: oklch(var(--wl) 0.15 245); }
.theme-bunt .wx-snow { --c: oklch(0.72 0.1 222); }
.theme-bunt .wx-storm { --c: oklch(var(--wl) 0.17 298); }
.theme-bunt .wear-jacket { --c: oklch(var(--wl) 0.16 250); } .theme-bunt .wear-shirt { --c: oklch(var(--wl) 0.16 150); }
.theme-bunt .wear-boot { --c: oklch(0.72 0.16 70); }         .theme-bunt .wear-beanie { --c: oklch(0.64 0.2 25); }
.theme-bunt .wear-mitten { --c: oklch(var(--wl) 0.18 302); } .theme-bunt .wear-layers { --c: oklch(0.68 0.12 195); }
.theme-bunt .wear-sunhat { --c: oklch(0.74 0.16 58); }       .theme-bunt .wear-tube { --c: oklch(0.68 0.18 352); }

/* Termine: Tage als Pille in der Wochentagsfarbe */
.theme-bunt .agenda-day { width: fit-content; margin: .6rem 0 .2rem; padding: .05rem .55rem; border-radius: 999px; letter-spacing: .04em;
                          background: var(--wd); color: var(--wd-on); }
.theme-bunt .agenda-day:first-of-type { margin-top: .1rem; }
.theme-bunt .cal-detail h2 > span:first-child { padding: 0 .5rem; margin: 0 .4rem 0 -.15rem; border-radius: 999px; background: var(--wd); color: var(--wd-on); }
.theme-bunt .cal-detail h2 > .sep { display: none; }

/* Kalender: Regenbogen-Kopf, heute in der Farbe des Wochentags */
.theme-bunt .month-head :is(h1, h2), .theme-bunt .month-head h2 a { color: var(--ink); }
.theme-bunt .cal-grid { background: color-mix(in oklab, var(--accent) 26%, var(--surface)); border-color: color-mix(in oklab, var(--accent) 34%, transparent); }
.theme-bunt .cal-wd { background: var(--wd); color: var(--wd-on); padding-block: .3rem; }
.theme-bunt .cal-day.we { background: color-mix(in oklab, var(--wd) 9%, var(--surface)); }      /* Wochenende: Hauch der Tagesfarbe */
.theme-bunt .cal-day.out { background: color-mix(in oklab, var(--tint) 65%, var(--surface)); }
.theme-bunt .cal-day.kita { background: var(--kita-bg); }
.theme-bunt .cal-day.today { background: color-mix(in oklab, var(--wd) 15%, var(--surface)); }
.theme-bunt .cal-day.today .cal-num { background: var(--wd); color: var(--wd-on); }
.theme-bunt .cal-day:active { background: var(--surface-2); }
.theme-bunt .weekday-pick .wd input:checked + span, .theme-bunt .ho-wd { background: var(--wd); border-color: var(--wd); color: var(--wd-on); }
.theme-bunt .ho-wd { display: grid; place-items: center; min-height: 28px; border-radius: 999px; font-size: .8rem; }

/* Tagesbild: der Wochentag trägt seine Farbe, Wetter und Kleidung ihre Töne wie in der Kopfzeile */
.theme-bunt .day-wd { padding: 0 .55rem; border-radius: 999px; background: var(--wd); color: var(--wd-on); }
.theme-bunt .day-tab.on { background: var(--wd); border-color: var(--wd); color: var(--wd-on); }
.theme-bunt .day-wx .ic, .theme-bunt .day-thing .ic { color: var(--c); fill: color-mix(in oklab, var(--c) 24%, transparent); }
.theme-bunt .sp-birthday .ic { color: oklch(var(--wl) 0.18 352); }
.theme-bunt .sp-holiday .ic { color: var(--hol-ink); fill: color-mix(in oklab, var(--hol-ink) 22%, transparent); }
