/* FitOne — mobile-first, iOS-PWA. Bewusst dunkel (ein Design, kein Light-Mode):
   echtes Schwarz als Grund (OLED), Karten in iOS-Systemgrau, Akzente aus der
   iOS-Systempalette. Fonts: SF Pro über -apple-system. */

:root {
  color-scheme: dark;
  --bg: #000000;
  --card: #1c1c1e;
  --card-2: #2c2c2e;
  --text: #f5f5f7;
  --muted: #98989e;
  --line: #2d2d30;
  --accent: #0a84ff;
  --accent-soft: #12293f;
  --green: #30d158;
  --orange: #ff9f0a;
  --red: #ff453a;
  --purple: #bf5af2;
  --teal: #64d2ff;
  /* Makro-Farben: einmal hier, benutzt von Anzeige, Balken und Tagebuch
     (Schema wie in Lukas' Vorlage: KH gelb, Fett rot, Protein grün) */
  --macro-p: #30d158;
  --macro-c: #ffd60a;
  --macro-f: #ff7a70;
  /* Muskel-Erholung: 3 = heute trainiert (glüht), 0 = bereit */
  --muscle-base: #232326;
  --muscle-l0: #2c2c2e;
  --muscle-l1: #59372b;
  --muscle-l2: #a34a2b;
  --muscle-l3: #ff6b3d;
  --radius: 16px;
  --tabbar-h: calc(58px + env(safe-area-inset-bottom));
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
  /* Die Ansicht wandert beim Umblättern ein Drittel der Breite hinaus — ohne
     das hier ließe sich die Seite währenddessen seitlich wegziehen. `clip`
     statt `hidden`, weil `hidden` aus dem Seitenkörper einen Scroll-Behälter
     machen und das senkrechte Scrollen verändern würde. */
  overflow-x: clip;
}

.view {
  padding: calc(12px + env(safe-area-inset-top)) 14px calc(var(--tabbar-h) + 34px);
  max-width: 640px;
  margin: 0 auto;
}

h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.022em; margin: 6px 2px 16px; }
h2 { margin: 18px 2px 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; font-size: .8rem; }
.sektion-kopf { display: flex; align-items: center; gap: 7px; margin: 18px 2px 8px; }
.sektion-kopf h2 { margin: 0; }
.sektion-aktion { margin-left: auto; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 1rem; }

/* ---------- Tabbar ---------- */

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--tabbar-h);
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  z-index: 50;
}
.tab-side { flex: 1; display: flex; }
.tabbar button {
  flex: 1; border: 0; background: none; color: var(--muted);
  font-size: .58rem; font-weight: 600; font-family: inherit; letter-spacing: .01em;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  cursor: pointer;
  transition: color .18s;
  min-width: 0;
}
.tabbar button.active { color: var(--accent); }

/* Heute: großer runder Knopf, der mittig über die Leiste hinausragt */
.tabbar .tab-center {
  flex: 0 0 76px;
  gap: 2px;
  justify-content: flex-end;
  padding-bottom: 5px;
  color: var(--muted);
  overflow: visible;
}
.tab-center-kreis {
  display: flex; align-items: center; justify-content: center;
  width: 54px; height: 54px; border-radius: 50%;
  background: var(--accent);
  color: #fff;
  margin-top: -22px;                    /* ragt über die Leiste hinaus */
  box-shadow: 0 4px 14px rgba(10,132,255,.42), 0 0 0 5px var(--bg);
  transition: transform .18s, box-shadow .18s;
}
.tabbar .tab-center.active { color: var(--accent); }
.tabbar .tab-center.active .tab-center-kreis {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(10,132,255,.55), 0 0 0 5px var(--bg);
}
.tab-icon { line-height: 0; }
.tab-icon .icon { display: block; }
.icon { display: inline-flex; line-height: 0; vertical-align: -0.18em; }
.icon svg { display: block; }

/* ---------- Tabwechsel: View schiebt sich herein ---------- */

/* Das Blatt der Nachbarseite beim Umblättern mit dem Finger. Liegt unter der
   Tableiste (z-index 50), damit die stehen bleibt wie bei iOS. */
.blatt {
  position: fixed; inset: 0; z-index: 40;
  background: var(--bg);
  overflow: hidden;
  will-change: transform;
}
.blatt .view { height: 100%; overflow: hidden; }

