/* le & le · a60 — «Ink»: Papierton und Tinte. Farbe markiert nur Personen. */

:root {
    --bg: #f4f4f0;
    --paper: #fbfbf8;
    --ink: #1a1a1a;
    --muted: #8a8a84;
    --line: rgba(26, 26, 26, .13);
    --line-soft: rgba(26, 26, 26, .08);
    /* Keine Akzentfarbe: Farbe bedeutet in dieser App ausschliesslich «eine
       Person» (Lavendel = Lari, Salbei = Lucas). Jeder andere Zustand wird mit
       Tinte, Grau und Form ausgedrückt — sonst muss man bei jedem farbigen
       Punkt erst prüfen, ob er jemanden meint oder etwas anderes. */
    --danger: #c0503a;
    --on-ink: #f7f7f4;
    --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
    --ease: cubic-bezier(.2, 0, 0, 1);
    color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.4;
    min-height: 100dvh;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, textarea, select {
    font: inherit; color: var(--ink);
    background: transparent;
    border: 0; border-bottom: 1.5px solid var(--line);
    border-radius: 0;
    padding: 10px 2px;
    width: 100%;
    outline: none;
    transition: border-color .15s var(--ease);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input:focus, textarea:focus, select:focus { border-bottom-color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.hidden, [hidden] { display: none !important; }

/* ── Topbar ─────────────────────────────────────────────────────────── */
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; justify-content: space-between;
    padding: calc(12px + env(safe-area-inset-top)) 22px 6px;
    background: var(--bg);
}
.brand { font-family: var(--mono); font-weight: 600; font-size: .76rem; color: var(--muted); }
.brand-dot { color: var(--muted); margin: 0 .4em; }
.brand-a60 { color: var(--muted); }
.offline-tag {
    margin-left: 10px; padding: 3px 7px;
    border: 1px solid var(--ink); border-radius: 5px;
    color: var(--ink); font-size: .62rem; letter-spacing: .06em;
    text-transform: uppercase; white-space: nowrap;
}
.avatar-btn { border-radius: 0; }
.avatar {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 4px;
    background: var(--marker, var(--ink)); color: var(--marker-fg, var(--on-ink));
    font-family: var(--mono); font-weight: 700; font-size: .74rem; text-transform: uppercase;
}

/* ── Layout ─────────────────────────────────────────────────────────── */
/* Gestenhoheit: horizontal darf der Browser die Seite NIE bewegen — sonst
   greift sich Safari den Wisch (Gummiband + touchcancel) und die App-Geste
   bricht mitten im Zug ab. Das war die Ursache des Zurückschnappens. */
html, body { overscroll-behavior-x: none; }
#view {
    max-width: 560px; margin: 0 auto;
    /* Seitlicher Abstand sitzt auf der KACHEL (.view-page), nicht hier — so bringt
       beim Wischen jede Kachel ihren eigenen Rand mit und an der Naht entsteht
       eine ruhige Lücke, statt dass Inhalt auf Inhalt stösst. */
    padding: 0 0 calc(170px + env(safe-area-inset-bottom));
    /* Vertikal scrollt der Browser, horizontal gehört die Geste der App. */
    touch-action: pan-y;
    /* Horizontalen Überhang IMMER abklemmen (nicht nur während des Slides).
       Sonst blitzt beim Lösen des Clips ein Rest der abziehenden Kachel am Rand.
       clip lässt das vertikale Scrollen unberührt (kein Scroll-Container). */
    overflow-x: clip;
}
/* Nur Opacity — KEIN transform: ein Transform auf #view würde es zum Containing-
   Block machen und den fixen FAB relativ zu #view (statt zum Viewport) setzen. */
@keyframes view-in { from { opacity: 0; } }
/* Die Animation gehört auf die KACHEL, nicht auf #view. Auf #view hing sie an
   einer Klasse (.sliding schaltete sie ab) — und sobald die Klasse am Ende des
   Slides wieder wegging, sprang die Eigenschaft von none zurück auf view-in und
   die Animation lief NEU an, ab opacity 0. Das war das Blitzen: ein leerer
   Frame, dann 180 ms Aufblenden. Eine frisch gebaute Kachel bekommt .fresh
   einmalig mit; beim Slide gar nicht, dort erledigt die Bewegung den Auftritt. */
.view-page.fresh { animation: view-in .18s var(--ease); }
/* Der Track ist dauerhaft da und hält im Ruhezustand genau eine Kachel. Nur
   während einer Geste wird er zweispurig (.two). So muss die gelandete Kachel
   nie umgehängt werden — Umhängen hiesse für den Browser: Render-Baum weg,
   neu aufbauen, und genau das sah man als kurzes Neu-Laden. */
.view-track { width: 100%; }
.view-track.two { display: flex; width: 200%; }
.view-track.two > .view-page { flex: 0 0 50%; width: 50%; }
/* Text konstant grau glätten: sonst rendert iOS ihn auf der Compositing-Ebene
   (während des Slides) anders als danach — beim Auflösen der Ebene «zuckt» der
   Text. Konstant = kein Umschalten = kein Zucken, sobald der Screen drin ist. */
.view-page {
    padding: 0 22px;                 /* eigener Seitenrand pro Kachel (s. #view) */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    /* Kein backface-visibility: erzwingt wie will-change eine eigene GPU-Ebene. */
}
/* Bewusst OHNE will-change: Das erzwingt eine GPU-Ebene, die beim Entfernen der
   Klasse wieder abgebaut wird — genau dieser Auf-/Abbau erzeugt ein Repaint-
   Blitzen. Der Browser komponiert während einer laufenden Transition ohnehin. */
#view.sliding .view-track {
    transition: transform .46s cubic-bezier(.4, 0, .2, 1);
}
/* Bewusst KEINE Deckkraft-Animation auf den Kacheln: Eine Opacity < 1 zwingt den
   Inhalt auf eine eigene Compositing-Ebene, die beim Erreichen von 100 % wieder
   aufgelöst wird — dieser Wechsel ist die letzte verbliebene Blitz-Quelle.
   Die Ruhe kommt jetzt aus Geometrie, Naht-Lücke und Kurve. */
