:root {
  /* Warme Beige-Palette wie in der WebDev- und Umschulungs-Lernapp */
  color-scheme: light dark;
  --bg: #faf7f2;
  --bg-card: #ffffff;
  --hero: #f3e8d8;
  --accent: #b45309;
  --on-accent: #ffffff;
  --text: #211a12;
  --text-dim: #6b6255;
  --border: #e8e1d6;
  --overlay: rgba(33, 26, 18, 0.45);
  --short: #15803d;
  --day: #a16207;
  --long: #be123c;
  --warn: #a16207;
  --danger: #dc2626;
  --t-goat: #8b7cf6;
  --t-peak: #60a5fa;
  --t-fire: #f87171;
  --t-good: #84cc16;
  --t-meh: #a8a29e;
  --t-wtf: #f472b6;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --bg-card: #221d16;
    --hero: #2c2419;
    --accent: #fbbf24;
    --on-accent: #1c1409;
    --text: #f3ede4;
    --text-dim: #a89f92;
    --border: #362f26;
    --overlay: rgba(8, 6, 4, 0.72);
    --short: #4ade80;
    --day: #fbbf24;
    --long: #fb7185;
    --warn: #fbbf24;
    --danger: #f87171;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.25rem 0.75rem;
  max-width: 640px;
  margin: 0 auto;
}

header h1 {
  font-size: 1.4rem;
  margin: 0;
  cursor: pointer;
}

.lang-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.lang-toggle button {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.lang-toggle button.active {
  background: var(--accent);
  color: var(--on-accent);
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 0.5rem 1.25rem 3rem;
}

.subtitle {
  color: var(--text-dim);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.card {
  display: block;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem 1.1rem;
  margin-bottom: 0.85rem;
  text-decoration: none;
  color: var(--text);
}

.card h2 {
  font-size: 1.05rem;
  margin: 0 0 0.4rem;
}

.card .meta {
  color: var(--text-dim);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
}

.progress-bar {
  height: 5px;
  border-radius: 999px;
  background: var(--border);
  margin-top: 0.6rem;
  overflow: hidden;
}

.progress-bar > div {
  height: 100%;
  background: var(--accent);
}

.back-link {
  display: inline-block;
  color: var(--text-dim);
  text-decoration: none;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.list-title {
  font-size: 1.3rem;
  margin: 0 0 0.25rem;
}

.list-source {
  color: var(--text-dim);
  font-size: 0.8rem;
  margin: 0 0 1.25rem;
}

.list-source a {
  color: var(--accent);
}

.item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.6rem;
  cursor: pointer;
}

.item input[type="checkbox"] {
  margin-top: 0.2rem;
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.item span {
  line-height: 1.4;
}

.item.done span {
  color: var(--text-dim);
  text-decoration: line-through;
}

.empty {
  color: var(--text-dim);
  text-align: center;
  margin-top: 3rem;
}

.section-heading {
  color: var(--text-dim);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.5rem 0 0.6rem;
}

/* ---- Tabs Solo / Gruppe ---- */

.tabs {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 1rem;
}

.tabs button {
  flex: 1;
  min-height: 44px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.tabs button[aria-selected="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

/* ---- Hero mit Würfel-Button ---- */

.hero {
  background: var(--hero);
  border: 1px solid var(--accent);
  border-radius: 18px;
  padding: 1.5rem 1.2rem 1.1rem;
  margin-bottom: 1rem;
}

.roll-btn {
  width: 100%;
  min-height: 64px;
  border: none;
  border-radius: 14px;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.roll-btn:active { transform: scale(0.97); }

.hero-progress {
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0.9rem 0 0;
}

/* ---- Eigene Dinge eintragen ---- */

.add-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.add-form input {
  flex: 1 1 100%;
  min-width: 0;
  min-height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0 0.8rem;
  font-size: 16px;
}

.add-form select {
  flex: 1;
  min-height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0 0.6rem;
  font-size: 16px;
}

.add-form input:focus,
.add-form select:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.add-form button,
button.primary,
button.secondary {
  min-height: 44px;
  border-radius: 10px;
  padding: 0 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
}

.add-form button,
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.add-note {
  min-height: 1.2em;
  color: var(--text-dim);
  font-size: 0.85rem;
  margin: 0.4rem 0 0;
}

.home-links {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
}

.home-links a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.6rem 0;
}

.home-links a:hover { color: var(--text); }

/* ---- Labels ---- */

.ding-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
}

.ding-tag {
  color: var(--accent);
  font-size: 0.8rem;
}

.size, .mode-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-dim);
  vertical-align: middle;
}

.size-short { color: var(--short); border-color: color-mix(in srgb, var(--short) 40%, transparent); }
.size-day { color: var(--day); border-color: color-mix(in srgb, var(--day) 40%, transparent); }
.size-long { color: var(--long); border-color: color-mix(in srgb, var(--long) 40%, transparent); }

.skip-badge {
  color: var(--warn);
  font-size: 0.8rem;
  margin: -0.6rem 0 1rem;
}

/* ---- Ein-Ding-Karte ---- */

.ding-modal {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 50;
}

.ding-modal.hidden { display: none; }

.ding-card {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 1px solid var(--accent);
  border-radius: 18px;
  padding: 2.2rem 1.3rem 1.3rem;
  text-align: center;
  overflow: hidden;
  animation: ding-pop 0.2s ease;
}

@keyframes ding-pop {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.ding-close {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.1rem;
  cursor: pointer;
}

.ding-text {
  font-size: 1.25rem;
  line-height: 1.45;
  margin: 0.9rem 0 1.4rem;
}

.ding-sub {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin: -0.6rem 0 1.2rem;
}

.ding-actions {
  display: flex;
  gap: 0.6rem;
}

.ding-actions button { flex: 1; }

.share-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 0.6rem;
  border-radius: 10px;
  border: 1px dashed var(--accent);
  background: transparent;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}

.confetti-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -10px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation-name: confetti-fall;
  animation-timing-function: ease-in;
  animation-fill-mode: forwards;
}

@keyframes confetti-fall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to { transform: translateY(220px) rotate(340deg); opacity: 0; }
}