/* Antippen in der Leiste blättert nicht mit dem Finger — dafür bleibt die
   Animation. Der Weg macht das Gefühl, nicht die Dauer allein: Vorher wanderte
   die Ansicht 26 px in .26s, das wirkte wie ein Zucken. Die Deckkraft ist bei
   55 % schon voll, damit das Ende eine reine Verschiebung ist. */
.view.slide-left  { animation: viewInLeft .36s cubic-bezier(.32,.72,.35,1); }
.view.slide-right { animation: viewInRight .36s cubic-bezier(.32,.72,.35,1); }
@keyframes viewInLeft {
  from { transform: translateX(32%);  opacity: .3; }
  55%  { opacity: 1; }
}
@keyframes viewInRight {
  from { transform: translateX(-32%); opacity: .3; }
  55%  { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .view.slide-left, .view.slide-right, .sheet, .sheet-backdrop, .toast,
  .rekord-banner { animation: none; }
}

/* ---------- Karten & Listen ---------- */

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.list { background: var(--card); border-radius: var(--radius); overflow: hidden; margin-bottom: 12px; }
.row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  border-bottom: .5px solid var(--line);
  min-height: 48px;
}
.row:last-child, .swipe:last-child .row { border-bottom: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { color: var(--muted); font-size: .8rem; margin-top: 1px; }
.row .value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.row.tappable { cursor: pointer; }

/* „Mehr" im Listenmuster: Symbol links, Status und Pfeil rechts */
.row-icon { color: var(--muted); line-height: 0; flex: 0 0 24px; }
.row .chev { color: var(--muted); opacity: .45; line-height: 0; }
.badge {
  font-size: .74rem; font-weight: 700; letter-spacing: .01em;
  padding: 3px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--card-2); color: var(--muted);
}
.badge.gut { background: var(--accent-soft); color: var(--accent); }
.badge.offen { background: #3a2a10; color: var(--orange); }

/* ---------- Dashboard anpassen ---------- */

.dash-an {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; flex: 0 0 22px; border-radius: 999px;
}
.dash-an.ein { background: var(--accent); color: #fff; }
.dash-an.aus { background: var(--card-2); color: transparent; }
.iconbtn[disabled] { opacity: .25; }

.dash-karten { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.dash-karte {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--bg);
}
/* Ausgeblendete Kacheln bleiben sichtbar, aber deutlich zurückgenommen */
.dash-karte.aus { opacity: .38; }
.dash-karte-kopf {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  background: var(--card);
  cursor: pointer;
  -webkit-user-select: none; user-select: none;
}
.dash-karte-kopf .title { font-weight: 500; font-size: .92rem; }
.dash-griff {
  color: var(--muted); line-height: 0; padding: 4px;
  cursor: grab;
  touch-action: none;          /* sonst scrollt der Browser statt zu ziehen */
}

/* Die Vorschau zeigt die echte Kachel, nur halb so groß und ohne Bedienung */
.dash-mini { overflow: hidden; pointer-events: none; padding: 8px 10px 0; }
.dash-mini-innen { transform: scale(.5); transform-origin: top left; width: 200%; }
.dash-mini-leer {
  color: var(--muted); font-size: .8rem;
  padding: 10px 2px 14px;
}

/* Karten in Sheets brauchen keinen eigenen Grund — der Sheet hat denselben */
.sheet .card { background: transparent; padding: 0; margin-bottom: 0; }
.row.tappable:active { background: var(--card-2); }

/* ---------- Buttons & Formulare ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 0; border-radius: 12px;
  background: var(--accent); color: #fff;
  font-weight: 600; font-size: 1rem; line-height: 1; font-family: inherit;
  padding: 13px 18px;
  cursor: pointer;
  width: 100%;
}
.btn:active { opacity: .8; }
.btn.secondary { background: var(--card-2); color: var(--text); }
.btn.danger { background: var(--red); }
.btn.small { width: auto; padding: 8px 12px; font-size: .85rem; border-radius: 10px; }
.btn.ghost { background: none; color: var(--accent); }
.btn:disabled { opacity: .45; }

.iconbtn {
  border: 0; background: var(--card-2); color: var(--accent);
  width: 34px; height: 34px; border-radius: 10px;
  font-size: 1.1rem; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: inherit;
}
/* Vorzeichen-Umschalter am Gewichtsfeld: „−" heißt Unterstützung (Minusgewicht) */
.iconbtn.minus { background: var(--accent); color: #fff; }

input[type="text"], input[type="number"], input[type="search"], input[type="date"],
input[type="time"], input[type="email"], input[type="password"], select, textarea {
  width: 100%;
  font-size: 1rem; font-family: inherit;
  color: var(--text);
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  appearance: none;
  -webkit-appearance: none;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Eingabe, die keine Zahl ergibt (zahlenfelderOk in ui.js) */
input.fehler, select.fehler, textarea.fehler { border-color: var(--red); }
.feld-fehler { color: var(--red); font-size: .78rem; margin-top: 5px; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; }

.seg { display: flex; background: var(--card-2); border-radius: 10px; padding: 3px; margin-bottom: 12px; }
.seg button {
  flex: 1; border: 0; background: none; color: var(--muted);
  font-weight: 600; font-size: .85rem; font-family: inherit;
  padding: 8px 4px; border-radius: 8px; cursor: pointer;
}
.seg button.active { background: #48484c; color: var(--text); }

/* Menge mit Plus-Minus (Portions-Sheet, mengenFeld in lebensmittel.js) */
.mengen-zeile { display: flex; align-items: center; gap: 8px; }
.mengen-zeile input { flex: 1; min-width: 0; text-align: center; font-weight: 600; }
.mengen-einheit {
  flex: 0 0 auto; min-width: 58px;
  color: var(--muted); font-size: .85rem; font-weight: 600;
}
.mengen-schritt {
  flex: 0 0 46px; height: 44px;
  border: 1px solid var(--line); background: var(--card-2); color: var(--text);
  border-radius: 10px; font-family: inherit; font-size: 1.3rem; font-weight: 600;
  cursor: pointer;
}
.mengen-schritt:active { background: #48484c; }

/* Zutat im Rezept-Formular (rezepte.js): Name links, Menge in Gramm rechts */
.zutat-menge { flex: 0 0 76px; text-align: center; font-weight: 600; padding: 9px 6px; }

/* ---------- Fortschritt ---------- */

.bar { height: 8px; background: var(--card-2); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .3s; }
.bar > i.over { background: var(--red); }

/* ---------- Sheets (Bottom-Dialoge) ---------- */

.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6);
  z-index: 100; display: flex; align-items: flex-end;
  animation: fadeIn .18s;
}
/* Oben verankert (Suche/Picker): die iOS-Tastatur verdeckt so nicht den Kopf */
.sheet-backdrop.oben { align-items: flex-start; }
.sheet-backdrop.oben .sheet {
  border-radius: 0 0 18px 18px;
  padding-top: calc(10px + env(safe-area-inset-top));
  max-height: 62vh; max-height: 62dvh;
  animation: slideDown .22s ease-out;
}
@keyframes slideDown { from { transform: translateY(-40%); } }
.sheet {
  background: var(--card);             /* hebt sich vom schwarzen Grund ab */
  width: 100%; max-width: 640px; margin: 0 auto;
  border-radius: 18px 18px 0 0;
  padding: 10px 16px calc(18px + env(safe-area-inset-bottom));
  max-height: 92vh; max-height: 92dvh;
  overflow-y: auto;
  animation: slideUp .22s ease-out;
}
.sheet-handle { width: 38px; height: 4px; border-radius: 2px; background: #48484c; margin: 2px auto 12px; }
/* Karten/Listen im Sheet eine Stufe heller, sonst verschmelzen sie mit dem Sheet */
.sheet .card, .sheet .list, .sheet .chat-posten { background: var(--card-2); }
.sheet .row { border-bottom-color: #3a3a3e; }
.sheet .row.tappable:active { background: #3a3a3e; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.sheet-head h3 { font-size: 1.15rem; }
@keyframes slideUp { from { transform: translateY(40%); } }
@keyframes fadeIn { from { opacity: 0; } }

/* ---------- Toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 14px);
  transform: translateX(-50%);
  background: #3a3a3c; color: #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  padding: 10px 18px; border-radius: 999px;
  font-size: .88rem; font-weight: 500;
  z-index: 200; white-space: nowrap;
  animation: fadeIn .2s;
}

/* „Gelöscht · Rückgängig": Knopf im Toast, durch eine Linie abgesetzt.
   Die Polsterung ist der Daumen — sie macht den Toast bewusst etwas höher. */
.toast-aktion {
  margin-left: 12px; padding: 6px 2px 6px 12px;
  border: 0; border-left: .5px solid rgba(255,255,255,.3);
  background: none; color: var(--accent);
  font: inherit; font-weight: 700;
}

/* ---------- Diverses ---------- */

.muted { color: var(--muted); }
.small { font-size: .82rem; }
.center { text-align: center; }
.big-num { font-size: 2.1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.spacer { height: 8px; }
/* Anmeldeseite (public/anmelden.html): am Handy volle Breite, am Desktop mittig */
.anmelde-box { max-width: 420px; margin: 0 auto; padding-top: 8vh; }
.empty { text-align: center; color: var(--muted); padding: 28px 16px; }
.empty .emoji { font-size: 2.2rem; display: block; margin-bottom: 8px; }

.chart-wrap { overflow-x: auto; }
.chart-wrap svg { display: block; width: 100%; height: auto; }

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 999px;
  font-size: .72rem; font-weight: 600;
  background: var(--accent-soft); color: var(--accent);
}
.pill.green { background: color-mix(in srgb, var(--green) 18%, transparent); color: var(--green); }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.swipe-del {
  border: 0; background: var(--red); color: #fff;
  border-radius: 8px; padding: 6px 10px; font-weight: 600; font-size: .78rem; font-family: inherit;
  cursor: pointer;
}

.dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  margin-right: 6px; vertical-align: baseline;
}

.macro-legend {
  display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin-top: 10px;
}

.timer-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 10px);
  max-width: 616px; margin: 0 auto;
  background: var(--accent); color: #fff;
  border-radius: 14px; padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  z-index: 60;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.timer-banner .time { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
/* Letzte fünf Sekunden: der Zähler wächst und der Banner wird orange */
.timer-banner.gleich { background: var(--orange); }
.timer-banner.gleich .time { font-size: 2rem; }
/* Ende: deutlicher Umschlag, damit es auch ohne Ton auffällt */
.timer-banner.vorbei { background: var(--green); }
.timer-banner button {
  border: 0; border-radius: 9px; background: rgba(255,255,255,.22); color: #fff;
  font-weight: 600; font-size: .85rem; font-family: inherit; padding: 8px 12px; cursor: pointer;
}

/* Neuer Rekord: sitzt über dem Pausen-Banner, das im selben Moment startet —
   ein Toast läge genau darauf. Grün wie „geschafft", geht nach ein paar
   Sekunden von selbst wieder weg (oder auf Tipp). */
.rekord-banner {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 68px);
  max-width: 616px; margin: 0 auto;
  background: var(--green); color: #06250f;
  border-radius: 14px; padding: 11px 16px;
  display: flex; align-items: center; gap: 11px;
  z-index: 61;
  box-shadow: 0 6px 20px rgba(0,0,0,.3);
  animation: fadeIn .2s;
}
.rekord-banner .rekord-text { flex: 1; min-width: 0; }
.rekord-banner .rekord-titel { font-weight: 700; }
.rekord-banner .rekord-sub { font-size: .78rem; opacity: .75; }

/* ---------- Bot / Chat ---------- */

.chat-list {
  display: flex; flex-direction: column; gap: 10px;
  padding-bottom: 8px;
}

.chat-msg {
  max-width: 86%;
  padding: 10px 13px;
  border-radius: var(--radius);
  line-height: 1.4;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.chat-msg.user {
  align-self: flex-end;
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.chat-msg.bot {
  align-self: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.chat-msg.pending { color: var(--muted); font-style: italic; }
.chat-msg.fehler { border-color: var(--red); }

.chat-photo {
  display: block; width: 100%; max-width: 260px;
  border-radius: 10px; margin-bottom: 6px;
}

/* Vorschlagskarte im Bot-Sprechblasen-Kontext */
.chat-card {
  margin-top: 10px;
  padding: 10px;
  background: var(--card-2);
  border-radius: 10px;
  display: flex; flex-direction: column; gap: 8px;
}
.chat-card .seg { margin: 0; }

.chat-posten {
  display: flex; flex-direction: column; gap: 5px;
  padding: 8px; background: var(--card); border-radius: 8px;
}
.chat-posten .row { align-items: center; gap: 6px; }

.chat-field {
  font: inherit; color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 9px; width: 100%;
}
.chat-field.narrow { width: 78px; }

.chat-summe { font-weight: 700; text-align: right; }

/* Wert aus dem Bot-Vorschlag, der nicht sein kann („914 kg") — sichtbar
   markiert, mit dem wahrscheinlich gemeinten Wert daneben */
.chat-wert {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px; background: var(--card); border-radius: 8px;
}
.chat-wert .row { align-items: center; gap: 6px; }
.chat-wert.warn {
  background: color-mix(in srgb, var(--orange) 15%, var(--card));
  border: 1px solid color-mix(in srgb, var(--orange) 40%, transparent);
}
.chat-warn-text { color: var(--orange); }
.chat-warn-text.ok { color: var(--green); }
.chat-fix {
  width: auto; align-self: flex-start; margin: 0;
  padding: 6px 12px; font-size: .85rem;
}

.chat-actions { display: flex; gap: 8px; }
.chat-actions .btn { flex: 1; margin: 0; }

.chat-bar {
  position: sticky;
  bottom: calc(var(--tabbar-h) + 4px);
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px;
  padding: 8px;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.chat-input {
  flex: 1; min-width: 0;
  font: inherit; font-size: 16px;      /* < 16px lässt iOS hineinzoomen */
  color: var(--text); background: none; border: 0; outline: none;
  padding: 6px 4px;
}
.chat-cam { font-size: 1.25rem; }
.chat-send { width: auto; margin: 0; padding: 8px 16px; border-radius: 999px; }

/* ---------- Barcode-Scanner ---------- */

.scan-video {
  width: 100%;
  max-height: 46vh;
  background: #000;
  border-radius: var(--radius);
  object-fit: cover;
  margin-bottom: 8px;
}

/* ---------- Tagebuch: Wischen und Ziehen ---------- */

.swipe { position: relative; overflow: hidden; }
.swipe-content {
  position: relative; z-index: 1;
  background: var(--card);
  touch-action: pan-y;                 /* senkrecht scrollt der Browser, waagerecht wir */
  will-change: transform;
  /* sonst poppt beim langen Drücken die iOS-Lupe samt Auswahl auf */
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
.swipe-actions {
  position: absolute; inset: 0 0 0 auto;
  width: 96px;
  display: flex; align-items: stretch; justify-content: stretch;
  padding: 6px;
}
.swipe-actions .swipe-del { width: 100%; border-radius: 10px; }

/* Ziehen: Vorlage bleibt blass stehen, die Kopie hängt am Finger */
.drag-source { opacity: .3; }
.drag-ghost {
  position: fixed; z-index: 300;
  background: var(--card);
  border: 1px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(0,0,0,.28);
  pointer-events: none;
  transform: scale(1.02);
}
body.dragging { user-select: none; -webkit-user-select: none; }
.list.drop-target {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
  background: var(--accent-soft);
}

/* Mahlzeiten-Icons in Listen */
.meal-icon { color: var(--muted); line-height: 0; }
.empty .emoji .icon { color: var(--muted); }

/* ---------- Training: Muskel-Karte, Legende, Fortschritt ---------- */

.muscle-card { padding: 10px 8px 12px; }
.muscle-legend {
  display: flex; justify-content: center; gap: 14px; flex-wrap: wrap;
  margin-top: 8px;
}
.muscle-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 5px; vertical-align: -1px;
  background: var(--card-2);
}
.muscle-dot[data-art="aufbau"] { background: linear-gradient(90deg, #4a2417, var(--muscle-l3)); }
.muscle-dot[data-art="voll"] { background: var(--green); box-shadow: 0 0 6px rgba(48,209,88,.45); }

.pill.red { background: color-mix(in srgb, var(--red) 18%, transparent); color: var(--red); }

/* Mahlzeiten-Kopf: Aufklapp-Pfeil */
.meal-chev { color: var(--muted); line-height: 0; transition: transform .18s; }
.meal-chev.open { transform: rotate(90deg); }

/* ---------- Dashboard im Vorlagen-Layout ---------- */

.dash-kopf {
  display: grid; grid-template-columns: 68px 1fr 68px;
  align-items: center; margin: 6px 0 10px;
}
.dash-titel { margin: 0; text-align: center; font-size: 1.35rem; }
.dash-kopf-aktionen { display: flex; gap: 8px; justify-content: flex-end; }

.woche {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px;
  margin: 0 0 14px;
}
.woche-tag {
  border: 0; background: none; font-family: inherit; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 2px 0;
}
.woche-zahl {
  width: 34px; height: 34px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .95rem; color: var(--accent);
}
.woche-name { font-size: .78rem; font-weight: 600; color: var(--text); }
.woche-tag.sel .woche-zahl { background: var(--accent); color: #fff; }
.woche-tag.sel .woche-name { color: var(--accent); }
.woche-tag.heute .woche-zahl { box-shadow: inset 0 0 0 1.5px var(--accent); }
.woche-tag.andermonat .woche-zahl { background: var(--card-2); color: var(--muted); }
.woche-tag.andermonat .woche-name { color: var(--muted); }

.hero {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 4px;
}
.hero-seite { text-align: center; display: flex; flex-direction: column; gap: 2px; }
.hero-seite .hero-zahl2 { margin-top: 14px; }
.hero-zahl, .hero-zahl2 { font-size: 1.35rem; font-weight: 800; font-variant-numeric: tabular-nums; }

.hero-makros {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px;
  margin-top: 4px; text-align: center;
}
.hero-makro { display: flex; flex-direction: column; gap: 6px; }
.hero-makro-label { font-weight: 700; font-size: .95rem; }

.naehr-grid {
  display: grid; grid-template-columns: auto auto; gap: 22px;
  align-items: center; justify-content: center; margin-top: 4px;
}
.naehr-legende { display: flex; flex-direction: column; gap: 10px; }
.naehr-eintrag { display: flex; flex-direction: column; gap: 1px; }

/* Ballaststoffe, Zucker, Salz unter dem Donut — je Zeile Balken und Ziel */
.naehr-extra {
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--line);
}
.naehr-extra-zeile { display: flex; flex-direction: column; gap: 5px; }
.naehr-extra-kopf { display: flex; align-items: baseline; gap: 2px; }
.naehr-extra-wert { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Bot-Leiste im Dashboard: kein Sticky, normale Karte im Fluss */
.chat-bar-dash { position: static; margin: 0 0 12px; }

/* ---------- Alkohol-Hinweis (Dashboard, ganz oben) ---------- */
.alko-banner {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: color-mix(in srgb, var(--red) 15%, var(--card));
  border: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
  border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.alko-banner:active { opacity: .85; }
.alko-banner .alko-icon { flex: 0 0 auto; line-height: 0; color: var(--red); }
.alko-banner .alko-icon .icon { animation: alkoPuls 2.6s ease-in-out infinite; }
.alko-titel { font-weight: 700; }
.alko-zeit { font-variant-numeric: tabular-nums; font-weight: 800; }
.alko-banner .bar { margin-top: 8px; }
.alko-banner .alko-chev { color: var(--muted); line-height: 0; flex: 0 0 auto; }
.alko-banner.fertig {
  background: color-mix(in srgb, var(--green) 11%, var(--card));
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
}
.alko-banner.fertig .alko-icon { color: var(--green); }
.alko-banner.fertig .alko-icon .icon { animation: none; }
.alko-banner.rueckblick { background: var(--card); border-color: var(--line); }
.alko-banner.rueckblick .alko-icon { color: var(--muted); }
.alko-banner.rueckblick .alko-icon .icon { animation: none; }
@keyframes alkoPuls { 50% { opacity: .45; } }
@media (prefers-reduced-motion: reduce) {
  .alko-banner .alko-icon .icon { animation: none; }
}

/* ---------- Fasten-Ticker (Dashboard) ---------- */
/* Gleiches Muster wie der Alkohol-Hinweis, nur ruhiger: Fasten violett,
   Essensfenster grün. */
.fasten-banner {
  display: flex; align-items: center; gap: 11px; width: 100%;
  background: color-mix(in srgb, var(--purple) 13%, var(--card));
  border: 1px solid color-mix(in srgb, var(--purple) 36%, transparent);
  border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px;
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.fasten-banner:active { opacity: .85; }
.fasten-banner .fasten-icon { flex: 0 0 auto; line-height: 0; color: var(--purple); }
.fasten-titel { font-weight: 700; }
.fasten-zeit { font-variant-numeric: tabular-nums; font-weight: 800; }
.fasten-banner .bar { margin-top: 8px; }
.fasten-banner .fasten-chev { color: var(--muted); line-height: 0; flex: 0 0 auto; }
.fasten-banner.essen {
  background: color-mix(in srgb, var(--green) 11%, var(--card));
  border-color: color-mix(in srgb, var(--green) 30%, transparent);
}
.fasten-banner.essen .fasten-icon { color: var(--green); }
/* Vergangener Tag: kein Countdown, nur das gemessene Fenster — also still */
.fasten-banner.rueckblick { background: var(--card); border-color: var(--line); }
.fasten-banner.rueckblick .fasten-icon { color: var(--muted); }

/* ---------- Lückenkalender (Mehr → Erfasste Tage) ---------- */
/* Ein Punkt je Tag: grün alles erfasst, orange teilweise, roter Ring gar
   nichts. Blass sind Tage, die niemand beurteilen kann (Zukunft, vor dem
   ersten Eintrag). */

.kal-kopf { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.kal-monat { flex: 1; text-align: center; font-weight: 700; }

.kal-raster { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.kal-wochentag {
  text-align: center; font-size: .72rem; font-weight: 600;
  color: var(--muted); padding-bottom: 4px;
}
.kal-tag {
  border: 0; background: none; font-family: inherit; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 6px 0; border-radius: 10px; cursor: pointer;
}
.kal-tag .kal-zahl { font-size: .8rem; font-variant-numeric: tabular-nums; }
.kal-tag.sel { background: var(--card-2); }
.kal-tag.heute .kal-zahl { color: var(--accent); font-weight: 700; }
.kal-tag[data-stand="zukunft"], .kal-tag[data-stand="vor"] { opacity: .35; cursor: default; }

.kal-punkt {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--card-2); flex: 0 0 auto;
}
.kal-punkt[data-stand="voll"] { background: var(--green); }
.kal-punkt[data-stand="teil"] { background: var(--orange); }
.kal-punkt[data-stand="leer"] {
  background: transparent; box-shadow: inset 0 0 0 1.5px var(--red);
}

.kal-zeile { min-height: 20px; margin-top: 12px; }
.kal-legende { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.kal-legende > * { display: inline-flex; align-items: center; gap: 6px; }

/* ---------- Ohne Netz: Hinweis auf den letzten bekannten Stand ---------- */
/* Liegt über allem und bleibt beim Tabwechsel stehen — er gehört zur App,
   nicht zu einer Ansicht. */
.stand-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 70;
  display: flex; align-items: center; gap: 8px;
  padding: calc(7px + env(safe-area-inset-top)) 14px 7px;
  background: color-mix(in srgb, var(--orange) 20%, var(--card));
  border: 0; border-bottom: 1px solid color-mix(in srgb, var(--orange) 40%, transparent);
  color: var(--text); font: inherit; font-size: .82rem; text-align: left;
  cursor: pointer;
}
.stand-banner:active { opacity: .85; }
.stand-banner .icon { color: var(--orange); flex: 0 0 auto; }
.stand-text { flex: 1; min-width: 0; font-weight: 600; }
.stand-neu { color: var(--accent); font-weight: 600; flex: 0 0 auto; }
/* Der Hinweis verdeckt sonst die Kopfzeile der Ansicht */
body.hat-stand .view { padding-top: calc(46px + env(safe-area-inset-top)); }

/* ---------- Kopfzeile in einer Karte ---------- */
/* Symbol, Titel, rechts ein Wert — das Muster der Karten auf „Heute". */
.karte-kopf { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.karte-kopf .karte-kopf-wert { margin-left: auto; }
.karte-kopf .chev { color: var(--muted); opacity: .45; line-height: 0; }

/* ---------- Wochen-Rückblick ---------- */
.woche-zahlen {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  text-align: center; margin-top: 12px;
}
.woche-zahl-gross { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; }
