:root {
    /* --color-primary, --color-primary-tint sowie alle Modul-/Statusfarben kommen aus
       colors.css (zusaetzlich geladen). --color-primary-dark hat dort bewusst keinen
       Eintrag (nur fuer den Login-Bildschirm gebraucht) und bleibt daher hier. */
    --color-primary-dark: #3e8688;
    --color-bg: #f6f6fb;
    --color-card: #ffffff;
    --color-text: #1d1d1f;
    --color-muted: #6b6b6f;
    --color-border: #e5e5ee;
    --radius: 14px;
    --tab-bar-height: 64px;
    --header-height: 56px;
}

/* Akzentfarbe je Seite (Tab, "+"-Button, Links, ...). "Start"/"Mehr" nutzen den Standardwert aus
   colors.css, bekommen also keinen eigenen Block. Header/Avatar-Leiste/Footer nutzen bewusst
   NICHT --color-primary, sondern das fixe --color-chrome/-chrome-tint aus colors.css (siehe
   Kommentar dort); der Seitenhintergrund (--color-background) bleibt ebenfalls fix.
   --color-primary-tint wird aktuell von .card/.shopping-row/.template-tile NICHT mehr genutzt
   (die sind bewusst weiss, siehe --color-card) - bleibt aber als wiederverwendbare Pastell-
   Variante pro Seite bestehen (z.B. fuer die Modul-Kacheln auf Start/Mehr, dort direkt ueber
   --color-X-tint statt --color-primary-tint). */
body[data-view="calendar"] { --color-primary: var(--color-calendar); --color-primary-tint: var(--color-calendar-tint); }
body[data-view="shopping"], body[data-view="shoppingStats"] { --color-primary: var(--color-shopping); --color-primary-tint: var(--color-shopping-tint); }
body[data-view="tasks"], body[data-view="tasksHistory"] { --color-primary: var(--color-tasks); --color-primary-tint: var(--color-tasks-tint); }
body[data-view="birthdays"] { --color-primary: var(--color-birthdays); --color-primary-tint: var(--color-birthdays-tint); }
body[data-view="vehicles"] { --color-primary: var(--color-vehicles); --color-primary-tint: var(--color-vehicles-tint); }
body[data-view="family"] { --color-primary: var(--color-family); --color-primary-tint: var(--color-family-tint); }
body[data-view="verliehen"] { --color-primary: var(--color-loans); --color-primary-tint: var(--color-loans-tint); }
body[data-view="projekte"], body[data-view="projekteDetail"] { --color-primary: var(--color-projects); --color-primary-tint: var(--color-projects-tint); }
body[data-view="kontakte"] { --color-primary: var(--color-contacts); --color-primary-tint: var(--color-contacts-tint); }

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--color-background);
    color: var(--color-text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    -webkit-tap-highlight-color: transparent;
}

button, input, textarea, select {
    font-family: inherit;
}

/* --- App Header: Utility-Zeile + Familien-Karte --- */
.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
}
.app-header-utility {
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 0 26px;
    background: var(--color-chrome);
    color: #fff;
}
.app-header-utility h1 {
    font-size: 18px;
    margin: 0;
    font-weight: 600;
    flex: 1;
    text-align: right;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: pointer;
}
.app-header-utility-icons {
    display: flex;
    align-items: center;
    gap: 4px;
}
.header-icon-btn {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.header-icon-btn:active { background: rgba(255, 255, 255, 0.15); }

.app-header-hero {
    display: flex;
    align-items: center;
    gap: 32px;
    padding: 16px 26px 16px;
    background: var(--color-chrome);
}
/* Foto ragt bewusst deutlich (mehr als die Haelfte) unten aus dem Header-Block heraus
   (aufgelockerte Optik statt streng im Farbblock eingefasst) - .app-header-hero hat kein
   overflow:hidden, daher bleibt der ueberstehende Teil sichtbar. Weisser Ring verleiht dem
   Foto mehr optisches Gewicht, ohne es weiter zu vergroessern. */
.header-hero-photo {
    flex-shrink: 0;
    margin-bottom: -64px;
    position: relative;
    z-index: 1;
    cursor: pointer;
}
.header-hero-photo .pet-card-thumb {
    width: 112px;
    height: 112px;
    font-size: 46px;
    box-shadow: 0 0 0 7px rgba(255, 255, 255, 0.9);
}
.header-hero-photo .pet-card-thumb svg { width: 46px; height: 46px; }
.header-hero-text { min-width: 0; flex: 1; }
.header-hero-greeting {
    color: #fff;
    font-size: 21px;
    font-weight: 700;
    line-height: 1.35;
}
.header-hero-date {
    color: #fff;
    font-size: 17px;
    font-weight: 600;
    margin-top: 6px;
}

/* --- Main / Views --- */
#view-container {
    padding: 32px 12px calc(var(--tab-bar-height) + 24px);
}
.view-page-title {
    /* Linker Einzug (14px) bringt den Text auf Hoehe des Karteninhalts (Kartenpadding), nicht
       nur auf Hoehe des Kartenrands; negativer margin-top zieht die Ueberschrift etwas naeher
       an den Header heran. */
    margin: -12px 0 12px 14px;
    font-size: 20px;
    font-weight: 700;
    color: var(--color-text);
}
/* Startseite braucht keine zusaetzliche Seitenueberschrift (Header-Begruessung uebernimmt das
   bereits) - spart dort Platz. */
