/* FITCODER Portal – Farben und Schriften angelehnt an fitcoder-coaching.de */
:root {
  color-scheme: light;
  --bg: #F8EFEA;
  --surface: #FFF9F6;
  --sand: #F2E3DC;
  --ink: #3B1B35;
  --muted: #6E5068;
  --line: #EBD9D3;
  --axis: #D9C3BD;
  --plum: #3B1B35;
  --on-plum: #F8EFEA;
  --olive-soft: #DDE2C3;
  --good: #46591B;
  --danger: #A3312B;
  --danger-soft: #F9E1DE;
  --warn-soft: #F6E3B8;
  --warn-ink: #5C4300;
  --focus: #A63D82;
  /* Kopfleiste: in beiden Modi dunkel, passend zur Statusleiste des Handys (theme-color) */
  --bar: #3B1B35;
  --on-bar: #F8EFEA;
  /* Diagramm: geprüfte Farben (Kontrast, Farbsehschwächen) für helle Fläche */
  --series-avg: #A63D82;
  --series-daily: #5F8A1F;
  --shadow: 0 18px 40px -22px rgba(59, 27, 53, .35);
  --radius: 20px;
  --display: "Gloock", Georgia, "Times New Roman", serif;
  --body: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #1A1118;
    --surface: #241822;
    --sand: #2E2030;
    --ink: #F3E6E1;
    --muted: #C2A9B8;
    --line: #3A2A37;
    --axis: #4D3A49;
    --plum: #E3B9CF;
    --on-plum: #1A1118;
    --olive-soft: #3A3D27;
    --good: #B4C27A;
    --danger: #EF9A94;
    --danger-soft: #4A2523;
    --warn-soft: #4A3A12;
    --warn-ink: #F3D88A;
    --focus: #E3B9CF;
    --series-avg: #C9609F;
    --series-daily: #7FA03A;
    --shadow: 0 18px 40px -22px rgba(0, 0, 0, .6);
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1.2; margin: 0 0 .4em; text-wrap: balance; }
h1 { font-size: 1.7rem; }
h2 { font-size: 1.25rem; }
p { margin: 0 0 .8em; }
a { color: inherit; text-underline-offset: 3px; }
code { font-size: .9em; background: var(--sand); padding: .1em .35em; border-radius: 6px; }
small { font-weight: 400; color: var(--muted); }

.muted { color: var(--muted); }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* ---------- Rahmen ---------- */
.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 20px; padding-bottom: 32px; }
main.narrow { max-width: 480px; }
main.narrow-wide { max-width: 640px; }

.topbar { background: var(--bar); color: var(--on-bar); padding-top: env(safe-area-inset-top); }
.topbar :focus-visible { outline-color: var(--on-bar); }
/* Als App vom Startbildschirm geöffnet (iPhone): Die Seite reicht bis unter Uhrzeit und Akku-Anzeige, die dort immer hell
   sind. Der Streifen hält diesen Bereich dunkel, auch beim Scrollen und im dunklen Modus. Im Browser ist er 0 hoch. */
body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; z-index: 30; height: env(safe-area-inset-top); background: var(--bar); }
/* Wer das Portal schon als App geöffnet hat, braucht die Anleitung dazu nicht mehr */
@media (display-mode: standalone) { .install-hint { display: none; } }
.install-steps { margin: 0; padding: 0; list-style: none; display: grid; gap: 12px; }
.install-steps p { margin: 0; font-size: .9rem; }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { font-family: var(--display); font-size: 1.25rem; letter-spacing: .04em; text-decoration: none; }
.brand-sub { font-family: var(--body); font-size: .7rem; letter-spacing: .14em; text-transform: uppercase; margin-left: .6em; opacity: .75; }
.nav { display: flex; gap: 4px; margin-right: auto; margin-left: 12px; }
.nav a { white-space: nowrap; color: var(--on-bar); text-decoration: none; font-size: .9rem; font-weight: 600; padding: 8px 12px; border-radius: 999px; opacity: .8; }
.nav a:hover { opacity: 1; }
.nav a[aria-current="page"] { opacity: 1; background: color-mix(in srgb, var(--on-bar) 16%, transparent); }
.topbar-user { display: flex; align-items: center; gap: 8px; margin: 0; min-width: 0; }
.topbar-name { font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40vw; }
.topbar .btn-quiet { color: var(--on-bar); border-color: color-mix(in srgb, var(--on-bar) 35%, transparent); }
.topbar .btn-quiet:hover, .topbar .btn-quiet:active { background: color-mix(in srgb, var(--on-bar) 16%, transparent); }

.footer { display: flex; gap: 16px; justify-content: center; padding-top: 8px; padding-bottom: 24px; font-size: .85rem; color: var(--muted); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { margin-bottom: .15em; }
.page-head p { margin: 0; }
.back { margin-bottom: 12px; font-size: .9rem; }

/* ---------- Karten ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; box-shadow: var(--shadow); }
.card-flush { padding: 4px 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.card-head h2 { margin: 0; }
.eyebrow { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: .5em; }

.flash { padding: 12px 16px; border-radius: 14px; margin-bottom: 16px; font-weight: 600; }
.flash-ok { background: var(--olive-soft); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
.hint { font-size: .9rem; color: var(--muted); margin: 16px 0 0; }

/* ---------- Formulare ---------- */
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; }
input[type="text"], input[type="email"], input[type="password"], input[type="date"], textarea, select {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  font: inherit;
  font-weight: 400;
  font-size: 1rem;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--axis);
  border-radius: 12px;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .7; }
textarea { resize: vertical; min-height: 96px; line-height: 1.45; }
.input-short { max-width: 160px; }
.check { display: grid; grid-template-columns: auto 1fr; gap: 10px; font-size: .9rem; align-items: start; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--plum); }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 10px 20px;
  font: inherit; font-weight: 700;
  color: var(--on-plum); background: var(--plum);
  border: 1px solid var(--plum); border-radius: 999px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn-block { width: 100%; }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--axis); font-weight: 600; }
.btn-quiet:hover { background: var(--sand); filter: none; }
.btn-small { min-height: 36px; padding: 4px 14px; font-size: .85rem; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); filter: none; }

.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); align-items: end; }
.form-actions { display: flex; }

.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; font-size: .9rem; }

.action-list form { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); margin: 0; }
.action-list form:first-child { border-top: 0; padding-top: 4px; }
.action-list p { margin: 0; font-size: .9rem; }

/* ---------- Eintrag (Kunde) ---------- */
.entry-card h1, .entry-card .entry-title { margin-bottom: .6em; }
.hero { margin: 0 0 .1em; line-height: 1; }
.hero-num { font-size: 3.5rem; font-weight: 700; letter-spacing: -.02em; }
.hero-unit { font-size: 1.25rem; color: var(--muted); font-weight: 600; }
.entry-form { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.entry-form .field-note, .entry-form .btn { grid-column: 1 / -1; }
.field-weight input { font-size: 1.5rem; font-weight: 700; min-height: 56px; }
.entry-form input[type="date"] { min-height: 56px; }
.entry-more { margin-top: 8px; }
.entry-more summary { cursor: pointer; color: var(--muted); font-weight: 600; font-size: .9rem; padding: 8px 0; }
.entry-more[open] summary { margin-bottom: 8px; }

/* ---------- Kennzahlen ---------- */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 16px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px; }
.tile p { margin: 0; }
.tile-label { font-size: .8rem; color: var(--muted); font-weight: 600; }
.tile-value { font-size: 1.6rem; font-weight: 700; line-height: 1.25; }
.tile-value small { font-size: .9rem; font-weight: 600; }
.tile-sub { font-size: .8rem; color: var(--muted); }

.delta { white-space: nowrap; }
.delta-good { color: var(--good); font-weight: 700; }

/* ---------- Diagramm ---------- */
.segmented { display: inline-flex; border: 1px solid var(--axis); border-radius: 999px; padding: 2px; }
.segmented button { font: inherit; font-size: .85rem; font-weight: 600; color: var(--muted); background: transparent; border: 0; border-radius: 999px; min-height: 36px; padding: 4px 14px; cursor: pointer; }
.segmented button[aria-pressed="true"] { background: var(--plum); color: var(--on-plum); }

.chart-legend { list-style: none; display: flex; gap: 18px; flex-wrap: wrap; margin: 0 0 6px; padding: 0; font-size: .85rem; color: var(--muted); }
.chart-legend li, .tip-row { display: flex; align-items: center; gap: 8px; }
.key { display: inline-block; width: 16px; height: 0; border-top: 3px solid; border-radius: 2px; flex: none; }
.key-avg { border-color: var(--series-avg); }
.key-daily { border-color: var(--series-daily); }