/* ---- Läuft gerade ---- */

.running {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  margin-bottom: 0.6rem;
}

.running .ding-meta { justify-content: flex-start; }

.running p {
  margin: 0.4rem 0 0.8rem;
  line-height: 1.4;
}

.running-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.running-actions button { flex: 1 1 auto; }

/* ---- Listen / Archiv ---- */

.muted {
  color: var(--text-dim);
  font-size: 0.9rem;
}

.item span { flex: 1; }

.delete-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  margin: -0.6rem -0.8rem -0.6rem 0;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
}

.delete-btn:hover { color: var(--danger); }

.archive-row {
  display: flex;
  gap: 1rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--border);
}

.archive-date {
  flex-shrink: 0;
  width: 5.5rem;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  padding-top: 0.1rem;
}

.archive-row p {
  margin: 0 0 0.2rem;
  line-height: 1.4;
}

button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---- Filme: Rangliste ---- */

.ranking-link {
  display: block;
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}

.tier-goat { --tier: var(--t-goat); }
.tier-peak { --tier: var(--t-peak); }
.tier-fire { --tier: var(--t-fire); }
.tier-good { --tier: var(--t-good); }
.tier-meh { --tier: var(--t-meh); }
.tier-wtf { --tier: var(--t-wtf); }
.tier-none { --tier: var(--border); }

.tier-row {
  margin: 1rem 0;
  padding: 0.8rem;
  border-radius: 14px;
  border-left: 5px solid var(--tier);
  background: color-mix(in srgb, var(--tier) 10%, var(--bg-card));
}

.tier-row h3 {
  margin: 0 0 0.6rem;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
}

