/* Aurora body data. Shared tokens and shell; no styles for other areas. */
.app-main .body-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.app-main .body-card {
  --card-ink: var(--accent);
  --card-tint: var(--tint);
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--round);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  text-decoration: none;
  color: var(--ink);
  transition:
    border-color var(--t-fast),
    box-shadow var(--t-fast);
}
.app-main .body-card--waist {
  --card-ink: var(--carbs-ink);
  --card-tint: var(--recipe-tint);
}
.body-card__label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: var(--text-xs);
  font-weight: 700;
  min-height: 28px;
}
.body-card__icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--card-tint);
  color: var(--card-ink);
}
.body-card__icon svg {
  width: 18px;
  height: 18px;
}
.body-card__value {
  font-size: var(--text-27);
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.8px;
  white-space: nowrap;
}
.body-card__value > span:not(.body-card__empty) {
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: 0;
  margin-left: 5px;
  color: var(--muted);
}
/* Leerer Zustand: ein leichter Strich statt einer Zahl, und die Karte darf
   kürzer sein als ihre gefüllte Nachbarin (align-items: start im Raster). */
.app-main .body-cards {
  align-items: start;
}
.app-main .body-card.is-empty {
  gap: 6px;
}
.body-card.is-empty .body-card__value {
  line-height: 0.2;
}
.body-card__value .body-card__empty {
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--muted);
}
.body-card__meta {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: var(--text-2xs);
  line-height: 1.5;
  color: var(--muted);
}
.body-card__meta strong {
  align-self: flex-start;
  background: var(--card-tint);
  color: var(--card-ink);
  border-radius: var(--radius-xs);
  padding: 3px 7px;
  font-weight: 650;
}
.body-card__meta small {
  font-size: inherit;
}
/* ---------------------------------------------------------------- page frame
   Konzept 1 (25.10.2026): der Bereich steht auf Weiß -- nur dieser Bereich,
   der Hintergrund-Token der übrigen Module bleibt. Kopfleiste und Fußleiste
   nehmen auf dieser Seite dieselbe Fläche. */
body.body-page {
  background: var(--surface);
}
.body-page .app-header {
  background: var(--surface);
}
.body-page .app-container {
  gap: 18px;
}
.body-page .body-add {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  width: 44px;
  height: 44px;
}
.body-page .page-heading {
  align-items: center;
  min-height: 44px;
}

/* Schlichte obere Subnavigation, keine Reiter: zwei Links, die aktive
   Ansicht unterstrichen, rechts der Sprung zu den Diagrammen. Sie klebt
   unter der Kopfleiste und zieht sich über die Seitenränder, damit ihre
   Linie wie die der Kopfleiste durchläuft. ``--body-subnav-h`` kennen auch
   der Tabellenkopf des Verlaufs und die Rollziele. */
.body-page {
  --body-subnav-h: 45px;
}
.body-page .body-subnav {
  position: sticky;
  top: calc(var(--app-header-h) + var(--safe-top));
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: var(--body-subnav-h);
  margin: -22px calc(-1 * max(var(--page-gutter), var(--safe-right))) 0 calc(-1 * max(var(--page-gutter), var(--safe-left)));
  padding: 0 max(var(--page-gutter), var(--safe-right)) 0 max(var(--page-gutter), var(--safe-left));
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.body-subnav > a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-size: var(--text-sm);
  font-weight: 650;
  line-height: 1.4;
  color: var(--muted);
  text-decoration: none;
}
.body-subnav > a[aria-current="page"] {
  color: var(--accent);
  font-weight: 750;
}
.body-subnav > a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
}
.body-subnav__shortcut {
  margin-left: auto;
  font-size: var(--text-xs);
  font-weight: 600;
}

/* Ohne geltendes Ziel: die Einladung unter dem Titel, vor der Heute-Messung
   (Konzeptnachtrag 25.10.2026). Getönte Fläche im Akzent, ganze Fläche tippbar. */