.chart-plot { position: relative; }
.chart-svg { display: block; width: 100%; touch-action: pan-y; border-radius: 8px; }
.chart-grid { stroke: var(--line); stroke-width: 1; }
.chart-axis { stroke: var(--axis); stroke-width: 1; }
.chart-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-target { stroke: var(--muted); stroke-width: 1; }
.chart-daily { fill: none; stroke: var(--series-daily); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; opacity: .55; }
.chart-daily-dot { fill: var(--series-daily); stroke: var(--surface); stroke-width: 2; }
.chart-avg { fill: none; stroke: var(--series-avg); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-avg-dot { fill: var(--series-avg); stroke: var(--surface); stroke-width: 2; }
.chart-endlabel { fill: var(--ink); font-size: 12px; font-weight: 700; }
.chart-cross { stroke: var(--muted); stroke-width: 1; }
.chart-hit { fill: transparent; }

.chart-tip {
  position: absolute; top: 0; left: 0; z-index: 2; pointer-events: none;
  background: var(--surface); border: 1px solid var(--axis); border-radius: 12px;
  padding: 8px 12px; font-size: .8rem; color: var(--muted); box-shadow: var(--shadow);
  white-space: nowrap; max-width: 240px;
}
.chart-tip strong { color: var(--ink); font-size: .95rem; font-variant-numeric: tabular-nums; }
.tip-date { font-weight: 600; margin-bottom: 2px; }
.tip-note { white-space: normal; margin-top: 4px; font-style: italic; }
.tip-note:empty { display: none; }
[hidden] { display: none !important; }

/* ---------- Einträge ---------- */
.history { list-style: none; margin: 0; padding: 0; }
.history-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px 16px; padding: 10px 0; border-top: 1px solid var(--line); }
.history-row:first-child { border-top: 0; }
.history-main { display: grid; min-width: 0; }
.history-date { font-weight: 600; }
.history-note { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.history-value { text-align: right; display: grid; font-variant-numeric: tabular-nums; }
.history-value .delta { font-size: .8rem; color: var(--muted); }
.history-actions { display: flex; gap: 8px; }
.history-actions form { margin: 0; }
/* Eintrag als eine Zeile zum Antippen: führt zum Tag unter „Heute“ (ändern oder löschen) */
.history-hint { font-size: .9rem; margin: -4px 0 6px; }
.history-row.is-link { display: block; padding: 0; }
.history-link { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 12px; min-height: 56px; padding: 8px 0; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
.history-link:hover, .history-link:active { background: var(--sand); }
.history-go { color: var(--muted); font-size: 1.3rem; line-height: 1; }

.table-scroll { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .78rem; color: var(--muted); font-weight: 600; padding: 6px 12px 6px 0; border-bottom: 1px solid var(--axis); }
.table td { padding: 9px 12px 9px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th.num, .table td.num { text-align: right; }
.table td:last-child { color: var(--muted); min-width: 140px; }

/* ---------- Kundenliste (Coach) ---------- */
.client-row { display: grid; grid-template-columns: minmax(130px, 1.2fr) minmax(160px, 1.3fr) minmax(130px, 1.1fr) 78px minmax(84px, .8fr) minmax(84px, .8fr) 104px; gap: 12px; align-items: center; padding: 14px 20px; border-top: 1px solid var(--line); text-decoration: none; }
a.client-row:hover { background: var(--sand); }
.client-row-head { border-top: 0; font-size: .78rem; font-weight: 600; color: var(--muted); padding-top: 12px; padding-bottom: 10px; }
.client-row-head small { display: block; font-size: inherit; font-weight: 400; }
.client-row-head .num { white-space: normal; }
.client-week { font-size: .9rem; }
.client-week-part { white-space: nowrap; }
.client-name { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.client-name strong { overflow-wrap: anywhere; }
.client-last { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spark { display: block; width: 100px; height: 28px; }
.spark polyline { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }

.badge { display: inline-block; font-family: var(--body); font-size: .72rem; font-weight: 700; letter-spacing: .02em; padding: 2px 10px; border-radius: 999px; background: var(--sand); color: var(--ink); vertical-align: middle; white-space: nowrap; }
.badge-active { background: var(--olive-soft); }
.badge-late, .badge-expired { background: var(--warn-soft); color: var(--warn-ink); }
.badge-withdrawn { background: var(--danger-soft); color: var(--danger); }
.badge-paused { background: transparent; border: 1px solid var(--axis); color: var(--muted); }


/* ---------- Check-ins ---------- */
.badge-checkin-new { background: var(--plum); color: var(--on-plum); }
.badge-checkin-open { background: var(--warn-soft); color: var(--warn-ink); }
.badge-checkin-done { background: var(--olive-soft); }

.checkin-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.checkin-card-main { flex: 1; min-width: 220px; }
.checkin-card p:last-child { margin-bottom: 0; }

.feedback { background: var(--olive-soft); border-radius: 14px; padding: 14px 16px; margin: 12px 0 16px; }
.feedback p:last-child { margin-bottom: 0; }
.feedback-plain { margin: 0; }
.feedback-head { font-size: .8rem; font-weight: 700; margin-bottom: .3em; }

.question { border: 0; padding: 0; margin: 0; min-width: 0; }
.question legend, .checkin-form .field > span:first-child { font-weight: 600; font-size: 1rem; padding: 0; margin-bottom: 8px; }
.checkin-form { gap: 26px; }
.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 6px; }
.scale label, .choice label { position: relative; display: block; cursor: pointer; }
.scale input, .choice input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.scale span, .choice span {
  display: flex; align-items: center; justify-content: center; min-height: 46px;
  border: 1px solid var(--axis); border-radius: 12px; background: var(--bg);
  font-weight: 700; font-variant-numeric: tabular-nums;
}
.scale input:checked + span, .choice input:checked + span { background: var(--plum); border-color: var(--plum); color: var(--on-plum); }
.scale input:focus-visible + span, .choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.scale-hint { display: flex; justify-content: space-between; font-size: .8rem; color: var(--muted); margin: 6px 0 0; }
.choice { display: grid; grid-template-columns: repeat(2, minmax(0, 140px)); gap: 8px; }
.field-error { color: var(--danger); font-size: .85rem; font-weight: 600; margin: 6px 0 0; }
.has-error .scale span, .has-error .choice span, .has-error input, .has-error textarea { border-color: var(--danger); }

.checkin { border-top: 1px solid var(--line); padding: 4px 0; }
.card.checkin { border-top: 1px solid var(--line); padding: 12px 20px; }
.checkin summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; cursor: pointer; padding: 10px 0; list-style-position: outside; }
.checkin-week { font-weight: 700; }
.checkin-date { font-size: .85rem; margin-left: auto; }

.answers { margin: 0 0 16px; }
.answer { padding: 10px 0; border-top: 1px solid var(--line); }
.answer:first-child { border-top: 0; }
.answer dt { font-size: .85rem; color: var(--muted); margin-bottom: 2px; }
.answer dd { margin: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.answer-text { overflow-wrap: anywhere; }
.answer-prev { font-size: .82rem; }
.scale-value { min-width: 4.6em; }
.scale-bar { width: 140px; height: 6px; flex: none; }
.scale-track { fill: var(--sand); }
.scale-fill { fill: var(--series-avg); }

.feedback-form { display: grid; gap: 12px; margin: 4px 0 14px; }
.feedback-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.feedback-hint { margin: 0; font-size: .85rem; }
.feedback-reply { margin-top: .6em; font-size: .9rem; font-weight: 600; }

/* Woche in wenigen Zeilen (Kundenseite des Coachs, Check-in) */
.week-facts { background: var(--sand); border-radius: 12px; padding: 4px 14px; margin: 0 0 14px; font-size: .92rem; }
.week-facts > div { display: grid; grid-template-columns: 116px minmax(0, 1fr); gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.week-facts > div:first-child { border-top: 0; }
.week-facts dt { font-weight: 700; }
.week-facts dd { margin: 0; overflow-wrap: anywhere; }
.card > .week-facts:last-child { margin-bottom: 0; }
@media (max-width: 520px) {
  .week-facts > div { grid-template-columns: minmax(0, 1fr); }
}

/* Kundenseite des Coachs: Sprungmarken, Abschnitte, ältere Check-ins */
.jump { display: flex; flex-wrap: wrap; gap: 6px 8px; margin: 0 0 16px; }
.jump a { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: .85rem; font-weight: 600; text-decoration: none; color: var(--ink); background: var(--surface); }
.jump a:hover { border-color: var(--plum); }
.group-title { font-family: var(--body); font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 30px 0 10px; scroll-margin-top: 12px; }
.card[id], .section-head[id] { scroll-margin-top: 12px; }
.checkin-older { border-top: 1px solid var(--line); }
.checkin-older > summary { cursor: pointer; padding: 12px 0; font-weight: 600; font-size: .92rem; }

.question-list { list-style: none; margin: 0; padding: 0; }
.question-list li { border-top: 1px solid var(--line); padding: 14px 0; }
.question-list li:first-child { border-top: 0; padding-top: 4px; }
.question-row { display: grid; grid-template-columns: minmax(0, 1fr) 170px auto; gap: 10px 14px; align-items: end; }
.question-required { align-self: center; align-items: center; margin-top: 22px; }
.question-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; }

/* Fragen-Pakete: Name des Pakets, wer es bekommt, einem Kunden geben */
.pack-row { display: grid; gap: 10px; }
.pack-row .field { max-width: 460px; }
.pack-row .field .badge { margin-left: 6px; }
.pack-clients { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 8px; }
.pack-clients li { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: .9rem; background: var(--surface); }
.pack-clients a { font-weight: 600; text-decoration: none; color: var(--ink); }
.pack-clients a:hover { text-decoration: underline; }
.pack-assign { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin-top: 4px; }
.pack-assign .field { flex: 1 1 240px; max-width: 460px; }
.checkin-set-pick { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: end; margin: 0 0 16px; }
.checkin-set-pick .field { flex: 1 1 220px; max-width: 380px; }
.btn[disabled] { opacity: .35; cursor: default; }

/* ---------- Messwerte ---------- */
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 24px 0 12px; }
.section-head h2 { margin: 0; }
.metric-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.metric-card { margin-bottom: 0; padding: 16px 18px; min-width: 0; }
.metric-card .card-head { margin-bottom: 2px; flex-wrap: nowrap; align-items: baseline; }
.metric-card h3 { margin: 0; overflow-wrap: anywhere; }
.metric-latest { white-space: nowrap; }
.metric-latest strong { font-size: 1.4rem; }
.metric-sub { font-size: .82rem; margin-bottom: 8px; }
.metric-hint { font-size: .85rem; margin: 0; }
.metric-values { margin-top: 6px; }
.metric-values summary { cursor: pointer; font-size: .85rem; font-weight: 600; color: var(--muted); padding: 6px 0; }
.metric-values ul { list-style: none; margin: 4px 0 0; padding: 0; max-height: 220px; overflow-y: auto; }
.metric-values li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.metric-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.field-date { max-width: 220px; }
.metric-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, .7fr) minmax(0, 1.2fr) minmax(0, .9fr); gap: 10px 14px; align-items: end; }
.metric-check { grid-column: 1 / -1; }
.metric-count { font-size: .82rem; align-self: center; margin-left: auto; }

/* ---------- Ziele: Liste und Formular ---------- */
.goal-list { list-style: none; margin: 0; padding: 0; }
.goal { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 24px; align-items: start; padding: 14px 0; border-top: 1px solid var(--line); }
.goal:first-child { border-top: 0; padding-top: 0; }
.goal:last-child { padding-bottom: 0; }
.goal p { margin: 0; }
.goal-name { font-size: .8rem; font-weight: 600; color: var(--muted); }
.goal-target { font-size: 1.05rem; overflow-wrap: anywhere; }
.goal-target strong { font-size: 1.5rem; line-height: 1.25; }
.goal-kind { font-size: .9rem; color: var(--muted); }
.goal-note { font-size: .88rem; margin-top: 2px; }
.goal-progress { display: grid; gap: 4px; align-content: start; font-size: .9rem; }
.goal-now { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.goal-now strong { font-size: 1.05rem; }
.goal-basis { font-size: .8rem; }
.goal-bar { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 8px; border: 0; border-radius: 999px; overflow: hidden; background: var(--sand); color: var(--series-daily); }
.goal-bar::-webkit-progress-bar { background: var(--sand); border-radius: 999px; }
.goal-bar::-webkit-progress-value { background: var(--series-daily); border-radius: 999px; }
.goal-bar::-moz-progress-bar { background: var(--series-daily); border-radius: 999px; }
.goal-stand { font-size: .82rem; }
.goal-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, .9fr) minmax(0, 1.2fr); gap: 10px 14px; align-items: end; }
.goal-field-wide { grid-column: span 2; }
.goal-field-full { grid-column: 1 / -1; }
.goal-help { padding-left: 1.1em; display: grid; gap: 4px; }
.week-goals { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 2px 18px; }
.goal-presets { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
@media (max-width: 720px) {
  .goal { grid-template-columns: minmax(0, 1fr); }
  .goal-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .goal-row .goal-field-name, .goal-row .goal-field-wide { grid-column: 1 / -1; }
}

/* Eigene Ziele der Kundin (höchstens drei): kurze Liste auf der Startseite und beim Coach, auf der Seite „Ziele“
   je Ziel eine Zeile, die sich zum Ändern aufklappt */
.badge-own { background: transparent; border: 1px solid var(--axis); color: var(--muted); }
h2 .goal-stand { font-family: var(--body); font-weight: 400; letter-spacing: 0; margin-left: 6px; white-space: nowrap; }
.own-intro { font-size: .9rem; margin: -4px 0 12px; }
.own-brief { list-style: none; margin: 0; padding: 0; }
.own-brief li { display: grid; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); overflow-wrap: anywhere; }
.own-brief li:first-child { border-top: 0; padding-top: 2px; }
.own-brief li:last-child { padding-bottom: 2px; }
.own-brief .muted { font-size: .85rem; }
.own-note { font-size: .9rem; }
.own-list { list-style: none; margin: 0 0 14px; padding: 0; border-bottom: 1px solid var(--line); }
.own-goal { border-top: 1px solid var(--line); }
.own-goal summary { cursor: pointer; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 56px; padding: 8px 0; -webkit-tap-highlight-color: transparent; }
.own-goal summary::-webkit-details-marker, .own-new summary::-webkit-details-marker { display: none; }
.own-goal-text { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
.own-goal-text small { font-size: .85rem; }
.own-goal-edit { color: var(--muted); font-size: .85rem; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.own-goal details[open] { padding-bottom: 18px; }
.own-goal details:not([open]) .own-when-open, .own-goal details[open] .own-when-closed { display: none; }
.own-new summary { cursor: pointer; list-style: none; display: inline-block; }
.own-new[open] summary { margin-bottom: 14px; }
.own-form { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 10px 14px; align-items: end; }
.own-field-full { grid-column: 1 / -1; }
@media (max-width: 520px) {
  .own-form { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Ziele zum Abhaken (früher „Gewohnheiten“, daher die Klassennamen) ---------- */
.habit-list { list-style: none; margin: 0; padding: 0; }
.habit { padding: 14px 0; border-top: 1px solid var(--line); scroll-margin-top: 12px; }
.habit:first-child { border-top: 0; padding-top: 0; }
.habit:last-child { padding-bottom: 0; }
.habit p { margin: 0; }
.habit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.habit-name { overflow-wrap: anywhere; }
.habit-name .muted { font-size: .85rem; margin-left: 4px; white-space: nowrap; }
.habit-count { font-size: .9rem; font-weight: 600; white-space: nowrap; }
.habit-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; max-width: 480px; }
.habit-day { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 52px; padding: 4px 0; border: 1px solid var(--axis); border-radius: 12px; background: var(--bg); color: var(--ink); font: inherit; }
button.habit-day { cursor: pointer; }
button.habit-day:hover { border-color: var(--ink); }
.habit-wd { font-size: .72rem; font-weight: 600; color: var(--muted); }
.habit-mark { font-size: 1.05rem; font-weight: 700; line-height: 1.2; min-height: 1.2em; }
.habit-day.is-done { background: var(--olive-soft); border-color: var(--good); }
.habit-day.is-done .habit-wd { color: var(--ink); }
.habit-day.is-static:not(.is-done) { background: transparent; }
.habit-day.is-future { opacity: .45; border-style: dashed; }
.habit-weeklabel { font-size: .85rem; margin: -6px 0 12px; }
.habit-weeknav-links { display: flex; gap: 6px; }
.habit-today { display: grid; gap: 8px; margin: 0; }
.habit-check { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; border: 1px solid var(--axis); border-radius: 14px; background: var(--bg); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.habit-check:hover { border-color: var(--ink); }
.habit-check.is-done { background: var(--olive-soft); border-color: var(--good); }
.habit-box { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid var(--axis); border-radius: 8px; background: var(--surface); font-weight: 700; line-height: 1; }
.habit-check.is-done .habit-box { border-color: var(--good); background: var(--good); color: var(--surface); }
.habit-check-text { display: grid; min-width: 0; overflow-wrap: anywhere; }
.habit-check-text small { font-size: .82rem; }
.habit-check.is-done small { color: var(--ink); }
.habit-check.is-static { cursor: default; }
.habit-check.is-static:hover { border-color: var(--good); }
.habit-detail { font-size: .85rem; margin: -4px 0 8px; }
.habit-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 10px 14px; align-items: end; }
.habit-copy { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.habit-copy .field { flex: 1 1 220px; }
.habit-overview td:last-child { color: inherit; min-width: 0; }
.habit-overview td.num, .habit-overview th.num { white-space: nowrap; }
.habit-ok { color: var(--good); font-weight: 700; }
.habit-details { margin-top: 12px; }
.habit-details summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--muted); padding: 6px 0 10px; }

/* ---------- Trainingsplan ---------- */
.card-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.plan-meta { font-size: .88rem; margin: -6px 0 10px; }
.plan-exercises { list-style: none; margin: 0; padding: 0; }
.plan-exercises li { display: flex; justify-content: space-between; align-items: baseline; gap: 2px 16px; flex-wrap: wrap; padding: 9px 0; border-top: 1px solid var(--line); }
.plan-exercises li:first-child { border-top: 0; }
.plan-exercises li:last-child { padding-bottom: 0; }
.plan-ex-name { font-weight: 600; overflow-wrap: anywhere; }
.plan-ex-name .muted { font-weight: 400; }
.plan-ex-target { white-space: nowrap; font-weight: 600; }
.plan-ex-note { flex-basis: 100%; font-size: .88rem; color: var(--muted); }
.workout-card { scroll-margin-top: 12px; }
.workout-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) minmax(0, .7fr); gap: 10px 14px; align-items: end; }
.workout-hint { margin: 10px 0 0; }
.workout-sub { font-family: var(--body); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 20px 0 6px; }
.exercise-row { display: grid; grid-template-columns: minmax(0, 1.5fr) 84px minmax(0, .9fr) 96px minmax(0, 1.3fr); gap: 10px 14px; align-items: end; }
.exercise-add { margin-top: 6px; border-top: 1px solid var(--line); }
.exercise-add .workout-sub { margin-top: 16px; }
.exercise-bulk { margin-top: 12px; }
.exercise-bulk summary { cursor: pointer; font-size: .9rem; font-weight: 600; color: var(--muted); padding: 6px 0; }
.exercise-bulk form { display: grid; gap: 10px; margin-top: 8px; }
/* Reiter über dem Trainingsplan (Coach und Kundin): Es ist immer nur eine Einheit geöffnet */
.unit-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.unit-tab { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; min-height: 42px; padding: 5px 16px 5px 6px; border: 1px solid var(--axis); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: .9rem; font-weight: 600; text-decoration: none; }
.unit-tab:hover { background: var(--sand); }
.unit-tab[aria-current="page"] { background: var(--plum); border-color: var(--plum); color: var(--on-plum); }
.unit-tab-no { flex: none; display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--sand); color: var(--ink); font-size: .82rem; }
.unit-tab[aria-current="page"] .unit-tab-no { background: color-mix(in srgb, var(--on-plum) 22%, transparent); color: var(--on-plum); }
.unit-tab-name { min-width: 0; max-width: 24ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unit-tab-empty { flex: none; font-size: .74rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; opacity: .7; }
.unit-tab-new { padding-left: 16px; border-style: dashed; color: var(--muted); }
/* bei der Kundin ohne Nummer: so passen am Handy zwei Einheiten in eine Zeile */
.unit-tabs-client .unit-tab { padding-left: 16px; }
.set-exercise { padding: 16px 0; border-top: 1px solid var(--line); margin-top: 16px; }
.set-exercise p { margin: 0; }
.set-head { display: flex; justify-content: space-between; align-items: baseline; gap: 4px 16px; flex-wrap: wrap; }
.set-head h2 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.set-note, .set-last { font-size: .88rem; margin-top: 2px; }
.set-row { display: grid; grid-template-columns: 58px minmax(0, 1fr) 12px minmax(0, 1fr); gap: 8px; align-items: center; margin-top: 8px; max-width: 420px; }
/* mit Zusatzfeld je Satz (z. B. RIR): eine dritte, schmalere Spalte */
.set-row-extra { grid-template-columns: 52px minmax(0, 1fr) 12px minmax(0, 1fr) minmax(0, .8fr); max-width: 520px; }
.set-row-extra.set-row-head span:last-child { overflow-wrap: anywhere; }
.set-row-head { font-size: .78rem; font-weight: 600; color: var(--muted); margin-top: 12px; }
.set-no { font-size: .88rem; font-weight: 600; color: var(--muted); }
.set-row input { text-align: center; min-width: 0; width: 100%; }
.set-row input[aria-invalid="true"] { border-color: var(--danger); }
/* Im Training (training.js): Haken „Satz beenden“ je Satz, Hinweis auf nicht gespeicherte Eingaben, Leiste mit der Pause */
.set-done { display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid var(--axis); border-radius: 50%; background: var(--surface); color: var(--muted); cursor: pointer; }
.set-done:hover { background: var(--sand); }
.set-done[aria-pressed="true"] { background: var(--good); border-color: var(--good); color: var(--surface); }
.is-live .set-row { grid-template-columns: 58px minmax(0, 1fr) 12px minmax(0, 1fr) 44px; max-width: 472px; }
.is-live .set-row-extra { grid-template-columns: 52px minmax(0, 1fr) 12px minmax(0, 1fr) minmax(0, .8fr) 44px; max-width: 572px; }
.set-row.is-done input { background: var(--sand); border-color: var(--line); }
.set-row.is-done .set-no { color: var(--good); }
.set-row.is-next .set-no { color: var(--ink); }
.set-row.is-next input { border-color: var(--plum); }
.draft-note { display: flex; align-items: center; justify-content: space-between; gap: 6px 16px; flex-wrap: wrap; }
.draft-note-action { font: inherit; font-weight: 700; color: inherit; background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }
html.has-rest-bar body { padding-bottom: 150px; }
.rest-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: var(--plum); color: var(--on-plum); box-shadow: 0 -6px 24px rgba(0, 0, 0, .2); padding-bottom: env(safe-area-inset-bottom); }
.rest-bar.is-over { background: var(--good); }
.rest-progress { height: 4px; background: color-mix(in srgb, var(--on-plum) 25%, transparent); }
.rest-progress span { display: block; height: 100%; width: 0; background: var(--on-plum); transition: width .25s linear; }
.rest-bar-inner { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; width: 100%; max-width: 640px; margin: 0 auto; padding: 10px 16px 12px; }
.rest-text { display: grid; min-width: 0; }
.rest-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rest-next { font-size: .85rem; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rest-bar.is-all-done .rest-next { white-space: normal; }
.rest-time { font-size: 2.3rem; line-height: 1; font-weight: 700; font-variant-numeric: tabular-nums; }
.rest-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; }
.rest-btn { min-height: 44px; padding: 6px 14px; font: inherit; font-size: .9rem; font-weight: 700; color: var(--on-plum); background: transparent; border: 1px solid color-mix(in srgb, var(--on-plum) 45%, transparent); border-radius: 999px; cursor: pointer; white-space: nowrap; }
.rest-btn:disabled { opacity: .4; cursor: default; }
.rest-sound { margin-right: auto; font-weight: 600; }
.rest-main { background: var(--on-plum); border-color: var(--on-plum); color: var(--plum); }
.rest-bar.is-over .rest-main { color: var(--good); }
@media (max-width: 480px) {
  /* schmale Handys: Felder dichter, mit Zusatzfeld steht statt „Satz 1“ nur die Nummer */
  .is-live .set-row { gap: 6px; }
  .is-live .set-row input { padding-left: 6px; padding-right: 6px; }
  .is-live .set-row-extra { grid-template-columns: 14px minmax(0, 1fr) 10px minmax(0, 1fr) minmax(0, .8fr) 44px; }
  .is-live .set-row-extra .set-word { display: none; }
  .rest-btn { padding: 6px 12px; }
}
.set-notefield { margin: 20px 0 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.tlog-list details { border-top: 1px solid var(--line); padding: 10px 0; }
.tlog-list details:first-child { border-top: 0; padding-top: 0; }
.tlog-list details:last-child { padding-bottom: 0; }
.tlog-list summary { cursor: pointer; }
.tlog-list summary > * { margin-left: 6px; }
.tlog-sets { list-style: none; margin: 10px 0 0; padding: 0; }
.tlog-sets li { display: flex; justify-content: space-between; gap: 2px 16px; flex-wrap: wrap; padding: 6px 0; border-top: 1px solid var(--line); font-size: .92rem; }
.tlog-ex { font-weight: 600; }
.tlog-empty { margin: 8px 0 0; font-size: .92rem; }
.tlog-note { margin: 10px 0 0; font-size: .92rem; background: var(--sand); border-radius: 12px; padding: 8px 12px; }
.tlog-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.tlog-actions form { margin: 0; }
/* Kalender der Trainings (Coach): links der Monat, rechts der gewählte Tag bzw. die Trainings des Monats */
.tcal-layout { display: grid; grid-template-columns: minmax(0, 348px) minmax(0, 1fr); gap: 20px 28px; align-items: start; }
.tcal-layout[id], .tcal-detail[id] { scroll-margin-top: 12px; }
.tcal-detail { min-width: 0; }
.tcal-detail > :first-child { margin-top: 0; }
.tcal { background: var(--bg); border: 1px solid var(--line); border-radius: 16px; padding: 14px 12px 12px; }
.tcal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.tcal-month { font-size: 1.02rem; }
.tcal-nav { flex: none; display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); color: var(--ink); font-size: 1.3rem; line-height: 1; text-decoration: none; }
a.tcal-nav:hover { background: var(--sand); }
.tcal-nav.is-off { opacity: .3; }
.tcal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
.tcal-grid th { padding: 2px 0 6px; font-size: .74rem; font-weight: 600; color: var(--muted); text-align: center; }
.tcal-grid td { padding: 2px 0; text-align: center; vertical-align: top; }
.tcal-grid .tcal-sum { width: 15%; vertical-align: middle; font-size: .8rem; font-weight: 600; color: var(--muted); border-left: 1px solid var(--line); }
.tcal-grid td.tcal-sum.has-trainings { color: var(--ink); font-weight: 700; font-size: .9rem; }
.tcal-day { display: grid; justify-items: center; gap: 3px; padding: 2px 0 3px; border-radius: 12px; color: var(--ink); text-decoration: none; }
.tcal-no { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid transparent; font-size: .92rem; font-variant-numeric: tabular-nums; }
.tcal-dots { display: flex; justify-content: center; gap: 3px; height: 6px; }
.tcal-dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--series-daily); }
a.tcal-day:hover .tcal-no { background: var(--sand); }
.tcal-day.is-trained .tcal-no { background: var(--olive-soft); font-weight: 700; }
.tcal-day.is-today .tcal-no { border-color: var(--axis); }
.tcal-day.is-other, .tcal-day.is-future { color: var(--muted); }
.tcal-day.is-other .tcal-no, .tcal-day.is-future .tcal-no { opacity: .55; }
.tcal-day.is-other.is-trained .tcal-no { opacity: .8; }
.tcal-day[aria-current="date"] .tcal-no, a.tcal-day[aria-current="date"]:hover .tcal-no { background: var(--plum); border-color: var(--plum); color: var(--on-plum); opacity: 1; }
.tcal-total { margin: 10px 4px 0; font-size: .88rem; color: var(--muted); }
.tcal-total strong { color: var(--ink); }
.tcal-log { border-top: 1px solid var(--line); padding: 14px 0; }
.tcal-log:first-of-type { border-top: 0; padding-top: 0; }
.tcal-log:last-child { padding-bottom: 0; }
.tcal-log h3 { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.tcal-log h3 .muted, .tlog-list summary .muted { font-size: .85rem; font-weight: 400; }
@media (max-width: 760px) {
  .tcal-layout { grid-template-columns: minmax(0, 1fr); }
  .tcal { max-width: 420px; }
}
@media (max-width: 720px) {
  .workout-row { grid-template-columns: minmax(0, 1fr); }
  .exercise-row { grid-template-columns: minmax(0, 1fr) 84px; }
  /* Übung | Sätze, darunter Wiederholungen | Pause, darunter der Hinweis über die ganze Breite */
  .exercise-row .field-wide { grid-column: 1 / -1; }
}

/* ---------- Fortschrittsfotos ---------- */
.action-list .action-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.action-list .action-item p { margin: 0; font-size: .9rem; }
.action-list .action-item { padding: 14px 0; border-top: 1px solid var(--line); }
.action-list .action-item:first-child { border-top: 0; padding-top: 4px; }
.action-list .action-item:last-child { padding-bottom: 0; }
.action-list .action-item > div { flex: 1 1 220px; min-width: 0; }
.photo-inputs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
input[type="file"] { width: 100%; min-height: 48px; padding: 10px; font: inherit; font-size: .85rem; font-weight: 400; color: var(--ink); background: var(--bg); border: 1px dashed var(--axis); border-radius: 12px; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: 10px; padding: 6px 12px; border: 1px solid var(--axis); border-radius: 999px; background: var(--surface); color: var(--ink); cursor: pointer; }
.photo-status { margin: 0; font-weight: 600; }
/* Fotoauswahl: ohne JavaScript die normale Dateiauswahl, mit JavaScript eine Kachel mit Vorschau */
.photo-pick { display: grid; gap: 6px; justify-items: center; min-width: 0; }
.photo-pick-zone { display: grid; gap: 6px; width: 100%; font-weight: 600; font-size: .9rem; }
.photo-pick-preview, .photo-pick-text { display: none; }
.is-enhanced .photo-inputs { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.is-enhanced .photo-pick-zone {
  position: relative; aspect-ratio: 3 / 4; align-content: center; justify-items: center; text-align: center;
  padding: 10px; border: 2px dashed var(--axis); border-radius: 14px; background: var(--bg); cursor: pointer; overflow: hidden;
}
.is-enhanced .photo-pick-zone:hover { border-color: var(--plum); }
.is-enhanced .photo-pick-zone:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.is-enhanced .photo-pick-zone input[type="file"] { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; padding: 0; border: 0; opacity: 0; cursor: pointer; }
.is-enhanced .photo-pick-text { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); }
.is-enhanced .photo-pick-text::before { content: "+"; display: block; font-size: 1.8rem; font-weight: 400; line-height: 1; margin-bottom: 4px; }
.is-enhanced .photo-pick-preview { display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.is-enhanced .has-file .photo-pick-zone { border-style: solid; border-color: var(--plum); }
.is-enhanced .has-file .photo-pick-pose, .is-enhanced .has-file .photo-pick-text {
  position: relative; z-index: 1; justify-self: center; padding: 2px 10px; border-radius: 999px; background: var(--plum); color: var(--on-plum);
}
.is-enhanced .has-file .photo-pick-text::before { content: none; }
.is-enhanced .has-file .photo-pick-zone { align-content: space-between; }
.compare-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; margin-bottom: 16px; }
.compare-head, .compare-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare-head p { margin: 0 0 4px; font-size: .9rem; }
.compare-pair { align-items: start; margin-bottom: 8px; }
.compare-pair img, .photo-thumb img { display: block; width: 100%; height: auto; border-radius: 12px; background: var(--sand); }
.photo-missing { display: flex; align-items: center; justify-content: center; text-align: center; min-height: 120px; padding: 12px; border: 1px dashed var(--axis); border-radius: 12px; color: var(--muted); font-size: .85rem; }
.photo-day { border-top: 1px solid var(--line); padding: 14px 0; }
.card-head + .photo-day { border-top: 0; padding-top: 0; }
.photo-date { margin-bottom: 8px; }
.photo-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: start; }
.photo-thumb { margin: 0; min-width: 0; }
.photo-thumb img { aspect-ratio: 3 / 4; object-fit: cover; }
.photo-thumb .photo-missing { aspect-ratio: 3 / 4; min-height: 0; }
.photo-thumb figcaption { display: flex; justify-content: space-between; align-items: center; gap: 6px; flex-wrap: wrap; font-size: .82rem; color: var(--muted); margin-top: 4px; }
.photo-thumb form { margin: 0; }
.link-button { font: inherit; font-size: .82rem; color: var(--danger); background: none; border: 0; padding: 4px 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* ---------- Erinnerungen ---------- */
h3 { font-size: 1rem; font-weight: 700; margin: 22px 0 10px; }
.field > small { font-size: .82rem; }
.status-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px 24px; margin: 0; }
.status-list dt { font-size: .8rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
.status-list dd { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.invite-mail { margin: 12px 0 0; }
.card > form > .form-actions, .card > .form-actions { margin-top: 16px; }

/* ---------- Sicherung ---------- */
.backup-list { list-style: none; margin: 0; padding: 0; }
.backup-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.backup-list li:first-child { border-top: 0; padding-top: 0; }
.backup-list li > div { display: flex; flex-direction: column; min-width: 0; }
.backup-list .muted { font-size: .88rem; }
.backup-list form { margin: 0; }
.flash a { color: inherit; font-weight: 600; }
.flash-note { background: var(--sand); font-weight: 400; }
.plain-list { margin: 0 0 16px; padding-left: 1.2em; display: grid; gap: 4px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin: 20px 0 0; }
.action-list form > div { min-width: 0; }

/* ---------- Nachrichten ---------- */
.nav-count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 2px; border-radius: 999px; background: var(--on-bar); color: var(--bar); font-size: .72rem; line-height: 20px; font-weight: 700; text-align: center; vertical-align: 1px; }
.thread { list-style: none; margin: 0 0 18px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.thread-day { align-self: center; font-size: .78rem; font-weight: 600; color: var(--muted); margin: 10px 0 2px; }
.thread-day:first-child { margin-top: 0; }
.thread-new { display: flex; align-items: center; gap: 10px; font-size: .78rem; font-weight: 700; color: var(--plum); margin: 6px 0 2px; }
.thread-new::before, .thread-new::after { content: ""; flex: 1; height: 1px; background: currentColor; opacity: .35; }
.thread-older { text-align: center; font-size: .9rem; margin: 0 0 12px; }
.thread-empty { margin: 0 0 18px; }
.msg { display: flex; flex-direction: column; max-width: min(85%, 520px); }
.msg-own { align-self: flex-end; align-items: flex-end; }
.msg-other { align-self: flex-start; align-items: flex-start; }
.msg-bubble { padding: 10px 14px; border-radius: 18px; line-height: 1.45; overflow-wrap: anywhere; }
.msg-own .msg-bubble { background: var(--plum); color: var(--on-plum); border-bottom-right-radius: 6px; }
.msg-other .msg-bubble { background: var(--sand); border-bottom-left-radius: 6px; }
.msg-bubble a { color: inherit; }
.msg-meta { display: flex; align-items: center; gap: 10px; font-size: .75rem; color: var(--muted); margin: 3px 6px 0; }
.msg-meta form { margin: 0; }
.msg-meta .link-button { font-size: .75rem; padding: 0; }
.thread-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; margin: 0; padding-top: 16px; border-top: 1px solid var(--line); }
.thread-form textarea { min-height: 52px; resize: none; }
/* „Löschen“ der eigenen Nachricht hinter drei Punkten. Die Tippfläche ist größer als das Zeichen, ohne die Zeile höher zu machen */
.msg-more { position: relative; }
.msg-more summary { cursor: pointer; list-style: none; display: inline-grid; place-items: center; min-width: 44px; height: 44px; margin: -13px -6px; border-radius: 999px; color: var(--muted); font-size: 1rem; font-weight: 700; letter-spacing: .08em; -webkit-tap-highlight-color: transparent; }
.msg-more summary::-webkit-details-marker { display: none; }
.msg-more summary:hover, .msg-more summary:active, .msg-more[open] summary { color: var(--ink); }
.msg-more[open] { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.msg-more form { margin: 12px 0 2px; }
.thread-hint { margin-top: 0; }

/* ---------- Konto ---------- */
.steps { margin: 0 0 16px; padding-left: 1.3em; display: grid; gap: 8px; }
.steps code { overflow-wrap: anywhere; }
.inbox-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 20px; border-top: 1px solid var(--line); text-decoration: none; }
.inbox-row:first-child { border-top: 0; }
a.inbox-row:hover { background: var(--sand); }
.inbox-main { display: flex; flex-direction: column; min-width: 0; }
.inbox-excerpt { font-size: .9rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inbox-unread .inbox-excerpt { color: var(--ink); font-weight: 600; }
.inbox-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-size: .82rem; white-space: nowrap; }

/* Navigation in eine eigene Zeile, sobald sie neben Logo und Abmelden nicht mehr passt */
@media (max-width: 1240px) {
  .topbar-inner { flex-wrap: wrap; padding-top: 6px; padding-bottom: 6px; }
  .nav { order: 3; width: 100%; margin: 0 0 0 -12px; flex-wrap: wrap; gap: 0 4px; }
}

@media (max-width: 820px) {
  .col-wide { display: none; }
  .client-row { grid-template-columns: 1fr 1fr; gap: 4px 12px; padding: 14px 16px; }
  .client-row-head { display: none; }
  .client-row-head + .client-row { border-top: 0; }
  .client-row .client-name, .client-row .client-last, .client-row .client-week, .client-row .client-checkin { grid-column: 1 / -1; }
  .client-row .client-week, .client-row .client-checkin { font-size: .85rem; }
  .client-row .client-week::before, .client-row .client-checkin::before { content: attr(data-label) ": "; color: var(--muted); }
  .question-row, .metric-row { grid-template-columns: 1fr; }
  .compare-form { grid-template-columns: 1fr 1fr; }
  .compare-form .btn { grid-column: 1 / -1; }
  .client-row .num { grid-column: 1 / -1; text-align: left; font-size: .85rem; white-space: normal; }
  .client-row .num::before { content: attr(data-label) ": "; color: var(--muted); }
  .action-list form { flex-direction: column; align-items: stretch; }
}

@media (max-width: 520px) {
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
  .topbar-name { display: none; }
  .history-row { grid-template-columns: 1fr auto; }
  .history-actions { grid-column: 1 / -1; }
}

@media (max-width: 420px) {
  .scale { grid-template-columns: repeat(5, 1fr); }
  .card { padding: 16px; border-radius: 16px; }
  .hero-num { font-size: 3rem; }
  .entry-form { grid-template-columns: 1fr; }
  .copy-row { flex-direction: column; }
}

/* ---------- Paket 3: eine Eingabe, Fortschritt, Konto ---------- */
.entry-form .entry-full { grid-column: 1 / -1; }
.entry-form .field-date { grid-column: 1 / -1; }
/* Selten Gebrauchtes im Formular „Eintragen“ (Notiz, weitere Messwerte, anderer Tag): zugeklappt nebeneinander in einer
   Zeile, aufgeklappt über die ganze Breite */
.entry-options { display: flex; flex-wrap: wrap; gap: 0 20px; align-items: flex-start; margin: -6px 0; }
.entry-option { min-width: 0; }
.entry-option[open] { flex-basis: 100%; padding-bottom: 10px; }
.entry-option summary { cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--muted); font-weight: 600; font-size: .9rem; }
.entry-option summary::-webkit-details-marker { display: none; }
.entry-option summary::before { content: "+"; font-weight: 700; }
.entry-option[open] summary { color: var(--ink); }
.entry-option[open] summary::before { content: "–"; }
.entry-hint { margin-top: 12px; }
.entry-delete { margin: 6px 0 0; }
.entry-delete .link-button { min-height: 44px; font-size: .9rem; }
.field-hint { color: var(--muted); font-size: .8rem; margin: 6px 0 0; }
.start-more { margin: 20px 0 0; }
a.topbar-name { color: var(--on-bar); text-decoration: none; font-weight: 600; padding: 8px 4px; border-radius: 6px; }
a.topbar-name:hover, a.topbar-name[aria-current="page"] { text-decoration: underline; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; }
.pick-list li { padding: 12px 0; border-top: 1px solid var(--line); }
.pick-list li:first-child { border-top: 0; padding-top: 0; }
.pick-list .check { font-size: 1rem; }
.pick-list .check .muted { font-size: .88rem; }
.pick-list input:disabled + span strong { opacity: .75; }
/* Module je Kunde: Auswahl im Formular „Neuer Kunde“, Hinweis auf der Kundenseite */
.module-pick { border: 0; padding: 0; margin: 0; min-width: 0; }
.module-pick legend { font-weight: 600; font-size: .9rem; padding: 0; margin-bottom: 10px; }
.module-pick legend small { font-weight: 400; color: var(--muted); }
.module-note { margin: -6px 0 16px; }
.metric-card .chart-legend { margin-bottom: 4px; }
/* Menü des Kunden auf dem Handy: fünf Punkte in einer Zeile (zur Not seitlich schieben statt umbrechen) */
@media (max-width: 520px) {
  .nav-client { flex-wrap: nowrap; gap: 0; margin-left: -5px; justify-content: space-between; overflow-x: auto; scrollbar-width: none; }
  .nav-client::-webkit-scrollbar { display: none; }
  .nav-client a { padding: 8px 5px; font-size: .8125rem; }
  .nav-client a[aria-current="page"] { padding-left: 9px; padding-right: 9px; }
}

