/* Tokens. Dark ist der Standard (design.md Abschnitt 8), Light über data-theme="light".
   Roboto Slab und die Grundregeln bringt seit 17.09.2026 basis.css mit, geladen VOR
   dieser Datei. Quelle ist ~/ai-workspaces/_suite, nie hier bearbeiten. */

:root {
  --bg: #0f1512; --bg-elev: #161e19; --bg-elev2: #1d2721; --line: #2a362f;
  --fg: #e8ede9; --fg-muted: #9fb0a6; --fg-dim: #7f9086;
  /* Pink seit 17.09.2026. Vorher mint #6fd39b, dieselbe Farbe wie in Zettel und der
     Fitness-App: drei Apps in einer Farbe. Fitness behaelt sie, die beiden anderen
     bekommen eigene. --gut behaelt das Mint, das ist ein Zustand, keine Hausfarbe. */
  --accent: #fe9cba; --accent-fg: #300c19;
  --gut: #6fd39b; --neutral: #d9c46a; --achtung: #f08a7a;
  --schlaf: #8fb4ff; --training: #ffb86b; --essen: #ffd166; --gewicht: #b48cff; --blutdruck: #ff8fa3; --routine: #7fe0c8;
  --phase-deep: #2b5fc4; --phase-rem: #5d8ff2; --phase-light: #a9c9f7; --phase-awake: #f2b04a;
  --sleep-score: #b48cff; --sleep-hrv: #ef6f6c;
  --kcal-in: #f2b04a; --kcal-out2: #5d8ff2; --defizit: #6fd39b; --ueberschuss: #ef6f6c;
  --radius: 14px; --radius-s: 9px; --shadow: 0 6px 18px rgba(0,0,0,.35);
  --font: "Roboto Slab", Georgia, "Times New Roman", serif;
  color-scheme: dark;
  /* Die Namen, unter denen die Suite dieselben Farben kennt (basis.css). */
  --akzent: var(--accent); --akzent-hell: var(--accent); --grau: var(--fg-dim);
  --grund: var(--bg); --karte: var(--bg-elev); --text: var(--fg); --linie: var(--line);
}
:root[data-theme="light"] {
  --bg: #f4f6f4; --bg-elev: #ffffff; --bg-elev2: #eef2ef; --line: #d9e0dc;
  --fg: #16201a; --fg-muted: #4f5e56; --fg-dim: #6a776f;
  --accent: #de267a; --accent-fg: #ffffff;
  --gut: #2c8a57; --neutral: #9a7f10; --achtung: #c8422f;
  --schlaf: #3563c9; --training: #c26a12; --essen: #a67c00; --gewicht: #7248c9; --blutdruck: #c93d5b; --routine: #178a74;
  --phase-deep: #1d4fb0; --phase-rem: #4a7ee6; --phase-light: #86b0ec; --phase-awake: #d99321;
  --sleep-score: #7248c9; --sleep-hrv: #c0392b;
  --kcal-in: #d99321; --kcal-out2: #4a7ee6; --defizit: #2c8a57; --ueberschuss: #c8422f;
  --shadow: 0 6px 18px rgba(0,0,0,.10);
  color-scheme: light;
}

html, body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-text-size-adjust: 100%; }
/* Die Huelle ist genau so hoch wie der Bildschirm und scrollt selbst nicht, gescrollt
   wird in #app. Grund: auf dem iPhone beschneidet iOS die position:fixed-Ebene auf
   documentElement.clientHeight, und der ist um env(safe-area-inset-top) zu klein
   (gemessen 762 bei 812 Punkten Bildschirm). Ein fixed-Element kommt an den unteren
   Bildschirmrand also gar nicht heran, auch nicht mit height. Darum haengt hier nichts
   mehr an fixed: die Huelle ist ein normales Element, Overlays liegen absolut darin.
   --hoehe kommt aus huelleHoehe(), 100dvh ist nur der Wert bis zur ersten Messung. */
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
  font-variant-numeric: tabular-nums;
  position: relative;
  height: var(--hoehe, 100dvh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* basis.css macht aus #app einen Flex-Container. Hier haengen die Ansichten als
   gewoehnliche Bloecke drin und gerollt wird hier, also zurueck auf den Grundzustand. */
#app {
  flex: 1;
  min-height: 0;
  display: block;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* Der untere Safe-Area-Abstand sass frueher am body, dort wuerde er jetzt die Huelle
     verkuerzen statt den Inhalt freizuhalten. */
  padding-bottom: env(safe-area-inset-bottom);
}
* { box-sizing: border-box; }
/* Global statt einzeln je Klasse: jede Klasse, die selbst display setzt (.btn,
   .confirm-bar, .hr-zones, ...), hat sonst dieselbe Spezifität wie [hidden] und
   gewinnt je nach Regelreihenfolge - !important macht [hidden] immer verlässlich. */
