/* Kilossos – Oberfläche „Wiegeprotokoll“ (ab 0.23.0): sachlich wie eine Gewichtskarte beim Tierarzt.
   Papier, Tinte, Millimeterpapier; Tanne für Aktionen, Bernstein für Warnungen, Rot nur für Sofort-Warnungen.
   Die Wahl Hell/Dunkel steht als data-theme="hell" | "dunkel" am <html>-Element (gesetzt im <head> von index.html).
   Kontraste mit der WCAG-Formel geprüft: Text mindestens 4,5 : 1, Feldränder mindestens 3 : 1.
   Text auf den „-hell“-Flächen immer in --text. Die alten Variablennamen bleiben, nur die Werte sind neu. */

/* Schriften liegen im Repo (fonts/, SIL Open Font License) – keine Verbindung zu Google Fonts. */
@font-face {
  font-family: "Literata";
  src: url("fonts/literata.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible Next";
  src: url("fonts/atkinson-hyperlegible-next.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --hintergrund: #f3f5f2; /* Papier */
  --flaeche: #fbfcfa; /* Blatt */
  --flaeche-2: #e8eee9;
  --text: #1d2b2a; /* Tinte */
  --text-leise: #5b6b68;
  --akzent: #2f6b5e; /* Tanne */
  --akzent-stark: #2f6b5e;
  --akzent-text: #ffffff;
  --akzent-hell: #c9ddcf; /* Salbei */
  --gut: #2f6b5e;
  --gut-hell: #dcebe0;
  --warnung: #a65a12; /* Bernstein */
  --warnung-hell: #f6ead9;
  --gefahr: #b3261e;
  --gefahr-hell: #f9dedc;
  --rand: #dbe3dd; /* Raster */
  --rand-stark: #c3cfc6;
  --feldrand: #7a8a85;
  --fokus: #8fb8ad;
  /* Diagrammfarben im PDF-Bericht: dunkles Grün und Bernstein, auch bei Farbsehschwäche unterscheidbar */
  --reihe-1: #2f6b5e;
  --reihe-2: #a65a12;
  --schatten: none;
  --schatten-menue: 0 12px 32px rgb(29 43 42 / 0.18);
  --rund: 12px;
  --rund-klein: 6px;
  --serif: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Atkinson Hyperlegible Next", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --feder: cubic-bezier(0.3, 0.9, 0.3, 1);
}

:root[data-theme="dunkel"] {
  color-scheme: dark;
  --hintergrund: #131b1a;
  --flaeche: #1b2524;
  --flaeche-2: #243130;
  --text: #e4ebe8;
  --text-leise: #a2b1ad;
  --akzent: #7cc0ad;
  --akzent-stark: #7cc0ad;
  --akzent-text: #10201c;
  --akzent-hell: #2a4a42;
  --gut: #7cc0ad;
  --gut-hell: #22382f;
  --warnung: #e3a35e;
  --warnung-hell: #3a2b19;
  --gefahr: #f2b8b5;
  --gefahr-hell: #4a2523;
  --rand: #2c3a38;
  --rand-stark: #465755;
  --feldrand: #71837f;
  --fokus: #4f8f80;
  --reihe-1: #7cc0ad;
  --reihe-2: #e3a35e;
  --schatten-menue: 0 12px 32px rgb(0 0 0 / 0.45);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--hintergrund);
  color: var(--text);
  line-height: 1.45;
  padding-bottom: calc(80px + env(safe-area-inset-bottom));
  transition: background 0.4s, color 0.4s;
}

button, input { font: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--serif); font-weight: 500; }
:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }

/* Zahlen in der Serifenschrift, gleich breit, damit Spalten sauber stehen */
.zahl, .gross, .wert, .kcal-zahl, .waage-zahl {
  font-family: var(--serif);
  font-variant-numeric: tabular-nums lining-nums;
}

/* Linien-Icons (js/symbole.js) */
.ico {
  width: 1.5rem; height: 1.5rem; flex: none; display: block;
  fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
}

.kopf {
  padding: 12px 16px 0;
  max-width: 560px;
  margin: 0 auto;
}
/* Schriftzug ab 0.29.3 größer und in Tinte (vorher 0.875rem, grau: „klein und schmächtig“, Handy-Test 04.11.2026) */
.kopf h1 {
  margin: 0; font-size: 1.25rem; font-weight: 600; letter-spacing: 0.02em; color: var(--text);
}