/* ---------- Übungsdatenbank (Coach) ---------- */
.lib-seed { display: flex; gap: 10px; flex-wrap: wrap; }
.lib-filter { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px 14px; align-items: end; }
.lib-filter-actions { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 6px; }
.lib-count { margin: 16px 0 10px; font-size: .9rem; }
.lib-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.lib-card { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 12px; align-items: center; height: 100%; padding: 8px; border: 1px solid var(--line); border-radius: 16px; background: var(--bg); color: var(--ink); text-decoration: none; }
.lib-card:hover { border-color: var(--plum); }
.lib-thumb { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 12px; overflow: hidden; background: var(--sand); color: var(--muted); }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-card-body { display: grid; gap: 3px; min-width: 0; }
.lib-name { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.lib-tags { font-size: .85rem; }
.lib-meta { display: flex; gap: 4px; flex-wrap: wrap; }
.lib-meta:empty { display: none; }
.lib-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.lib-form-wide { grid-column: 1 / -1; }
.lib-form .field small, .lib-defaults legend small { font-weight: 400; color: var(--muted); }
.lib-defaults { border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 16px; margin: 0; min-width: 0; display: grid; grid-template-columns: 96px minmax(0, 1fr) 120px; gap: 10px 14px; align-items: end; }
.lib-defaults legend { font-weight: 600; font-size: .9rem; padding: 0 6px; }
.lib-defaults .field-hint { grid-column: 1 / -1; margin: 0; }
.lib-images { list-style: none; margin: 0 0 18px; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.lib-images li { display: grid; gap: 8px; align-content: start; }
.lib-images img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 14px; background: var(--sand); display: block; }
.lib-image-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.lib-upload { display: grid; gap: 12px; padding-top: 16px; border-top: 1px solid var(--line); }
.lib-images + .lib-upload, .card-head + .lib-upload { margin-top: 0; }
.lib-upload input[type="file"] { font: inherit; font-weight: 400; max-width: 100%; }
.lib-previews { display: flex; gap: 10px; flex-wrap: wrap; }
.lib-preview { position: relative; width: 120px; }
.lib-preview canvas { width: 120px; height: 90px; border-radius: 12px; background: var(--sand); display: block; }
.lib-preview span { display: block; font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 4px; }
.lib-preview.is-over canvas { opacity: .35; }
.lib-upload-status { margin: 0; font-weight: 600; }
.lib-usage { margin-bottom: 0; }
/* Trainingsplan des Coachs: je Übung der Stand der Anleitung aus der Übungsdatenbank, aufgeklappt das Zuordnen von Hand */
.lib-pick { font-size: .85rem; align-self: center; margin-left: auto; min-width: 0; }
.lib-pick summary { cursor: pointer; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; list-style: none; text-align: right; padding: 6px 0; }
.lib-pick summary::-webkit-details-marker { display: none; }
.lib-pick.is-linked summary { color: var(--good); font-weight: 600; text-decoration: none; }
.lib-pick[open] { flex-basis: 100%; margin-left: 0; }
.lib-pick[open] summary { text-align: left; }
.lib-pick-body { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 8px 10px; align-items: end; padding: 4px 0 2px; }
.lib-pick-body .field-hint { grid-column: 1 / -1; margin: 0; }

/* ---------- Anleitung zu einer Übung (Kundin und Vorschau des Coachs) ---------- */
.ex-guide { margin-top: 8px; }
.plan-exercises .ex-guide { flex-basis: 100%; margin-top: 2px; }
.ex-guide summary { cursor: pointer; display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; padding: 6px 0; font-size: .9rem; color: var(--muted); list-style: none; }
.ex-guide summary::-webkit-details-marker { display: none; }
.ex-guide summary::before { content: "+"; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--axis); font-weight: 700; line-height: 1; color: var(--ink); align-self: center; }
.ex-guide[open] summary::before { content: "–"; }
.ex-guide-title { font-weight: 700; color: var(--ink); }
.ex-guide-has { font-size: .82rem; }
.ex-guide-body { display: grid; gap: 10px; padding: 8px 0 6px; font-size: .95rem; }
.ex-guide-body p, .ex-guide-body ol, .ex-guide-body ul { margin: 0; }
.ex-guide-images { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 4px; }
.ex-guide-images img { flex: none; height: 210px; width: auto; max-width: 86%; object-fit: cover; border-radius: 14px; background: var(--sand); scroll-snap-align: start; }
.ex-guide-images.is-single img { height: auto; max-height: 320px; max-width: 100%; object-fit: contain; }
.ex-guide-muscles { font-size: .88rem; color: var(--muted); }
.ex-guide-steps, .ex-guide-cues { padding-left: 1.3em; display: grid; gap: 5px; }
.ex-guide-sub { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ex-guide-video { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: .82rem; }

@media (max-width: 820px) {
  .lib-filter { grid-template-columns: 1fr 1fr; }
  .lib-filter .field:first-child, .lib-filter-actions { grid-column: 1 / -1; }
  .lib-form { grid-template-columns: 1fr; }
  .lib-defaults { grid-template-columns: 84px minmax(0, 1fr) 96px; }
  .lib-pick { margin-left: 0; flex-basis: 100%; }
  .lib-pick summary { text-align: left; }
  .lib-pick-body { grid-template-columns: 1fr 1fr; }
  .lib-pick-body .field { grid-column: 1 / -1; }
  .ex-guide-images img { height: 170px; }
}

/* ---------- Bedienung am Handy (KONZEPT-MOBIL.md, Paket A) ---------- */
/* Werte vom letzten Mal im Training: gut lesbar (Kontrast), kursiv bleibt erkennbar, dass es eine Vorgabe ist */
.set-row input::placeholder { color: var(--muted); opacity: 1; font-style: italic; }

/* Rückmeldung beim Antippen – :hover gibt es am Handy nicht */
.btn, .habit-check, button.habit-day, .set-done, .segmented button, .unit-tab, .jump a, .lib-card, a.client-row, a.inbox-row, a.tcal-day, .scale label, .choice label { -webkit-tap-highlight-color: transparent; }
.btn:active { transform: scale(.97); filter: brightness(.9); }
.btn-quiet:active { background: var(--sand); filter: none; }
.btn-danger:active { background: var(--danger-soft); filter: none; }
.habit-check:not(.is-static):active, button.habit-day:active, .set-done:active { transform: scale(.97); border-color: var(--ink); }
.segmented button:not([aria-pressed="true"]):active, .unit-tab:not([aria-current]):active, .jump a:active, .lib-card:active, a.client-row:active, a.inbox-row:active { background: var(--sand); }
a.tcal-day:not([aria-current]):active .tcal-no { background: var(--sand); }
.scale label:active span, .choice label:active span { border-color: var(--plum); }

/* Tippflächen: alles Antippbare mindestens 44 px hoch */
@media (max-width: 820px) {
  .btn-small { min-height: 44px; min-width: 44px; }
  .segmented button { min-height: 44px; }
  .back { margin: -8px 0 4px; }
  .back a, .footer a { display: inline-flex; align-items: center; min-height: 44px; }
  .footer { padding-top: 0; padding-bottom: 12px; }
  .jump a, .pack-clients li, .unit-tab { min-height: 44px; }
  .tcal-nav { width: 44px; height: 44px; }
  .entry-more summary, .metric-values summary, .habit-details summary, .exercise-bulk summary, .lib-pick summary { padding-top: 12px; padding-bottom: 12px; }
  .checkin summary { min-height: 44px; }
  .ex-guide summary { min-height: 44px; align-items: center; }
  .tlog-list details, .tlog-list details:first-child, .tlog-list details:last-child { padding: 0; }
  .tlog-list details[open] { padding-bottom: 12px; }
  .tlog-list summary { padding: 10px 0; }
}

@media (max-width: 520px) {
  /* Menü der Kundin: Der Zähler sitzt an der Ecke des Menüpunkts und braucht keinen Platz in der Zeile */
  .nav-client { padding-top: 6px; margin-top: -6px; }
  .nav-client a { position: relative; padding-top: 12px; padding-bottom: 12px; }
  .nav-client .nav-count { position: absolute; top: -4px; right: 0; margin: 0; min-width: 18px; padding: 0 5px; line-height: 18px; box-shadow: 0 0 0 2px var(--bar); }

  /* Hauptaktion auf „Training“: großer Knopf über die ganze Breite */
  .card-head .workout-go { width: 100%; }

  /* Check-in: Skala in zwei Reihen, auch auf großen Handys */
  .scale { grid-template-columns: repeat(5, 1fr); }

  /* „Heute“: Messwerte zweispaltig; Beschriftung, Feld und Hinweis stehen je Zeile auf gleicher Höhe */
  .entry-form > .metric-inputs { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: end; }
  @supports (grid-template-rows: subgrid) {
    .entry-form > .metric-inputs { align-items: stretch; row-gap: 0; margin-bottom: -8px; }
    .entry-form > .metric-inputs > .field { grid-row: span 3; grid-template-rows: subgrid; row-gap: 6px; margin-bottom: 8px; }
  }

  /* Schrift: Nebentexte 14 px, kleine Beschriftungen 13 px, nichts unter 12 px. Ausnahme: das Menü der Kundin (13 px), sonst passen die fünf Punkte nicht in eine Zeile */
  small, .footer, .btn-small, .tile-label, .tile-sub, .segmented button, .chart-legend, .chart-tip, .history-note, .history-value .delta,
  .client-row .client-week, .client-row .client-checkin, .client-row .num, .feedback-head, .scale-hint, .field-error, .checkin-date,
  .answer dt, .answer-prev, .feedback-hint, .jump a, .metric-sub, .metric-hint, .metric-values summary, .metric-count,
  .goal-name, .goal-basis, .goal-stand, .habit-name .muted, .habit-weeklabel, .habit-check-text small, .habit-detail, .rest-next,
  .is-enhanced .photo-pick-text, .photo-missing, .photo-thumb figcaption, .link-button, input[type="file"], .field > small,
  .status-list dt, .inbox-side, .field-hint, .lib-tags, .lib-pick, .ex-guide-has, .ex-guide-video, .unit-tab-no,
  .tcal-log h3 .muted, .tlog-list summary .muted { font-size: .875rem; }
  .eyebrow, .badge, .group-title, .workout-sub, .habit-wd, .set-row-head, .unit-tab-empty, .tcal-grid th, .table th,
  .thread-day, .thread-new, .msg-meta, .msg-meta .link-button, .ex-guide-sub, .lib-preview span { font-size: .8125rem; }
  .brand-sub, .nav-count { font-size: .75rem; }
  .chart-tick { font-size: 12px; }
}

/* Sehr schmale Handys (320 px): Kopf und Menü bleiben in je einer Zeile */
@media (max-width: 340px) {
  .brand-sub { display: none; }
  .nav-client a { padding-left: 2px; padding-right: 2px; font-size: .75rem; }
  .nav-client a[aria-current="page"] { padding-left: 7px; padding-right: 7px; }
}

/* ---------- Menüleiste der Kundin am Handy (KONZEPT-MOBIL.md, Paket B) ---------- */
/* layout.php setzt „has-tabbar“, sobald die Kundin mindestens zwei Bereiche hat. Am Handy wird das Menü dann zur festen
   Leiste am unteren Rand, der Kopf zeigt nur Logo und Konto-Symbol. „tabbar-off“: Seite ohne Leiste (Training eintragen,
   dort steht unten die Pausenleiste). „is-typing“ setzt app.js, wenn die Bildschirmtastatur die Seite verkleinert. */
.nav-icon { display: none; }
.nav-icon svg { display: block; }
@media (max-width: 520px) {
  .has-tabbar:not(.tabbar-off) { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .has-tabbar .topbar-inner { flex-wrap: nowrap; padding-top: 0; padding-bottom: 0; }
  .has-tabbar .topbar-user .btn { display: none; }
  .has-tabbar .topbar-account { display: grid; place-items: center; width: 44px; height: 44px; max-width: none; padding: 0; margin-right: -8px; border-radius: 50%; overflow: visible; }
  .has-tabbar .topbar-account .nav-icon { display: block; }
  .has-tabbar .topbar-account-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .has-tabbar a.topbar-account:hover, .has-tabbar a.topbar-account[aria-current="page"] { text-decoration: none; }
  .has-tabbar .footer-account { display: none; }
  .has-tabbar a.topbar-account[aria-current="page"], .has-tabbar a.topbar-account:active { background: color-mix(in srgb, var(--on-bar) 16%, transparent); }

  .has-tabbar .nav-client {
    /* --tabbar-shift setzt app.js: am iPhone bleibt der sichtbare Ausschnitt nach dem Tippen manchmal verschoben stehen */
    position: fixed; left: 0; right: 0; bottom: var(--tabbar-shift, 0px); z-index: 15; order: 0; width: auto; margin: 0;
    padding: 0 max(4px, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-left));
    display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 0; overflow: visible;
    background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -18px rgba(59, 27, 53, .45);
  }
  .has-tabbar .nav-client a, .has-tabbar .nav-client a[aria-current="page"] {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    min-height: 64px; padding: 6px 0 7px; border-radius: 0; background: none; opacity: 1;
    color: var(--muted); font-size: .75rem; font-weight: 600; line-height: 1.2; -webkit-tap-highlight-color: transparent;
  }
  .has-tabbar .nav-client a[aria-current="page"] { color: var(--ink); font-weight: 700; }
  .has-tabbar .nav-client a:focus-visible { outline-color: var(--focus); outline-offset: -3px; }
  .has-tabbar .nav-client .nav-icon { display: grid; place-items: center; width: 56px; height: 30px; border-radius: 999px; }
  .has-tabbar .nav-client a[aria-current="page"] .nav-icon { background: var(--olive-soft); }
  .has-tabbar .nav-client a:not([aria-current]):active .nav-icon { background: var(--sand); }
  .has-tabbar .nav-client .nav-count { top: 3px; right: auto; left: calc(50% + 6px); background: var(--plum); color: var(--on-plum); box-shadow: 0 0 0 2px var(--surface); }
  .has-tabbar.tabbar-off .nav-client, .is-typing .has-tabbar .nav-client { display: none; }
}
@media (max-width: 340px) {
  /* fünf Punkte auf 320 px: „Nachrichten“ ist breiter als seine Spalte, etwas enger gesetzt bleibt Abstand zum Nachbarn */
  .has-tabbar .nav-client a, .has-tabbar .nav-client a[aria-current="page"] { letter-spacing: -.02em; }
}

/* ---------- Nachrichten am Handy (KONZEPT-MOBIL.md, Paket C) ---------- */
/* Das Eingabefeld bleibt beim Lesen am unteren Rand stehen – über der Menüleiste der Kundin, sonst am Bildschirmrand.
   Am Ende des Verlaufs steht es an seinem gewohnten Platz. */
@media (max-width: 820px) {
  .thread-form { position: sticky; bottom: 0; z-index: 5; background: var(--surface); padding-bottom: 10px; margin-bottom: -10px; }
}
@media (max-width: 520px) {
  .has-tabbar:not(.tabbar-off) .thread-form { bottom: calc(65px + env(safe-area-inset-bottom)); }
  .is-typing .has-tabbar .thread-form { bottom: 0; }
}

/* ---------- Coach unterwegs (KONZEPT-MOBIL.md, Paket D) ---------- */
/* Menü des Coachs am Handy: drei Hauptpunkte und „Mehr“. layout.php gibt die selteneren Punkte zweimal aus –
   in der Zeile (.nav-wide, am Computer) und im Aufklapper (.nav-more, am Handy). */
.nav-more { display: none; position: relative; }
.nav-more summary { list-style: none; cursor: pointer; white-space: nowrap; color: var(--on-bar); font-size: .9rem; font-weight: 600; padding: 8px 12px; border-radius: 999px; opacity: .8; -webkit-tap-highlight-color: transparent; }
.nav-more summary::-webkit-details-marker { display: none; }
.nav-more summary::after { content: "▾"; margin-left: 6px; }
.nav-more[open] summary, .nav-more summary.is-current { opacity: 1; background: color-mix(in srgb, var(--on-bar) 16%, transparent); }
.nav-more-panel { position: absolute; top: calc(100% + 8px); right: 0; z-index: 40; display: grid; gap: 2px; min-width: 230px; padding: 8px; background: var(--bar); border: 1px solid color-mix(in srgb, var(--on-bar) 28%, transparent); border-radius: 18px; box-shadow: 0 20px 40px -16px rgba(0, 0, 0, .55); }
.nav-more-panel a { padding: 12px 14px; border-radius: 12px; font-size: 1rem; }
@media (max-width: 820px) {
  .nav .nav-wide { display: none; }
  /* Die Liste hinter „Mehr“ hängt an der ganzen Menüzeile, nicht am Wort: so bleibt sie immer im Bild */
  .nav:not(.nav-client) { position: relative; }
  .nav-more { display: block; position: static; }
  .nav-more-panel { left: 12px; right: 0; top: calc(100% + 4px); min-width: 0; }
  .nav:not(.nav-client) > a, .nav-more summary { padding: 11px 10px; }
  /* Zähler an der Ecke von „Nachrichten“: braucht keinen Platz in der Zeile */
  .nav:not(.nav-client) > a { position: relative; }
  .nav:not(.nav-client) .nav-count { position: absolute; top: 0; right: -4px; margin: 0; min-width: 18px; padding: 0 5px; line-height: 18px; box-shadow: 0 0 0 2px var(--bar); }
}
@media (max-width: 520px) {
  .nav:not(.nav-client) { margin-left: -8px; gap: 0 4px; }
  .nav:not(.nav-client) > a, .nav-more summary { padding-left: 8px; padding-right: 8px; }
  .nav-more-panel { left: 8px; }
}
@media (max-width: 340px) {
  .nav:not(.nav-client) { margin-left: -6px; gap: 0; }
  .nav:not(.nav-client) > a, .nav-more summary { padding-left: 6px; padding-right: 6px; font-size: .8125rem; }
}

/* Kundenseite mit Reitern (Coach am Handy): Statt einer langen Seite ist immer nur ein Bereich zu sehen. Ohne Skript:
   Sichtbar ist der Bereich, in dem das Sprungziel der Adresse liegt (#plan, #check-ins, #zugang …), sonst der Überblick.
   Deshalb landen auch Weiterleitungen nach dem Speichern im richtigen Bereich. Browser ohne :has() zeigen die lange Seite. */
.client-tabbar { display: none; }
@media (max-width: 820px) {
  @supports selector(:has(*)) {
    .client-page .jump { display: none; }
    .client-tabbar { display: flex; gap: 4px; position: sticky; top: env(safe-area-inset-top); z-index: 6; margin: 0 -16px 14px; padding: 8px 12px; background: var(--bg); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
    .client-tabbar::-webkit-scrollbar { display: none; }
    .client-tabbar a { flex: 1 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-size: .875rem; font-weight: 600; text-decoration: none; white-space: nowrap; -webkit-tap-highlight-color: transparent; }
    .client-tab { display: none; }
    .client-tab[data-tab="ueberblick"] { display: block; }
    .client-page:has(.client-tab :target) .client-tab { display: none; }
    .client-page:has(.client-tab :target) .client-tab:has(:target) { display: block; }
    .client-page:not(:has(.client-tab :target)) .client-tabbar a[data-tab="ueberblick"],
    .client-page:has(.client-tab[data-tab="ueberblick"] :target) .client-tabbar a[data-tab="ueberblick"],
    .client-page:has(.client-tab[data-tab="plan"] :target) .client-tabbar a[data-tab="plan"],
    .client-page:has(.client-tab[data-tab="fortschritt"] :target) .client-tabbar a[data-tab="fortschritt"],
    .client-page:has(.client-tab[data-tab="einstellungen"] :target) .client-tabbar a[data-tab="einstellungen"] { background: var(--plum); border-color: var(--plum); color: var(--on-plum); }
    .client-tab [id] { scroll-margin-top: 72px; }
    .client-tab > .group-title:first-child { margin-top: 6px; }
  }
}
.client-tabbar .badge { background: var(--warn-soft); color: var(--warn-ink); }

/* Listen zum Bearbeiten (Ziele, Messwerte, Check-in-Fragen, Übungen einer Einheit) am Handy: je Eintrag eine Zeile;
   Antippen öffnet das Formular dieses Eintrags (er ist dann das Sprungziel der Adresse), „Schließen“ klappt es wieder zu.
   Am Computer stehen wie bisher alle Formulare offen untereinander. */
.edit-row, .edit-close { display: none; }
@media (max-width: 820px) {
  .question-list li.edit-item { padding: 0; scroll-margin-top: 8px; }
  .edit-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; min-height: 60px; padding: 10px 0; color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
  .edit-row:active { background: var(--sand); }
  .edit-row-text { display: grid; gap: 1px; min-width: 0; overflow-wrap: anywhere; }
  .edit-row-text small { font-size: .875rem; }
  .edit-go { color: var(--muted); font-size: 1.3rem; line-height: 1; }
  .edit-item:not(:target) > form { display: none; }
  .question-list li.edit-item:target { padding-bottom: 18px; }
  .edit-item:target .edit-go { transform: rotate(90deg); }
  .edit-close { display: inline-flex; }
}

/* Übungsdatenbank: nach Muskelgruppe gegliedert; library.js filtert beim Tippen, „Anzeigen“ entfällt dann */
.lib-section { border-top: 1px solid var(--line); }
.lib-section[open] { padding-bottom: 16px; }
.lib-section-title { cursor: pointer; padding: 12px 0; font-size: 1rem; font-weight: 700; }
.lib-section-title .muted { margin-left: 6px; font-size: .875rem; font-weight: 400; }
.lib-filter.is-live .lib-filter-actions { display: none; }

/* Kennzahlen am Handy: zwei gleich breite Spalten, auch wenn ein Text lang ist (vier Kacheln beim Coach) */
@media (max-width: 520px) {
  .tiles { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tile .delta { white-space: normal; }
}

/* ---------- Startseite „Heute“: Begrüßung, Wochenleiste, nächster Schritt, Erfolge, Impuls des Coachs (src/Start.php) ---------- */
.start-card > :last-child { margin-bottom: 0; }
.start-card h1 { margin-bottom: .55em; }
.impulse { margin: 0 0 18px; padding: 12px 16px; background: var(--sand); border-left: 3px solid var(--focus); border-radius: 4px 14px 14px 4px; }
.impulse blockquote { margin: 0; font-family: var(--display); font-size: 1.1rem; line-height: 1.4; overflow-wrap: anywhere; }
.impulse figcaption { margin-top: .45em; font-size: .8rem; font-weight: 700; color: var(--muted); }
.week-strip { list-style: none; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; margin: 0 0 14px; padding: 0; }
.week-strip li { display: grid; justify-items: center; gap: 5px; font-size: .78rem; font-weight: 700; color: var(--muted); }
.week-strip-dot { display: grid; place-items: center; width: 36px; height: 36px; border: 2px solid var(--axis); border-radius: 50%; background: var(--bg); font-size: 1rem; line-height: 1; }
.week-strip .is-future .week-strip-dot { border-style: dashed; background: transparent; }
.week-strip .is-today { color: var(--ink); }
.week-strip .is-today .week-strip-dot { border-color: var(--ink); }
.week-strip .is-done .week-strip-dot { border-color: var(--good); background: var(--good); color: var(--surface); }
.start-line { margin: 0 0 14px; font-weight: 600; }
.start-line.is-reached { color: var(--good); }
/* Satz zur Woche und daneben der Weg zur Wochenansicht (nur wenn die Karte „Heute abhaken“ fehlt) */
.start-week { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; margin: 0 0 14px; }
.start-week .start-line { margin: 0; }
.start-hint { margin: 8px 0 0; font-size: .85rem; color: var(--muted); text-align: center; }
.start-done { margin: 0; padding: 12px 16px; border-radius: 14px; background: var(--olive-soft); font-weight: 600; }
/* Training außerhalb des Plans: für heute abhaken oder das Häkchen wieder entfernen – bewusst leise, der Plan ist der Hauptweg */
.start-alt { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 0 8px; margin: 4px 0 0; font-size: .85rem; color: var(--muted); text-align: center; }
.start-alt-button { min-height: 44px; padding: 4px 0; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.wins { list-style: none; display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0; padding: 0; }
.wins li { display: grid; align-content: start; gap: 2px; padding: 12px 14px; border-radius: 14px; background: var(--sand); min-width: 0; overflow-wrap: anywhere; }
.win-value { font-family: var(--display); font-weight: 400; font-size: 1.45rem; line-height: 1.2; }
.win-text { font-size: .85rem; color: var(--muted); }
/* Coach: der Impuls ist eine Zeile – Feld und Knopf nebeneinander */
.impulse-edit .field small { font-weight: 400; color: var(--muted); }
.impulse-row { display: flex; gap: 8px; margin-top: 6px; }
.impulse-row input { flex: 1; min-width: 0; }
.impulse-edit .hint { margin-top: 10px; }
@media (max-width: 520px) {
  .impulse-row { flex-direction: column; }
  .wins { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .wins li:first-child:nth-last-child(odd) { grid-column: 1 / -1; }
}