body[data-view="start"] .view-page-title { display: none; }
.view { display: none; }
.view.active { display: block; }

/* --- Tab Bar --- */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-bar-height);
    display: flex;
    background: var(--color-chrome);
    padding-bottom: env(safe-area-inset-bottom);
    z-index: 20;
}
.tab-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.65);
    font-size: 12px;
    cursor: pointer;
}
.tab-btn .tab-icon { display: flex; }
.tab-btn .tab-icon svg { width: 26px; height: 26px; }
.tab-btn.active { color: #fff; font-weight: 700; }

/* --- Generic UI --- */
.card {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border-left: 4px solid var(--color-border);
}
a.card { display: flex; color: inherit; text-decoration: none; }
#kontakte-list .card { border-left: none; }

.fab {
    position: fixed;
    right: 18px;
    bottom: calc(var(--tab-bar-height) + 18px + env(safe-area-inset-bottom));
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    border: none;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
    z-index: 15;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: flex-end;
    z-index: 30;
}
.modal-sheet {
    background: var(--color-card);
    width: 100%;
    border-radius: 18px 18px 0 0;
    padding: 20px;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    max-height: 85vh;
    overflow-y: auto;
}
.modal-sheet h2 { margin-top: 0; }
.form-row { margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 13px; color: var(--color-muted); }
.form-row input, .form-row textarea, .form-row select {
    padding: 10px 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-size: 15px;
}
.form-row-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row-split label { display: block; }

.input-clearable { position: relative; }
.input-clearable input.input-locked {
    padding-right: 34px;
    background: var(--color-bg);
    color: var(--color-muted);
    cursor: not-allowed;
}
.input-clear-btn {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
    width: 26px;
    height: 26px;
    border: none;
    background: none;
    color: var(--color-muted);
    font-size: 15px;
    cursor: pointer;
}
.field-hint { font-size: 12px; color: var(--color-muted); }
.form-row-split input { width: 100%; }
.form-row-triple { grid-template-columns: 1fr 1.4fr 1fr; }
.form-row-triple select, .form-row-triple input { width: 100%; }

.form-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    position: sticky;
    bottom: 0;
    background: var(--color-card);
    padding-top: 12px;
    padding-bottom: 8px;
    border-top: 1px solid var(--color-border);
}
.btn {
    flex: 1;
    min-width: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 8px;
    border-radius: 10px;
    border: none;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}