.tier-row h3 span {
  color: var(--text-dim);
  font-weight: 400;
  font-size: 0.8rem;
  margin-left: 0.3rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.chip {
  min-height: 36px;
  padding: 0.35rem 0.75rem;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--tier) 45%, transparent);
  background: color-mix(in srgb, var(--tier) 22%, var(--bg-card));
  color: var(--text);
  font-size: 0.88rem;
  text-align: left;
  cursor: pointer;
}

.tier-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.tier-btn {
  min-height: 48px;
  border-radius: 10px;
  border: 2px solid transparent;
  background: color-mix(in srgb, var(--tier) 28%, var(--bg-card));
  color: var(--text);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
}

.tier-btn[aria-pressed="true"] { border-color: var(--tier); }

.rate-later { width: 100%; }

/* ---- Sortieren ---- */

.sort-bar {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px;
  margin: 0.2rem 0 0.8rem;
  background: var(--bg-card);
}

.sort-bar button {
  min-height: 36px;
  padding: 0 0.9rem;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  font-size: 0.85rem;
  cursor: pointer;
}

.sort-bar button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 600;
}

.ranking-link + .ranking-link { margin-top: 0.5rem; }

/* ---- Filme-Reiter ---- */

.film-tabs a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.film-tabs a[aria-current="page"] {
  background: var(--accent);
  color: var(--on-accent);
}

.tier-tag {
  flex: 0 0 auto !important;
  align-self: center;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tier) 28%, var(--bg-card));
}

/* =========================================================
   Mein Hub: Startseite, Leiste unten, Training
   ========================================================= */

main { padding-bottom: calc(5.5rem + env(safe-area-inset-bottom)); }

.arc-bar {
  background: var(--hero);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  margin: 0.4rem 0 1rem;
}

.arc-bar p { margin: 0 0 0.5rem; font-size: 0.92rem; }
.arc-bar .progress-bar { margin-top: 0; }

.tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.8rem;
}

.tile {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
  transition: transform 0.1s ease, border-color 0.15s ease;
}

.tile:hover { border-color: var(--accent); }
.tile:active { transform: scale(0.97); }
.tile-icon { font-size: 2.6rem; line-height: 1; }

@media (min-width: 700px) {
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 0.3rem 0.4rem calc(0.3rem + env(safe-area-inset-bottom));
}

.bottom-nav a {
  flex: 1;
  max-width: 128px;
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 12px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.72rem;
  font-weight: 600;
}

.bottom-nav a span:first-child { font-size: 1.25rem; }
.bottom-nav a[aria-current="page"] { color: var(--accent); background: var(--hero); }

/* ---- Training ---- */

.phase-card {
  background: var(--hero);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  margin-bottom: 0.8rem;
}

.phase-card p { margin: 0; font-size: 0.9rem; line-height: 1.4; }
.phase-month { font-weight: 700; color: var(--accent); margin-bottom: 0.2rem !important; }

.hint {
  color: var(--warn);
  font-size: 0.88rem;
  margin: 0 0 0.8rem;
}

.workout-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.6rem;
}

.workout-head .list-title { margin: 0; }

.workout-pick {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.workout-pick select,
.workout-pick select:focus {
  min-height: 40px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0 0.5rem;
  font-size: 16px;
}

.exercise {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.8rem 0.9rem;
  margin-bottom: 0.7rem;
}

.exercise h3 { margin: 0 0 0.5rem; font-size: 1rem; }

.exercise-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.3rem 0.8rem;
}

.scheme {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 600;
}

.set-row {
  display: grid;
  grid-template-columns: 3.6rem 1fr auto 1fr 44px;
  align-items: center;
  gap: 0.4rem;
  margin: 0.35rem 0;
}

.set-label { color: var(--text-dim); font-size: 0.82rem; }
.set-x { color: var(--text-dim); font-size: 0.8rem; }

.set-row input {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  text-align: center;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.set-row input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.set-check {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
}

.set-check[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

.set-done input { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }

.last {
  margin: 0.4rem 0 0;
  color: var(--text-dim);
  font-size: 0.8rem;
}

.wide { width: 100%; margin-top: 0.4rem; }

.finished {
  text-align: center;
  font-weight: 700;
  color: var(--short);
  margin: 0.8rem 0 0.2rem;
}

.period-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.8rem;
  font-weight: 600;
}

.period-nav button { min-width: 44px; }
.period-nav button:disabled { opacity: 0.35; cursor: default; }

.week-days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.3rem;
  margin-bottom: 0.8rem;
}