/* Während der Finger zieht: kein Nachlauf, alles klebt am Finger. */
#view.dragging .view-track { transition: none; }

/* Kopf: grosser Wochentag + Meta + Filter */
.day-head { margin: 10px 0 26px; }
.day-title, .page-title {
    font-size: clamp(2.3rem, 12vw, 3.1rem);
    font-weight: 800; letter-spacing: -.04em; text-transform: uppercase; line-height: .92;
}
/* Seitentitel steht allein oben — Umlaut-Punkte (Ä) brauchen Kopfraum,
   sonst stossen sie an die Topbar. Der mehrzeilige Wochentag bleibt knapp. */
.page-title { line-height: 1.06; padding-top: .1em; }
.day-meta {
    font-family: var(--mono); font-size: .72rem; color: var(--muted);
    letter-spacing: .01em; margin-top: 9px;
}
.marker {
    display: inline-block; width: 10px; height: 10px; flex: 0 0 auto;
    border-radius: 2px; background: var(--m, var(--muted));
}

/* Filter-Chips: nach Person filtern, nochmal tippen hebt auf */
.filters { display: flex; gap: 10px; margin-top: 16px; }
.filter-chip {
    display: inline-flex; align-items: center; gap: 9px;
    padding: 10px 16px; border-radius: 11px;
    background: var(--paper);
    border: 1.5px solid var(--line);
    font-family: var(--mono); font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
    transition: border-color .15s var(--ease), opacity .15s var(--ease), transform .15s var(--ease);
}
.filter-chip:active { transform: scale(.96); }
.filter-chip.on { border-color: var(--ink); }
.filter-chip.dim { opacity: .38; }

/* Einkaufslisten-Umschalter: Pillen, horizontal scrollbar */
.shop-tabs {
    display: flex; gap: 9px; overflow-x: auto; padding-bottom: 4px;
    margin-bottom: 16px; scrollbar-width: none;
    /* Eigener horizontaler Scroll-Streifen — hier gilt das pan-y von #view nicht. */
    touch-action: pan-x;
}
.shop-tabs::-webkit-scrollbar { display: none; }
.shop-tab {
    flex: 0 0 auto;
    padding: 9px 15px; border-radius: 11px;
    background: var(--paper); border: 1.5px solid var(--line);
    font-family: var(--mono); font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
    transition: border-color .15s var(--ease), color .15s var(--ease), transform .15s var(--ease);
}
.shop-tab:active { transform: scale(.96); }
.shop-tab.on { border-color: var(--ink); color: var(--ink); }
.shop-tab.add { color: var(--muted); padding: 9px 13px; }