.btn svg { width: 17px; height: 17px; flex-shrink: 0; }
.btn-secondary svg { color: var(--color-primary); }
#pet-activity-add-btn svg { color: var(--color-family); }
.btn-primary { background: var(--color-primary); color: #fff; }
.btn-secondary { background: var(--color-bg); color: var(--color-text); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-icon-only { flex: 0 0 auto; width: 48px; padding: 12px 0; }

.empty-state { text-align: center; color: var(--color-muted); padding: 40px 16px; }

/* --- Benachrichtigungs-Glocke (globale Utility-Zeile) --- */
.notif-bell-unread { animation: notif-bell-ring 1.8s ease-in-out infinite; }
.notif-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    border-radius: 9px;
    background: #dc2626;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
@keyframes notif-bell-ring {
    0%, 85%, 100% { transform: rotate(0deg); }
    88% { transform: rotate(-14deg); }
    91% { transform: rotate(11deg); }
    94% { transform: rotate(-8deg); }
    97% { transform: rotate(5deg); }
}

/* --- Benachrichtigungsseite --- */
.notifications-toolbar { display: flex; justify-content: flex-end; margin: 10px 0; }
.notification-item { border-left: none; }
.notification-item-title { font-weight: 500; }
.notification-item-body { font-size: 14px; margin-top: 4px; }
.notification-item-time { font-size: 12px; color: var(--color-muted); margin-top: 6px; }
.notification-item-unread .notification-item-title,
.notification-item-unread .notification-item-body { font-weight: 700; }

/* --- Generische Swipe-to-delete-Komponente (swipe_delete.js) --- */
.swipe-item { position: relative; overflow: hidden; border-radius: var(--radius); margin-bottom: 10px; }
.swipe-item-actions {
    position: absolute;
    inset: 0;
    background: var(--color-danger);
    display: flex;
    justify-content: flex-end;
    /* Der rote Hintergrund fuellt die komplette Zeile (nicht nur die 76px des Buttons) - er
       liegt beim Ruhezustand ohnehin vollstaendig unter der weissen Kachel, dadurch kann an der
       abgerundeten Ecke nie ein Spalt zum Seitenhintergrund durchscheinen (kein Ecken-Abgleich
       zwischen zwei separaten Elementen noetig). */
}
.swipe-delete-btn {
    width: 76px;
    border: none;
    background: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
}
.swipe-delete-label { font-size: 11px; font-weight: 500; }
.swipe-item-content {
    position: relative;
    transition: transform 0.15s ease;
    touch-action: pan-y;
}
/* Hoehere Spezifitaet als einzelne Aufrufer-Klassen (.card, .shopping-row, ...), damit deren
   eigenes margin-bottom hier IMMER ueberschrieben wird, unabhaengig von der Regel-Reihenfolge
   im Stylesheet - sonst wird das Margin vom umgebenden overflow:hidden eingeschlossen und
   blaeht die absolut positionierte .swipe-item-actions ueber die sichtbare Zeile hinaus auf. */
.swipe-item > .swipe-item-content { margin-bottom: 0; }

/* --- .section-frame: bewusste Ausnahme vom Karten-Design fuer Module mit einer Liste
   gleichfoermiger, aufklappbarer Abschnitte (flaches Raster/Liste mit Trennlinien statt
   abgerundeter Kaertchen-in-Kaertchen, wirkt sonst eher nach Listen-App). Der ganze Zeitraum/
   Umfang steckt in EINEM grossen abgerundeten Rahmen, analog zu .hour-grid-scroll in der
   Kalender-Tagesansicht, damit der App-eigene Kachel-Look nicht komplett verloren geht.
   Verwendet von: Kalender (Wochen-/Monatsansicht), Geburtstage (Monate). --- */
.section-frame {
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    padding: 6px 14px 14px;
}
.day-card { padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.day-card:last-child { border-bottom: none; }
.day-card-header {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-muted);
    margin-bottom: 8px;
}
.day-entry {
    border-left: 3px solid var(--color-primary);
    padding: 6px 10px;
    border-bottom: 1px solid var(--color-border);
    background: var(--color-card);
}
/* Kalender-Wochen-/Monatsansicht ist bewusst flach (Trennlinie statt Kaertchen, siehe
   .section-frame) - der generische .swipe-item-Look (Radius + Abstand pro Eintrag) wuerde das
   wieder rueckgaengig machen, daher hier auf 0 gesetzt. overflow:hidden bleibt fuer den
   Swipe-Mechanismus selbst noetig. */
.day-entry-wrap.swipe-item { border-radius: 0; margin-bottom: 0; }
.day-entry-wrap:last-child .day-entry { border-bottom: none; }
.day-entry-row { display: flex; justify-content: space-between; align-items: center; }
.day-entry-meta { font-size: 13px; color: var(--color-muted); margin-top: 2px; }
.day-entry-note { font-size: 14px; margin-top: 4px; }

.allday-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.allday-entry {
    border-left: 3px solid var(--color-primary);
    padding: 6px 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}
.allday-entry-meta { font-size: 12px; color: var(--color-muted); }

.hour-grid-scroll {
    max-height: 65vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    background: var(--color-card);
    border-radius: var(--radius);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.hour-grid { position: relative; margin-left: 44px; }
.hour-row { position: absolute; left: -44px; right: 0; border-top: 1px solid var(--color-border); }
.hour-label {
    position: absolute;
    top: -7px;
    left: 0;
    width: 38px;
    font-size: 11px;
    color: var(--color-muted);
    text-align: right;
    padding-right: 4px;
    background: var(--color-card);
}
.hour-event {
    position: absolute;
    box-sizing: border-box;
    border-radius: 6px;
    padding: 2px 6px;
    overflow: hidden;
    background: var(--color-primary);
    color: #fff;
    font-size: 12px;
    cursor: pointer;
}
.hour-event-title { display: flex; align-items: center; gap: 4px; font-weight: 600; }
.hour-event-title-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hour-event .gcal-btn, .hour-event .inline-icon { color: #fff; }
.hour-event-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hour-event-time .person-chip { font-size: 10px; gap: 3px; flex-shrink: 0; }
.hour-event-time .person-chip .pet-card-thumb { width: 14px; height: 14px; font-size: 8px; }
.hour-event-time .person-cluster .pet-card-thumb { width: 12px; height: 12px; }
.current-time-line { position: absolute; left: 0; right: 0; height: 2px; background: #dc2626; z-index: 2; }
.current-time-line::before {
    content: '';
    position: absolute;
    left: -4px;
    top: -3px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #dc2626;
}

/* Extra Abstand zur globalen Avatar-Kopfzeile: deren Chevron sitzt sonst zu dicht ueber den
   eigenen Pfeil-Buttons und wurde beim Wechseln von Tag/Woche/Monat leicht verklickt. */
#view-calendar .month-nav { margin-top: 12px; }
.calendar-nav-btn {
    background: none;
    border: none;
    color: var(--color-primary);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.calendar-nav-btn svg { width: 22px; height: 22px; }
.calendar-nav-btn:active { background: var(--color-bg); }

.view-mode-tabs { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.view-mode-tab {
    padding: 6px 14px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    background: var(--color-card);
    color: var(--color-text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
.view-mode-tab.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; }
.view-mode-tabs .btn-link { margin-left: auto; }

.month-grid-header { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-bottom: 4px; }
.month-grid-header-cell { text-align: center; font-size: 12px; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.month-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 1px;
    background: var(--color-border);
    border: 1px solid var(--color-border);
}
.month-grid-cell {
    background: var(--color-card);
    padding: 4px 3px;
    min-height: 68px;
    min-width: 0;
    overflow: hidden;
    cursor: pointer;
}
.month-grid-cell.other-month { opacity: 0.4; }
.month-grid-cell.today { box-shadow: inset 0 0 0 2px var(--color-primary); }
.month-grid-cell.has-events { background: color-mix(in srgb, var(--color-primary) 10%, var(--color-card)); }
.month-grid-day-number { font-size: 13px; margin-bottom: 4px; }
.month-grid-day-number.has-events { font-weight: 700; color: var(--color-primary); }
.month-grid-chip {
    border-left: 2px solid var(--color-primary);
    padding-left: 4px;
    margin-bottom: 2px;
    font-size: 11px;
    line-height: 1.3;
}
.month-grid-chip-title {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}
.month-grid-more { font-size: 11px; color: var(--color-muted); }

.gcal-btn {
    background: none;
    border: none;
    padding: 0;
    margin: 0;
    line-height: 1;
    color: var(--color-primary);
    flex-shrink: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.gcal-btn svg { width: 16px; height: 16px; }
/* row-delete-btn ist eine app-weit geteilte Klasse (Standardfarbe grau) - hier gezielt
   auf die Kalender-Modulfarbe umgefaerbt, analog zu #projekt-edit-btn svg etc. */
#view-calendar .row-delete-btn { color: var(--color-primary); }

/* --- Einkaufsliste --- */
.list-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
}
/* Aufgaben-Seite: "Historie"-Link auf Hoehe des Karteninhalts einruecken, wie die
   Seitenueberschrift - nicht ueber die geteilte .list-toolbar-Klasse (die auch fuer
   Monatsnavigation in Kalender/Statistik genutzt wird und dort ueber die volle Breite geht). */
#view-tasks > .list-toolbar { margin-left: 10px; }
.toggle-label { display: flex; align-items: center; gap: 6px; color: var(--color-muted); }
.btn-link { background: none; border: none; color: var(--color-primary); font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px; display: inline-flex; align-items: center; gap: 4px; }
.btn-link svg { width: 15px; height: 15px; }

#shopping-form-suggestions:empty { display: none; margin: 0; }
.shopping-form-name-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 17px;
    background: var(--color-bg);
    border-radius: 10px;
    padding: 10px 12px;
}

.shopping-row {
    background: var(--color-card);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.shopping-row.row-added { animation: row-added-flash 1.4s ease; }
@keyframes row-added-flash {
    0% { background: #dcfce7; box-shadow: inset 0 0 0 2px var(--color-success); }
    100% { background: var(--color-card); box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
}
.shopping-row.current-shop-match {
    background: color-mix(in srgb, var(--color-primary) 20%, var(--color-card));
    box-shadow: inset 0 0 0 2px var(--color-primary);
}
.shopping-row input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; }
.shopping-name-wrap { flex: 1; cursor: pointer; }
.shopping-name { font-size: 16px; }
.tag-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    border-radius: 50%;
    vertical-align: middle;
}
.tag-badge svg { width: 13px; height: 13px; }
.tag-badge-offer { background: #f97316; }
.tag-badge-vegan { background: #16a34a; }
.tag-badge-vegetarian { background: #84cc16; }
.tag-badge-glutenfree { background: #7c3aed; }
.tag-badge-lowprio { background: #64748b; }
.shopping-tag-badges { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; vertical-align: middle; }
.shopping-note { width: 100%; font-size: 13px; color: var(--color-muted); }
.shopping-shop-icons { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: 6px; vertical-align: middle; }
.shop-pref-pill { position: relative; display: inline-flex; align-items: center; }
/* Praeferenz wird ueber ein Eck-Icon signalisiert statt ueber Groesse: Schloss = ausschliesslich,
   Daumen hoch = bevorzugt, "moeglich" bleibt ohne Badge (neutrale Grundstufe). */
.shop-pref-badge {
    position: absolute;
    bottom: -3px;
    right: -3px;
    background: #fff;
    color: var(--color-primary);
    border-radius: 50%;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.35);
}
.shop-pref-badge svg { width: 9px; height: 9px; }
/* .pet-card-thumb-tiny ist 22px hoch; das Monogramm-Oval (siehe unten) bekommt hier explizit
   dieselbe Hoehe, damit Logo/Icon- und Monogramm-Geschaefts-Pillen gleich hoch bleiben. */
.pet-card-thumb-monogram.pet-card-thumb-tiny { height: 22px; min-width: 30px; }
.qty-badge { font-size: 13px; color: var(--color-muted); margin-left: 6px; }
.row-delete-btn { background: none; border: none; font-size: 18px; color: var(--color-muted); cursor: pointer; display: inline-flex; align-items: center; }
.row-delete-btn svg { width: 20px; height: 20px; }

.shopping-toolbar { display: flex; justify-content: flex-end; margin-bottom: 4px; }
.shop-filter-label { font-size: 13px; color: var(--color-muted); margin-bottom: 6px; }
#shopping-shop-filter { margin-bottom: 16px; margin-left: 14px; }
#shopping-shop-filter:empty { display: none; margin: 0; }

.template-section { margin-top: 20px; }
.template-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-muted);
    margin: 0 4px 8px;
}
.template-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.template-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px 10px;
    border: none;
    border-radius: var(--radius);
    background: var(--color-card);
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    cursor: pointer;
    overflow: hidden;
}
.template-tile-icon { font-size: 32px; }
.template-tile.tile-added::after {
    content: '✓';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(22, 163, 74, 0.92);
    color: #fff;
    font-size: 30px;
    font-weight: 700;
    animation: tile-check-flash 0.6s ease;
}
@keyframes tile-check-flash {
    0% { opacity: 0; }
    25% { opacity: 1; }
    100% { opacity: 0; }
}
.template-tile-name { font-size: 14px; text-align: center; }

.avatar-picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.avatar-picker-btn {
    width: 56px;
    height: 56px;
    padding: 2px;
    border: 2px solid transparent;
    border-radius: 50%;
    background: var(--color-bg);
    cursor: pointer;
    overflow: hidden;
}
.avatar-picker-btn img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-picker-btn.active { border-color: var(--color-primary); }
.icon-picker { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.icon-picker-btn {
    width: 38px;
    height: 38px;
    font-size: 18px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    background: var(--color-card);
    cursor: pointer;
}

/* --- Kaufhäufigkeit --- */
.month-nav { gap: 10px; }
.stats-table { width: 100%; border-collapse: collapse; background: var(--color-card); border-radius: var(--radius); overflow: hidden; }
.stats-table th, .stats-table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--color-border); }
.stats-table th { font-size: 13px; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.stats-table tr:last-child td { border-bottom: none; }

/* --- Start/Übersicht --- */
.push-banner-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
}
.push-hint {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
    color: var(--color-muted);
    padding: 4px 2px 16px;
}

.start-card { cursor: pointer; border-left: none; }
.start-card-outer { border-left: none; }
.start-line { display: flex; align-items: center; gap: 18px; padding: 14px 4px; }
.start-line-icon {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.start-line-icon svg { width: 23px; height: 23px; }
.start-line-text { flex: 1; min-width: 0; font-size: 16px; }
.start-line-clickable { cursor: pointer; }
/* Zwei umschaltbare Trennlinien-Varianten zwischen den Status-Zeilen, siehe
   START_LINE_DIVIDER_STYLE in overview.js. Sehr helle, dezente Linie - kein kraeftiger Schnitt. */
.start-lines-full .start-line + .start-line { border-top: 1px solid var(--color-border); }
.start-lines-inset .start-line + .start-line .start-line-text { border-top: 1px solid var(--color-border); }
.start-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    margin-bottom: 8px;
}
.start-card-title { display: flex; align-items: center; gap: 10px; }
.start-card-arrow { color: var(--color-muted); font-size: 18px; }
.start-card-row {
    font-size: 14px;
    padding: 4px 0;
}
.start-card-row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.start-card-row-tappable { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.start-card-row-main { min-width: 0; flex: 1; }
.start-card-row-person { font-size: 12px; color: var(--color-muted); margin-top: 2px; }
.start-card-meta { color: var(--color-muted); font-size: 13px; }
.start-card-empty { color: var(--color-muted); }
.start-card-chevron { display: flex; color: var(--color-muted); transition: transform 0.15s; }
.start-card-chevron.expanded { transform: rotate(180deg); }

/* --- Aufgaben --- */
.task-card, .verliehen-card { border-left: none; }
.task-done strong { text-decoration: line-through; color: var(--color-muted); }
.task-done { opacity: 0.7; }

.checkbox-group { display: flex; flex-wrap: wrap; gap: 8px; }
.checkbox-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 14px;
    cursor: pointer;
}
.checkbox-pill input { width: 16px; height: 16px; }
.checkbox-pill.disabled { opacity: 0.4; cursor: not-allowed; }

.shop-assign-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.shop-assign-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shop-assign-row .checkbox-pill { flex: 1; min-width: 140px; }
.shop-assign-preference { padding: 6px 8px; border: 1px solid var(--color-border); border-radius: 8px; font-size: 13px; }
.shop-assign-preference:disabled { opacity: 0.4; }

.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 1px solid var(--color-border);
    border-radius: 999px;
    font-size: 14px;
    background: var(--color-card);
    color: var(--color-text);
    cursor: pointer;
}
.filter-pill.active { background: var(--color-primary); border-color: var(--color-primary); color: #fff; font-weight: 600; }

.history-bucket-heading {
    font-size: 13px;
    color: var(--color-muted);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 18px 0 8px;
}
.history-bucket-heading:first-child { margin-top: 0; }

/* --- Projekte --- */
.projekt-card { border-left: none; }
#projekt-edit-btn svg, #projekt-status-btn svg { color: var(--color-primary); }
.projekt-card-row { display: flex; align-items: flex-start; gap: 14px; }
.projekt-card-body { flex: 1; min-width: 0; }
.projekt-card-meta { font-size: 13px; color: var(--color-muted); margin-top: 2px; }
.project-progress-ring {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: conic-gradient(var(--color-projects) calc(var(--pct, 0) * 1%), var(--color-border) 0);
}
.pet-card-thumb-medium { width: 56px; height: 56px; font-size: 24px; }
.task-meta-row { display: flex; align-items: center; gap: 8px; margin-top: 2px; flex-wrap: wrap; }
.task-meta-due { font-size: 13px; color: var(--color-muted); }

.responsible-badge {
    font-size: 12px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 999px;
    color: #fff;
}
.helper-note {
    font-size: 12px;
    color: var(--color-muted);
    margin-top: 4px;
}

/* --- Personen-Kennzeichnung ueber Avatare (statt farbiger Rollen-Chips) --- */
.person-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
}
.person-cluster { display: inline-flex; align-items: center; vertical-align: middle; }
.person-cluster .pet-card-thumb {
    width: 16px;
    height: 16px;
    font-size: 8px;
    border: 1.5px solid #fff;
    margin-left: -6px;
}
.person-cluster .pet-card-thumb:first-child { margin-left: 0; }

.person-picker { display: flex; flex-wrap: wrap; gap: 10px; }
.person-picker-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    width: 60px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
}
.person-picker-tile .pet-card-thumb { transition: box-shadow 0.15s ease; }
.person-picker-tile.active .pet-card-thumb { box-shadow: 0 0 0 2px var(--color-primary); }
.person-picker-name {
    font-size: 11px;
    color: var(--color-muted);
    max-width: 56px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.person-picker-tile.active .person-picker-name { color: var(--color-text); font-weight: 600; }
.person-picker-empty { background: var(--color-bg); color: var(--color-muted); font-weight: 700; font-size: 16px; }

/* --- Geburtstage --- */
.month-card { cursor: pointer; padding: 12px 0; border-bottom: 1px solid var(--color-border); }
.month-card:last-child { border-bottom: none; }
.month-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}
.month-card-header strong { font-size: 18px; }
.month-card-name-active { color: var(--color-primary); }
.month-card-meta { font-size: 13px; color: var(--color-muted); margin-top: 2px; }
.month-card-arrow { color: var(--color-muted); font-size: 18px; }
.month-card-details {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--color-border);
}
.month-entry { background: var(--color-card); padding: 14px; }
.month-entry-row { display: flex; justify-content: space-between; align-items: center; }
.month-entry-meta { font-size: 13px; color: var(--color-muted); margin-top: 2px; }
.month-entry-note { font-size: 14px; margin-top: 4px; }

/* --- Mehr-Menü --- */
.menu-card {
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
}
.menu-card[data-go="birthdays"] { border-left: none; }
.menu-card[data-go="family"] { border-left: none; }
.menu-card[data-go="vehicles"] { border-left: none; }
.menu-card[data-go="verliehen"] { border-left: none; }
.menu-card[data-go="projekte"] { border-left: none; }
.menu-card[data-go="kontakte"] { border-left: none; }
.menu-card-icon { font-size: 26px; }
.menu-card-body { flex: 1; }
.menu-card-meta { font-size: 13px; color: var(--color-muted); margin-top: 2px; }

/* --- Modul-Identitaetskarten: farbiges Icon-Quadrat (Start-Uebersicht + Mehr-Menue) --- */
.module-card-icon {
    width: 38px;
    height: 38px;
    min-width: 38px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
}
.module-card-icon svg { width: 20px; height: 20px; }

/* --- Haustiere / geteilte Profil-Detailseiten (Haustiere, Personen, Fahrzeuge) --- */
#family-back-btn { margin-bottom: 10px; }
.section-divider { border: none; border-top: 1px solid var(--color-border); margin: 16px 0; }

.pet-card { display: flex; align-items: center; gap: 14px; cursor: pointer; border-left: none; }
.pet-profile, .vehicle-section-card { border-left: none; }
.pet-card-thumb {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-bg);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    overflow: hidden;
    flex-shrink: 0;
}
.pet-card-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pet-card-thumb svg { width: 24px; height: 24px; }
.vehicle-icon-thumb { background: var(--color-primary); color: #fff; }
.vehicle-emergency-btn { color: var(--color-danger); }
.pet-card-thumb-small { width: 36px; height: 36px; font-size: 18px; }
.pet-card-thumb-small svg { width: 18px; height: 18px; }
.pet-card-thumb-tiny { width: 22px; height: 22px; font-size: 13px; }
.pet-card-thumb-tiny svg { width: 13px; height: 13px; }
.pet-card-thumb-large { width: 72px; height: 72px; font-size: 34px; }
.pet-card-thumb-large svg { width: 34px; height: 34px; }
.pet-card-thumb-monogram {
    width: auto;
    height: 1.5em;
    min-width: 2.3em;
    padding: 0 0.4em;
    border-radius: 999px;
}
.pet-card-meta { font-size: 13px; color: var(--color-muted); margin-top: 2px; }
#haushalt-name-card { border-left: none; }

/* --- Unsere Familie: Kachel-Grid --- */
.family-tile-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.family-tile {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    text-align: center;
}
.family-tile .pet-card-thumb { width: 64px; height: 64px; font-size: 30px; }
/* Aktuell auf diesem Geraet gewaehlte Person (getStoredPersonId()) - gleiches Prinzip wie
   .family-hero-avatar-active im Header (leicht vergroessert + Ring in der Akzentfarbe). */
.family-tile-active .pet-card-thumb { width: 72px; height: 72px; font-size: 34px; box-shadow: 0 0 0 3px var(--color-primary); }
.family-tile-emergency-btn,
.family-tile-identity-btn {
    position: absolute;
    top: -8px;
    right: 2px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: none;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    padding: 0;
    cursor: pointer;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}
.family-tile-emergency-btn svg,
.family-tile-identity-btn svg { width: 19px; height: 19px; }
.family-tile-emergency-btn { color: var(--color-primary); }
.family-tile-identity-btn { right: 40px; color: var(--color-primary); }
.family-tile-name {
    font-size: 13px;
    font-weight: 600;
    max-width: 88px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.add-chooser { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.add-chooser-option {
    flex: 1 1 100px;
    min-width: 90px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 10px;
    cursor: pointer;
    background: var(--color-card);
    border: 1px solid var(--color-border);
}
.add-chooser-icon { font-size: 32px; color: var(--color-primary); }
.add-chooser-icon svg { width: 32px; height: 32px; }

.pet-profile-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.pet-profile-avatar-wrap { position: relative; flex-shrink: 0; }
/* Etwas weiter nach rechts als der Standard-Wert, da der Avatar hier eng neben dem Namen sitzt
   statt wie im Kachel-Raster mit Luft drumherum. Farbe kommt bereits von .family-tile-emergency-btn. */
.pet-profile-avatar-wrap #person-emergency-btn { right: -6px; }

.pet-stammdaten { display: flex; flex-direction: column; gap: 8px; }
.pet-stammdaten-row {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 14px;
    padding: 6px 0;
    border-bottom: 1px solid var(--color-border);
}
.pet-stammdaten-row:last-child { border-bottom: none; }
.pet-stammdaten-label { color: var(--color-muted); }
.pet-stammdaten-value { text-align: right; font-weight: 600; }

.pet-notes { font-size: 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--color-border); }

.section-heading { font-size: 15px; margin: 18px 4px 8px; color: var(--color-text); }

.form-section-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--color-primary);
    margin: 18px 0 8px;
}
.form-section-title:first-child { margin-top: 0; }
.form-hint { font-size: 12px; color: var(--color-muted); }

.event-card { border-left: none; cursor: pointer; }
.event-card-header { display: flex; align-items: center; gap: 10px; }
.event-card-icon { color: var(--color-primary); flex-shrink: 0; }
.event-card-icon svg { width: 22px; height: 22px; display: block; }
.event-card-body { font-size: 14px; margin-top: 8px; padding-left: 32px; }
.inline-icon { display: inline-flex; vertical-align: -3px; color: var(--color-primary); }
.inline-icon svg { width: 14px; height: 14px; }

/* --- Fahrzeuge --- */
.tel-link { display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; color: var(--color-primary); font-weight: 600; text-decoration: none; }
.tel-link svg { width: 16px; height: 16px; flex-shrink: 0; }
.emergency-card { font-size: 16px; }
.emergency-card .pet-stammdaten-value { font-size: 17px; }
.modal-title-icon { display: inline-flex; align-items: center; gap: 8px; }
.modal-title-icon svg { width: 22px; height: 22px; flex-shrink: 0; }
.date-select-group { display: grid; grid-template-columns: 1fr 1.4fr 1fr; gap: 8px; }
.date-select-group select { width: 100%; }
.notfall-med-item { display: flex; align-items: center; gap: 6px; padding: 8px 0; border-bottom: 1px solid var(--color-border); }
.notfall-med-item:last-of-type { border-bottom: none; }

/* --- Login --- */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: var(--color-primary);
}
.login-card {
    background: #fff;
    border-radius: var(--radius);
    padding: 28px 24px;
    width: 90%;
    max-width: 340px;
    text-align: center;
}
.login-card h1 { margin: 0 0 4px; color: var(--color-primary-dark); }
.login-sub { color: var(--color-muted); font-size: 14px; margin-bottom: 18px; }
.login-card input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid var(--color-border);
    border-radius: 10px;
    font-size: 16px;
}
.login-card button[type="submit"] {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    background: var(--color-primary);
    color: #fff;
    font-size: 16px;
    font-weight: 600;
}
.pin-mask {
    -webkit-text-security: disc;
    text-security: disc;
    letter-spacing: 4px;
}
.password-wrap { position: relative; margin-bottom: 12px; }
.password-wrap input { padding-right: 44px; margin-bottom: 0; }
.pw-toggle { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); width: auto; background: none; border: none; cursor: pointer; padding: 0; display: flex; align-items: center; color: #aaa; }
.login-error {
    color: var(--color-danger);
    font-size: 14px;
    font-weight: 600;
    background: color-mix(in srgb, var(--color-danger) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-danger) 35%, transparent);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
}
.login-success {
    color: var(--color-success);
    font-size: 14px;
    font-weight: 600;
    background: color-mix(in srgb, var(--color-success) 12%, transparent);
    border: 1px solid color-mix(in srgb, var(--color-success) 35%, transparent);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
}
.login-links { margin-top: 14px; font-size: 14px; display: flex; justify-content: space-between; }
.login-links a { color: var(--color-primary-dark); text-decoration: none; }