.body-goal-invitation {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 64px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--tint);
  color: var(--accent);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.body-goal-invitation__icon {
  display: inline-grid;
  place-items: center;
  flex: none;
}
.body-goal-invitation__icon svg {
  width: 22px;
  height: 22px;
}
.body-goal-invitation__body {
  flex: 1;
  min-width: 0;
}
.body-goal-invitation strong {
  display: block;
  font-size: var(--text-sm);
  font-weight: 750;
  line-height: 1.5;
}
.body-goal-invitation small {
  display: block;
  margin-top: 2px;
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--muted);
}
.body-goal-invitation > svg {
  width: 15px;
  height: 15px;
  flex: none;
}

/* ---------------------------------------------------------------- today */
.body-page .body-today {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--round);
  padding: 16px;
}
.body-today__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.body-today__head h2 {
  font-size: var(--text-md);
}
.body-today__head > span {
  font-size: var(--text-xs);
  color: var(--muted);
}
.body-today-logged {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  text-decoration: none;
  color: var(--ink);
}
.body-today-logged strong {
  display: block;
  color: var(--muted);
  font-size: var(--text-2xs);
  font-weight: 650;
}
.body-today-logged small {
  display: block;
  margin-top: 4px;
  font-size: var(--text-sm);
  font-variant-numeric: tabular-nums;
}
.body-today-logged > span:last-child {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: var(--text-xs);
  font-weight: 700;
  color: var(--accent);
}
.body-today-logged svg {
  width: 13px;
  height: 13px;
}
.body-field + .body-field {
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: 12px;
}
.body-field__head {
  display: flex;
  align-items: center;
  gap: 6px;
}
.body-field__head label {
  flex: 1;
  margin: 0;
  font-size: var(--text-sm);
  font-weight: 650;
}
.body-page .app-main .form-field.body-field .body-field__head input[type="number"] {
  width: 110px;
  min-width: 0;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  padding: 3px;
  background: transparent;
  text-align: right;
  font-size: var(--text-2xl);
  letter-spacing: -0.7px;
  font-weight: 750;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  appearance: textfield;
}
.body-field__head input::-webkit-inner-spin-button,
.body-field__head input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}
.body-page .app-main .form-field.body-field .body-field__head input[type="number"]:focus {
  background: var(--bg);
  border-color: var(--line);
}
.body-field__head > span {
  font-size: var(--text-xs);
  color: var(--muted);
  min-width: 19px;
  text-align: right;
}
.body-form-hint {
  font-size: var(--text-sm);
  line-height: 1.8;
  color: var(--muted);
  margin: 0;
}
.body-today .body-form-hint {
  text-align: center;
  font-size: var(--text-2xs);
  margin: 12px 0 14px;
}
.body-today .btn {
  min-height: 44px;
  font-size: var(--text-sm);
}

/* ---------------------------------------------------------- Ø 3 / 7 / 14
   Offene Abschnitte: Titelstrich im Akzent, Info direkt am Titel, darunter
   die beiden Messgrößen nebeneinander mit Durchschnitt, Richtungspfeil und
   Betrag. Kein Datum, keine Minikurve, keine Flächen. Die feine Linie
   zwischen den Spalten gehört zur Referenz; senkrechte Linien sind nur in
   der Verlaufstabelle verworfen. */
.body-periods {
  display: grid;
  gap: 11px;
}
.body-period {
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.body-period:first-child {
  border-top: 0;
  padding-top: 0;
}
.body-period__head {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 28px;
}
.body-period__title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: var(--text-2xs);
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  white-space: nowrap;
}
.body-period__title::before {
  content: "";
  width: 3px;
  height: 13px;
  border-radius: 3px;
  background: var(--accent);
  flex: none;
}
.body-info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--muted);
  background: none;
  border: 0;
  border-radius: var(--radius-xs);
  position: relative;
  cursor: pointer;
}
/* Sichtbar klein, berührbar 44 × 44. */
.body-info::before {
  content: "";
  position: absolute;
  inset: -8px;
}
.body-info svg {
  width: 16px;
  height: 16px;
}
.body-period__readings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding-top: 7px;
}
.body-reading {
  display: flex;
  flex-direction: column;
  gap: 5px;
  align-items: flex-start;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.body-reading + .body-reading {
  border-left: 1px solid var(--line);
  padding-left: 16px;
}
.body-reading__label {
  font-size: var(--text-2xs);
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}
.body-reading__value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: -0.5px;
  color: var(--ink);
}
.body-reading__value small {
  font-size: var(--text-2xs);
  font-weight: 400;
  letter-spacing: 0;
  color: var(--muted);
}
.body-reading.is-missing .body-reading__value {
  color: var(--text-subtle);
}
.body-reading__change {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 16px;
  font-size: var(--text-xs);
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  color: var(--accent);
}
.body-reading--waist .body-reading__change {
  color: var(--carbs-ink);
}
.body-reading__change.is-missing {
  color: var(--muted);
}
.body-reading__change svg {
  width: 13px;
  height: 13px;
}