/* ── Sektionen ──────────────────────────────────────────────────────── */
/* Läuft bei jedem Neuaufbau der Liste — bewusst kurz und nur Deckkraft */
.todo-sec { margin-bottom: 18px; animation: sec-in .2s var(--ease) both; }
@keyframes sec-in { from { opacity: 0; transform: translateY(3px); } }
.sec-head, .done-details summary, .shop-done-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
    padding-bottom: 6px; margin-bottom: 0;
    border-bottom: 1px solid var(--line);
    font-family: var(--mono); font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .13em; color: var(--muted);
}
.todo-sec:first-of-type .sec-head { color: var(--ink); }
.sec-count { font-variant-numeric: tabular-nums; letter-spacing: .05em; color: var(--muted); }
.todo-sec:first-of-type .sec-count { color: var(--ink); }
/* Überfällig steht zuoberst und bleibt in Tinte — kein Alarmrot */
.todo-sec.sec-overdue .sec-head { color: var(--ink); }
.todo-sec.sec-overdue .sec-count { color: var(--muted); }

/* ── Items ──────────────────────────────────────────────────────────── */
.item {
    display: flex; align-items: flex-start; gap: 14px;
    padding: 11px 2px;
    border-bottom: 1px solid var(--line-soft);
    transition: opacity .3s var(--ease), background .12s var(--ease);
}
.item:last-child { border-bottom: 0; }
.item:active { background: rgba(26, 26, 26, .035); }
.item-body { flex: 1; min-width: 0; cursor: pointer; }
.item-title { font-weight: 500; font-size: 1.02rem; letter-spacing: -.012em; overflow-wrap: anywhere; }
.item-meta {
    display: flex; align-items: center; flex-wrap: wrap; gap: 4px 9px;
    font-family: var(--mono); font-size: .68rem; color: var(--muted);
    text-transform: uppercase; letter-spacing: .06em;
    margin-top: 5px;
}
.item-meta:empty { display: none; }
.meta-sep { color: var(--line); }
.meta-date.overdue { color: var(--ink); }
.item.done { opacity: .55; }
.item.done .item-title { text-decoration: line-through; text-decoration-thickness: 1.5px; color: var(--muted); }
.item-x {
    flex: 0 0 auto; width: 26px; height: 26px;
    color: var(--muted); font-size: 1.1rem; line-height: 1;
}
.item-x:active { color: var(--danger); }
.item-chev { color: var(--muted); font-size: 1.15rem; align-self: center; }
.item-repeat { flex: 0 0 auto; color: var(--muted); font-size: .95rem; line-height: 1.4; }

/* Checkbox */
.check {
    flex: 0 0 26px; height: 26px; margin-top: 1px;
    border: 1.5px solid var(--ink);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    transition: background .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease);
}
.check:active { transform: scale(.88); }
.check svg { width: 14px; height: 14px; fill: none; stroke: #fff; stroke-width: 3.2; opacity: 0; transition: opacity .12s var(--ease); }
.item.done .check { background: var(--ink); border-color: var(--ink); }
.item.done .check svg { opacity: 1; }

/* Wer-Angabe: Marker (+ Name, wo er zählt) */
.who { display: inline-flex; align-items: center; gap: 7px; }

/* Erledigt-Bereich */
.done-details { margin-top: 6px; }
.done-details summary { cursor: pointer; list-style: none; }
.done-details summary::-webkit-details-marker { display: none; }
.done-details summary::after { content: '+'; font-size: .9rem; }
.done-details[open] summary::after { content: '–'; }
.shop-done-head { margin-top: 22px; }

/* Leerzustand */
.empty {
    text-align: center; color: var(--muted); padding: 52px 20px;
    font-family: var(--mono); font-size: .76rem; letter-spacing: .03em;
}
.empty.small { padding: 26px; }

/* ── FAB ────────────────────────────────────────────────────────────── */
.fab {
    position: fixed; right: 22px; z-index: 11;
    bottom: calc(104px + env(safe-area-inset-bottom));
    width: 52px; height: 52px; border-radius: 14px;
    background: var(--ink); color: var(--on-ink);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.5rem; font-weight: 300; line-height: 1;
    transition: transform .15s var(--ease);
}
.fab:active { transform: scale(.9); }
/* Während des Slides liegt der FAB in der transformierten Spur und würde
   falsch (relativ zur Spur statt zum Viewport) sitzen — solange ausblenden,
   danach sitzt er sofort korrekt am unteren Rand, kein Sprung. */
#view.sliding .fab { display: none; }

/* ── Tabbar: schwebende Pille ───────────────────────────────────────── */
/* Verlauf darunter, damit die Liste weich auslaufend dahinter verschwindet */
.tab-fade {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    height: calc(130px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--bg) 42%, color-mix(in srgb, var(--bg) 55%, transparent) 74%, transparent);
    pointer-events: none;
}
.tabbar {
    position: fixed; left: 50%; transform: translateX(-50%); z-index: 12;
    bottom: calc(20px + env(safe-area-inset-bottom));
    width: min(92vw, 480px);
    display: flex; align-items: center;
    padding: 4px;
    background: var(--paper);
    border: 1.5px solid var(--ink);
    border-radius: 13px;
}
/* Gleitender Indikator hinter dem aktiven Tab */
.tab-ind {
    position: absolute; top: 4px; bottom: 4px; left: 0; width: 0;
    z-index: 2;                          /* ÜBER den Tabs — sonst übermalt deren
                                            dunkle Schrift die weisse Ebene */
    background: var(--ink); border-radius: 9px;
    overflow: hidden;                    /* klippt die weisse Label-Ebene darunter */
    transition: transform .46s cubic-bezier(.4, 0, .2, 1), width .46s cubic-bezier(.4, 0, .2, 1);
}
/* Zweite Beschriftung in Weiss, exakt auf den Slider geklippt: dadurch ist der
   Text IMMER lesbar — dunkel auf Papier, weiss unter dem Slider — auch wenn der
   Slider beim Wischen zwischen zwei Tabs steht und beide halb überdeckt.
   Die Ebene wandert gegenläufig zum Slider, bleibt also deckungsgleich mit den
   echten Labels; gleiche Transition = synchron auch während der Animation. */