.day-pill {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.45rem 0.1rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.8rem;
}

.day-pill small {
  font-size: 0.62rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.day-pill.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.day-pill.on small { color: var(--on-accent); }

.stat {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  background: var(--hero);
  border-radius: 12px;
  padding: 0.7rem 1rem;
  margin-bottom: 0.4rem;
}

.stat strong { font-size: 1.3rem; }

.vol-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

.up { color: var(--short); font-size: 0.8rem; font-weight: 600; }
.down { color: var(--long); font-size: 0.8rem; font-weight: 600; }

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.3rem;
  max-width: 460px;
  margin: 0 auto 0.8rem;
}

.cal-head {
  text-align: center;
  color: var(--text-dim);
  font-size: 0.72rem;
  padding-bottom: 0.2rem;
}

.cal-cell {
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.8rem;
}

.cal-cell small { font-size: 0.58rem; }
.cal-cell.cal-blank { background: transparent; border: none; }
.cal-cell.out { opacity: 0.45; }
.cal-cell.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cal-cell.today { outline: 2px solid var(--accent); outline-offset: 1px; }

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 0.82rem;
  cursor: pointer;
  min-height: 36px;
}

.add-inline { margin: 0 0 1rem; flex-wrap: nowrap; }
.add-inline input { flex: 1 1 0; }

.rest-card {
  text-align: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 1.5rem 1.2rem;
}

.rest-card > span { font-size: 2.6rem; }
.rest-card .list-title { margin: 0.4rem 0; }
.rest-card p { margin: 0 0 0.6rem; }

.rest-card select {
  min-height: 44px;
  margin-top: 0.4rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 0 0.8rem;
  font-size: 16px;
}

/* ---- Essen ---- */

.macro { margin-bottom: 0.7rem; }

.macro-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.9rem;
  margin-bottom: 0.3rem;
}

.macro .progress-bar { margin-top: 0; height: 8px; }
.macro.ok .progress-bar > div { background: var(--short); }
.macro.over .progress-bar > div { background: var(--long); }

.micro-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

@media (min-width: 700px) {
  .micro-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.micro {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.5rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.85rem;
}

.micro small { color: var(--text-dim); font-size: 0.72rem; font-variant-numeric: tabular-nums; }
.micro.ok { border-color: color-mix(in srgb, var(--short) 45%, var(--border)); }

.small { font-size: 0.8rem; margin-top: 0.5rem; }

.meal {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.meal-time { color: var(--text-dim); font-size: 0.8rem; width: 2.8rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.meal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.meal-main span { overflow-wrap: anywhere; }
.meal-main small { color: var(--text-dim); font-size: 0.75rem; }
.meal strong { font-size: 0.85rem; white-space: nowrap; }
.meal .delete-btn { margin: 0; }

.food-buttons { margin-top: 1rem; }

.food-panel {
  margin-top: 1rem;
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.food-panel textarea,
.food-panel input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  padding: 0.5rem 0.7rem;
  font-size: 16px;
  font-family: inherit;
}

.food-panel textarea:focus,
.food-panel input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

.food-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
}

.food-grid label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.78rem;
  color: var(--text-dim);
}

.food-panel details summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.88rem;
  padding: 0.4rem 0;
}

.food-panel details .food-grid { margin-top: 0.4rem; }

/* ---- Bilanz ---- */

.bottom-nav a { max-width: 180px; }

.b-grid {
  display: grid;
  grid-template-columns: minmax(96px, 1.7fr) repeat(7, minmax(0, 1fr));
  gap: 0.3rem;
  align-items: stretch;
  margin: 0.8rem 0 1rem;
}

.b-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  padding-bottom: 0.2rem;
}