/* ---------- Willkommen und Einrichtung (nur beim ersten Start, drei Schritte) ---------- */
.willkommen {
  position: fixed; inset: 0; z-index: 8; overflow-y: auto; background: var(--hintergrund);
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
.willkommen[hidden] { display: none; }
.willkommen-inhalt { max-width: 560px; margin: 0 auto; display: grid; gap: 14px; animation: hereinfahren 0.35s cubic-bezier(0.2, 0.8, 0.2, 1); }
.willkommen-logo { justify-self: center; border-radius: 24px; box-shadow: 0 0 0 1px var(--rand-stark); } /* Kasten statt Kreis (0.34.2): Ohr und Napf ganz zu sehen */
.willkommen h1 { margin: 6px 0 0; text-align: center; font-size: 1.75rem; line-height: 1.2; }
.willkommen h1:focus { outline: none; }
.willkommen-unter { margin: -8px 0 4px; text-align: center; color: var(--text-leise); }
.willkommen .karte p { margin: 0 0 10px; }
.willkommen-daten { margin: 0; text-align: center; }
.willkommen-daten .knopf-text { padding: 12px 4px; }
.willkommen-schritt[hidden] { display: none; }
.willkommen-schritt > h1:not(#willkommen-titel) { text-align: left; font-size: 1.5rem; margin-top: 0; }
.willkommen-punkte { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.willkommen-punkte li { display: flex; gap: 12px; align-items: flex-start; }
.willkommen-punkte .ico { flex: none; width: 1.5rem; height: 1.5rem; color: var(--akzent-stark); margin-top: 1px; }
.willkommen-geschichte { margin: 0; }
.willkommen-schritt > .knopf-text { justify-self: start; margin: -10px 0; }
.willkommen-schritte { margin: 4px 0 -6px; text-align: center; font-size: 0.8125rem; color: var(--text-leise); }
.willkommen-schritt > .knopf-haupt { width: 100%; }
.willkommen .knoepfe > button { flex: 1; }
.willkommen-notfall { padding-left: 10px; border-left: 3px solid var(--warnung); }
.einrichtung-foto { position: relative; display: flex; gap: 14px; align-items: center; }
.einrichtung-foto .avatar { width: 72px; height: 72px; }
.einrichtung-foto .avatar .initiale { font-size: 1.75rem; }
.einrichtung-foto .knopf-zweit { display: inline-flex; gap: 8px; align-items: center; }
.einrichtung-foto .tipp { margin-top: 4px; }
body.willkommen-offen { overflow: hidden; }
.knopf-text {
  border: 0; background: none; padding: 12px 0; min-height: 48px; cursor: pointer;
  color: var(--akzent-stark); font-weight: 700; text-align: left; text-decoration: underline; text-underline-offset: 3px;
}
#dialog-warum p { margin: 0 0 10px; }
#dialog-bcs p, #dialog-bcs ul, #dialog-grenzen p, #dialog-grenzen ul { margin: 0 0 10px; }
#dialog-bcs ul, #dialog-grenzen ul { padding-left: 20px; display: grid; gap: 6px; }
#dialog-bcs h3, #dialog-grenzen h3 { margin: 4px 0 0; font-size: 1.0625rem; }
#dialog-bcs h2:focus, #dialog-grenzen h2:focus, #dialog-geschichte h2:focus { outline: none; }
#dialog-grenzen .leise a { color: inherit; font-weight: 700; }
/* Geschichte ab 0.90.3: zwei Porträts mit Foto (4:3), Überschriften wie auf den Erklärseiten */
#dialog-geschichte h3 { margin: 18px 0 6px; font-size: 1.0625rem; }
.geschichte-foto {
  display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover;
  border-radius: var(--rund); box-shadow: 0 0 0 1px var(--rand-stark); margin: 4px 0 6px; background: var(--akzent-hell);
}
.geschichte-gruss { margin-top: 14px; font-style: italic; }
/* Erklärseiten ab 0.30.0: „Warum nimmt meine Katze nicht ab?“ wie „Welche Grenzen gelten?“,
   „Begriffe kurz erklärt“ als ruhige Liste mit Trennlinien, Begriff halbfett, Quelle klein darunter. */
#dialog-nicht-ab p { margin: 0 0 10px; }
#dialog-nicht-ab h3 { margin: 4px 0 0; font-size: 1.0625rem; }
#dialog-nicht-ab .notfall-hinweis { margin: 0 0 12px; }
#dialog-begriffe h2:focus, #dialog-nicht-ab h2:focus { outline: none; }
/* „Tipps fürs Abnehmen“ (0.57.0), „Häufige Fragen“ (0.58.0) und „Warum ist meine Katze zu schwer geworden?“ (0.62.0)
   wie „Warum nimmt meine Katze nicht ab?“.
   Verweise stehen als eigene Zeile; ein Link braucht inline-block, sonst greift min-height (48 px) nicht. */
#dialog-tipps p, #dialog-fragen p, #dialog-ursachen p { margin: 0 0 10px; }
#dialog-tipps h3, #dialog-fragen h3, #dialog-ursachen h3 { margin: 4px 0 0; font-size: 1.0625rem; }
#dialog-fragen .notfall-hinweis, #dialog-ursachen .notfall-hinweis { margin: 0 0 12px; }
#dialog-tipps h2:focus, #dialog-fragen h2:focus, #dialog-ursachen h2:focus { outline: none; }
/* „Wie wiege ich meine Katze genau?“ (0.73.0) */
#dialog-wiegen p, #dialog-wiegen li { margin: 0 0 10px; }
#dialog-wiegen h3 { margin: 4px 0 0; font-size: 1.0625rem; }
#dialog-wiegen h2:focus { outline: none; }
.wiegen-link { margin: 0; } /* im Gewicht-Fenster nur der Abstand des Formulars (gap), wie bei den Feldern */
a.knopf-text { display: inline-block; }
#begriffe-liste { margin: 0 0 12px; border-top: 1px solid var(--rand); }
.begriff { border-bottom: 1px solid var(--rand); }
.begriff > .aufklapp-kopf .zusammen { font-weight: 600; }
.begriff .aufklapp-inhalt p { margin: 0 0 4px; }
.begriff .knopf-text { display: block; }
.begriff .quelle { display: block; color: var(--text-leise); font-size: 0.8125rem; }
.begriff.offen .aufklapp-inhalt > div { padding-bottom: 12px; }

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px;
}

.ansicht { display: grid; gap: 12px; padding-top: 8px; }
.ansicht[hidden] { display: none; }
/* Beim Aktualisieren in einem anderen Bereich: „Heute“ nicht kurz aufblitzen lassen (Marke aus dem Kopf-Skript, app.js nimmt sie weg). */
html[data-start] .ansicht[data-ansicht="heute"] { display: none; }
.ansicht > * { min-width: 0; }
.ansicht.rein { animation: hereinfahren 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes hereinfahren { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
/* Nach einem Wischen: der neue Bereich kommt von der Seite, aus der man ihn hereingezogen hat. */
.ansicht.rein-rechts { animation: von-rechts 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
.ansicht.rein-links { animation: von-links 0.3s cubic-bezier(0.2, 0.8, 0.2, 1); }
@keyframes von-rechts { from { opacity: 0; transform: translateX(32px); } to { opacity: 1; transform: none; } }
@keyframes von-links { from { opacity: 0; transform: translateX(-32px); } to { opacity: 1; transform: none; } }

/* Ein „Blatt“: helle Fläche mit feinem Rand, kein Schatten */
.karte {
  background: var(--flaeche);
  border: 1px solid var(--rand);
  border-radius: var(--rund);
  padding: 14px 16px;
  display: grid;
  gap: 8px;
  transition: background 0.4s;
}
.karte h2 { margin: 0; font-size: 1.1875rem; line-height: 1.25; }
.karte p { margin: 0; }
.label { font-size: 0.8125rem; color: var(--text-leise); font-weight: 400; }

.summe { text-align: center; }
.gross { font-size: 2.75rem; font-weight: 500; line-height: 1.1; color: var(--text); }

.leise { color: var(--text-leise); font-size: 0.875rem; }
.hinweis-text-klein { margin: 0; color: var(--text-leise); font-size: 0.8125rem; }
.tipp { margin: 0; color: var(--text-leise); font-size: 0.875rem; }
.leer { margin: 0; color: var(--text-leise); text-align: center; padding: 8px 0; }
.leer[hidden] { display: none; }

/* ---------- Kopf auf „Heute“ mit Profilbild ---------- */
.tier-kopf { display: flex; align-items: center; gap: 14px; padding: 4px 0 6px; }
.tier-kopf .tier-text { flex: 1; min-width: 0; }
.tier-kopf b { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.625rem; line-height: 1.15; }
.tier-kopf small { color: var(--text-leise); font-size: 0.875rem; }
.tier-kopf .datum { font-size: 0.8125rem; color: var(--text-leise); text-align: right; }
.profil-feld { position: relative; }
.profil {
  width: 56px; height: 56px; border-radius: 21%; padding: 0; border: 0; flex: none;
  box-shadow: 0 0 0 1px var(--rand-stark); /* wie das Bild auf der Willkommensseite (0.74.0), vorher Kreis */
  background: var(--akzent-hell); position: relative; cursor: pointer;
  display: grid; place-items: center;
  transition: transform 0.15s;
}
.profil:active { transform: scale(0.95); }
.profil img, .avatar img {
  width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block;
  animation: foto-rein 0.35s ease-out;
}
@keyframes foto-rein { from { opacity: 0; } to { opacity: 1; } }
/* Ohne Foto: Initiale auf Salbei, ruhig und neutral */
.initiale {
  font-family: var(--serif); font-weight: 500; font-size: 1.5rem; line-height: 1; color: var(--text);
}
.profil .kamera {
  position: absolute; right: -3px; bottom: -3px; width: 24px; height: 24px; border-radius: 21%; /* wie das Profilbild (0.74.1) */
  background: var(--flaeche); color: var(--text); display: grid; place-items: center;
  border: 1px solid var(--rand-stark);
}
.profil .kamera .ico { width: 14px; height: 14px; stroke-width: 2; }
.avatar {
  width: 40px; height: 40px; border-radius: 21%; box-shadow: 0 0 0 1px var(--rand-stark); background: var(--akzent-hell);
  display: grid; place-items: center; overflow: hidden; flex: none;
}
.avatar .initiale { font-size: 1.125rem; }
.profil-menue { left: 0; right: auto; min-width: 190px; }
.profil-feld.offen > .auswahl-menue, .tier-feld.offen > .auswahl-menue { transform: none; opacity: 1; visibility: visible; }
/* Name auf „Heute“: bei mehreren Tieren ein Knopf zum Wechseln */
.tier-feld { position: relative; }
.tier-wechsel {
  display: block; width: 100%; min-height: 48px; padding: 0; border: 0; background: none;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.tier-wechsel:disabled { cursor: default; }
.tier-wechsel .pfeil { color: var(--text-leise); display: inline-block; vertical-align: middle; }
.tier-wechsel .pfeil[hidden] { display: none; } /* bei nur einem Tier: kein Pfeil, der Knopf ist gesperrt */
.tier-wechsel .pfeil .ico { width: 1.1rem; height: 1.1rem; }
.tier-menue { left: 0; right: auto; min-width: 190px; }
.auswahl-menue.tier-menue .haken { opacity: 1; }
.tier-menue .avatar { width: 32px; height: 32px; }

/* ---------- Tagesauswahl ---------- */
.tagwahl { display: flex; align-items: center; justify-content: space-between; }
.tagwahl h2 { margin: 0; font-size: 1.25rem; }
/* Tagestitel als Knopf: öffnet den Kalender des Geräts (0.70.0). Das Datumsfeld liegt unsichtbar darunter, damit
   der Kalender dort aufgeht; showPicker() verlangt ein gezeichnetes Feld, daher kein display: none. */
.tag-titel-kopf { position: relative; min-width: 0; margin-inline: 4px; }
.tag-titel-knopf {
  min-height: 48px; padding: 0 6px; border: 0; border-radius: 24px; background: none; color: inherit;
  font: inherit; display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
}
.tag-titel-knopf .ico { width: 18px; height: 18px; color: var(--text-leise); }
.tag-titel-knopf:active { background: var(--flaeche); }
.tag-kalender {
  position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0;
  opacity: 0; pointer-events: none;
}

.knopf-rund {
  width: 48px; height: 48px; border-radius: 21%; border: 1px solid var(--rand-stark); background: var(--flaeche); /* Name bleibt, seit 0.74.1 eckig wie die Profilbilder */
  color: var(--text); cursor: pointer; display: grid; place-items: center; padding: 0;
  transition: transform 0.12s;
}
.knopf-rund:active { transform: scale(0.94); }
.knopf-rund:disabled { opacity: 0.35; cursor: default; }

/* ---------- Zeilen (Wägungen, Sorten) ---------- */
.zeilen { list-style: none; margin: 0; padding: 0; }
.zeile {
  display: flex; align-items: center; gap: 12px; padding: 10px 0;
  border-bottom: 1px solid var(--rand);
}
.zeile:last-child { border-bottom: 0; }
/* Antippbare Zeilen (eigene Sorten, Futterliste) sind echte Knöpfe, damit Tastatur und Vorlesefunktion sie erreichen. */
.zeile-knopf {
  width: 100%; margin: 0; background: none; border: 0; border-bottom: 1px solid var(--rand); border-radius: 0;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.zeile-knopf, .protokoll-knopf { position: relative; } /* Halt für den versteckten Vorlese-Zusatz */
.zeile-knopf:focus-visible { outline-offset: -3px; }
.protokoll-knopf:focus-visible { outline-offset: 3px; }
.zeile .icon, .aufklapp-kopf > .icon {
  width: 36px; height: 36px; border-radius: var(--rund-klein); display: grid; place-items: center;
  background: var(--flaeche-2); color: var(--text); flex: none;
}
.zeile .icon .ico, .aufklapp-kopf > .icon .ico { width: 1.25rem; height: 1.25rem; }
.zeile .name { flex: 1; min-width: 0; font-size: 0.9375rem; overflow-wrap: anywhere; }
.zeile .name b { font-family: var(--serif); font-weight: 500; font-variant-numeric: tabular-nums; }
.zeile .name small { display: block; color: var(--text-leise); font-size: 0.8125rem; }
.zeile .kcal { font-family: var(--serif); font-size: 0.9375rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tippbar { cursor: pointer; }
.tippbar:active { background: var(--flaeche-2); }
/* Wägung antippen = ändern (seit 0.31.0): Gewicht, Datum, Notiz und Marke als ein Knopf zwischen Foto und Kreuz.
   Mindestens 48 px hoch zum Tippen. Rand und Polster heben sich auf (7 px wie das Polster von .tag-klapp .zeile):
   Zeile und Text bleiben, wo sie vorher waren, der Knopf füllt die ganze Zeilenhöhe.
   Fokus-Rahmen nach innen, sonst schneidet die aufklappbare Monatskarte ihn oben und unten ab. */
.waegung-knopf {
  flex: 1; min-width: 0; min-height: 48px; margin: -7px -4px; padding: 7px 4px;
  display: flex; align-items: center; gap: 12px;
  background: none; border: 0; border-radius: var(--rund-klein); color: var(--text); text-align: left;
  position: relative; /* Halt für den versteckten Vorlese-Zusatz */
}
.waegung-knopf:focus-visible { outline-offset: -3px; }

.knopf-loeschen {
  flex: none; width: 48px; height: 48px; margin: -6px -10px -6px 0; border: none; border-radius: var(--rund-klein);
  background: transparent; color: var(--text-leise); cursor: pointer; display: grid; place-items: center;
}
.knopf-loeschen .ico { width: 1.125rem; height: 1.125rem; }

/* Marken: Text immer in --text, die Farbe nur als Fläche */
.marke {
  flex: none; display: inline-block; font-size: 0.8125rem; font-weight: 700; padding: 2px 9px;
  border-radius: var(--rund-klein); background: var(--flaeche-2); color: var(--text); white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.marke-gut, .marke-packung, .marke-hersteller { background: var(--gut-hell); }
.marke-warnung, .marke-ungefaehr, .marke-geschaetzt { background: var(--warnung-hell); }
.marke-gefahr { background: var(--gefahr-hell); }

/* ---------- Knöpfe ---------- */
.knopf-haupt, .knopf-zweit, .knopf-gefahr {
  min-height: 50px; padding: 0 20px; border-radius: var(--rund-klein); font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.12s, background 0.2s;
}
.knopf-haupt:active, .knopf-zweit:active, .knopf-gefahr:active { transform: scale(0.98); }
.knopf-haupt { background: var(--akzent-stark); color: var(--akzent-text); border: none; }
.knopf-zweit { background: transparent; color: var(--akzent-stark); border: 1px solid var(--akzent-stark); }
.knopf-gefahr { background: transparent; border: 1px solid var(--gefahr); color: var(--gefahr); margin-right: auto; }
.knopf-gefahr[hidden] { display: none; }
a.knopf-zweit { text-decoration: none; }
.lade-fehler { position: relative; }
.lade-fehler-knoepfe { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.lade-fehler-knoepfe .knopf-gefahr { margin-right: 0; }
.lade-fehler-knoepfe [hidden] { display: none; }
a.knopf-zweit[hidden] { display: none; }
.knopf-haupt .ico, .knopf-zweit .ico { width: 1.25rem; height: 1.25rem; stroke-width: 2; }

/* ---------- „Mehr“: ruhige Einstellungsliste (ab 0.24.0) ---------- */
/* Ein Blatt mit Einträgen untereinander, getrennt durch feine Linien. Kein overflow: hidden,
   sonst würden aufgeklappte Auswahlmenüs abgeschnitten. */
.liste {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--rund);
  display: grid; transition: background 0.4s;
}
.liste > .eintrag, .liste > * > .eintrag { border-top: 1px solid var(--rand); }
.liste > .eintrag:first-child, .liste > :first-child > .eintrag:first-child { border-top: 0; }
.eintrag {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 8px 14px 8px 16px;
  background: none; border: 0; border-radius: 0; color: var(--text); font: inherit; font-size: 1rem;
  text-align: left; text-decoration: none; margin: 0;
}
button.eintrag, a.eintrag, label.eintrag { cursor: pointer; }
label.eintrag { position: relative; }
button.eintrag:active, a.eintrag:active, label.eintrag:active { background: var(--flaeche-2); }
.liste > :first-child, .liste > :first-child > .eintrag:first-child { border-top-left-radius: var(--rund); border-top-right-radius: var(--rund); }
.liste > :last-child, .liste > :last-child > .eintrag:last-child { border-bottom-left-radius: var(--rund); border-bottom-right-radius: var(--rund); }
.eintrag:focus-visible { outline-offset: -3px; }
.eintrag[hidden] { display: none; }
.liste[hidden] { display: none; }
.liste > .eintrag[hidden]:first-child + .eintrag { border-top: 0; border-top-left-radius: var(--rund); border-top-right-radius: var(--rund); }
.liste > .eintrag:has(+ .eintrag[hidden]:last-child) { border-bottom-left-radius: var(--rund); border-bottom-right-radius: var(--rund); }
/* Nur optisch versteckt: bleibt für Tastatur und Vorlesefunktion erreichbar (Sicherung einlesen). */
.nur-vorlesen { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
label.eintrag:has(input:focus-visible) { outline: 3px solid var(--fokus); outline-offset: -3px; }
.eintrag > .ico, .eintrag > [data-symbol] .ico { width: 1.375rem; height: 1.375rem; color: var(--text-leise); }
.eintrag > [data-symbol] { display: grid; flex: none; }
.eintrag .text { flex: 1; min-width: 0; display: grid; gap: 2px; overflow-wrap: anywhere; }
.eintrag .text small { color: var(--text-leise); font-size: 0.875rem; }
.eintrag .wert { color: var(--text-leise); font-size: 0.9375rem; text-align: right; }
.eintrag > .weiter, .eintrag > .weiter .ico { color: var(--text-leise); flex: none; width: 1.25rem; height: 1.25rem; }
.eintrag.gefahr, .eintrag.gefahr > [data-symbol] .ico { color: var(--gefahr); }
.eintrag .aktiv-marke { color: var(--akzent-stark); font-weight: 700; }
.eintrag .avatar { width: 40px; height: 40px; }
.eintrag-tier .text b { font-family: var(--serif); font-weight: 500; font-size: 1.125rem; }
/* Eintrag mit Auswahlmenü rechts (Wiegetag, Darstellung, Zeitraum) */
.eintrag-auswahl { flex-wrap: wrap; row-gap: 0; }
/* Titel bricht nur zwischen Wörtern; reicht der Platz nicht, rutscht das Menü in die nächste Zeile (große Schrift). */
/* 6.5rem seit 0.63.0: mit 7.5rem fehlte dem Wiegetag („Kein fester Tag“) bei 375 px genau 1 px, das Menü brach um. */
.eintrag-auswahl .text { flex: 1 1 6.5rem; overflow-wrap: normal; }
.eintrag-auswahl > .auswahl, .eintrag-auswahl > div > .auswahl { flex: 0 1 auto; min-width: 0; }
.eintrag-auswahl > div:last-child { margin-left: auto; min-width: 0; }
.eintrag-auswahl .auswahl-knopf { border-color: transparent; background: none; padding: 8px 4px 8px 10px; color: var(--text-leise); width: auto; }
.eintrag-auswahl .auswahl-knopf:hover { color: var(--text); }
.eintrag-auswahl .auswahl-menue { left: auto; right: 0; min-width: 210px; }
/* Freigabe-Tafel: nutzt .eckdaten aus dem Verlauf */
.freigabe-tafel { display: grid; gap: 6px; }
.freigabe-tafel .eckdaten { margin: 0; }
/* Seit 0.34.0 ist die Tafel ein Knopf „ändern“: gleiches Bild wie vorher (Eckdaten, darunter die Zeile mit 6 px Abstand),
   nur antippbar. Fokus-Rahmen nach innen, damit die Karte ihn nicht abschneidet. */
.freigabe-knopf {
  display: grid; gap: 6px; width: 100%; min-height: 48px; margin: 0; padding: 0;
  background: none; border: 0; border-radius: var(--rund-klein); color: var(--text); text-align: left;
  position: relative; /* Halt für den versteckten Vorlese-Zusatz */
}
.freigabe-knopf:focus-visible { outline-offset: -3px; }
.freigabe-knopf > .leise { display: block; }
/* Ab 0.35.1 sichtbar: „Korrigieren oder löschen“ als umrandetes Feld. Kein eigener Knopf, antippen kann man weiter die
   ganze Tafel; das Feld zeigt nur, dass es geht. Bei „Frühere Freigaben“ ein kleiner Stift rechts in jeder Zeile. */
.freigabe-hinweis {
  display: inline-flex; align-items: center; gap: 6px; justify-self: start;
  margin-top: 2px; padding: 6px 12px 6px 10px;
  border: 1px solid var(--akzent); border-radius: var(--rund-klein); /* wie die Knöpfe, keine Pille (0.74.2) */
  color: var(--akzent-stark); font-weight: 700; font-size: 0.875rem; line-height: 1.2;
}
.freigabe-hinweis .ico { width: 1rem; height: 1rem; flex: none; }
.freigabe-zeile .stift { flex: none; display: grid; color: var(--text-leise); }
.freigabe-zeile .stift .ico { width: 1.125rem; height: 1.125rem; }
.karte > h4.label { margin: 0; }
.mehr-hinweis { margin: 6px 2px 0; }
.speicher-belegt { display: grid; gap: 6px; }
.speicher-belegt[hidden], .speicher-warnung[hidden] { display: none; }
.speicher-balken { display: block; height: 6px; border-radius: 3px; background: var(--raster, var(--rand)); overflow: hidden; }
.speicher-balken > span { display: block; height: 100%; background: var(--akzent); }
.speicher-belegt.knapp .speicher-balken > span, .speicher-belegt.voll .speicher-balken > span { background: var(--warnung); }
.speicher-warnung { margin: 0; padding: 8px 10px; border-left: 3px solid var(--warnung); background: var(--warnung-hell); font-size: 0.875rem; }

/* ---------- Fotos an Wägungen (ab 0.25.0) ---------- */
#gewicht-foto-bereich[hidden], #gewicht-foto-wiegetag-tipp[hidden] { display: none; }
.gewicht-foto { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; position: relative; }
.gewicht-foto img { width: 72px; height: 72px; border-radius: var(--rund-klein); object-fit: cover; border: 1px solid var(--rand); }
.gewicht-foto .knopf-zweit { display: inline-flex; align-items: center; gap: 8px; }
.waegung-foto-knopf { flex: none; width: 48px; height: 48px; padding: 4px; margin: -4px 0; border: 0; background: none; border-radius: var(--rund-klein); cursor: pointer; }
.waegung-foto-knopf .waegung-foto { display: block; }
.foto-aktionen { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; position: relative; }
.foto-aktionen .knopf-zweit { display: inline-flex; align-items: center; gap: 8px; }
.foto-gross { width: 100%; max-width: 360px; aspect-ratio: 1; justify-self: center; object-fit: cover; border-radius: var(--rund); border: 1px solid var(--rand); }
.waegung-foto { width: 40px; height: 40px; border-radius: var(--rund-klein); object-fit: cover; flex: none; border: 1px solid var(--rand); }
.vorher-nachher { gap: 10px; }
.vn-paar { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vn-seite { margin: 0; display: grid; gap: 6px; min-width: 0; align-content: start; }
.vn-seite img, .vn-platzhalter { width: 100%; aspect-ratio: 1; border-radius: var(--rund-klein); object-fit: cover; display: block; }
.vn-seite img { border: 1px solid var(--rand); }
/* 0.43.0: Foto ist ein Knopf zum Foto-Fenster (ändern oder entfernen); Tippfläche ist das ganze Bild. */
.vn-bild { position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: var(--rund-klein); cursor: pointer; color: inherit; font: inherit; }
.vn-bild:active img { filter: brightness(0.92); }
.vn-plakette {
  position: absolute; top: 8px; right: 8px; display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px 4px 8px; border-radius: var(--rund-klein); background: rgba(0, 0, 0, 0.62); color: #fff;
  font-size: 0.8125rem; font-weight: 600; line-height: 1.2; pointer-events: none; white-space: nowrap;
}
.vn-plakette .ico { width: 16px; height: 16px; stroke-width: 2; }
.vn-platzhalter {
  display: grid; place-content: center; justify-items: center; gap: 6px; color: var(--text-leise);
  background: var(--flaeche-2); border: 1px dashed var(--rand-stark); font-size: 0.8125rem;
}
.vn-platzhalter .ico { width: 56px; height: 56px; stroke-width: 1.2; }
.vn-seite figcaption { display: grid; gap: 1px; }
.vn-seite figcaption b { font-family: var(--serif); font-weight: 500; font-size: 1.125rem; font-variant-numeric: tabular-nums; }
.vn-seite figcaption small { color: var(--text-leise); font-size: 0.8125rem; }
.zwei-spalten { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- Untere Leiste ---------- */
.leiste {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 4;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--flaeche); border-top: 1px solid var(--rand);
  padding: 4px 4px env(safe-area-inset-bottom);
  transition: background 0.4s;
}
.leiste button {
  min-height: 60px; border: none; background: transparent; color: var(--text-leise);
  font-size: 0.8125rem; font-weight: 400; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  transition: color 0.2s;
}
.leiste .ico { transition: transform 0.25s var(--feder); }
.leiste button[aria-current="page"] { color: var(--akzent-stark); font-weight: 700; }
.leiste button[aria-current="page"] .ico { transform: translateY(-1px); stroke-width: 2; }

/* ---------- Warnungen: sofort/achtung immer offen, hinweis aufklappbar ---------- */
.warnungen { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.warnungen:empty { display: none; }
.warnung {
  padding: 12px 14px; border-radius: var(--rund-klein); background: var(--gefahr-hell); color: var(--text);
  border-left: 4px solid var(--gefahr); font-size: 0.9375rem;
}
.warnung-sofort { font-weight: 700; }
.warnung-achtung { background: var(--warnung-hell); border-left-color: var(--warnung); }
.warnung .quelle, .hinweis .quelle { display: block; margin-top: 4px; color: var(--text-leise); font-size: 0.8125rem; font-weight: 400; }
.hinweis { background: var(--warnung-hell); border-radius: var(--rund-klein); padding: 0 14px; border-left: 4px solid var(--warnung); }
.hinweis > .aufklapp-kopf { padding: 12px 0; font-weight: 700; font-size: 0.9375rem; }
.hinweis .punkt {
  width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--warnung); color: var(--text);
  display: grid; place-items: center; font-size: 0.8125rem; font-weight: 700; flex: none;
}
.hinweis .aufklapp-inhalt > div > p { margin: 0 0 4px; font-size: 0.875rem; }
.hinweis .aufklapp-inhalt > div { padding-bottom: 0; }
.hinweis.offen .aufklapp-inhalt > div { padding-bottom: 12px; }

.sicherung-hinweis { display: grid; gap: 10px; background: var(--warnung-hell); border-left-color: var(--warnung); }
.sicherung-hinweis[hidden] { display: none; }

/* ---------- Aufklapp-Baustein (js/aufklappen.js) ---------- */
.aufklapp-kopf {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left; min-height: 48px;
  border: 0; background: none; padding: 0; cursor: pointer; color: inherit;
}
.aufklapp-kopf .zusammen { flex: 1; min-width: 0; font-weight: 400; }
.aufklapp-kopf .zusammen small { display: block; font-weight: 400; color: var(--text-leise); font-size: 0.8125rem; }
.aufklapp-kopf .pfeil {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; color: var(--text-leise); flex: none;
  transition: transform 0.3s;
}
.aufklapp-kopf .pfeil .ico, .auswahl-knopf .pfeil .ico { width: 1.125rem; height: 1.125rem; }
.aufklapp.offen > .aufklapp-kopf .pfeil { transform: rotate(180deg); }
.aufklapp-inhalt { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.35s var(--feder); }
.aufklapp.offen > .aufklapp-inhalt { grid-template-rows: 1fr; }
.aufklapp-inhalt > div { overflow: hidden; min-height: 0; }
/* Zugeklappt: auch für Tastatur und Vorlesefunktion weg – erst nach der Zuklapp-Animation. */
.aufklapp:not(.offen) .aufklapp-inhalt > div { visibility: hidden; transition: visibility 0s linear 0.35s; }
.aufklapp.karte > .aufklapp-inhalt > div > :first-child { margin-top: 8px; }
.karte-titel { font-family: var(--serif); font-weight: 500; font-size: 1.1875rem; color: var(--text); }
.gruppe-titel {
  font-family: var(--sans); font-size: 0.8125rem; font-weight: 700; color: var(--text-leise);
  letter-spacing: 0.06em; text-transform: uppercase; margin: 14px 2px 0;
}

/* Balken, die beim Aufklappen wachsen (Breite über --w) */
.balken { flex: 1; height: 8px; border-radius: 2px; background: var(--flaeche-2); overflow: hidden; min-width: 40px; }
.balken > i { display: block; height: 100%; border-radius: 2px; background: var(--akzent); width: 0; transition: width 0.75s var(--feder); }
.offen > .aufklapp-inhalt .balken > i,
.offen > .aufklapp-kopf .balken > i,
.balken.sofort > i { width: var(--w); }
.balken.gut > i { background: var(--gut); }
.balken.langsam > i, .balken.ueber > i { background: var(--warnung); }
.balken.zu-schnell > i, .balken.gefahr > i { background: var(--gefahr); }
.balken.neutral > i { background: var(--text-leise); }

/* ---------- Heute: Gefüttert (ab 0.38.0, Mischung kompakt) ---------- */
.kcal-kopf { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 8px; }
.kcal-zahl { font-size: 3rem; font-weight: 500; line-height: 1; }
.kcal-kopf .von { color: var(--text-leise); }
/* Balken: ein Stück je Mahlzeit, der Rest bis zur Tagesmenge blass, Marke bei der Tagesmenge */
.gef-feld { position: relative; margin-top: 6px; padding: 4px 0; }
.gef-bahn { position: relative; display: flex; gap: 2px; height: 14px; }
.gef-st { display: block; min-width: 3px; border-radius: 3px; }
.gef-st:first-child { border-top-left-radius: 7px; border-bottom-left-radius: 7px; }
.gef-st:last-of-type { border-top-right-radius: 7px; border-bottom-right-radius: 7px; }
.gef-chip.nass, .gef-st.nass { background: var(--akzent); }
.gef-chip.trocken, .gef-st.trocken { background: color-mix(in srgb, var(--akzent) 50%, var(--flaeche)); }
/* Frischfleisch (0.72.0): Akzent mit Punkten in der Flächenfarbe. Eine Mischfarbe mit --text war im hellen Modus
   kaum von Nass zu unterscheiden (beide dunkelgrün); das Muster trennt in hell und dunkel. */
.gef-chip.frischfleisch, .gef-st.frischfleisch { background: radial-gradient(circle, var(--flaeche) 0 1px, transparent 1.4px) 0 0 / 4px 4px, var(--akzent); }
.gef-chip.leckerli, .gef-st.leckerli { background: repeating-linear-gradient(135deg, var(--akzent) 0 2px, var(--flaeche) 2px 4px); }
.gef-st.rest { background: var(--flaeche-2); }
/* Über der Tagesmenge: rechts der Marke überdeckt, bis zum Spielraum grau schraffiert, darüber Bernstein */
.gef-drueber {
  position: absolute; top: 0; bottom: 0; right: 0; border-radius: 0 7px 7px 0;
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--text) 35%, transparent) 0 2px, transparent 2px 5px);
}
.gef-drueber.stark { background: var(--warnung); opacity: 0.85; }
.gef-marke { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); border-radius: 1px; }
/* Legende je vorkommender Art */
.gef-legende { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: 0.875rem; color: var(--text-leise); }
.gef-chip { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }
/* Zwei Kacheln, je eine Zeile: Wort links, Zahl rechts */
.gef-kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 4px; }
.gef-kachel {
  display: flex; justify-content: space-between; align-items: baseline; gap: 6px; min-width: 0; padding: 6px 10px;
  background: var(--hintergrund); border: 1px solid var(--rand); border-radius: var(--rund-klein);
}
.gef-kachel strong { font-family: var(--serif); font-weight: 500; font-size: 1.25rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gef-kachel.warn { background: var(--warnung-hell); border-color: var(--warnung); }
.gef-kachel.warn strong { color: var(--warnung); }
/* „Mehr zur Fütterung“ (0.44.0): aufklappbar unten in der Karte, Zahl und Einheit brechen nie um. */
.gef-mehr { margin-top: 10px; border-top: 1px solid var(--rand); }
.gef-mehr > .aufklapp-kopf { font-weight: 600; font-size: 0.9375rem; }
.gef-mehr .aufklapp-inhalt > div > :last-child { margin-bottom: 8px; }
.gef-satz { margin: 2px 0 8px; font-size: 0.9375rem; }
.gef-satz b { font-family: var(--serif); font-weight: 600; white-space: nowrap; }
.gef-zeilen { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 16px; margin: 0 0 10px; font-size: 0.9375rem; }
.gef-zeilen span, .gef-zeilen b { white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.gef-zeilen span:nth-child(3n + 1) { white-space: normal; text-align: left; min-width: 0; }
.gef-zeilen span:nth-child(3n + 2) { color: var(--text-leise); }
.gef-zeilen b { font-weight: 600; }
.gef-klein { margin: 0 0 4px; color: var(--text-leise); font-size: 0.875rem; }
/* Leckerlis im Aufklappmenü (seit 0.78.0, vorher eigene Karte unter „Letzte Messung“) */
.gef-leckerli { display: grid; gap: 6px; margin: 0 0 10px; padding-top: 10px; border-top: 1px solid var(--rand); font-size: 0.9375rem; }
.gef-leckerli .oben { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.gef-leckerli .wert { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kcal-rest { margin: 0; font-size: 0.9375rem; }
.kcal-rest b { font-family: var(--serif); font-weight: 600; }
.ca-hinweis { margin: 0; color: var(--text-leise); font-size: 0.8125rem; }
.ca-hinweis[hidden] { display: none; }

/* Protokoll-Liste der Mahlzeiten: Uhrzeit | Futter | Gramm und kcal | Löschen */
.protokoll { list-style: none; margin: 0; padding: 0; }
.protokoll li {
  display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--rand); font-size: 0.9375rem;
}
/* Die Zeile ist ein Knopf (seit 0.28.5, vorher nur antippbar): Zeit, Sorte und Menge stehen darin. */
.protokoll-knopf {
  display: grid; grid-template-columns: 3.25rem 1fr auto; gap: 10px; align-items: center;
  width: 100%; min-height: 52px; padding: 0; margin: 0; background: none; border: 0; border-radius: var(--rund-klein);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.protokoll li:first-child { border-top: 0; }
.protokoll .zeit { color: var(--text-leise); font-family: var(--serif); font-variant-numeric: tabular-nums; }
.protokoll .was { min-width: 0; overflow-wrap: anywhere; }
.protokoll .wert { text-align: right; font-family: var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; }
.protokoll small { display: block; color: var(--text-leise); font-size: 0.8125rem; font-family: var(--sans); }
.protokoll li .knopf-loeschen { margin: -6px -10px -6px -4px; }

/* Wie gestern (0.94.0): Vorlage unter „Mahlzeit eintragen“, leiser als die echten Mahlzeiten; das Kreuz blendet nur aus. */
#heute-wie-gestern:not(:empty) { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--rand); }
#heute-wie-gestern h3 { margin: 0 0 2px; font-size: 1.0625rem; }
#heute-wie-gestern .tipp { margin-bottom: 4px; }
.wie-gestern-liste li { grid-template-columns: 1fr auto; } /* seit 0.94.1 mit Kreuz „für heute ausblenden“ */
#heute-wie-gestern > .knopf-text { margin-top: 4px; }
.wie-gestern-liste .protokoll-knopf { color: var(--text-leise); }
.wie-gestern-versteckt { margin-top: 10px; } /* Aufklappmenü „Ausgeblendet“ (0.95.1) */
.wie-gestern-versteckt .wie-gestern-liste li { grid-template-columns: 1fr; }
/* Besonderer Tag auf „Heute“ (0.33.0): Art fett, darunter Zeitraum und Notiz; Beenden-Knopf in eigener Zeile. */
.besonders-liste .protokoll-knopf { grid-template-columns: 1fr; padding: 6px 0; }
.besonders-liste .was b { font-weight: 700; }
.besonders-liste .notiz { overflow-wrap: anywhere; }
.besonders-liste .knopf-beenden { grid-column: 1 / -1; justify-self: start; min-height: 48px; margin-bottom: 4px; }
.notfall-kasten { font-size: 1.0625rem; font-weight: 400; }
.notfall-kasten strong { display: block; margin-bottom: 2px; }

/* ---------- Heute: Letzte Messung (ab 0.39.0, Mischung flach, ohne Korridor) ---------- */
.mess-kopf { display: grid; gap: 4px; }
.mess-zeile { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
/* „Verlauf ›“: klein, Tippfläche 48 px über Innenabstand, der negative Rand hält die Zeile niedrig */
.mess-link {
  min-height: 48px; min-width: 48px; padding: 14px 8px; margin: -14px -8px -14px 0;
  border: 0; background: none; cursor: pointer; border-radius: var(--rund-klein);
  color: var(--akzent-stark); font: inherit; font-size: 0.875rem; font-weight: 700; line-height: 1.4; white-space: nowrap;
}
.mess-gewicht { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 10px; }
.mess-gewicht .wert { font-family: var(--serif); font-size: 2rem; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; }
.mess-gewicht .wert small { font-size: 1rem; color: var(--text-leise); font-family: var(--sans); }
.mess-kurve, .mess-skala { width: 100%; height: auto; display: block; overflow: visible; }
.mess-kurve .achse, .mess-skala .achse { fill: var(--text-leise); font-size: 11px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.mess-kurve .gitter { stroke: var(--rand); }
.mess-linie {
  fill: none; stroke: var(--text); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: zeichnen 1.2s 0.2s ease forwards; /* Linie hat pathLength="1" */
}
.mess-punkt { fill: var(--text); }
.mess-endtext { fill: var(--text); font-size: 13px; font-family: var(--serif); font-weight: 500; }
.mess-sk-spur { stroke: var(--rand-stark); stroke-width: 2; stroke-linecap: round; }
.mess-sk-zone { fill: var(--akzent-hell); }
:root[data-theme="dunkel"] .mess-sk-zone { fill: color-mix(in srgb, var(--akzent) 35%, var(--flaeche)); }
.mess-sk-strich { stroke: var(--text-leise); stroke-width: 1; }
/* Punkt auf der Skala und letzter Punkt der Kurve in der Farbe der Bewertung; grau = nicht bewertet */
.mess-sk-punkt, .mess-end { stroke: var(--flaeche); stroke-width: 2; fill: var(--text-leise); }
.mess-sk-punkt.gut, .mess-end.gut { fill: var(--gut); }
.mess-sk-punkt.langsam, .mess-end.langsam, .mess-sk-punkt.zunahme, .mess-end.zunahme { fill: var(--warnung); }
.mess-sk-punkt.zu-schnell, .mess-end.zu-schnell { fill: var(--gefahr); }
.mess-tempo { display: grid; gap: 6px; } /* 6 px: Skalenzahlen klebten am Satz (0.75.0); margin am p schlägt .karte p */
.mess-urteil { margin: 0; font-size: 0.9375rem; color: var(--text-leise); }
.mess-urteil b { color: var(--text); font-family: var(--serif); font-weight: 600; }
.mess-urteil.gut { color: var(--gut); }
.mess-urteil.langsam, .mess-urteil.zunahme { color: var(--warnung); }
.mess-urteil.zu-schnell { color: var(--gefahr); }
@keyframes zeichnen { to { stroke-dashoffset: 0; } }

.notfall-hinweis {
  margin: 4px 0 0; padding: 2px 0 2px 12px; border-left: 3px solid var(--warnung);
  color: var(--text-leise); font-size: 0.875rem;
}
.notfall-hinweis strong { color: var(--text); }

/* ---------- Kacheln (Leckerli) ---------- */
.kacheln { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kachel {
  display: grid; gap: 2px; align-content: start; padding: 14px; min-width: 0;
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--rund);
}
.kachel strong, .kachel .wert { font-family: var(--serif); font-size: 1.375rem; font-weight: 500; }
.kachel .wert small { font-size: 0.875rem; font-family: var(--sans); color: var(--text-leise); }
.kachel .leise { font-size: 0.8125rem; }
.kachel .balken { margin-top: 6px; }

/* ---------- Gewicht ---------- */
.gewicht-kopf { display: flex; align-items: baseline; gap: 6px; justify-content: center; }
.gewicht-kopf .einheit { font-size: 1.125rem; color: var(--text-leise); }

/* ---------- Verlauf ---------- */
[data-ansicht="verlauf"] { position: relative; }
#verlauf-inhalt { display: grid; gap: 12px; }
.verlauf-kopf { display: flex; align-items: center; gap: 14px; }
.verlauf-kopf h2 { margin: 0; font-size: 1.625rem; line-height: 1.15; }
.verlauf-kopf p { margin: 2px 0 0; font-size: 0.875rem; color: var(--text-leise); }
.verlauf-kopf .avatar { width: 52px; height: 52px; }
.verlauf-kopf .avatar .initiale { font-size: 1.375rem; }
/* Mit Foto ist das Bild im Kopf von „Verlauf“ ein Knopf zur Großansicht (0.89.0) */
.profilbild-knopf {
  padding: 0; border: 0; background: none; border-radius: 21%; cursor: pointer; flex: none;
  transition: transform 0.15s ease-out;
}
.profilbild-knopf:active { transform: scale(0.95); }
.profilbild-knopf:focus-visible { outline: 3px solid var(--fokus); outline-offset: 2px; }
.eckdaten {
  display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--rand); border-bottom: 1px solid var(--rand);
}
.eckdaten > * { padding: 10px 0; min-width: 0; }
.eckdaten > * + * { border-left: 1px solid var(--rand); padding-left: 12px; }
.eckdaten .label { display: block; }
/* Bei großer Handy-Schrift höchstens 6 % der Breite, damit „erreicht“ in die Spalte passt; normal bleibt 1.375rem. */
.eckdaten strong { font-family: var(--serif); font-weight: 500; font-size: min(1.375rem, 6vw); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.eckdaten small { display: block; font-size: 0.8125rem; color: var(--text-leise); }
.umschalter { display: flex; gap: 6px; }
.umschalter button {
  flex: 1; min-height: 48px; border: 1px solid var(--rand-stark); background: transparent; border-radius: var(--rund-klein);
  font-size: 0.875rem; color: var(--text); cursor: pointer; transition: background 0.2s, color 0.2s;
}
.umschalter button[aria-pressed="true"] { background: var(--text); color: var(--hintergrund); border-color: var(--text); font-weight: 700; }
.diagramm-kopf { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.diagramm-kopf .wert { font-size: 1.75rem; font-weight: 500; }
.diagramm-kopf .wert small { font-size: 0.9375rem; color: var(--text-leise); font-family: var(--sans); }
/* Millimeterpapier */
.papier {
  background-color: var(--flaeche);
  background-image: linear-gradient(var(--rand) 1px, transparent 1px), linear-gradient(90deg, var(--rand) 1px, transparent 1px);
  background-size: 10px 10px; background-position: -1px -1px;
  border: 1px solid var(--rand-stark); border-radius: var(--rund); padding: 8px 4px 4px;
}
.kurve-feld { position: relative; }
.kurve { width: 100%; height: auto; display: block; touch-action: pan-y; overflow: visible; }
.kurve .linie { fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 2000; stroke-dashoffset: 2000; animation: zeichnen 1.4s ease-out forwards; }
.kurve .achse { fill: var(--text-leise); font-size: 11.5px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.kurve .grundlinie { stroke: var(--rand-stark); stroke-width: 1; }
.kurve .achsen-strich { stroke: var(--text-leise); stroke-width: 1; }
.kurve .ziel { stroke: var(--akzent); stroke-width: 2; stroke-dasharray: 5 4; }
.kurve .ziel-text { fill: var(--akzent); font-size: 12px; font-family: var(--serif); }
.kurve .band { fill: var(--akzent-hell); opacity: 0.4; }
:root[data-theme="dunkel"] .kurve .band { opacity: 0.75; }
.kurve .freigabe-marke { stroke: var(--warnung); stroke-width: 1.5; stroke-dasharray: 2 3; }
.kurve .freigabe-text { fill: var(--warnung); font-size: 11px; font-family: var(--sans); }
.kurve .punkt { fill: var(--text); stroke: var(--flaeche); stroke-width: 2; }
.kurve .end-text { fill: var(--text); font-size: 14px; font-family: var(--serif); font-weight: 500; }
.kurve .hilfslinie { stroke: var(--text-leise); stroke-width: 1; stroke-dasharray: 3 3; }
.legende-zeile { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 0.8125rem; color: var(--text-leise); margin: 0; }
.legende-zeile i { display: inline-block; width: 14px; height: 0; vertical-align: middle; margin-right: 5px; border-top: 2.5px solid var(--text); }
.legende-zeile i.ziel { border-top: 2px dashed var(--akzent); }
.legende-zeile i.freigabe { width: 0; height: 12px; border-top: 0; border-left: 2px dotted var(--warnung); }
.legende-zeile i.band { height: 10px; border: 0; background: var(--akzent-hell); }
.legende-zeile i.besonders { height: 8px; border: 0; border-radius: 4px; background: var(--text-leise); }

/* Zeitleiste der besonderen Tage unter der Gewichtskurve und im PDF (0.33.0): eine ruhige Farbe, Notfall in Rot. */
.zeitleiste { width: 100%; height: auto; display: block; overflow: visible; touch-action: pan-y; margin-top: 4px; }
.zeitleiste .zl-balken { stroke: var(--text-leise); stroke-width: 8; stroke-linecap: round; }
.zeitleiste .zl-punkt { fill: var(--text-leise); stroke: var(--flaeche); stroke-width: 1.5; } /* heller Rand: sichtbar auf einem Balken */
.zeitleiste .zl-balken.notfall { stroke: var(--gefahr); }
.zeitleiste .zl-punkt.notfall { fill: var(--gefahr); }
/* Besondere Tage im PDF (0.35.0): dünne Linien mit Nummernkreis unter der Kurve, Liste mit denselben Nummern darunter. */
.bt-leiste { width: 100%; height: auto; display: block; overflow: visible; margin-top: 2px; }
.bt-leiste .bt-linie { stroke: var(--text-leise); stroke-width: 2; }
.bt-leiste .bt-ende, .bt-leiste .bt-pfeil { stroke: var(--text-leise); stroke-width: 1.5; fill: none; stroke-linejoin: round; stroke-linecap: round; }
.bt-leiste .bt-linie.notfall, .bt-leiste .bt-ende.notfall, .bt-leiste .bt-pfeil.notfall { stroke: var(--gefahr); }
.bt-leiste .bt-kreis { fill: var(--flaeche); stroke: var(--text); stroke-width: 1; }
.bt-leiste .bt-kreis.notfall { fill: var(--gefahr); stroke: var(--gefahr); }
.bt-leiste .bt-nr { fill: var(--text); font-family: var(--sans); font-size: 7.5px; font-weight: 700; text-anchor: middle; }
.bt-leiste .bt-nr.notfall { fill: #fff; }
.diagramm .achsen-strich { stroke: var(--text-leise); stroke-width: 1; }
.bericht-besonders { margin-bottom: 12px; }
.bericht-besonders h3 { margin: 4px 0 2px; font-family: var(--sans); font-size: 0.8125rem; font-weight: 700; }
.bericht-besonders h3 small { margin-left: 6px; font-size: 0.75rem; font-weight: 400; color: var(--text-leise); }
.bericht .bt-liste { width: auto; margin-top: 2px; font-size: 0.8125rem; }
.bericht .bt-liste td { border-bottom: 0; padding: 1px 12px 1px 0; vertical-align: baseline; }
.bericht .bt-liste td:first-child:has(.bt-nr-kreis) { padding-right: 6px; }
.bericht .bt-liste td:nth-last-child(3) { white-space: nowrap; } /* Zeitraum */
.bericht .bt-liste tr.notfall td { color: var(--gefahr); font-weight: 700; }
.bt-nr-kreis {
  display: inline-grid; place-items: center; width: 1.5em; height: 1.5em; border-radius: 50%;
  border: 1px solid var(--text); font-size: 0.6875rem; font-weight: 700; line-height: 1;
}
.bt-nr-kreis.notfall { background: var(--gefahr); border-color: var(--gefahr); color: #fff; }
/* Tempo pro Woche (0.40.0): Punkte über der Zeit auf Millimeterpapier, Zeitachse wie die Gewichtskurve. */
.tempo-diagramm { width: 100%; height: auto; display: block; overflow: visible; }
.tempo-diagramm .gitter { stroke: var(--rand-stark); stroke-width: 0.6; }
.tempo-diagramm .achse { fill: var(--text-leise); font-size: 11px; font-family: var(--sans); font-variant-numeric: tabular-nums; }
.tempo-diagramm .achsen-strich { stroke: var(--text-leise); stroke-width: 1; }
.tempo-null { stroke: var(--text-leise); stroke-width: 1.2; }
.tempo-band { fill: var(--akzent-hell); opacity: 0.7; }
:root[data-theme="dunkel"] .tempo-band { opacity: 1; }
.tempo-band-text { fill: var(--akzent); font-size: 10.5px; font-family: var(--sans); }
.tempo-verbindung { fill: none; stroke: var(--text-leise); stroke-width: 1; opacity: 0.6; }
.tempo-p { stroke: var(--flaeche); stroke-width: 2; fill: var(--text-leise); }
.tempo-p.gut { fill: var(--gut); }
.tempo-p.langsam { fill: var(--warnung); }
.tempo-p.zu-schnell { fill: var(--gefahr); }
.tempo-durch { stroke: var(--text); stroke-width: 1.2; stroke-dasharray: 4 3; }
.tempo-durch-text { fill: var(--text); font-size: 11px; font-family: var(--sans); }
.tempo-end-text { fill: var(--text); font-size: 12px; font-family: var(--serif); font-weight: 600; }
.tempo-end-label { fill: var(--text-leise); font-size: 10px; font-family: var(--sans); }
.tempo-pfeil { fill: var(--text-leise); font-size: 9px; font-family: var(--sans); } /* Punkt außerhalb der Achse */
.infoblase {
  position: absolute; pointer-events: none; background: var(--text); color: var(--hintergrund);
  font-size: 0.8125rem; padding: 6px 9px; border-radius: var(--rund-klein); white-space: nowrap;
  transform: translate(-50%, -130%); z-index: 2;
}
.infoblase[hidden] { display: none; }
/* Text eines besonderen Tags mit Notiz: darf umbrechen, damit er bei 375 px auf den Bildschirm passt. */
.infoblase.lang { white-space: normal; width: max-content; max-width: min(260px, 80vw); }
.woche { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rand); font-size: 0.875rem; }
.woche:last-child { border: 0; }
.woche .tag { width: 46px; text-align: center; font-size: 0.8125rem; color: var(--text-leise); line-height: 1.2; flex: none; }
.woche .tag b { display: block; font-family: var(--serif); font-weight: 500; font-size: 1.05rem; color: var(--text); }
.tag-klapp { border-bottom: 1px solid var(--rand); }
.tag-klapp:last-child { border: 0; }
.tag-klapp > .aufklapp-kopf { padding: 8px 0; font-size: 0.875rem; }
.tag-klapp > .aufklapp-kopf .pfeil { width: 24px; height: 24px; margin-left: 0; }
.tag-klapp .tagname { width: 78px; flex: none; }
.tag-klapp .tagname small { display: block; color: var(--text-leise); font-size: 0.8125rem; }
.tag-klapp .kcal { width: 66px; text-align: right; font-family: var(--serif); font-variant-numeric: tabular-nums; flex: none; }
.tag-klapp .zeile { padding: 7px 0 7px 8px; }
.tag-klapp .zeile .icon { width: 30px; height: 30px; }
.tag-klapp .zeile .icon .ico { width: 1.05rem; height: 1.05rem; }

/* Diagramme im PDF-Bericht */
.diagramm { width: 100%; height: auto; display: block; margin-top: 0.5rem; touch-action: pan-y; }
.diagramm .gitter { stroke: var(--rand); stroke-width: 1; }
.diagramm .achse { fill: var(--text-leise); font-size: 12px; font-variant-numeric: tabular-nums; }
.diagramm .beschriftung { fill: var(--text-leise); font-size: 11.5px; }
.diagramm .beschriftung.stark { fill: var(--text); font-weight: 700; }
.diagramm .band { fill: var(--gut); opacity: 0.12; }
.diagramm .band-text { fill: var(--gut); font-size: 11px; }
.diagramm .ziel { stroke: var(--text-leise); stroke-width: 1; }
.diagramm .linie { fill: none; stroke: var(--reihe-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.diagramm .endpunkt { fill: var(--reihe-1); stroke: var(--flaeche); stroke-width: 2; }
.diagramm .marker { fill: var(--reihe-1); stroke: var(--flaeche); stroke-width: 2; opacity: 0; }
.diagramm .freigabe-linie { fill: none; stroke: var(--text); stroke-width: 1.5; }
/* kcal-Diagramm im PDF (seit 0.68.0): Punkte je Woche, Band ±10 %, Leckerli-Spur */
.diagramm .kcal-band { fill: var(--akzent-hell); opacity: 0.55; }
.diagramm .kcal-linie { fill: none; stroke: var(--akzent); stroke-width: 1.6; stroke-linejoin: round; }
.diagramm .kcal-punkt { fill: var(--akzent); stroke: var(--flaeche); stroke-width: 1; }
.diagramm .kcal-punkt.raus { fill: var(--warnung); stroke: var(--text); stroke-width: 1.2; }
.diagramm .kcal-wert { fill: var(--text); font-size: 9px; font-weight: 700; }
.diagramm .kcal-hinweis { fill: var(--text-leise); font-size: 9px; }
.diagramm .kcal-leck { fill: var(--reihe-2); opacity: 0.75; }
.diagramm .kcal-leck.raus { opacity: 1; }
.diagramm .kcal-grenze { stroke: var(--text); stroke-width: 0.8; stroke-dasharray: 3 2; }
.diagramm .kcal-spur-grund { stroke: var(--rand); stroke-width: 1; }
.legende { list-style: none; display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0.5rem 0 0; padding: 0; font-size: 0.8125rem; color: var(--text-leise); }
.legende li { display: flex; align-items: center; gap: 0.375rem; }
.schluessel { width: 10px; height: 10px; border-radius: 2px; }
.schluessel.kcal-punkt-s { width: 9px; height: 9px; border-radius: 50%; background: var(--akzent); }
.schluessel.kcal-band-s { background: var(--akzent-hell); }
.schluessel.kcal-leck-s { width: 6px; background: var(--reihe-2); opacity: 0.75; }
.schluessel.strich { width: 14px; height: 0; border-top: 1.5px solid var(--text); border-radius: 0; }

/* ---------- Blätter von unten (alle <dialog>) ---------- */
dialog {
  width: 100%; max-width: 520px; max-height: 92dvh; margin: auto auto 0; overflow-y: auto;
  border: none; border-radius: 20px 20px 0 0; padding: 10px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--flaeche); color: var(--text); transition: transform 0.2s ease-out;
}
dialog[open] { animation: blatt-rein 0.35s cubic-bezier(0.2, 0.9, 0.25, 1); }
@keyframes blatt-rein { from { transform: translateY(100%); } to { transform: none; } }
/* Griff zum Herunterziehen (von app.js eingefügt); die ganze Breite ist Zugfläche. */
.griff { touch-action: none; cursor: grab; margin: -10px -20px 0; padding: 12px 0 10px; }
.griff::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: var(--rand-stark); margin: 0 auto; }
dialog h2 { touch-action: none; }
dialog::backdrop { background: rgb(29 43 42 / 0.4); animation: einblenden 0.3s ease; }
@keyframes einblenden { from { opacity: 0; } to { opacity: 1; } }

/* ---------- Profilbild groß (0.89.0): Vollbild statt Blatt, Bild wächst per Skript von seiner Stelle ---------- */
dialog.profilbild-gross {
  position: fixed; inset: 0; width: 100%; max-width: none; height: 100%; max-height: none; margin: 0;
  padding: calc(64px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
  border-radius: 0; background: transparent; color: #fff; overflow: hidden;
}
dialog.profilbild-gross[open] { animation: none; }
.profilbild-gross[open] { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; }
.profilbild-gross::backdrop { background: rgb(16 22 21 / 0.9); }
.profilbild-gross .griff { display: none; }
.profilbild-inhalt { margin: 0; display: grid; gap: 14px; justify-items: center; width: 100%; }
#profilbild-bild {
  display: block; width: min(100%, 420px, 60dvh); aspect-ratio: 1; object-fit: cover;
  border-radius: var(--rund); box-shadow: 0 12px 40px rgb(0 0 0 / 0.35);
}
#profilbild-name { font-family: var(--serif); font-size: 1.5rem; font-weight: 500; line-height: 1.2; color: #fff; text-align: center; }
.profilbild-profil {
  min-height: 48px; padding: 12px 16px; border: 0; background: none; cursor: pointer;
  font: inherit; font-size: 0.9375rem; color: rgb(255 255 255 / 0.85);
  text-decoration: underline; text-underline-offset: 3px;
}
.profilbild-zu {
  position: absolute; top: calc(8px + env(safe-area-inset-top)); right: 8px; width: 48px; height: 48px;
  border: 0; border-radius: 21%; background: rgb(255 255 255 / 0.12); color: #fff;
  display: grid; place-items: center; cursor: pointer;
}
.profilbild-zu .ico { width: 22px; height: 22px; }
.profilbild-profil:focus-visible, .profilbild-zu:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

dialog form, .willkommen form { display: grid; gap: 14px; }
dialog h2 { margin: 0; font-size: 1.3125rem; }
/* Zwischenüberschriften im Freigabe-Fenster (0.42.5): Plan oben, Befund mit Linie darüber abgesetzt. */
.form-abschnitt { margin: 4px 0 -6px; font-size: 1.0625rem; }
.form-abschnitt small { font-family: var(--sans); font-size: 0.8125rem; font-weight: 400; color: var(--text-leise); }
.form-abschnitt.befund { margin-top: 6px; padding-top: 16px; border-top: 1px solid var(--rand); }
dialog label, .willkommen label, .feld { display: grid; gap: 4px; font-weight: 400; font-size: 0.875rem; color: var(--text-leise); }
dialog label > input, .willkommen label > input, .feld > div { color: var(--text); font-size: 1rem; }
dialog input:not([type="radio"]):not([type="hidden"]), .willkommen input:not([type="hidden"]):not([type="file"]) {
  min-height: 48px; padding: 0 12px; border: 1px solid var(--feldrand); border-radius: var(--rund-klein);
  background: var(--hintergrund); font-weight: 400; font-size: 1.0625rem; width: 100%; color: var(--text);
}
dialog input:focus-visible, .willkommen input:focus-visible { outline: 3px solid var(--fokus); outline-offset: 1px; border-color: var(--akzent); }
/* Häkchen-Zeile im Fenster „Besonderer Tag“: ganze Zeile antippbar, mindestens 48 px hoch. */
dialog .haken-zeile { display: flex; align-items: center; gap: 12px; min-height: 48px; color: var(--text); font-size: 1rem; cursor: pointer; }
dialog .haken-zeile input[type="checkbox"] {
  width: 24px; height: 24px; min-height: 0; padding: 0; margin: 0; flex: none; accent-color: var(--akzent);
}
#besonders-bis-feld[hidden] { display: none; }
/* 0.85.0: Wiegetag im Profil nur beim Anlegen eines Tiers; .feld setzt display: grid und würde hidden überstimmen. */

/* Gewicht eintragen: große Zahl mit ±10 g */
.waage { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stufe {
  width: 56px; height: 56px; border-radius: 21%; border: 1px solid var(--rand-stark); background: var(--hintergrund); /* eckig wie die Tagespfeile (0.74.2) */
  color: var(--text); font-weight: 700; cursor: pointer; flex: none; padding: 0;
  font-variant-numeric: tabular-nums; transition: transform 0.1s;
  /* Große Handy-Schrift: „−10 g“ bleibt einzeilig im Kreis, die große Zahl daneben behält ihren Platz (0.41.0). */
  font-size: min(0.9375rem, 18px); white-space: nowrap;
}
.stufe:active { transform: scale(0.92); }
.waage-anzeige { flex: 1; min-width: 0; display: flex; align-items: baseline; justify-content: center; gap: 4px; }
dialog .waage-anzeige input.waage-zahl {
  border: 0; border-bottom: 2px solid var(--rand-stark); border-radius: 0; background: transparent; padding: 0;
  width: 100%; max-width: 6.5ch; min-height: 0; text-align: center; font-size: 3.5rem; font-weight: 500; line-height: 1.1;
  font-family: var(--serif);
}
dialog .waage-anzeige input.waage-zahl::placeholder { color: var(--text-leise); opacity: 0.55; }
dialog .waage-anzeige input.waage-zahl:focus-visible { outline: none; border-bottom-color: var(--akzent); }
.waage-anzeige .einheit { font-size: 1.25rem; color: var(--text-leise); }
.waage-hilfe { margin: -6px 0 0; text-align: center; font-size: 0.8125rem; color: var(--text-leise); }
.rueckmeldung {
  display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: center; margin: 0;
  background: var(--hintergrund); border-radius: var(--rund-klein); padding: 12px 14px; font-size: 0.9375rem;
  border-left: 4px solid transparent;
}
.rueckmeldung[hidden] { display: none; }
.rueckmeldung b { font-family: var(--serif); font-weight: 600; font-variant-numeric: tabular-nums; }
.rueckmeldung .leise { display: block; font-size: 0.875rem; margin-top: 2px; }
.rueckmeldung .zeichen {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--flaeche-2); color: var(--text);
  font-weight: 700; font-size: 0.875rem;
}
.rueckmeldung .zeichen .ico { width: 18px; height: 18px; stroke-width: 2.2; }
.rueckmeldung.gut .zeichen { background: var(--akzent-hell); color: var(--akzent-stark); }
.rueckmeldung.langsam, .rueckmeldung.zunahme { background: var(--warnung-hell); border-left-color: var(--warnung); }
.rueckmeldung.zu-schnell { background: var(--gefahr-hell); border-left-color: var(--gefahr); }

/* Strichcode scannen */
#dialog-scanner h2:focus { outline: none; }
.scanner-bild { position: relative; aspect-ratio: 4 / 3; border-radius: var(--rund); overflow: hidden; background: #000; }
.scanner-bild video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-rahmen {
  position: absolute; inset: 30% 10%; border: 3px solid #fff; border-radius: 8px;
  box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.35);
}
.scanner-treffer { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--rand-stark); border-radius: var(--rund); }
.scanner-treffer h3 { margin: 0; font-size: 1.0625rem; }
.scanner-treffer p { margin: 0; }

/* Menge mit − / + */
.gramm { display: flex; align-items: center; gap: 10px; }
.gramm button {
  width: 48px; height: 48px; border-radius: 21%; border: 1px solid var(--rand-stark); background: var(--hintergrund); /* eckig wie die Tagespfeile (0.74.2) */
  color: var(--text); cursor: pointer; flex: none; display: grid; place-items: center; padding: 0; transition: transform 0.1s;
}
.gramm button:active { transform: scale(0.92); }
dialog .gramm input { text-align: center; font-family: var(--serif); font-size: 1.75rem; font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Auf dem Arm gewogen (Gewicht-Dialog) ---------- */
.arm { border: 1px solid var(--rand-stark); border-radius: var(--rund-klein); }
.arm > summary {
  min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 12px;
  cursor: pointer; list-style: none; font-weight: 700; color: var(--text);
}
.arm > summary::-webkit-details-marker { display: none; }
.arm > summary:focus-visible { outline: 3px solid var(--fokus); outline-offset: 1px; border-radius: var(--rund-klein); }
.arm > summary .pfeil { margin-left: auto; color: var(--text-leise); transition: transform 0.25s; }
.arm > summary .pfeil .ico { width: 1.125rem; height: 1.125rem; }
.arm[open] > summary .pfeil { transform: rotate(180deg); }
.arm-inhalt { display: grid; gap: 10px; padding: 0 12px 12px; }
.arm-warnung { margin: 0; padding: 10px 12px; background: var(--warnung-hell); border-left: 4px solid var(--warnung); border-radius: var(--rund-klein); color: var(--text); }
.arm-felder { display: grid; grid-template-columns: repeat(auto-fit, minmax(8.5rem, 1fr)); gap: 10px; }
.arm-ergebnis { margin: 0; color: var(--text); font-weight: 700; }

/* ---------- Auswahlmenü (js/auswahl.js) ---------- */
.auswahl { position: relative; font-weight: 400; }
.auswahl-knopf, .auswahl-fest {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; min-height: 48px;
  border-radius: var(--rund-klein); border: 1px solid var(--feldrand); background: var(--hintergrund); color: var(--text);
  font-size: 0.9375rem; text-align: left; font-weight: 400;
}
.auswahl-fest { border-color: var(--rand-stark); }
.auswahl-knopf { cursor: pointer; transition: border-color 0.2s; }
.auswahl-knopf:focus-visible, .auswahl.offen > .auswahl-knopf { border-color: var(--akzent); outline: 3px solid var(--fokus); outline-offset: 1px; }
.auswahl-knopf .pfeil { margin-left: auto; color: var(--text-leise); transition: transform 0.25s; }
.auswahl.offen > .auswahl-knopf .pfeil { transform: rotate(180deg); }
.auswahl-knopf small, .auswahl-fest small, .auswahl-menue small { display: block; color: var(--text-leise); font-size: 0.8125rem; }
.auswahl-knopf .platzhalter { color: var(--text-leise); }
.auswahl-menue {
  list-style: none; margin: 0; position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 3;
  background: var(--flaeche); border-radius: var(--rund); box-shadow: var(--schatten-menue);
  padding: 6px; border: 1px solid var(--rand-stark); max-height: 50dvh; overflow-y: auto; color: var(--text);
  transform-origin: top center; transform: scale(0.97); opacity: 0; visibility: hidden;
  transition: transform 0.18s ease-out, opacity 0.15s, visibility 0.18s;
}
.auswahl.offen > .auswahl-menue { transform: none; opacity: 1; visibility: visible; }
/* Unten zu wenig Platz (js/auswahl.js): Menü klappt nach oben auf */
.auswahl.nach-oben > .auswahl-menue { top: auto; bottom: calc(100% + 6px); transform-origin: bottom center; }
.auswahl-menue li, .auswahl-menue button {
  display: flex; align-items: center; gap: 10px; padding: 11px 10px; border-radius: var(--rund-klein);
  font-size: 0.9375rem; cursor: pointer; width: 100%; border: 0; background: none; text-align: left; color: var(--text);
}
.auswahl-menue li:hover, .auswahl-menue li:focus, .auswahl-menue button:hover, .auswahl-menue button:focus-visible { background: var(--flaeche-2); outline: none; }
.auswahl-menue .haken { margin-left: auto; color: var(--akzent-stark); font-weight: 700; opacity: 0; }
.auswahl-menue [aria-selected="true"] .haken { opacity: 1; }
.auswahl-menue .extra { border-top: 1px solid var(--rand); border-radius: 0 0 var(--rund-klein) var(--rund-klein); color: var(--akzent-stark); font-weight: 700; }

.vorschau { margin: 0; text-align: center; font-family: var(--serif); font-size: 1.25rem; font-weight: 500; color: var(--text); min-height: 1.5em; }
.fehler { margin: 0; color: var(--gefahr); font-weight: 700; }
.fehler[hidden] { display: none; }

/* ---------- Fenster „Eigene Sorte“: kJ-Schutz und kcal-Rechner (0.32.0) ---------- */
/* Satz, roter Kasten und Rückmeldung hängen am kcal-Feld; leere Teile nehmen keinen Platz weg. */
.kcal-hilfe { display: grid; margin-top: -8px; }
.kcal-hilfe > :not(:first-child):not(:empty) { margin-top: 8px; }
.kcal-meldung { color: var(--text); }
dialog input[aria-invalid="true"]:not([type="hidden"]) { border-color: var(--gefahr); box-shadow: 0 0 0 1px var(--gefahr); }
.kcal-kasten, .rechner-ausgabe .warnung { display: grid; gap: 8px; }
.kcal-kasten p, .rechner-ausgabe .warnung p { margin: 0; }
.kcal-kasten .w-text, .rechner-ausgabe .warnung .w-text { font-weight: 400; }
.w-knoepfe { display: grid; gap: 8px; margin-top: 4px; }
/* Alle Antworten gleich gestaltet: keine wird hervorgehoben, damit niemand zur falschen Umrechnung gelenkt wird. */
.antwort {
  display: grid; gap: 2px; text-align: left; padding: 9px 12px; min-height: 52px; border-radius: var(--rund-klein);
  border: 1px solid var(--rand-stark); background: var(--flaeche); color: var(--text); font: inherit; font-weight: 700; cursor: pointer;
}
.antwort small { font-weight: 400; color: var(--text-leise); font-size: 0.875rem; }
.antwort:active { background: var(--flaeche-2); }
.antwort:focus-visible { outline: 3px solid var(--fokus); outline-offset: 1px; }
.plopp { animation: plopp 0.38s var(--feder) both; }
@keyframes plopp { from { opacity: 0; transform: translateY(-8px) scale(0.97); } to { opacity: 1; transform: none; } }
dialog input.frisch { animation: frisch 1.2s ease; }
@keyframes frisch { from { background: var(--gut-hell); } to { background: var(--hintergrund); } }

.rechner { border: 1px solid var(--rand-stark); border-radius: var(--rund); padding: 0 14px; background: var(--flaeche); }
.rechner > .aufklapp-kopf { padding: 12px 0; font-size: 0.9375rem; color: var(--text); }
.rechner > .aufklapp-kopf .zusammen { font-weight: 700; }
.rechner-inhalt { display: grid; gap: 10px; padding-bottom: 14px; }
.werte { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.wert-feld small { color: var(--text-leise); font-size: 0.75rem; }
.wert-eingabe { position: relative; display: block; }
dialog .wert-eingabe input:not([type="hidden"]) { padding-right: calc(12px + 1.4rem); text-align: right; font-variant-numeric: tabular-nums; }
.wert-eingabe .einheit {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-leise); font-size: 1rem; pointer-events: none;
}
.rechner-ausgabe > p { margin: 0; font-size: 0.875rem; color: var(--text-leise); }
.ergebnis { border-radius: var(--rund-klein); background: var(--flaeche-2); padding: 12px 14px; display: grid; gap: 8px; }
.ergebnis p { margin: 0; font-size: 0.875rem; color: var(--text-leise); }
.ergebnis .ergebnis-zahl {
  font-family: var(--serif); font-size: 1.75rem; font-weight: 500; line-height: 1.1; color: var(--text); font-variant-numeric: tabular-nums;
}
.ergebnis .ergebnis-zahl small { font-family: var(--sans); font-size: 0.9375rem; color: var(--text-leise); font-weight: 400; }
.ergebnis .annahme { color: var(--text); background: var(--warnung-hell); border-left: 3px solid var(--warnung); padding: 6px 10px; border-radius: 4px; }
.ergebnis .knopf-haupt { width: 100%; }
.ergebnis .uebernommen { color: var(--gut); font-weight: 700; }
.knoepfe { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; container-type: inline-size; }
/* Mit rotem Knopf (Profil „Entfernen“, Futter „Löschen“, „Freigabe löschen“): festes Raster, damit kein Knopf je die
   Zeile wechselt (Stefan 06.11., 0.61.2; vorher stand der rote Knopf schräg unter „Abbrechen | Speichern“, und davor brach
   „Speichern“ allein um, 0.41.0). Oben „Abbrechen | Speichern“ je zur Hälfte, darunter der rote Knopf über beide Spalten.
   Wird es eng (große Schrift), bricht der Text im Knopf um, der Knopf bleibt an seinem Platz. Drei nebeneinander passen
   auf dem Handy nicht (gemessen 368 px bei 335 px Platz). Die eigene Rückfrage hat ihre eigene Anordnung. */
.knoepfe:not(.rueckfrage-knoepfe):has(> .knopf-gefahr:not([hidden])) { display: grid; grid-template-columns: 1fr 1fr; }
.knoepfe:not(.rueckfrage-knoepfe):has(> .knopf-gefahr:not([hidden])) > button { min-width: 0; padding-inline: 12px; text-align: center; }
.knoepfe:not(.rueckfrage-knoepfe) > .knopf-gefahr { grid-column: 1 / -1; order: 2; margin-right: 0; }
/* Eigene Rückfrage (0.52.0): Absätze aus 

, Knöpfe teilen sich die Breite. Der rote Ja-Knopf bleibt neben
   „Abbrechen“ (die Umbruch-Regel oben gilt nur für Formulare mit Löschen-Knopf). Mit drittem Weg (Monatsfoto)
   stehen alle drei untereinander, der Ja-Knopf oben. */
.rueckfrage-text { white-space: pre-line; margin: 0; font-size: 1rem; color: var(--text); }
.rueckfrage-knoepfe > button { flex: 1 1 auto; }
.rueckfrage-knoepfe > [hidden] { display: none; }
.rueckfrage-knoepfe > .knopf-gefahr { margin-right: 0; order: 0; }
.rueckfrage-knoepfe::before { display: none; }
#dialog-rueckfrage:has(#rueckfrage-dritte:not([hidden])) .rueckfrage-knoepfe { flex-direction: column-reverse; }
.fuss { margin: 0; text-align: center; color: var(--text-leise); font-size: 0.8125rem; }

/* ---------- Bestätigung unten ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 10;
  transform: translate(-50%, 16px); width: max-content; max-width: calc(100% - 32px); /* sonst schrumpft sie wegen left: 50% auf die halbe Breite */
  background: var(--text); color: var(--hintergrund); padding: 10px 16px; border-radius: var(--rund-klein);
  font-size: 0.875rem; opacity: 0; pointer-events: none;
  transition: opacity 0.25s, transform 0.25s ease-out;
}
.toast.zeigen { opacity: 1; transform: translate(-50%, 0); }

/* Hinweisleiste im Demo-Modus */
.demo-leiste {
  margin: 8px auto 0; max-width: calc(560px - 32px); padding: 0.5rem 0.75rem; background: var(--warnung-hell); color: var(--text);
  font-size: 0.875rem; border-radius: var(--rund-klein); border-left: 4px solid var(--warnung);
}
@media (max-width: 592px) { .demo-leiste { margin-left: 16px; margin-right: 16px; } }
.demo-leiste a { color: inherit; font-weight: 700; margin-left: 0.25rem; }

/* ---------- Übersicht für den Tierarzt ---------- */
.karte label { display: grid; gap: 6px; font-weight: 400; }
.bericht-werkzeuge { display: grid; gap: 8px; }
/* Zeitraum (0.64.0) als schlichte Zeile wie „Fotos zeigen“, ohne Karte */
.bericht-werkzeuge > .bericht-zeitraum { padding: 0; min-height: 48px; gap: 12px; }
/* Schalter „Fotos zeigen“ (0.45.0): ganze Zeile antippbar, mindestens 48 px hoch; im Druck mit den Werkzeugen ausgeblendet. */
.bericht-schalter { display: flex; align-items: center; gap: 12px; min-height: 48px; color: var(--text); font-size: 1rem; font-weight: 600; cursor: pointer; }
.bericht-schalter input[type="checkbox"] { width: 24px; height: 24px; margin: 0; flex: none; accent-color: var(--akzent); }
.bericht-schalter small { display: block; color: var(--text-leise); font-size: 0.875rem; font-weight: 400; }
.bericht-schalter:has(input:focus-visible) { outline: 3px solid var(--fokus); outline-offset: 2px; border-radius: var(--rund-klein); }
.bericht {
  background: var(--flaeche); border: 1px solid var(--rand); border-radius: var(--rund);
  padding: 16px; font-size: 0.875rem; display: grid; gap: 16px;
  min-width: 0; overflow-x: auto; /* breite Tabellen scrollen innen, die Seite bleibt fest */
}
.bericht h1 { margin: 0 0 4px; font-size: 1.375rem; color: var(--text); }
.bericht h2 { margin: 0 0 6px; font-size: 1.0625rem; }
.bericht h3 { margin: 10px 0 0; font-size: 0.9375rem; }
.bericht p { margin: 0 0 6px; }
.bericht-vn-paar { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; max-width: min(12.5cm, calc(100vw - 64px)); } /* Bericht ist wegen breiter Tabellen oft breiter als der Schirm */
.bericht-vn-seite { margin: 0; display: grid; gap: 4px; break-inside: avoid; }
.bericht-vn-bild { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; border: 1px solid #ccc; }
.bericht-vn figcaption { font-size: 0.8125rem; }
.bericht-foto { float: right; width: 2cm; height: 2cm; border-radius: 21%; object-fit: cover; margin: 0 0 6px 12px; }
.bericht-klein { font-size: 0.75rem; color: var(--text-leise); }
.bericht-demo { font-weight: 700; color: var(--gefahr); }
.bericht table { width: 100%; border-collapse: collapse; margin-top: 6px; font-variant-numeric: tabular-nums; }
.bericht th, .bericht td { text-align: left; padding: 4px 6px 4px 0; border-bottom: 1px solid var(--rand); vertical-align: top; }
.bericht th { font-size: 0.75rem; color: var(--text-leise); font-weight: 700; }
.bericht-notizen .linie { border-bottom: 1px solid var(--text-leise); height: 28px; }
/* Wägungen als Monatsraster (ab 0.36.0, js/bericht.js waegungsRaster): eine Zeile je Monat, bis zu 5 Wägungen nebeneinander.
   Feste Spaltenbreiten, damit die Wägungen aller Monate untereinander stehen. Auf dem Handy breiter als der Schirm:
   scrollt innen wie die anderen breiten Tabellen (min-width), im Druck reicht die Seite (182 mm).
   min-width 30rem (0.36.1): passt am PC in den Kasten (494 px Platz), vorher 34rem war rechts abgeschnitten. */
.bericht table.wg-raster { table-layout: fixed; min-width: 30rem; }
.wg-raster th, .wg-raster td { border-bottom: 0; padding: 4px 6px 4px 0; }
.wg-raster thead th { border-bottom: 1px solid var(--rand); }
.wg-raster thead th:first-child { width: max(21mm, 5rem); } /* wächst mit großer Handy-Schrift mit (0.36.1), im Druck 21 mm */
.wg-raster thead th:last-child { width: 30mm; }
.wg-erkl { font-weight: 400; display: block; } /* am Bildschirm eigene Zeile (sonst Umbruch mitten im Satz), im Druck daneben */
.wg-raster tr.wg-letzte > *, .wg-raster .wg-monat, .wg-raster .wg-summe { border-bottom: 1px solid var(--rand); }
.wg-raster .wg-monat { font-size: 0.8125rem; font-weight: 700; color: var(--text); white-space: nowrap; }
.wg-tag, .wg-diff { display: block; font-size: 0.75rem; color: var(--text-leise); line-height: 1.25; }
.wg-kg { display: block; font-size: 0.9375rem; line-height: 1.3; }
.wg-marke { font-size: 0.625rem; font-weight: 700; margin-left: 1px; }
.wg-summe b { display: block; }
.wg-summe small { display: block; font-size: 0.75rem; color: var(--text-leise); }
.wg-notizen { margin: 4px 0 0; font-size: 0.75rem; display: flex; flex-wrap: wrap; gap: 2px 14px; }
.wg-notizen sup { font-weight: 700; }

/* Der Ausdruck ist immer hell, auch wenn die App auf „Dunkel“ steht. */
@media print {
  :root, :root[data-theme="dunkel"] {
    color-scheme: light;
    --hintergrund: #ffffff;
    --flaeche: #ffffff;
    --text: #000000;
    --text-leise: #444444;
    --rand: #cccccc;
    --gut: #2f6b5e;
    --gefahr: #b3261e;
    --reihe-1: #2f6b5e;
    --reihe-2: #a65a12;
    --akzent: #2f6b5e;
    --akzent-hell: #c9ddcf;
    --warnung: #a65a12;
    --schatten: none;
  }
  @page { size: A4; margin: 14mm; }
  body { background: #fff; padding: 0; }
  .kopf, .leiste, .demo-leiste, .toast, .bericht-werkzeuge, .ansicht:not([data-ansicht="bericht"]) { display: none !important; }
  .ansicht.rein, .ansicht.rein-rechts, .ansicht.rein-links, .willkommen-inhalt { animation: none; }
  main { max-width: none; padding: 0; }
  .bericht { border: none; padding: 0; font-size: 10pt; overflow: visible; }
  /* Blöcke statt Raster (0.36.7): In zwei ineinander steckenden Rastern legte Chrome ein auf die nächste Seite
     geschobenes Diagramm über den folgenden Abschnitt. */
  .ansicht, .bericht { display: block; }
  .bericht > * + * { margin-top: 16px; }
  .bericht .diagramm, .bericht .bericht-grafik { max-width: 150mm; }
  .bericht tr, .bericht .diagramm, .bericht .bericht-grafik, .bericht-notizen { break-inside: avoid; }
  .bericht h2 { break-after: avoid; }
  .bericht h3, .bericht .legende { break-after: avoid; }
  .wg-erkl { display: inline; margin-left: 6px; }
  .wg-raster thead th:first-child { width: 21mm; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Datenschutz, Impressum, Nutzungsbedingungen: eigene Seiten neben index.html. */
.rechtstext { display: grid; gap: 14px; padding-top: 8px; padding-bottom: 32px; }
.rechtstext .karte h3 { margin: 0; font-size: 1.0625rem; }
.rechtstext ul { margin: 0; padding-left: 20px; }
.rechtstext a:not(.knopf-zweit) { color: var(--akzent-stark); }
.platzhalter { background: var(--flaeche-2); border-radius: 3px; padding: 0 4px; font-style: italic; }

/* Wer am Handy „Bewegung reduzieren“ eingeschaltet hat, bekommt keine Animationen. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-delay: 0s !important; transition-duration: 0.001s !important; }
}
/* Diätfutter-Hinweis (0.93.0): Knopf im aufgeklappten Hinweis, Zeile unter der Freigabe-Tafel */
.hinweis [data-aktion="diaetfutter-besprochen"] { width: 100%; min-height: 48px; margin-top: 8px; }
.hinweis .aufklapp-inhalt > div > p.leise { margin: 6px 0 4px; font-size: 0.8125rem; }
.diaet-besprochen { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin: 10px 0 0; }