.tab-ind-labels {
    position: absolute; top: -4px; bottom: -4px; left: 0;
    display: flex; align-items: center;
    transition: transform .46s cubic-bezier(.4, 0, .2, 1);
}
/* text-align: center holt nach, was ein <button> von sich aus tut — sonst sitzt
   das weisse Wort linksbündig in seiner Zelle und damit links in der Pille. */
.tab-ind-labels .tab {
    color: var(--on-ink); pointer-events: none; transition: none;
    text-align: center;
}
/* Beim Ziehen zieht der Balken direkt mit dem Finger mit — kein Nachlauf. */
.tabbar.dragging .tab-ind,
.tabbar.dragging .tab-ind-labels { transition: none; }
.tab {
    position: relative; z-index: 1;
    flex: 1; padding: 8px 4px; border-radius: 9px;
    font-family: var(--mono); font-size: .64rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
    transition: color .24s var(--ease);
}
.tab svg { display: none; }
/* Kein Farbwechsel für den aktiven Tab: Das Weiss liefert die geklippte Ebene im
   Slider. Sonst stünde beim Wischen weisse Schrift auf hellem Papier, sobald der
   Slider den aktiven Tab verlässt. */

/* ── Add-Bar (Einkauf, Listen) ──────────────────────────────────────── */
.addbar {
    display: flex; align-items: center; gap: 12px;
    border-bottom: 1.5px solid var(--ink);
    margin-bottom: 30px;
}
.addbar input { border-bottom: 0; padding: 9px 0; }
.addbar-btn {
    flex: 0 0 auto; padding: 4px 2px;
    font-size: 1.4rem; font-weight: 300; line-height: 1;
    transition: transform .15s var(--ease);
}
.addbar-btn:active { transform: scale(.85); }

/* ── View-Head (Ämtli) ──────────────────────────────────────────────── */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 24px; }
.view-head .muted { font-family: var(--mono); font-size: .7rem; line-height: 1.55; }
.chore-next b { font-weight: 700; color: var(--ink); }