.b-head small { font-size: 0.65rem; }
.b-head.today { color: var(--accent); font-weight: 700; }

.b-label {
  display: flex;
  align-items: center;
  font-size: 0.82rem;
  line-height: 1.2;
  overflow-wrap: break-word;
  hyphens: auto;
}

.habit-label { justify-content: space-between; gap: 0.2rem; }
.habit-tools { display: flex; flex-shrink: 0; }
.habit-tools .link-btn { min-height: 32px; min-width: 26px; padding: 0; color: var(--text-dim); }

.b-section {
  grid-column: 1 / -1;
  margin-top: 0.6rem;
  color: var(--text-dim);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.b-cell {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 0.95rem;
  padding: 0;
}

.b-cell.st-future { background: transparent; border-style: dashed; opacity: 0.5; }
.b-cell.st-missed { color: var(--long); font-weight: 700; }
.b-cell.st-done, .b-cell.st-ok { border-color: color-mix(in srgb, var(--short) 50%, var(--border)); }

.b-check { cursor: pointer; color: var(--on-accent); font-weight: 700; }
.b-check.on { background: var(--accent); border-color: var(--accent); }

/* ---- Rezepte + Einkauf ---- */

.food-tabs a { font-size: 0.78rem; padding: 0 0.2rem; }

.recipe-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

@media (min-width: 700px) {
  .recipe-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.recipe-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-height: 120px;
  padding: 0.9rem;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  text-decoration: none;
}

.recipe-tile:hover { border-color: var(--accent); }
.recipe-tile strong { line-height: 1.25; overflow-wrap: break-word; hyphens: auto; }
.recipe-macros { color: var(--accent); font-weight: 700; font-size: 0.85rem; margin-top: auto; }
.recipe-tile small { color: var(--text-dim); font-size: 0.72rem; }
.recipe-badge { position: absolute; top: 0.5rem; right: 0.6rem; font-size: 0.9rem; }

.recipe-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.4rem;
  margin: 0.4rem 0 0.2rem;
}

.recipe-stats div {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.5rem 0.2rem;
  border-radius: 10px;
  background: var(--hero);
}

.recipe-stats small { color: var(--text-dim); font-size: 0.7rem; text-align: center; }

.steps { padding-left: 1.2rem; line-height: 1.5; }
.steps li { margin-bottom: 0.4rem; }

.shop-group { margin-bottom: 0.8rem; }

.shop-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shop-head h3 { margin: 0.6rem 0 0.4rem; font-size: 0.95rem; }
.shop-amount { color: var(--text-dim); font-size: 0.8rem; white-space: nowrap; align-self: center; }

main a:not([class]) { color: var(--accent); }

/* ---- Daten sichern ---- */

.backup-link {
  display: block;
  text-align: center;
  margin-top: 1.4rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.6rem;
}

.file-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
  margin-top: 0.5rem;
}

.file-btn:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Rechner ---- */

.food-grid select {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  padding: 0 0.5rem;
  font-size: 16px;
}

.food-grid .span-2 { grid-column: 1 / -1; }
.food-panel button:disabled { opacity: 0.4; cursor: default; }

.food-grid label { justify-content: flex-end; }

/* ---- Rechner einklappbar ---- */

.calc-box { margin: 1rem 0 0.4rem; }

.calc-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 48px;
  padding: 0 1rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--bg-card);
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.calc-summary::-webkit-details-marker { display: none; }
.calc-summary::after { content: "▾"; color: var(--accent); transition: transform 0.15s ease; }
.calc-box:not([open]) .calc-summary::after { transform: rotate(-90deg); }
.calc-box[open] .calc-summary { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.calc-box[open] .food-panel { margin-top: 0; border-top: none; border-top-left-radius: 0; border-top-right-radius: 0; }
.calc-summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.recipe-cats { display: flex; width: 100%; margin-bottom: 0.9rem; }
.recipe-cats button { flex: 1; padding: 0 0.4rem; }
.recipe-cats small { opacity: 0.7; margin-left: 0.15rem; }