/* --------------------------------------------------------- empty states */
.body-empty {
  border: 1px dashed var(--border-strong);
  border-radius: 15px;
  background: var(--surface);
  text-align: center;
  padding: 18px 14px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.8;
}
.body-empty > svg {
  width: 24px;
  height: 24px;
  color: var(--accent);
  margin-bottom: 8px;
}
.body-empty strong {
  display: block;
  color: var(--ink);
  font-size: var(--text-sm);
  font-weight: 750;
}
.body-empty p {
  margin: 7px 0 0;
  font-size: var(--text-xs);
}
.body-empty .body-text-button {
  margin-top: 4px;
}
.body-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 6px 8px;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  font: inherit;
  font-size: var(--text-xs);
  font-weight: 750;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.body-text-button--quiet {
  font-weight: 600;
  color: var(--muted);
}

/* ---------------------------------------------------------------- charts
   Beide Graphen offen auf Weiß, ohne Karte, ohne Rahmen; eine Linie trennt
   den zweiten vom ersten. Der Zeitraum gilt für beide. */
.body-charts {
  scroll-margin-top: calc(var(--app-header-h) + var(--safe-top) + var(--body-subnav-h) + 8px);
}
.body-charts__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 40px;
  margin-bottom: 6px;
}
.body-charts__head h2 {
  margin: 0;
  font-size: var(--text-lg);
  font-weight: 750;
  letter-spacing: -0.3px;
}
.body-chart {
  padding: 0 0 18px;
}
.body-chart + .body-chart {
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.body-chart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  margin-bottom: 4px;
}
.body-chart__name {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  font-size: var(--text-md);
  font-weight: 750;
}
.body-chart__name svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
/* Das Auge wie bei einem Passwortfeld: offen heißt eingeblendet. */
.body-goal-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 4px 4px 4px 8px;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  font: inherit;
  font-size: var(--text-2xs);
  font-weight: 650;
  color: var(--muted);
  cursor: pointer;
}
.body-goal-toggle[aria-pressed="true"] {
  color: var(--carbs-ink);
}
.body-goal-toggle:disabled {
  opacity: 0.4;
  cursor: default;
}
.body-goal-toggle__icon {
  display: inline-grid;
  place-items: center;
}
.body-goal-toggle__icon svg {
  width: 20px;
  height: 20px;
}
.body-chart__target {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  background: var(--recipe-tint);
  padding: 10px 12px;
  margin: 9px 0 14px;
  border-radius: var(--radius-md);
}
.body-chart__target strong {
  display: block;
  color: var(--carbs-ink);
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.5;
}
.body-chart__target small {
  display: block;
  color: var(--muted);
  font-size: var(--text-2xs);
  margin-top: 3px;
  line-height: 1.5;
}
.body-chart__target button {
  min-height: 44px;
  padding: 4px 0;
  font-size: var(--text-xs);
  color: var(--carbs-ink);
  font-weight: 700;
  background: none;
  border: 0;
  white-space: nowrap;
  cursor: pointer;
}
.body-chart__periods {
  display: flex;
  gap: 1px;
  flex: none;
}
.body-chart__periods button {
  font: inherit;
  font-size: var(--text-2xs);
  font-weight: 500;
  color: var(--muted);
  border: 0;
  background: none;
  min-height: 40px;
  padding: 6px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
}
.body-chart__periods button[aria-pressed="true"] {
  background: var(--bg);
  color: var(--ink);
  font-weight: 750;
}
.body-chart__plot {
  position: relative;
  min-height: 150px;
  touch-action: pan-y;
  user-select: none;
  cursor: crosshair;
}
.app-main .body-chart__plot svg {
  width: 100%;
  height: auto;
  fill: none;
  stroke: none;
  stroke-width: 0;
  overflow: visible;
  font-family: var(--font-sans);
}
.body-chart__plot svg * {
  vector-effect: non-scaling-stroke;
}
.body-chart__grid {
  stroke: var(--line);
  stroke-width: 1;
}
.body-chart__raw {
  stroke: var(--muted);
  stroke-width: 1.15;
  stroke-opacity: 0.45;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.body-chart__avg {
  stroke: var(--accent);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.body-chart__goal {
  stroke: var(--carbs-ink);
  stroke-width: 1.3;
  stroke-dasharray: 5 4;
  opacity: 0.8;
}
.body-chart__goal-change {
  fill: var(--surface);
  stroke: var(--carbs-ink);
  stroke-width: 1.3;
}
.body-chart__lone {
  stroke-width: 2;
}
.body-chart__interp {
  fill: var(--surface);
  stroke: var(--muted);
  stroke-width: 1.2;
}
.body-chart__last {
  fill: var(--accent);
}
.body-chart__label {
  fill: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}
.body-chart__label--avg {
  fill: var(--accent);
  font-weight: 700;
}
.body-chart__marker {
  stroke: var(--muted);
  stroke-width: 1;
  opacity: 0.6;
}
.body-chart__pick {
  fill: var(--ink);
  stroke: var(--surface);
  stroke-width: 1;
}
.body-chart__pick--avg {
  fill: var(--accent);
}
.body-chart__pick.is-interpolated {
  fill: var(--surface);
  stroke: var(--muted);
}
.body-chart__empty {
  fill: var(--muted);
  font-size: 12px;
}
.body-chart__tooltip rect {
  fill: var(--surface);
  stroke: var(--line);
  stroke-width: 1;
  filter: drop-shadow(0 2px 4px #20273914);
}
.body-chart__tooltip text {
  font-size: 10px;
  fill: var(--muted);
  font-variant-numeric: tabular-nums;
}
.body-chart__tooltip .body-chart__tooltip-value {
  font-size: 12px;
  fill: var(--ink);
}
.body-chart__tooltip .body-chart__tooltip-avg {
  fill: var(--accent);
  font-weight: 700;
}
.body-chart__tooltip .body-chart__tooltip-goal {
  fill: var(--carbs-ink);
}
.body-chart__legend {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 7px 11px;
  font-size: var(--text-2xs);
  color: var(--muted);
  margin-top: 12px;
}
.body-chart__legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.body-chart__legend i {
  width: 14px;
  border-top: 2px solid var(--accent);
}
.body-chart__legend i.is-raw {
  border-top: 1px solid var(--muted);
  opacity: 0.6;
}
.body-chart__legend i.is-goal {
  border-top: 1.5px dashed var(--carbs-ink);
}
.body-chart__events {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 30px;
  margin-top: 7px;
  font-size: var(--text-2xs);
  color: var(--muted);
}
.body-chart__events-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.body-chart__events button {
  position: relative;
  min-height: 28px;
  padding: 4px 7px;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  font: inherit;
  font-size: var(--text-2xs);
  font-weight: 600;
  color: var(--carbs-ink);
  cursor: pointer;
}
.body-chart__events button::before {
  content: "";
  position: absolute;
  inset: -8px 0;
}
.body-chart__legend i.is-estimated {
  width: 6px;
  height: 6px;
  border: 1px solid var(--muted);
  border-radius: 50%;
}
.body-chart__detail {
  border-top: 1px solid var(--line);
  padding-top: 11px;
  margin-top: 14px;
  min-height: 48px;
  font-size: var(--text-2xs);
  line-height: 1.7;
  color: var(--muted);
}
/* --------------------------------------------------------------- history
   Eine offene Tabelle über die Inhaltsbreite: kein Kasten, keine senkrechten
   Linien, der Kopf bleibt unter Kopfleiste und Subnavigation stehen. */
.body-history__intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: -8px;
  min-height: 40px;
}
.body-history__intro p {
  margin: 0;
  font-size: var(--text-xs);
  color: var(--muted);
}
.body-history__intro .body-text-button {
  padding-right: 0;
}
/* Die Löschfläche einer Zeile liegt rechts außerhalb der Tabelle. ``clip``
   statt ``hidden``: ``hidden`` machte den Rahmen zum Rollcontainer, und der
   feste Tabellenkopf klebte dann an ihm statt am Fenster. ``clip`` schneidet
   nur und lässt die Seite nicht quer rollen. */
.body-history__table {
  overflow-x: clip;
}
.body-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.body-table th,
.body-table td {
  padding: 12px 3px;
  text-align: right;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  font-size: var(--text-sm);
  white-space: nowrap;
  letter-spacing: -0.2px;
}
.body-table th:first-child {
  text-align: left;
  padding-left: 0;
}
.body-table th:last-child,
.body-table td:last-child {
  padding-right: 0;
}
.body-table thead th {
  position: sticky;
  top: calc(var(--app-header-h) + var(--safe-top) + var(--body-subnav-h));
  z-index: 2;
  background: var(--surface);
  font-size: var(--text-2xs);
  font-weight: 650;
  color: var(--muted);
  padding-block: 14px;
}
/* Speichern, Löschen und der Wechsel zurück in den Verlauf kehren auf eine
   Zeile zurück (``#tag-…``, ``#ziel-…``, ``#luecke-…``); sie darf dabei nicht
   unter Kopfleiste, Subnavigation und Tabellenkopf liegen. */
.body-table__day,
.body-table__goal,
.body-table__gap {
  scroll-margin-top: calc(var(--app-header-h) + var(--safe-top) + var(--body-subnav-h) + 52px);
}
.body-table thead th:nth-child(3),
.body-table thead th:nth-child(5),
.body-table__avg {
  color: var(--accent);
  font-weight: 650;
}
.body-table tbody tr:last-child > * {
  border-bottom: 0;
}
.body-table__day {
  --row-bg: var(--surface);
  --row-swipe-x: 0px;
  clip-path: inset(0 round 8px);
  touch-action: pan-y;
  cursor: pointer;
}
.body-table__day > th,
.body-table__day > td {
  position: relative;
  /* Hier und nicht am ``tr``: touch-action gilt nicht für Tabellenzeilen. */
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background: var(--row-bg);
  transform: translateX(var(--row-swipe-x));
  transition:
    transform 180ms var(--ease),
    background var(--t-fast);
}
.body-table__day.is-today {
  --row-bg: var(--bg);
}
.body-table__day.is-swiping > * {
  transition: none;
}
.body-table__day th a {
  display: block;
  position: relative;
  color: var(--muted);
  font-size: var(--text-xs);
  font-weight: 500;
  text-decoration: none;
  padding-block: 4px;
  white-space: nowrap;
}
.body-table__day th a:before {
  content: "";
  position: absolute;
  inset: -8px 0;
}
.body-table__day.is-today th a {
  color: var(--ink);
  font-weight: 700;
}
.body-table .is-missing,
.body-table .is-interpolated {
  color: var(--muted);
  font-weight: 400;
}
.body-estimate-mark {
  display: inline-block;
  width: 5px;
  height: 5px;
  border: 1px solid currentColor;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 3px;
}
.body-table__delete {
  position: absolute;
  inset: 0 auto 0 100%;
  width: 68px;
  background: var(--danger);
  color: #fff !important;
  font-size: var(--text-2xs);
  text-decoration: none;
  visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.body-table__day.is-open .body-table__delete,
.body-table__day.is-swiping .body-table__delete {
  visibility: visible;
}
.body-table__delete svg {
  width: 19px;
  height: 19px;
}
.body-table__goal td {
  text-align: left;
  white-space: normal;
  padding: 8px 0;
}
.body-table__goal-card {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 62px;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  background: var(--recipe-tint);
  color: var(--carbs-ink);
  text-decoration: none;
}
.body-table__goal-card > svg {
  width: 18px;
  height: 18px;
  flex: none;
}
.body-table__goal-card > svg:last-child {
  margin-left: auto;
  color: var(--muted);
}
.body-table__goal-card > span {
  flex: 1;
  min-width: 0;
}
.body-table__goal strong,
.body-table__goal small {
  display: block;
  font-size: var(--text-xs);
}
.body-table__goal strong {
  font-weight: 650;
  line-height: 1.5;
}
.body-table__goal small {
  color: var(--muted);
  font-size: var(--text-2xs);
  margin-top: 2px;
  line-height: 1.6;
}
.body-table__gap td {
  text-align: center;
  white-space: normal;
  color: var(--muted);
  font-size: var(--text-xs);
  padding: 16px 2px;
}
.body-table-key {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 30px;
  margin: 10px 2px 0;
  font-size: var(--text-2xs);
  line-height: 1.5;
  color: var(--muted);
}
.body-table-key > span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}
.body-table-key .body-info {
  margin-left: auto;
}
.body-history-more {
  overflow-anchor: none;
  margin-top: 6px;
  text-align: center;
}
.body-history-more__count {
  margin: 10px 0 0;
  font-size: var(--text-2xs);
  color: var(--muted);
}
.body-history-more__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 6px;
  border-radius: var(--radius-xs);
  color: var(--accent);
  font-size: var(--text-xs);
  font-weight: 550;
  text-decoration: none;
}
.body-history-more__link svg {
  width: 13px;
  height: 13px;
}
.body-history-more__link[aria-busy="true"] {
  opacity: 0.5;
  pointer-events: none;
}
.body-history-more__end {
  margin: 0;
  padding: 5px 0 10px;
  font-size: var(--text-2xs);
  line-height: 1.8;
  color: var(--muted);
}
.body-history-more__error {
  margin: 6px 0 0;
  font-size: var(--text-xs);
  line-height: 1.6;
  color: var(--danger);
}
.body-help__metric {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 4px 0 0;
  font-size: var(--text-sm);
  font-weight: 750;
}
.body-help__metric svg {
  width: 16px;
  height: 16px;
  color: var(--accent);
}
.body-help__window {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 12px;
  font-size: var(--text-xs);
  line-height: 1.8;
  color: var(--muted);
}
.body-help__window strong {
  display: block;
  color: var(--ink);
  font-weight: 750;
}
.body-help__window span {
  display: block;
}
.body-help__window .body-help__change {
  margin: 8px 0;
  color: var(--ink);
}
.body-help__rule {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}
.body-sheet {
  max-width: 430px;
}
.body-sheet .sheet__head .icon-button {
  width: 40px;
  height: 40px;
  background: var(--bg);
  border: 0;
  color: var(--muted);
}
/* Enger als die übrigen Bögen: Kopf, Inhalt und Knöpfe müssen auf kleinen
   Telefonen in die Höhe eines Dialogs passen, sonst rutscht der Löschen-Link
   unter den Rand. */
.body-sheet .sheet__head {
  padding: 14px 20px 4px;
}
.body-sheet .sheet__content {
  padding: 4px 20px 12px;
  gap: 12px;
}
.body-sheet .sheet__actions {
  padding: 14px 20px 7px;
  display: grid;
  gap: 4px;
}
.body-sheet .sheet__actions > .btn {
  min-height: 48px;
  font-size: var(--text-sm);
}
.body-sheet .sheet__actions > .btn--primary {
  grid-row: 1;
}
.body-sheet .sheet__actions > .btn--secondary {
  border: 0;
  background: none;
  color: var(--muted);
}
.body-goal-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.body-goal-help {
  background: var(--bg);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
}
.body-delete-link {
  display: block;
  margin: 0 20px;
  padding-top: 8px;
  min-height: 44px;
  text-align: center;
  color: var(--danger);
  font-weight: 650;
  font-size: var(--text-sm);
  text-decoration: none;
}
.body-sheet .body-delete-actions {
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.body-delete-summary strong {
  font-size: var(--text-md);
}
.body-delete-summary p {
  font-size: var(--text-sm);
  color: var(--muted);
  line-height: 1.7;
  margin: 6px 0 0;
}
.body-sheet[open] {
  animation: body-sheet-in 200ms var(--ease-out);
}
@keyframes body-sheet-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (hover: hover) {
  .app-main .body-card:hover {
    border-color: var(--card-ink);
    box-shadow: var(--shadow-sm);
  }
  .body-table__day:hover {
    --row-bg: var(--bg);
  }
  .body-history-more__link:hover,
  .body-chart__events button:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
  }
  .body-goal-toggle:not(:disabled):hover {
    background: var(--bg);
  }
}
@media (max-width: 350px) {
  .app-main .body-cards {
    gap: 10px;
  }
  .app-main .body-card {
    padding: 12px 10px;
  }
  .body-card__value {
    font-size: 25px;
  }
  .body-card__label {
    font-size: var(--text-2xs);
  }
  .body-card__icon {
    width: 24px;
    height: 24px;
  }
  .body-page .body-subnav {
    gap: 20px;
  }
  .body-subnav > a {
    font-size: var(--text-xs);
  }
  .body-subnav__shortcut {
    font-size: var(--text-2xs);
  }
  .body-period__readings {
    gap: 12px;
  }
  .body-reading + .body-reading {
    padding-left: 12px;
  }
  .body-reading__value {
    font-size: 21px;
  }
  .body-reading__label {
    letter-spacing: 0.06em;
  }
  .body-chart__target {
    padding-inline: 10px;
  }
  .body-chart__target strong {
    font-size: var(--text-xs);
  }
  .body-chart__target button {
    font-size: var(--text-2xs);
  }
  .body-table th,
  .body-table td,
  .body-table__day th a {
    font-size: var(--text-2xs);
    padding-inline: 2px;
  }
  .body-table th:first-child {
    padding-left: 0;
  }
  .body-table th:last-child,
  .body-table td:last-child {
    padding-right: 0;
  }
  .body-goal-fields {
    gap: 8px;
  }
  .body-page .app-main .form-field.body-field .body-field__head input[type="number"] {
    width: 94px;
  }
  .body-chart__periods button {
    padding-inline: 6px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .body-page *,
  .body-card {
    animation: none !important;
    transition: none !important;
  }
}

.body-ruler {
  position: relative;
  height: 58px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  overflow: hidden;
}

/* Die Nadel steht fest in der Mitte; die Skala läuft darunter durch. */
.body-ruler::after {
  content: "";
  position: absolute;
  top: 6px;
  bottom: 6px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  border-radius: 1px;
  background: var(--accent);
  pointer-events: none;
}

.body-ruler__track {
  height: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  touch-action: pan-x;
  overscroll-behavior-x: contain;
  cursor: grab;
}

.body-ruler__track::-webkit-scrollbar {
  display: none;
}

.body-ruler__content {
  display: flex;
  height: 100%;
}

.body-ruler__spacer {
  flex: 0 0 auto;
}

/* Striche alle 0,05, halbe Einheit länger, ganze Einheit am längsten. Die
   Teilung (``--tick``) setzt das Skript; sie ist der Abstand eines Schritts. */
.body-ruler__scale {
  position: relative;
  flex: 0 0 auto;
  height: 100%;
  --tick: 8px;
  background-image: linear-gradient(to right, var(--muted) 1px, transparent 1px), linear-gradient(to right, var(--muted) 1px, transparent 1px), linear-gradient(to right, var(--border-strong) 1px, transparent 1px);
  background-size:
    calc(var(--tick) * 20) 22px,
    calc(var(--tick) * 10) 15px,
    var(--tick) 9px;
  background-repeat: repeat-x;
  background-position: 0 100%;
}

.body-ruler__scale span {
  position: absolute;
  top: 7px;
  transform: translateX(-50%);
  font-size: 11px;
  font-weight: 650;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  .body-ruler__track {
    scroll-behavior: auto;
  }
}

/* Use the existing ruler engine with the quieter concept presentation. */
.body-ruler {
  height: 49px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.body-ruler::after {
  top: 4px;
  bottom: 16px;
}
.body-ruler__scale {
  background-position: 0 6px;
  background-size:
    calc(var(--tick) * 20) 22px,
    calc(var(--tick) * 10) 15px,
    var(--tick) 9px;
}
.body-ruler__scale span {
  top: auto;
  bottom: 0;
  font-size: 10px;
  font-weight: 500;
}

.body-ruler-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  align-items: center;
  gap: 4px;
}
.body-ruler-row:has(.body-ruler[hidden]) {
  display: none;
}
.body-ruler-step {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--bg);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.body-ruler-step:active {
  background: var(--tint);
  color: var(--accent);
}

.body-delete-link--button {
  width: 100%;
  background: none;
  border: 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  font-size: var(--text-sm);
}