[hidden] { display: none !important; }
h1, h2, h3 { font-weight: 600; margin: 0; }
/* padding und border-radius stehen mit, weil basis.css sie auf jedem button setzt.
   Hier gibt sie jede Klasse selbst an (.btn, .iconbtn, .seg button). */
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; border-radius: 0; cursor: pointer; }
button:disabled { opacity: .5; cursor: not-allowed; }
input, select, textarea { font: inherit; color: var(--fg); background: var(--bg-elev2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .55rem .7rem; width: 100%; }
a { color: var(--accent); }
.num { font-variant-numeric: tabular-nums; }

/* Layout */
.page { max-width: 880px; margin: 0 auto; padding: 1rem; }
.topbar { display: flex; align-items: center; gap: .75rem; padding: .5rem 0 1rem; }
.topbar h1 { font-size: 1.35rem; flex: 1; }
.iconbtn { width: 42px; height: 42px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bg-elev2); color: var(--fg-muted); }
.iconbtn:hover, .iconbtn:focus-visible { color: var(--fg); outline: 2px solid var(--accent); outline-offset: 2px; }
.iconbtn svg, .btn svg { width: 20px; height: 20px; }
.btn { display: inline-flex; align-items: center; gap: .5rem; padding: .6rem 1rem; border-radius: var(--radius-s); background: var(--bg-elev2); }
.btn.primary { background: var(--accent); color: var(--accent-fg); font-weight: 600; }
.btn.danger { color: var(--achtung); }
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }

/* Karten */
.card { background: var(--bg-elev); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); position: relative; }
.card + .card { margin-top: .9rem; }
.card[data-bereich] { border-left: 4px solid var(--card-accent, var(--line)); }
.card-head { display: flex; align-items: center; gap: .6rem; }
.card-head h2 { font-size: 1.1rem; flex: 1; display: flex; align-items: center; gap: .5rem; }
.card-head .bereich-icon { width: 22px; height: 22px; color: var(--card-accent); }
.ampel { width: 10px; height: 10px; border-radius: 50%; background: var(--fg-dim); }
.ampel.gut { background: var(--gut); } .ampel.neutral { background: var(--neutral); } .ampel.achtung { background: var(--achtung); }
.summary { margin: .5rem 0 .6rem; color: var(--fg); }
.kennzahlen { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.kennzahl .label { font-size: .78rem; color: var(--fg-dim); }
.kennzahl .value { font-size: 1.15rem; font-weight: 600; }
.meta { font-size: .78rem; color: var(--fg-dim); margin-top: .5rem; }
.fragen { margin-top: .5rem; padding: .5rem .7rem; border-radius: var(--radius-s); background: color-mix(in srgb, var(--neutral) 14%, transparent); color: var(--fg); font-size: .9rem; }
.fragen button { text-decoration: underline; padding: 0; }
.drag-handle { color: var(--fg-dim); cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.card.dragging { opacity: .6; }
.card.drop-before { box-shadow: 0 -3px 0 var(--accent); } .card.drop-after { box-shadow: 0 3px 0 var(--accent); }

/* Detailseite, Listen, Formulare, Modal */
.range { display: flex; gap: .4rem; margin: .8rem 0; }
.range button { padding: .35rem .7rem; border-radius: 999px; background: var(--bg-elev2); color: var(--fg-muted); }
.range button.active { background: var(--accent); color: var(--accent-fg); }
.chart-wrap { position: relative; height: 260px; }
.list { display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.row { display: grid; grid-template-columns: auto 1fr auto; gap: .6rem; align-items: center; padding: .5rem .6rem; border-radius: var(--radius-s); background: var(--bg-elev2); text-align: left; width: 100%; }
.row .sub { color: var(--fg-dim); font-size: .82rem; }
details summary { cursor: pointer; color: var(--fg-muted); }
.md p { margin: .5rem 0; } .md ul { padding-left: 1.2rem; } .md strong { color: var(--fg); }
.hint { display: flex; gap: .5rem; align-items: flex-start; font-size: .92rem; margin: .3rem 0; }
.hint .typ { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--fg-dim); min-width: 5.5rem; padding-top: .2rem; }
/* Absolut in der Huelle, nicht fixed: siehe Kommentar beim body. inset:0 genuegt, der
   Bezugsrahmen ist die Padding-Box des body und die schliesst dessen Safe-Area-Polster
   schon ein. Ein negativer oberer Wert hat den Hintergrund um genau diese 50px zu weit
   nach oben gezogen, die Modal-Kopfzeile lag dann unter der Statusleiste. */
.modal-backdrop { position: absolute; inset: 0; overscroll-behavior: contain; touch-action: none; background: var(--bg-elev); display: flex; align-items: flex-end; justify-content: center; z-index: 50; }
.modal { touch-action: pan-y; background: var(--bg-elev); width: 100%; max-width: 720px; height: 100%; left: 0; right: 0; max-height: 100%; border-radius: 0; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
.modal-head { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; border-bottom: 1px solid var(--line); }
.modal-body { padding: 1rem; overflow: auto; flex: 1; min-height: 0; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.modal-foot { padding: .8rem 1rem; border-top: 1px solid var(--line); display: flex; gap: .6rem; }
.toast { position: absolute; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--bg-elev2); border: 1px solid var(--line); padding: .6rem 1rem; border-radius: 999px; z-index: 60; }
.toast.error { border-color: var(--achtung); }
@media (min-width: 720px) {
  .modal-backdrop { align-items: center; background: rgba(0,0,0,.55); } .modal { border-radius: var(--radius); height: auto; max-height: 85vh; padding-top: 0; padding-bottom: 0; }
  .kennzahl .value { font-size: 1.3rem; }
}
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }

/* F2 */
.login-wrap { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 380px; }
.login-card h1 { text-align: center; margin-bottom: 1rem; }
.login-card > form + .btn { margin-top: .6rem; }
.btn.block { width: 100%; justify-content: center; }
.form-error { color: var(--achtung); font-size: .88rem; margin-top: .6rem; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .8rem; }
.field label { font-size: .82rem; color: var(--fg-muted); }
/* Beschriftung mit Knopf rechts daneben (Mikrofon am Kriterientext). */
.field label.mit-knopf { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.field .readonly { padding: .55rem .7rem; color: var(--fg-muted); }
.field textarea { resize: vertical; }
.form-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: .2rem; }
.einstellungen .card h3 { font-size: .95rem; color: var(--fg-muted); margin: 1.1rem 0 .5rem; }
.einstellungen .card h3:first-of-type { margin-top: .3rem; }
.inline-form { display: flex; gap: .5rem; margin-top: .6rem; }
.inline-form input { flex: 1; }
.row-flex { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border-radius: var(--radius-s); background: var(--bg-elev2); }
.row-flex .grow { flex: 1; min-width: 0; }
.code-box { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; background: var(--bg-elev2); padding: .6rem .7rem; border-radius: var(--radius-s); margin-top: .6rem; }
.job { padding: .6rem .7rem; border-radius: var(--radius-s); background: var(--bg-elev2); margin-top: .4rem; }
.job-head { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.job-head .grow { flex: 1; min-width: 8rem; }
.job-err { color: var(--achtung); font-size: .85rem; margin-top: .35rem; }
.job details { margin-top: .4rem; }
.job .logline { font-size: .82rem; color: var(--fg-muted); padding: .15rem 0; }
@media (min-width: 720px) {
  .settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
  .settings-form .field:has(textarea) { grid-column: 1 / -1; }
  .settings-form > .form-actions { grid-column: 1 / -1; }
}

/* F3 */
.card-head .iconbtn { width: 36px; height: 36px; }
.card-head .drag-handle { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 36px; }
.card-head .drag-handle svg { width: 18px; height: 18px; }
.card.dragging .drag-handle { cursor: grabbing; }
.fragen { display: flex; flex-direction: column; gap: .25rem; }
.fragen button { display: block; width: 100%; text-align: left; }
.meta button { text-decoration: underline; padding: 0; margin-left: .2rem; }
.kennzahl .value.text { font-size: 1rem; }

/* F4 */
.page.detail > div + div { margin-top: .9rem; }
.detail .card-head .ampel { width: 12px; height: 12px; }
.detail .topbar .bereich-icon { width: 22px; height: 22px; color: var(--card-accent); }
/* Kopfzeile der Detailseiten bleibt beim Scrollen oben stehen. Seit dem Umbau der Huelle
   ist #app der Scroller und beginnt bereits unter der Statusleiste: die frueher noetige
   Kompensation (negativer Rand ueber den Safe-Area-Abstand, derselbe Wert wieder als
   Polster) haette den Kopf um genau diese 50px aufgeblaeht. Polster jetzt wie bei
   .modal-head, damit Detailkopf und Chat-Kopf gleich hoch sind. */
.detail .topbar { position: sticky; top: 0; z-index: 20; background: var(--bg);
  margin: -1rem -1rem .6rem; padding: .8rem 1rem;
  border-bottom: 1px solid var(--line); }
.detail .chart-wrap + h2 { margin-top: .8rem; }
.hints { margin: .5rem 0; }
/* Eigener Chevron statt des nativen Markers: der wird im geflexten older-analysis-
   Summary (siehe unten) ohnehin unterdrückt, ein einheitliches Symbol für beide
   Ebenen ("Ältere Analysen" und die einzelnen älteren Einträge) ist konsistenter. */
.detail summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: .4rem; }
.detail summary::-webkit-details-marker { display: none; }
.detail summary .chevron { width: 16px; height: 16px; flex-shrink: 0; transition: transform .15s ease; transform: rotate(-90deg); }
.detail details[open] > summary .chevron { transform: rotate(0deg); }
.older-analysis { margin-top: .4rem; }
.older-analysis summary .sub { min-width: 8rem; }
.older-analysis .md { margin-top: .4rem; padding-left: 1.1rem; }
.note-form { margin-top: .8rem; }
.note-form .field:has(input[type="date"]) { max-width: 12rem; }
.note-row { grid-template-columns: auto 1fr; cursor: pointer; }
.note-row:hover { background: color-mix(in srgb, var(--bg-elev2) 70%, var(--accent) 10%); }
@media (min-width: 720px) {
  .detail .kennzahlen { grid-template-columns: repeat(5, 1fr); }
}

/* F5 */
.entry-row { cursor: pointer; }
.entry-row:hover { background: color-mix(in srgb, var(--bg-elev2) 70%, var(--accent) 10%); }
.row .main { min-width: 0; }
.bp-context { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.confirm-bar { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; padding: .6rem .7rem; border-radius: var(--radius-s); background: color-mix(in srgb, var(--achtung) 14%, transparent); flex-wrap: wrap; }
.confirm-bar span { flex: 1 1 100%; font-size: .9rem; }
.chip { display: inline-flex; align-items: center; padding: .12rem .55rem; border-radius: 999px; background: var(--bg-elev2); color: var(--fg-muted); font-size: .74rem; white-space: nowrap; }
.chip.outline { background: transparent; border: 1px solid var(--line); }
.wx-strip { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; margin: .8rem 0; }
.wx-tile { border: 2px solid var(--line); border-radius: var(--radius-s); padding: .5rem .3rem; text-align: center; background: var(--bg-elev2); }
.wx-tile.optimal { border-color: var(--gut); }
.wx-tile.borderline { border-color: var(--neutral); }
.wx-tile.bad { border-color: var(--achtung); }
.wx-day { font-weight: 600; font-size: .8rem; }
/* Ellipsis statt Ausblenden auf schmalen Screens: der Text bleibt über den (auf dem
   Tile ohnehin vorhandenen) title/aria-label erreichbar, verschwindet aber nicht
   komplett wie ein display:none es täte. */
.wx-sum { font-size: .68rem; color: var(--fg-dim); margin: .15rem 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wx-temp, .wx-rain, .wx-wind { font-size: .72rem; color: var(--fg-muted); }
.cal-list { margin-top: .6rem; }
.cal-row { display: flex; gap: .6rem; padding: .3rem 0; font-size: .86rem; }
.cal-row .sub { min-width: 6.5rem; flex-shrink: 0; }
.plan-text { white-space: pre-wrap; margin-top: .5rem; }
.activity-row { align-items: start; }
.activity-row .main > div:first-child { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.activity-row.expandable { cursor: pointer; }
.hr-zones { display: flex; flex-direction: column; gap: .2rem; margin-top: .5rem; }
.hr-zone { position: relative; height: 18px; border-radius: 4px; background: var(--bg-elev2); overflow: hidden; }
.hr-zone::before { content: ""; position: absolute; inset: 0; width: var(--w, 0%); background: var(--training); opacity: .55; }
.hr-zone span { position: relative; font-size: .7rem; padding-left: .4rem; line-height: 18px; }
@media (max-width: 480px) {
  .wx-strip { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .25rem; }
  .wx-tile { padding: .4rem .15rem; }
}

/* F6 */
.chat-thread { display: flex; flex-direction: column; gap: .7rem; }
.chat-msg { display: flex; flex-direction: column; max-width: 88%; }
.chat-msg.user { align-self: flex-end; align-items: flex-end; }
.chat-msg.claude { align-self: flex-start; align-items: flex-start; }
.chat-bubble { border-radius: var(--radius-s); padding: .55rem .75rem; }
.chat-bubble.user { background: var(--bg-elev2); }
.chat-bubble.claude { background: transparent; padding-left: 0; padding-right: 0; }
.chat-bubble.claude.pending { display: flex; align-items: center; gap: .5rem; color: var(--fg-muted); padding-left: 0; }
.chat-bubble.claude.pending svg { width: 18px; height: 18px; }
.chat-bubble.claude.error { color: var(--achtung); padding-left: 0; }
.chat-bubble .md { margin: 0; }
.chat-bubble .md > *:first-child { margin-top: 0; }
.chat-bubble .md > *:last-child { margin-bottom: 0; }
.chat-retry { margin-top: .4rem; }
.chat-retry:disabled { opacity: .5; }
.chat-ts { font-size: .7rem; color: var(--fg-dim); margin-top: .2rem; }
.chat-options { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .45rem; }
.chat-options .btn { border-radius: 999px; padding: .4rem .9rem; }
.version-line { text-align: center; margin-top: 1.5rem; }
.version-line button { text-decoration: underline; padding: 0; margin-left: .3rem; }
.chat-footwrap { display: flex; flex-direction: column; gap: .6rem; width: 100%; }
.chat-footwrap .confirm-bar { margin-top: 0; }
.chat-foot { display: flex; gap: .6rem; align-items: flex-end; width: 100%; }
.chat-foot textarea {
  flex: 1; resize: none; line-height: 1.35; max-height: calc(1.35em * 5 + 1.2rem); overflow-y: auto;
}
.chat-foot .iconbtn { flex-shrink: 0; }

/* R8 */
.chip-row { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .5rem; }
.routine-card.finished { opacity: .55; }
.routine-card.finished .card-head h2 { text-decoration: line-through; text-decoration-color: var(--fg-dim); }
.proposal-card { border-color: var(--routine); }
.diff-groups { display: flex; flex-direction: column; gap: .5rem; margin: .7rem 0; }
.diff-group h3 { font-size: .8rem; color: var(--fg-muted); margin: 0 0 .25rem; }
.diff-group .list { margin-top: 0; gap: .2rem; }
.chip-list { display: flex; flex-wrap: wrap; gap: .35rem; margin: .4rem 0; }
.chip.removable { display: inline-flex; align-items: center; gap: .3rem; padding-right: .3rem; }
.chip.removable button { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; color: inherit; }
.chip.removable svg { width: 13px; height: 13px; }
.goal-form { margin-top: .8rem; }
/* Kein umschließendes .card mehr um die Übungsliste (Task-R8-Review Punkt 7c): die
   Abschnitte (Vorschlag, Liste, "Neue Übung", Ziel/Einschränkungen, Entfernte Übungen)
   sind direkte Kinder von .routine-page, Abstand analog zu .page.detail > div + div. */
.routine-page > * + * { margin-top: .9rem; }

/* Bühne (laufende Übung) */
.routine-card.stage { border-left: 4px solid var(--routine); text-align: center; }
.stage-body { padding: 1.1rem 0 .6rem; transition: opacity .2s ease; }
.routine-card.stage.rest .stage-body { opacity: .6; }
.stage-label { font-size: 1.05rem; color: var(--fg-muted); }
.stage-value { font-size: 2.6rem; font-weight: 600; margin-top: .2rem; }
.stage.paused .stage-value { opacity: .6; }
.stage-progress { margin-top: .5rem; }
.stage-body.pulse { animation: routine-pulse .6s ease; }
@keyframes routine-pulse { 0% { opacity: .3; transform: scale(.97); } 100% { opacity: 1; transform: scale(1); } }
.stage-controls { display: flex; justify-content: center; gap: .9rem; margin-top: .8rem; }
.iconbtn.big { width: 58px; height: 58px; }
.iconbtn.big svg { width: 26px; height: 26px; }
.iconbtn.primary { background: var(--accent); color: var(--accent-fg); }
@media (prefers-reduced-motion: reduce) { .stage-body.pulse { animation: none; } }

/* Schlaf (Stufe 3): Chart und Nächte */
.chart-wrap.sleep { height: 300px; }
.nights { display: flex; flex-direction: column; margin-top: .4rem; }
.night { border-bottom: 1px solid var(--line); }
.night:last-child { border-bottom: 0; }
.night summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: .3rem .7rem; align-items: center; padding: .55rem .2rem; list-style: none; }
.night summary::-webkit-details-marker { display: none; }
.night-date { font-weight: 600; min-width: 6.2rem; }
.night-badges { display: inline-flex; gap: .6rem; }
.night-meta { color: var(--fg-muted); font-size: .86rem; }
.score { display: inline-block; min-width: 2.4rem; text-align: center; border-radius: 6px; padding: .05rem .4rem; font-weight: 700; font-size: .86rem; background: var(--bg-elev2); color: var(--fg-muted); }
.score.gut { background: color-mix(in srgb, var(--gut) 22%, transparent); color: var(--gut); }
.score.neutral { background: color-mix(in srgb, var(--neutral) 22%, transparent); color: var(--neutral); }
.score.achtung { background: color-mix(in srgb, var(--achtung) 22%, transparent); color: var(--achtung); }
.night-body { padding: .2rem .3rem .8rem; font-size: .9rem; display: flex; flex-direction: column; gap: .4rem; }
.night-body .meta { margin-top: 0; }
.phases { display: flex; flex-wrap: wrap; gap: .3rem .9rem; color: var(--fg-muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: .3rem; vertical-align: middle; }
.dot.deep { background: var(--phase-deep); } .dot.rem { background: var(--phase-rem); }
.dot.light { background: var(--phase-light); } .dot.awake { background: var(--phase-awake); }
.night-body .chip-row { margin-top: 0; }
.chip.tag-alkohol { background: color-mix(in srgb, var(--achtung) 22%, transparent); color: var(--achtung); }
.chip.tag-lifestyle { background: color-mix(in srgb, var(--neutral) 22%, transparent); color: var(--neutral); }
.chip.tag-training { background: color-mix(in srgb, var(--gut) 22%, transparent); color: var(--gut); }
.chip.tag-reise { background: color-mix(in srgb, var(--schlaf) 22%, transparent); color: var(--schlaf); }
.night-note { padding: .35rem .6rem; background: var(--bg-elev2); border-radius: var(--radius-s); border-left: 3px solid var(--line); font-size: .86rem; }
.report-btn { margin: .4rem 0 .2rem; }

/* Essen (Stufe 2): Bilanztabelle und Protokoll */
.chart-wrap.essen { height: 300px; }
.bilanz-wrap { overflow-x: auto; }
.bilanz { border-collapse: collapse; width: 100%; font-size: .9rem; }
.bilanz th, .bilanz td { padding: .35rem .3rem; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.bilanz th { color: var(--fg-dim); font-weight: 500; font-size: .78rem; }
.bilanz th:first-child, .bilanz td:first-child { text-align: left; }
.bilanz tr:last-child td { border-bottom: 0; }
.bilanz tr.incomplete td { color: var(--fg-dim); }
.bilanz td.pos { color: var(--gut); } .bilanz td.neg { color: var(--achtung); }
.protokoll { display: flex; flex-direction: column; }
.tag { border-bottom: 1px solid var(--line); }
.tag:last-child { border-bottom: 0; }
.tag summary { cursor: pointer; display: flex; align-items: center; gap: .6rem; padding: .55rem .2rem; list-style: none; }
.tag summary::-webkit-details-marker { display: none; }
.tag .tag-date { font-weight: 600; min-width: 6.2rem; }
.tag .tag-meta { color: var(--fg-muted); font-size: .86rem; flex: 1; }
.tag .list { margin: 0 0 .7rem; }
.food { grid-template-columns: 3.4rem 1fr auto; align-items: start; }
.food .kcal { white-space: nowrap; font-variant-numeric: tabular-nums; }
.food .reason { font-size: .82rem; color: var(--fg-dim); margin-top: .15rem; }
.food.flagged { box-shadow: inset 3px 0 0 var(--achtung); }
.food .chip.flag { margin-left: .4rem; background: color-mix(in srgb, var(--achtung) 22%, transparent); color: var(--achtung); font-size: .7rem; }

/* Angebote-App */
.suche-card { display: block; text-decoration: none; color: inherit; }
.suche-card.inaktiv { opacity: .6; }
.suche-card .warn { color: var(--achtung); display: inline-flex; }
.chip.neu { background: var(--accent); color: var(--accent-fg); }
.chip.fav { border-color: var(--gut); }
svg.inline { width: 1em; height: 1em; vertical-align: -.15em; }
.angebot-card { display: grid; grid-template-columns: 96px 1fr; gap: .75rem; text-decoration: none; color: inherit; }
.angebot-card .foto { width: 96px; height: 96px; border-radius: var(--radius-s); object-fit: cover; background: var(--bg-elev2); display: flex; align-items: center; justify-content: center; color: var(--fg-muted); }
.angebot-card .titel { font-weight: 600; margin-bottom: .2rem; }
.angebot-card .preis { font-variant-numeric: tabular-nums; font-weight: 600; }
.angebot-card.weg { opacity: .55; }
.badge { display: inline-block; font-size: .75rem; padding: .05rem .45rem; border-radius: 999px; border: 1px solid var(--line); margin-right: .3rem; }
.badge.passt { background: var(--gut); color: var(--accent-fg); border-color: transparent; }
.badge.vielleicht { background: var(--neutral); color: var(--accent-fg); border-color: transparent; }
.badge.nein { background: var(--bg-elev2); color: var(--fg-muted); }
.badge.neu { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.badge.geaendert { border-color: var(--achtung); color: var(--achtung); }
.badge.favorit { border-color: var(--gut); color: var(--gut); }
.filterbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin: .5rem 0 1rem; }
.filterbar select { max-width: 12rem; }
.galerie { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: .5rem; margin: .75rem 0; }
.galerie img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--radius-s); cursor: zoom-in; }
.galerie-gross { max-width: 100%; max-height: 80vh; display: block; margin: auto; }
.galerie-nav { display: flex; align-items: center; justify-content: space-between; gap: .6rem; width: 100%; }
.galerie-nav .galerie-zaehler { flex: 1; text-align: center; color: var(--fg-muted); }
.verlauf .row .sub { min-width: 7rem; }
.urteil { border-left: 3px solid var(--line); padding-left: .75rem; margin: .75rem 0; }
.aktionen { display: flex; gap: .5rem; flex-wrap: wrap; margin: 1rem 0; }
textarea.kriterien { min-height: 14rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85rem; }
@media (max-width: 480px) { .angebot-card { grid-template-columns: 80px 1fr; } .angebot-card .foto { width: 80px; height: 80px; } }

/* Review-Nacharbeit */
.topbar h1 { min-width: 0; overflow-wrap: anywhere; }
.angebot-card .titel, .urteil, .verlauf .row .main { overflow-wrap: anywhere; }
.beschreibung { white-space: pre-wrap; overflow-wrap: anywhere; }
a.btn { color: inherit; text-decoration: none; }
.feldhinweis { font-size: .78rem; color: var(--fg-dim); }
.field.schalter { flex-direction: row-reverse; flex-wrap: wrap; align-items: center; gap: .6rem; }
.field.schalter label { flex: 1; font-size: 1rem; color: var(--fg); }
.field.schalter input[type="checkbox"] { width: 1.15rem; height: 1.15rem; flex-shrink: 0; }
.field.schalter .feldhinweis { flex-basis: 100%; }
.urteil-kurz { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.filtergruppe { display: flex; align-items: center; gap: .4rem; }
.filtergruppe select { min-width: 0; }
.preis-gross { font-size: 1.4rem; }
.offline-hint { text-align: center; padding: .4rem 1rem; margin-top: 0; }

/* Wischgeste auf Angebotskarten (lib/swipe.js). Die Warnfläche liegt hinter der Karte und
   wird erst kräftig, wenn das Loslassen die Aktion wirklich auslöst. Die Karte braucht
   einen deckenden Hintergrund, sonst scheint die Fläche durch. */
.swipe-wrap { position: relative; overflow: hidden; border-radius: var(--radius); }
.swipe-wrap + .swipe-wrap { margin-top: .4rem; }
.swipe-flaeche {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end;
  gap: .5rem; padding-right: 1.1rem; font-weight: 600;
  background: var(--bg-elev2); color: var(--fg-muted);
  opacity: 0; transition: opacity .12s linear, background-color .12s linear, color .12s linear;
}
.swipe-flaeche.sichtbar { opacity: 1; }
.swipe-flaeche.scharf { background: var(--achtung); color: var(--bg); }
.swipe-flaeche svg { width: 20px; height: 20px; }
/* pan-y überlässt dem Browser das vertikale Scrollen, waagerecht bleibt für die Geste. */
/* user-select und user-drag aus: sonst markiert der Browser beim Wischen den Kartentext
   oder startet das native Ziehen des Links, beides bricht die Geste ab. */
.swipe-karte { touch-action: pan-y; will-change: transform; user-select: none; -webkit-user-select: none; -webkit-user-drag: none; -webkit-touch-callout: none; }
.swipe-karte img { -webkit-user-drag: none; user-select: none; pointer-events: none; }
.swipe-karte.federt { transition: transform .18s ease-out; }
.swipe-karte.faehrt-raus { transition: transform .2s ease-in, opacity .2s linear; transform: translateX(-100%); opacity: 0; }
.toast.mit-aktion { display: flex; align-items: center; gap: .9rem; }
.toast.mit-aktion button { background: none; border: none; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; padding: 0; }
@media (prefers-reduced-motion: reduce) {
  .swipe-karte.federt, .swipe-karte.faehrt-raus { transition: none; }
}