/* ── Kalender ───────────────────────────────────────────────────────── */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin: 10px 0 18px; }
.cal-head h2 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.038em; text-transform: uppercase; }
.cal-nav { width: 34px; height: 34px; font-size: 1.3rem; transition: transform .15s var(--ease); }
.cal-nav:active { transform: scale(.85); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border-top: 1px solid var(--line); }
.cal-wd {
    text-align: center; font-family: var(--mono); font-size: .6rem; font-weight: 700;
    letter-spacing: .1em; color: var(--muted); text-transform: uppercase;
    padding: 8px 0 7px;
    border-bottom: 1px solid var(--line);
}
.cal-cell {
    aspect-ratio: 1 / 1;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px;
    border-bottom: 1px solid var(--line-soft);
    font-family: var(--mono);
    transition: background .12s var(--ease);
}
.cal-cell:active { background: rgba(26, 26, 26, .05); }
.cal-cell.dim { color: rgba(26, 26, 26, .25); }
.cal-num { font-size: .82rem; font-weight: 500; }
.cal-cell.today { background: var(--ink); color: var(--on-ink); }
.cal-cell.today .cal-num { font-weight: 700; }
.cal-cell.sel { background: transparent; box-shadow: inset 0 0 0 2px var(--ink); }
/* Feiertage: nur eine leise Tönung, kein zweites Signal */
.cal-cell.feiertag { background: rgba(26, 26, 26, .055); }
.cal-cell.feiertag.sel { background: rgba(26, 26, 26, .055); box-shadow: inset 0 0 0 2px var(--ink); }
.cal-cell.feiertag .cal-num { font-weight: 700; }
.cal-holiday {
    font-family: var(--mono); font-size: .66rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .1em; color: var(--muted);
    margin-bottom: 8px;
}
.cal-cell.today.sel { background: var(--ink); }
.cal-dots { display: flex; gap: 3px; height: 5px; }
.cal-dots i { width: 5px; height: 5px; border-radius: 1px; }
.cal-dots i.ev { border-radius: 50%; }   /* rund = Termin, eckig = To-Do */
.cal-cell.today .cal-dots i { background: var(--on-ink) !important; }
.cal-day { margin-top: 30px; }
.cal-day-head {
    display: flex; align-items: baseline; justify-content: space-between;
    padding-bottom: 8px; border-bottom: 1px solid var(--line);
}
.cal-day-head h3 {
    font-family: var(--mono); font-size: .7rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .13em;
}

/* Termine im Tagesblatt */
.event-item { gap: 12px; }
.ev-bar {
    flex: 0 0 3px; align-self: stretch; min-height: 30px;
    background: var(--ink); border-radius: 2px;
}
.event-item.imported .ev-bar { background: var(--muted); }
.event-item.imported .item-title { font-weight: 450; }
.time-row { display: flex; align-items: center; gap: 12px; }
.time-row > span { font-family: var(--mono); font-size: .74rem; color: var(--muted); }

/* Kalender-Feeds */
.fd-actions { display: flex; gap: 10px; margin: 18px 0 34px; }
.fd-actions .btn { flex: 1; }
.fd-out .muted { margin: 12px 0; line-height: 1.6; }
.fd-url {
    font-family: var(--mono); font-size: .68rem; word-break: break-all;
    background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
    padding: 12px; margin-bottom: 12px; color: var(--muted);
}
.feed-item.has-error .item-meta { color: var(--danger); }

/* ── Formulare ──────────────────────────────────────────────────────── */
.form { display: flex; flex-direction: column; gap: 20px; }
.field-label {
    font-family: var(--mono); font-size: .64rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .13em; margin-bottom: -14px;
}
.seg { display: flex; gap: 18px; flex-wrap: wrap; }
.seg-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 0; border-bottom: 2px solid transparent;
    font-family: var(--mono); font-size: .74rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
    transition: color .15s var(--ease), border-color .15s var(--ease);
}
.seg-btn.on { color: var(--ink); border-bottom-color: var(--ink); }
.date-row { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; }
.date-row input[type=date] { flex: 1 1 150px; min-width: 0; }
/* Verbindungen */
.cn-intro { margin-bottom: 22px; line-height: 1.6; }
.cn-hint { margin-top: 20px; line-height: 1.6; }
.cn-dot {
    flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%;
    background: transparent; border: 1.5px solid var(--line-strong);
}
.cn-dot.on { background: var(--ink); border-color: var(--ink); }
.cn-note {
    font-family: var(--mono); font-size: .58rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
    border: 1px solid var(--line); border-radius: 4px;
    padding: 2px 5px; margin-left: 8px; vertical-align: middle;
}
.module-card[disabled] { cursor: default; opacity: .85; }

