/* Projekt 80 kg – Gestaltung. Farben kommen ausschließlich aus den Tokens unten. */
:root {
  color-scheme: light dark;
  --bg: #f3f5f1; --card: #ffffff; --ink: #1b2922; --muted: #5d6b62; --line: #e0e7e1;
  --accent: #286849; --on-accent: #ffffff; --soft: #e7f1e9; --hero: #17251f; --hero-ink: #ffffff; --hero-muted: #b9d3c2;
  --track: #e4ebe5; --warn: #b4560c; --warn-soft: #fbeedd; --danger: #b3261e;
  --s1: #1b7a4b; --s2: #c96a10; --grid: #e6ece7;
  --fig: #286849; --fig-far: #8fbba3; --fig-prop: #a9b6ad; --fig-bg: #eef4ef;
  --shadow: 0 2px 10px rgba(27, 41, 34, .05);
  --radius: 18px; --nav-h: 62px;
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1612; --card: #17211c; --ink: #e9f0eb; --muted: #a0b1a7; --line: #2a3830;
    --accent: #45b681; --on-accent: #06140d; --soft: #1e3027; --hero: #17251f; --hero-ink: #ffffff; --hero-muted: #a9c7b5;
    --track: #2a3830; --warn: #f0a44b; --warn-soft: #3a2a14; --danger: #f2877f;
    --s1: #3aa873; --s2: #d87a20; --grid: #26332c;
    --fig: #57c08f; --fig-far: #2f6f50; --fig-prop: #5b6c62; --fig-bg: #1b2822;
    --shadow: none;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Kopf und Navigation */
.top {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--hero); color: var(--hero-ink); padding: calc(var(--safe-t) + 10px) 16px 10px;
}
.top h1 { font-size: 18px; font-weight: 700; letter-spacing: -.01em; }
.top button { display: grid; place-items: center; width: 44px; height: 44px; margin: -6px -8px -6px 0; background: none; border: 0; color: var(--hero-ink); border-radius: 12px; }
main { max-width: 640px; margin: 0 auto; padding: 14px 16px calc(var(--nav-h) + var(--safe-b) + 28px); }
body.timer-on main { padding-bottom: calc(var(--nav-h) + var(--safe-b) + 112px); }
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--card); border-top: 1px solid var(--line); padding-bottom: var(--safe-b);
}
.tabs button {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; height: var(--nav-h);
  background: none; border: 0; color: var(--muted); font-size: 11px; font-weight: 600; min-width: 0;
}
.tabs button[aria-current="page"] { color: var(--accent); }