/* Benachrichtigungs-Karte (pro Gerät) */
.cn-push { margin-bottom: 22px; }
.cn-push-card {
    border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px;
}
.cn-push-head { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.cn-push-card p { line-height: 1.6; margin: 0; }
.cn-push-card .fd-actions { margin: 14px 0 0; }
.btn-ghost { color: var(--muted); }

/* Apple-Erinnerungen: Adressen-Liste im Sheet */
.apple-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.apple-row {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; border: 1px solid var(--line); border-radius: 9px;
}
.apple-name { font-weight: 700; }
.apple-steps { line-height: 1.6; padding-left: 18px; }
.apple-steps li { margin-bottom: 8px; }
.apple-steps code {
    font-family: var(--mono); font-size: .82em;
    background: var(--paper); border: 1px solid var(--line); border-radius: 4px; padding: 1px 4px;
}

.src-panel { display: flex; flex-direction: column; gap: 12px; }
.weekdays { display: flex; gap: 6px; }
.wd-btn {
    flex: 1; padding: 11px 0; border-radius: 9px;
    border: 1.5px solid var(--line);
    font-family: var(--mono); font-size: .7rem; font-weight: 700;
    text-transform: uppercase; color: var(--muted);
    transition: all .15s var(--ease);
}
.wd-btn.on { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.wd-btn:active { transform: scale(.94); }
.rhythm-row { display: flex; gap: 14px; align-items: baseline; }
.rhythm-row > span { font-family: var(--mono); font-size: .76rem; color: var(--muted); }
.rhythm-row input { width: 56px; text-align: center; }
.rhythm-row select { flex: 1; }
.mini-btn {
    padding: 5px 0;
    font-family: var(--mono); font-size: .68rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .07em;
    border-bottom: 1.5px solid var(--ink);
    white-space: nowrap;
    transition: opacity .15s var(--ease);
}
.mini-btn:active { opacity: .5; }

/* Buttons */
.btn {
    padding: 15px 20px; border-radius: 10px;
    background: transparent; border: 1.5px solid var(--ink);
    font-family: var(--mono); font-size: .76rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .08em;
    transition: opacity .15s var(--ease), transform .15s var(--ease);
}
.btn:active { transform: scale(.985); opacity: .8; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.btn-danger { background: transparent; border-color: transparent; color: var(--danger); padding-left: 0; }
.btn-sm { padding: 10px 15px; font-size: .68rem; }
.sheet-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.sheet-actions .btn-primary { flex: 1; }

/* ── Bottom-Sheet ───────────────────────────────────────────────────── */
.sheet-backdrop {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(26, 26, 26, .38);
    opacity: 0; transition: opacity .2s var(--ease);
}
.sheet-backdrop.open { opacity: 1; }
.sheet {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 41;
    max-width: 560px; margin: 0 auto;
    background: var(--paper);
    border-radius: 20px 20px 0 0;
    padding: 12px 22px calc(28px + env(safe-area-inset-bottom));
    transform: translateY(103%);
    transition: transform .22s var(--ease);
    max-height: 88dvh; overflow-y: auto;
}
.sheet.open { transform: translateY(0); }
.sheet-grip { width: 34px; height: 4px; border-radius: 2px; background: var(--line); margin: 2px auto 20px; }
.sheet h2 {
    font-size: 1.6rem; font-weight: 800; letter-spacing: -.035em;
    text-transform: uppercase; line-height: 1; margin-bottom: 22px;
}
.sheet .muted { font-family: var(--mono); font-size: .7rem; margin-bottom: 14px; }

/* ── Snackbar ───────────────────────────────────────────────────────── */
.toast {
    position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); z-index: 60;
    transform: translate(-50%, 8px);
    background: var(--ink); color: var(--on-ink);
    padding: 13px 18px; border-radius: 10px;
    font-family: var(--mono); font-size: .7rem; font-weight: 600;
    text-transform: uppercase; letter-spacing: .05em;
    opacity: 0; transition: opacity .2s var(--ease), transform .2s var(--ease);
    max-width: min(90vw, 480px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ── Auth ───────────────────────────────────────────────────────────── */
.screen { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 28px; }
.auth-card { width: 100%; max-width: 380px; animation: view-in .22s var(--ease); }
.auth-logo { display: flex; gap: 7px; margin-bottom: 22px; }
.auth-logo .c { width: 24px; height: 24px; border-radius: 4px; }
/* Spiegelt das App-Icon: zwei Quadrate, die beiden Personenfarben. */
.auth-logo .c1 { background: #b0a5e8; }
.auth-logo .c2 { background: #94b78e; }
.auth-card h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -.04em; text-transform: uppercase; line-height: .92; }
.auth-sub { font-family: var(--mono); font-size: .74rem; color: var(--muted); margin: 14px 0 34px; }
.auth-card form { display: flex; flex-direction: column; gap: 18px; }
.setup-person { display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px; }
.setup-person label {
    font-family: var(--mono); font-size: .64rem; font-weight: 700; color: var(--muted);
    text-transform: uppercase; letter-spacing: .13em;
}
.login-users { display: flex; gap: 10px; margin-bottom: 28px; }
.faceid-btn { width: 100%; margin-top: 18px; }
.login-user {
    flex: 1;
    display: flex; align-items: center; gap: 10px;
    padding: 15px; border: 1.5px solid var(--line); border-radius: 10px;
    font-family: var(--mono); font-size: .78rem; font-weight: 600;
    transition: border-color .15s var(--ease), background .15s var(--ease);
}
.login-user:active { background: rgba(26, 26, 26, .04); }
.login-user.on { border-color: var(--ink); }
.login-user .avatar { width: 28px; height: 28px; font-size: .74rem; }

/* ── Mehr-Hub & Unterseiten ─────────────────────────────────────────── */
.sub-head { display: flex; align-items: center; gap: 12px; margin: 10px 0 24px; flex-wrap: wrap; }
.sub-head h2 {
    font-size: clamp(1.9rem, 9vw, 2.4rem); font-weight: 800; letter-spacing: -.04em;
    text-transform: uppercase; line-height: .92; flex: 1;
}
.sub-head-actions { display: flex; gap: 16px; }
.back-btn { font-size: 1.5rem; line-height: 1; padding-right: 2px; transition: transform .15s var(--ease); }
.back-btn:active { transform: translateX(-3px); }

.module-list { border-top: 1px solid var(--line); }
.module-card {
    display: flex; align-items: center; gap: 16px; width: 100%;
    padding: 22px 2px;
    border-bottom: 1px solid var(--line-soft);
    text-align: left;
    transition: background .12s var(--ease);
}
.module-card:active { background: rgba(26, 26, 26, .04); }
.module-icon { display: flex; }
.module-icon svg { width: 23px; height: 23px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.module-text { flex: 1; }
.module-name { display: block; font-size: 1.3rem; font-weight: 800; letter-spacing: -.03em; text-transform: uppercase; }
.module-sub { display: block; font-family: var(--mono); font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 4px; }

/* ── Vision Board ───────────────────────────────────────────────────── */
.board-grid { columns: 2; column-gap: 12px; }
.board-grid .empty { columns: 1; column-span: all; }
.board-card {
    break-inside: avoid;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: border-color .15s var(--ease);
}
.board-card:active { border-color: var(--ink); }
.board-note { padding: 15px; }
.board-note.tinted { border-left: 3px solid var(--note); }
.board-title { font-weight: 800; text-transform: uppercase; letter-spacing: -.025em; margin-bottom: 6px; overflow-wrap: anywhere; }
.board-text { font-size: .85rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.board-img img { display: block; width: 100%; }
.board-caption { padding: 10px 13px; font-family: var(--mono); font-size: .64rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.swatches { display: flex; gap: 12px; }
.swatch {
    width: 32px; height: 32px; border-radius: 6px;
    background: var(--note, #c9c9c2);
    border: 2px solid transparent; outline: 1px solid var(--line);
    transition: outline-color .15s var(--ease);
}
.swatch.on { border-color: var(--paper); outline-color: var(--ink); outline-width: 2px; }
.sheet-img { display: block; width: 100%; border-radius: 8px; margin-bottom: 18px; }

/* ── Budget ─────────────────────────────────────────────────────────── */
.bud-card { margin-bottom: 28px; }
.bud-total { display: flex; flex-direction: column; margin-bottom: 14px; }
.bud-total-label { font-family: var(--mono); font-size: .64rem; font-weight: 700; text-transform: uppercase; letter-spacing: .13em; color: var(--muted); }
.bud-total-val { font-size: 2.7rem; font-weight: 800; letter-spacing: -.045em; line-height: 1.05; margin: 6px 0 3px; }
.bud-total-val.over { color: var(--danger); }
.bud-total .muted { font-family: var(--mono); font-size: .7rem; }
.bud-bar { height: 4px; background: var(--line); overflow: hidden; border-radius: 2px; }
.bud-bar i { display: block; height: 100%; background: var(--ink); transition: width .3s var(--ease); }
.bud-bar i.over { background: var(--danger); }
.bud-rows { margin-top: 24px; display: flex; flex-direction: column; gap: 16px; }
.bud-row-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.bud-name { font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .02em; }
.bud-nums { font-family: var(--mono); font-size: .72rem; font-variant-numeric: tabular-nums; }
.bud-nums.over { color: var(--danger); }
.bud-add { width: 100%; margin-bottom: 28px; }
.exp-amount { font-family: var(--mono); font-weight: 600; font-size: .86rem; font-variant-numeric: tabular-nums; white-space: nowrap; align-self: center; }
.chf-row { display: flex; align-items: baseline; gap: 12px; border-bottom: 1.5px solid var(--line); }
.chf-row > span { font-family: var(--mono); font-size: .78rem; font-weight: 700; color: var(--muted); }
.chf-row input { font-size: 1.7rem; font-weight: 800; letter-spacing: -.035em; border-bottom: 0; }
.cats-list { border-top: 1px solid var(--line); margin-bottom: 22px; }
.acct-actions { display: flex; gap: 12px; margin-top: 28px; }
.acct-actions .btn { flex: 1; }
.acct-actions .btn-danger { border: 1.5px solid var(--line); }
.acct-version {
    margin-top: 20px; text-align: center;
    font-family: var(--mono); font-size: .62rem; letter-spacing: .04em;
    color: var(--muted);
}
.cat-row { width: 100%; text-align: left; }

@media (min-width: 600px) {
    .board-grid { columns: 3; }
}

/* ────────────────────────────────────────────────────────────────────────
   Ab Tablet quer: Seitenleiste statt Tabbar, zwei Spalten statt Stapel.
   Gleiche Logik, nur mehr Platz — die Ansichten wissen nichts davon.
   ──────────────────────────────────────────────────────────────────────── */
@media (min-width: 900px) {
    /* Zwei Spalten: links Navigation, rechts Inhalt */
    #app { display: grid; grid-template-columns: 244px 1fr; grid-template-rows: auto 1fr; min-height: 100dvh; }

    .topbar {
        grid-column: 1; grid-row: 1;
        position: static;
        padding: 34px 24px 22px;
        border-right: 1px solid var(--line);
        border-bottom: 0;
    }
    .brand { font-size: .82rem; }

    /* Tabbar wird zur Navigationsspalte darunter */
    .tabbar {
        grid-column: 1; grid-row: 2;
        position: static; transform: none; align-self: start;
        width: auto; flex-direction: column; gap: 2px;
        padding: 0 16px;
        background: none; border: 0; border-right: 1px solid var(--line);
        border-radius: 0;
        height: 100%;
    }
    .tab {
        flex: 0 0 auto;                  /* sonst zieht flex:1 die Einträge auseinander */
        max-width: none; width: 100%;
        align-items: flex-start; text-align: left;
        padding: 12px 14px; border-radius: 9px;
        font-size: .72rem;
    }
    .tab-ind { display: none; }          /* Der Gleitbalken passt hier nicht */
    .tab.on { background: var(--ink); color: var(--on-ink); }
    .tab:hover:not(.on) { background: rgba(26, 26, 26, .05); }
    .tab-fade { display: none; }

    /* Inhalt bekommt die ganze rechte Seite */
    #view {
        grid-column: 2; grid-row: 1 / span 2;
        max-width: 1100px; margin: 0;
        padding: 34px 40px 60px;
    }

    /* Kalender: Raster links, Tagesblatt rechts */
    .cal-split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 40px; align-items: start; }
    .cal-day { margin-top: 0; }
    .cal-cell { aspect-ratio: 1 / .82; }

    /* Listen dürfen breiter, aber nicht endlos werden */
    #todo-list, #shop-list, #items-wrap, #chore-list, #hi-body, #fd-body, #cn-list,
    #bud-summary, #bud-list, .bud-add, .module-list, .fd-actions, .day-head, .view-head,
    .addbar, .sub-head { max-width: 720px; }

    .fab { display: none; }              /* Auf dem Desktop reicht die Add-Leiste */
    .board-grid { columns: 4; }
    .toast { left: auto; right: 40px; transform: translate(0, 10px); bottom: 40px; }
    .toast.show { transform: translate(0, 0); }

    /* Sheets als Dialog in der Mitte statt von unten */
    .sheet {
        top: 50%; bottom: auto; left: 50%; right: auto;
        transform: translate(-50%, -46%) scale(.98);
        width: min(560px, 92vw);
        border-radius: 16px;
        opacity: 0;
        transition: transform .2s var(--ease), opacity .2s var(--ease);
        max-height: 86dvh;
    }
    .sheet.open { transform: translate(-50%, -50%) scale(1); opacity: 1; }
    .sheet-grip { display: none; }
}

/* To-Dos zweispaltig, sobald wirklich Platz da ist */
@media (min-width: 1180px) {
    #todo-list { max-width: none; columns: 2; column-gap: 46px; }
    .todo-sec { break-inside: avoid; }
    #todo-list .empty { columns: 1; }
}

/* Wer Bewegung reduziert haben will, bekommt sie nicht */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