/* Bausteine */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.grid2 .card { margin: 0; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.grid3 .card { margin: 0; padding: 12px; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.stack > * + * { margin-top: 10px; }
.label { color: var(--muted); font-size: 13px; font-weight: 600; }
.big { font-size: 26px; font-weight: 750; letter-spacing: -.02em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.mid { font-size: 20px; font-weight: 700; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.small { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.h2 { font-size: 20px; font-weight: 750; letter-spacing: -.01em; }
.h3 { font-size: 16px; font-weight: 700; }
.section { font-size: 15px; font-weight: 700; margin: 20px 0 8px; }
.num { font-variant-numeric: tabular-nums; }

.bar { height: 8px; background: var(--track); border-radius: 99px; overflow: hidden; margin-top: 8px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .25s; }
.bar.over > span { background: var(--warn); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 46px; padding: 0 16px;
  border-radius: 13px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-weight: 650; font-size: 15px;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.small { min-height: 40px; padding: 0 12px; font-size: 14px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.iconbtn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; border: 0; background: transparent; color: var(--muted); flex: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.actions .btn { flex: 1 1 130px; padding: 0 10px; white-space: nowrap; }

label.field { display: block; font-size: 13.5px; font-weight: 600; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea, .input {
  display: block; width: 100%; min-width: 0; min-height: 46px; margin-top: 5px; padding: 10px 12px; font-size: 16px; font-weight: 500;
  color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; -webkit-appearance: none; appearance: none;
}
textarea { resize: vertical; min-height: 70px; }
input[type="date"] { min-height: 46px; }
.formgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.formgrid .wide { grid-column: 1 / -1; }
.error { color: var(--danger); font-size: 13.5px; font-weight: 600; min-height: 1em; }

.seg { display: flex; background: var(--track); border-radius: 12px; padding: 3px; gap: 2px; }
.seg button { flex: 1; white-space: nowrap; min-height: 38px; border: 0; background: transparent; border-radius: 10px; font-size: 14px; font-weight: 650; color: var(--muted); padding: 0 8px; }
.seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }

.notice { display: flex; gap: 10px; align-items: flex-start; background: var(--warn-soft); border-radius: 14px; padding: 12px; margin-bottom: 12px; font-size: 14px; }
.notice svg { color: var(--warn); margin-top: 1px; }
.tip { background: var(--soft); border-radius: 14px; padding: 12px; font-size: 14px; line-height: 1.5; margin-bottom: 12px; }
.empty { color: var(--muted); font-size: 14px; padding: 8px 0; }

/* Start */
.hero { background: var(--hero); color: var(--hero-ink); border-radius: 22px; padding: 18px; margin-bottom: 12px; }
.hero .label { color: var(--hero-muted); }
.hero .weight { font-size: 44px; font-weight: 780; letter-spacing: -.03em; line-height: 1.05; margin-top: 2px; font-variant-numeric: tabular-nums; }
.hero .weight small { font-size: 20px; font-weight: 650; letter-spacing: 0; }
.hero .bar { background: rgba(255, 255, 255, .16); height: 10px; margin-top: 14px; }
.hero .bar > span { background: #6fd3a3; }
.hero .scale { display: flex; justify-content: space-between; font-size: 13px; color: var(--hero-muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.hero .facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.hero .facts b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.hero .facts span { font-size: 12.5px; color: var(--hero-muted); }
.hero .btn { margin-top: 14px; background: rgba(255, 255, 255, .12); border-color: transparent; color: #fff; }

.weekdots { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; text-align: center; }
.weekdots div { font-size: 12px; color: var(--muted); font-weight: 600; }
.dot { display: grid; place-items: center; width: 30px; height: 30px; margin: 4px auto 0; border-radius: 50%; background: var(--track); color: var(--muted); }
.dot svg { width: 16px; height: 16px; stroke-width: 3; }
.dot.done { background: var(--accent); color: var(--on-accent); }
.dot.partial { background: var(--soft); color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }
.dot.rest { background: transparent; box-shadow: inset 0 0 0 1px var(--line); }
.today-mark { color: var(--ink); font-weight: 800; }

/* Training */
.strip { display: grid; grid-template-columns: 34px repeat(7, 1fr) 34px; gap: 2px; align-items: center; margin-bottom: 12px; }
.strip .nav { background: none; border: 0; color: var(--muted); display: grid; place-items: center; height: 56px; padding: 0; }
.strip .d { display: flex; flex-direction: column; align-items: center; gap: 1px; border: 0; background: transparent; border-radius: 12px; height: 56px; justify-content: center; padding: 0; color: var(--muted); font-size: 12px; font-weight: 600; min-width: 0; }
.strip .d b { font-size: 15px; color: var(--ink); font-variant-numeric: tabular-nums; }
.strip .d i { width: 6px; height: 6px; border-radius: 50%; background: transparent; }
.strip .d i.done { background: var(--accent); }
.strip .d i.partial { background: var(--fig-far); }
.strip .d.sel { background: var(--accent); color: var(--on-accent); }
.strip .d.sel b { color: var(--on-accent); }
.strip .d.sel i.done, .strip .d.sel i.partial { background: var(--on-accent); }
.strip .d.now:not(.sel) b { color: var(--accent); }

.ex { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); }
.ex:first-child { border-top: 0; padding-top: 2px; }
.ex:last-child { padding-bottom: 0; }
.ex .pic { background: var(--fig-bg); border: 0; border-radius: 14px; padding: 4px; width: 104px; align-self: start; }
.ex .name { font-weight: 700; font-size: 15.5px; line-height: 1.25; text-align: left; background: none; border: 0; padding: 0; display: block; }
.ex .dose { color: var(--accent); font-weight: 700; font-size: 14px; margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.ex.complete .name { color: var(--muted); }
.sets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.set { display: grid; place-items: center; min-width: 44px; height: 44px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); font-weight: 700; color: var(--ink); padding: 0 8px; font-size: 14px; }
.set svg { width: 18px; height: 18px; stroke-width: 3; }
.set.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.set.wide { padding: 0 12px; }
.set:disabled { opacity: .55; }
.rest-link { border: 0; background: none; color: var(--accent); font-size: 13.5px; font-weight: 650; height: 44px; padding: 0 4px; display: inline-flex; gap: 4px; align-items: center; }
.rest-link svg { width: 17px; height: 17px; }

.fig { width: 100%; height: auto; display: block; }
.fig path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.fig .fig-near { stroke: var(--fig); }
.fig .fig-far { stroke: var(--fig-far); }
.fig .fig-head { fill: var(--fig); }
.fig .fig-floor { stroke: var(--fig-prop); stroke-width: 3; stroke-linecap: round; }
.fig path.fig-prop { stroke: var(--fig-prop); stroke-width: 6; }
.fig .fig-prop-fill { fill: var(--fig-prop); }

.feel { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.feel .btn[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }

.timer {
  position: fixed; left: 10px; right: 10px; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); z-index: 35; max-width: 620px; margin: 0 auto;
  background: var(--hero); color: #fff; border-radius: 18px; padding: 10px 12px; box-shadow: 0 8px 26px rgba(0, 0, 0, .28);
}
.timer .bar { background: rgba(255, 255, 255, .18); margin: 0 0 8px; height: 5px; }
.timer .bar > span { background: #6fd3a3; transition: none; }
.timer .row { gap: 6px; }
.timer .t { font-size: 28px; font-weight: 780; font-variant-numeric: tabular-nums; line-height: 1; }
.timer .l { font-size: 12.5px; color: var(--hero-muted); }
.timer button { min-height: 44px; min-width: 44px; padding: 0 9px; background: rgba(255, 255, 255, .12); border: 0; border-radius: 11px; color: #fff; font-weight: 650; font-size: 14px; }
.timer.finished { background: var(--accent); color: var(--on-accent); }

/* Ernährung */
.daynav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.daynav .h3 { text-align: center; }
.meal-entry { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }
.meal-entry .grow { flex: 1; min-width: 0; }
.meal-entry .fname { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.food-hit { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 54px; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 8px 2px; }
.food-hit b { display: block; font-size: 15px; font-weight: 600; }
.water-actions { display: grid; grid-template-columns: 1fr 1fr 56px; gap: 8px; margin-top: 12px; }

/* Listen und Tabellen */
.list-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 0; border-top: 1px solid var(--line); min-height: 50px; }
.list-row:first-child { border-top: 0; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
table.t th { text-align: right; font-size: 12.5px; color: var(--muted); font-weight: 600; padding: 4px 0 6px 8px; }
table.t td { text-align: right; padding: 8px 0 8px 8px; border-top: 1px solid var(--line); }
table.t th:first-child, table.t td:first-child { text-align: left; padding-left: 0; }
details > summary { cursor: pointer; color: var(--accent); font-weight: 650; font-size: 14px; padding: 8px 0 2px; list-style-position: inside; }

/* Diagramme */
.chart { position: relative; width: 100%; touch-action: pan-y; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart text { font-size: 12px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.chart .end { fill: var(--ink); font-weight: 700; }
.chart .grid { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.chart .s1 { stroke: var(--s1); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chart .s2 { stroke: var(--s2); fill: none; stroke-width: 2; stroke-linecap: round; stroke-dasharray: 6 5; }
.chart .raw { fill: var(--s1); opacity: .35; }
.chart .endpt { fill: var(--s1); stroke: var(--card); stroke-width: 2; }
.chart .barm { fill: var(--s1); }
.chart .barm.low { opacity: .45; }
.chart .cross { stroke: var(--muted); stroke-width: 1; }
.tooltip {
  position: absolute; top: 0; z-index: 5; pointer-events: none; background: var(--ink); color: var(--card); border-radius: 9px; padding: 6px 9px;
  font-size: 12.5px; line-height: 1.35; white-space: nowrap; transform: translateX(-50%); font-variant-numeric: tabular-nums;
}
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin: 0 0 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.key { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--s1); }
.key.dash { border-top: 2px dashed var(--s2); }
.key.pt { width: 8px; height: 8px; border: 0; border-radius: 50%; background: var(--s1); opacity: .45; }

.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.cal .wd { text-align: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.cal .c { aspect-ratio: 1; display: grid; place-items: center; border-radius: 10px; font-size: 13.5px; font-variant-numeric: tabular-nums; background: var(--bg); color: var(--muted); border: 0; padding: 0; }
.cal .c.done { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cal .c.partial { background: var(--soft); color: var(--ink); box-shadow: inset 0 0 0 2px var(--accent); font-weight: 700; }
.cal .c.miss { box-shadow: inset 0 0 0 1px var(--fig-prop); }
.cal .c.rest { background: transparent; }
.cal .c.now { outline: 2px solid var(--ink); outline-offset: -2px; }
.cal .blank { background: transparent; }
.calkey { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.calkey span { display: inline-flex; align-items: center; gap: 6px; }
.calkey i { width: 14px; height: 14px; border-radius: 4px; display: inline-block; }

/* Bottom Sheet */
dialog.sheet {
  width: 100%; max-width: 640px; max-height: min(92dvh, 92vh); margin: auto auto 0; padding: 0; border: 0; border-radius: 22px 22px 0 0;
  background: var(--card); color: var(--ink); overflow: hidden;
}
dialog.sheet[open] { display: flex; flex-direction: column; animation: up .2s ease-out; }
dialog.sheet::backdrop { background: rgba(10, 18, 14, .5); }
@keyframes up { from { transform: translateY(30px); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.sheet-head .h3 { font-size: 17px; }
.sheet-body { padding: 14px 16px calc(var(--safe-b) + 18px); overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; flex: 1; }
.figwrap { background: var(--fig-bg); border-radius: 16px; padding: 8px; }
.figpair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.figpair > div { background: var(--fig-bg); border-radius: 12px; padding: 4px; text-align: center; font-size: 12.5px; color: var(--muted); font-weight: 600; }
ol.steps { margin: 0; padding-left: 20px; font-size: 15px; line-height: 1.5; }
ol.steps li + li { margin-top: 5px; }

.toast {
  position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + var(--safe-b) + 12px); z-index: 60; max-width: 560px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 48px;
  background: var(--ink); color: var(--card); padding: 8px 14px; border-radius: 14px; font-size: 14.5px; font-weight: 600; box-shadow: 0 6px 22px rgba(0, 0, 0, .25);
}
.toast button { background: none; border: 0; color: inherit; font-weight: 800; min-height: 40px; padding: 0 4px; text-decoration: underline; }
body.timer-on .toast { bottom: calc(var(--nav-h) + var(--safe-b) + 96px); }

.week-card { border-top: 1px solid var(--line); padding: 10px 0; }
.week-card:first-of-type { border-top: 0; }
.week-card .row { font-size: 14.5px; min-height: 26px; }
.badge { display: inline-block; font-size: 12.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }

@media (prefers-reduced-motion: reduce) { *, ::before, ::after { animation: none !important; transition: none !important; } }
@media (min-width: 560px) { .ex { grid-template-columns: 128px minmax(0, 1fr); } .ex .pic { width: 128px; } }
