:root {
  --bg: #0a0c0f;
  --bg-soft: #0f1318;
  --card: #12171e;
  --card-2: #161d26;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef2f6;
  --muted: #8b97a5;
  --faint: #5b6675;
  --jade: #34d399;
  --jade-dim: rgba(52, 211, 153, 0.14);
  --gold: #e8c47c;
  --gold-dim: rgba(232, 196, 124, 0.12);
  --red: #f87171;
  --blue: #60a5fa;
  --violet: #a78bfa;
  --radius: 18px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(52, 211, 153, 0.07), transparent 60%),
    radial-gradient(900px 500px at -10% 30%, rgba(96, 165, 250, 0.05), transparent 60%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 760px; margin: 0 auto; padding: 20px 16px 110px; }

/* ---------- Header ---------- */

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 2px 18px;
}
.brand { display: flex; flex-direction: column; gap: 1px; }
.brand .kicker {
  font-size: 11px; letter-spacing: 2.5px; text-transform: uppercase;
  color: var(--jade); font-weight: 600;
}
.brand .name { font-size: 19px; font-weight: 700; letter-spacing: -0.3px; }
.brand .name span { color: var(--muted); font-weight: 500; }

.topbar-right { display: flex; align-items: center; gap: 10px; }
.weekbadge {
  font-size: 12px; color: var(--gold); background: var(--gold-dim);
  border: 1px solid rgba(232, 196, 124, 0.25);
  padding: 6px 12px; border-radius: 999px; font-weight: 600; white-space: nowrap;
}
.gear {
  background: transparent; border: 1px solid var(--border-strong); color: var(--muted);
  width: 38px; height: 38px; border-radius: 11px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.gear svg { width: 19px; height: 19px; }
.gear:active { background: var(--bg-soft); }
.brand .name span { color: var(--gold); }

/* ---------- Cards ---------- */

.card {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}
.card h2 {
  font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--muted); font-weight: 600; margin-bottom: 14px;
}
.card h2 .accent { color: var(--jade); }

/* ---------- Hero (today) ---------- */

.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(500px 240px at 90% 0%, rgba(52, 211, 153, 0.12), transparent 70%),
    linear-gradient(180deg, var(--card-2), var(--card));
}
.hero .day-label { font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.hero .unit { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 6px; }
.hero .meta { font-size: 13.5px; color: var(--muted); margin-bottom: 3px; }
.hero .meta b { color: var(--text); font-weight: 600; }
.hero .cta { margin-top: 16px; }
.done-badge {
  display: inline-block; font-size: 14px; font-weight: 700;
  color: var(--jade); background: var(--jade-dim);
  border: 1px solid rgba(52, 211, 153, 0.35); border-radius: 999px;
  padding: 10px 18px; margin-right: 10px;
}

/* ---------- Stats grid ---------- */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stat {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 10px; text-align: center;
}
.stat .v { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.stat .v.good { color: var(--jade); }
.stat .l { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 1px; margin-top: 2px; }
.stat .t { font-size: 10.5px; color: var(--muted); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font); font-size: 15px; font-weight: 600;
  border: none; border-radius: 14px; padding: 13px 22px;
  cursor: pointer; transition: transform 0.06s ease, opacity 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, #2dd4a0, #1faf82); color: #04261a; }
.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border-strong);
}
.btn-danger { background: rgba(248, 113, 113, 0.12); color: var(--red); border: 1px solid rgba(248, 113, 113, 0.25); }
.btn-sm { font-size: 13px; padding: 8px 14px; border-radius: 11px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Segmented control ---------- */

.seg {
  display: flex; background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 14px; padding: 4px; gap: 4px; margin-bottom: 14px;
}
.seg button {
  flex: 1; font-family: var(--font); font-size: 14px; font-weight: 600;
  background: transparent; color: var(--muted); border: none;
  padding: 10px 6px; border-radius: 10px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.seg button.active { background: var(--jade-dim); color: var(--jade); }
.seg-2line button { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 4px; }
.seg-2line .seg-sub { font-size: 10px; font-weight: 600; opacity: 0.75; letter-spacing: 0.3px; }

/* ---------- Forms ---------- */

label.fld { display: block; margin-bottom: 12px; }
label.fld .lab {
  display: block; font-size: 12px; color: var(--muted);
  margin-bottom: 5px; font-weight: 600;
}
input, select, textarea {
  width: 100%; font-family: var(--font); font-size: 16px;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 11px 13px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--jade); }
input[type="number"] { -moz-appearance: textfield; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }

/* ---------- Exercise logging ---------- */

.exercise { border-top: 1px solid var(--border); padding: 16px 0 6px; }
.exercise:first-of-type { border-top: none; padding-top: 4px; }
.ex-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.ex-name { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.ex-target { font-size: 12px; color: var(--gold); white-space: nowrap; font-weight: 600; }
.ex-cue { font-size: 12.5px; color: var(--faint); margin: 3px 0 10px; }
.ex-last { font-size: 12px; color: var(--blue); margin-bottom: 8px; }

.setrow { display: grid; grid-template-columns: 34px 1fr 1fr 38px; gap: 8px; align-items: center; margin-bottom: 8px; }
.setrow .sn { font-size: 13px; color: var(--faint); font-weight: 700; text-align: center; }
.setrow input { padding: 9px 11px; text-align: center; font-weight: 600; }
.setrow .rm {
  background: transparent; border: none; color: var(--faint); font-size: 18px;
  cursor: pointer; padding: 4px;
}
.addset {
  font-size: 13px; color: var(--jade); background: transparent; border: none;
  cursor: pointer; font-weight: 600; padding: 4px 0 8px; font-family: var(--font);
}

/* ---------- Lists / history ---------- */

.hitem {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  border-top: 1px solid var(--border); padding: 12px 2px;
}
.hitem:first-child { border-top: none; }
.hitem .hl { min-width: 0; }
.hitem .ht { font-size: 14.5px; font-weight: 650; }
.hitem .hs { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.hitem .hd { font-size: 12px; color: var(--faint); white-space: nowrap; }

.pill {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 0.5px;
  padding: 3px 9px; border-radius: 999px; margin-right: 6px;
}
.pill-a { background: var(--jade-dim); color: var(--jade); }
.pill-b { background: rgba(96, 165, 250, 0.14); color: var(--blue); }
.pill-c { background: rgba(167, 139, 250, 0.14); color: var(--violet); }
.pill-z2 { background: rgba(96, 165, 250, 0.14); color: var(--blue); }
.pill-hiit { background: rgba(248, 113, 113, 0.14); color: var(--red); }
.pill-sauna { background: var(--gold-dim); color: var(--gold); }
.pill-mob { background: rgba(167, 139, 250, 0.14); color: var(--violet); }

/* ---------- Charts ---------- */

.chartbox { margin: 6px 0 4px; }
.chartbox svg { width: 100%; height: auto; display: block; }
.chart-title { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.chart-title .ct { font-size: 14px; font-weight: 700; }
.chart-title .cv { font-size: 13px; color: var(--jade); font-weight: 700; }
.chart-delta { font-size: 12px; color: var(--muted); margin-bottom: 8px; }

/* ---------- Tables (plan) ---------- */

.ptable { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ptable th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--faint); padding: 6px 8px 6px 0; font-weight: 600;
}
.ptable td { padding: 8px 8px 8px 0; border-top: 1px solid var(--border); vertical-align: top; }
.ptable td:first-child { font-weight: 650; white-space: nowrap; }
.ptable .sub { color: var(--muted); font-size: 12.5px; }

.kv { border-top: 1px solid var(--border); padding: 10px 0; }
.kv:first-of-type { border-top: none; }
.kv .k { font-size: 13px; font-weight: 700; color: var(--gold); margin-bottom: 2px; }
.kv .v { font-size: 13.5px; color: var(--muted); }

ul.dots { list-style: none; }
ul.dots li {
  font-size: 13.5px; color: var(--muted); padding: 7px 0 7px 18px;
  position: relative; border-top: 1px solid var(--border);
}
ul.dots li:first-child { border-top: none; }
ul.dots li::before { content: ''; position: absolute; left: 2px; top: 14px; width: 6px; height: 6px; border-radius: 50%; background: var(--jade); }

/* ---------- Tab bar ---------- */

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: rgba(10, 12, 15, 0.92);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--border);
  padding: 8px max(10px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom));
}
.tabbar .inner { max-width: 760px; margin: 0 auto; display: flex; }
.tabbar button {
  flex: 1; background: transparent; border: none; cursor: pointer;
  font-family: var(--font); color: var(--faint);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 6px 0; -webkit-tap-highlight-color: transparent;
}
.tabbar button { padding: 6px 2px; min-width: 0; }
.tabbar button svg { width: 21px; height: 21px; }
.tabbar button .tl { font-size: 9.5px; font-weight: 600; letter-spacing: 0.1px; white-space: nowrap; }
.tabbar button.active { color: var(--jade); }

/* ---------- Login ---------- */

.login-wrap {
  min-height: 80vh; display: flex; align-items: center; justify-content: center;
}
.login {
  width: 100%; max-width: 360px; text-align: center; padding: 36px 26px;
}
.login .kicker {
  font-size: 11px; letter-spacing: 3px; text-transform: uppercase;
  color: var(--jade); font-weight: 700; margin-bottom: 8px;
}
.login h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px; }
.login p { font-size: 13.5px; color: var(--muted); margin-bottom: 22px; }
.login input { text-align: center; font-size: 18px; letter-spacing: 2px; margin-bottom: 12px; }
.login .err { color: var(--red); font-size: 13px; margin-top: 10px; min-height: 18px; }

/* ---------- Misc ---------- */

.empty { text-align: center; color: var(--faint); font-size: 13.5px; padding: 18px 0; }
.note { font-size: 12.5px; color: var(--faint); margin-top: 10px; }
.spacer { height: 6px; }
.mt { margin-top: 14px; }

/* ---------- Rings ---------- */

.rings { display: flex; justify-content: space-around; align-items: flex-start; gap: 6px; padding: 6px 0 2px; }
.ringbox { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ringbox-click { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ringbox-click:active { opacity: 0.7; }
.ring-label { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.ring-sub { font-size: 11px; color: var(--faint); }

/* ---------- Progress bars (Ernaehrung) ---------- */

.pbar-wrap { margin-bottom: 14px; }
.pbar-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.pbar-head .pl { font-size: 13px; font-weight: 700; }
.pbar-head .pv { font-size: 13px; color: var(--muted); }
.pbar-head .pv b { color: var(--text); }
.pbar { height: 9px; background: var(--bg-soft); border-radius: 999px; overflow: hidden; border: 1px solid var(--border); }
.pbar .fill { height: 100%; border-radius: 999px; transition: width 0.4s ease; }

/* ---------- Ernährungsplan ---------- */

.kplan-meal { border-top: 1px solid var(--border); padding: 10px 0 4px; }
.kplan-meal:first-of-type { border-top: none; }
.kplan-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.kplan-head span:first-child { font-size: 14px; font-weight: 700; }
.kplan-macros { font-size: 12px; color: var(--jade); font-weight: 600; white-space: nowrap; }

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

.mile-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.mile { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 13px; padding: 12px 6px; text-align: center; }
.mile-v { font-size: 20px; font-weight: 800; letter-spacing: -0.5px; }
.mile-v.good { color: var(--jade); }
.mile-l { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* ---------- WYSS Scores ---------- */

.wyss-card { background: linear-gradient(180deg, var(--card-2), var(--card)); }
.wyss-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.wyss-title { font-size: 17px; font-weight: 800; letter-spacing: -0.3px; }
.wyss-accent { font-size: 12px; color: var(--muted); margin-top: 2px; }
.wyss-bars { display: flex; flex-direction: column; gap: 9px; }
.wyss-bar-top { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; margin-bottom: 3px; }
.wyss-bar-top span:first-child { color: var(--muted); }
.wyss-bar .pbar { height: 6px; }
.wyss-na { color: var(--faint); }
.vo2-big { font-size: 30px; font-weight: 800; line-height: 1; text-align: right; letter-spacing: -1px; }
.vo2-big span { display: block; font-size: 10px; font-weight: 600; color: var(--faint); letter-spacing: 0.5px; margin-top: 3px; }

/* ---------- Wochenplan im Training ---------- */

.wp-row { display: grid; grid-template-columns: 52px 1fr auto; gap: 10px; align-items: baseline; padding: 8px 0; border-top: 1px solid var(--border); font-size: 13.5px; }
.wp-row:first-of-type { border-top: none; }
.wp-day { font-weight: 700; color: var(--faint); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; }
.wp-unit { font-weight: 600; }
.wp-dur { font-size: 12px; color: var(--faint); white-space: nowrap; }
.wp-today { background: var(--jade-dim); margin: 0 -10px; padding: 8px 10px; border-radius: 10px; border-top: none; }
.wp-today .wp-day { color: var(--jade); }
.wp-today + .wp-row { border-top: none; }

/* ---------- WYSS Longevity Score (Flaggschiff) ---------- */

.lg-card {
  background:
    radial-gradient(500px 260px at 85% -10%, rgba(232, 196, 124, 0.13), transparent 70%),
    linear-gradient(180deg, var(--card-2), var(--card));
  border-color: rgba(232, 196, 124, 0.28);
}
.lg-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.lg-kicker { font-size: 16px; font-weight: 800; letter-spacing: -0.2px; }
.lg-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.lg-body { display: flex; align-items: center; gap: 20px; }
.lg-bio { flex: 1; }
.lg-bio-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); font-weight: 700; }
.lg-bio-age { font-size: 38px; font-weight: 800; letter-spacing: -1px; line-height: 1.1; }
.lg-bio-age span { font-size: 14px; font-weight: 500; color: var(--muted); }
.lg-bio-delta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- 4 WYSS Scores ---------- */

.four-scores { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 8px; justify-items: center; }
.fs-item { border-radius: 16px; padding: 6px 14px; }
.fs-item:active { background: var(--bg-soft); }

/* ---------- 3x3 Score-Gruppen ---------- */
.sg-group { margin-top: 14px; }
.sg-group:first-of-type { margin-top: 4px; }
.sg-head { display: flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 800; letter-spacing: 0.4px; text-transform: uppercase; color: var(--text); margin-bottom: 8px; }
.sg-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.sg-accent { font-size: 10.5px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); }
.sg-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; justify-items: center; }
.sg-cell { border-radius: 14px; padding: 4px 2px; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: background 0.15s; }
.sg-cell:active { background: var(--bg-soft); }

/* ---------- KI-Karte ---------- */

.ai-card { background: linear-gradient(135deg, rgba(167,139,250,0.10), rgba(52,211,153,0.06)), var(--card); border-color: rgba(167,139,250,0.25); }
.ai-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.ai-badge { font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--violet); }
.ai-refresh { background: transparent; border: none; color: var(--muted); font-size: 16px; cursor: pointer; padding: 2px 6px; -webkit-tap-highlight-color: transparent; }
.ai-text { font-size: 14.5px; line-height: 1.6; color: var(--text); white-space: pre-wrap; margin-bottom: 10px; }
.ai-text:last-child { margin-bottom: 0; }
.ai-sec { margin-bottom: 14px; padding-left: 11px; border-left: 2px solid rgba(167,139,250,0.35); }
.ai-sec:last-child { margin-bottom: 0; }
.ai-sec-h { font-size: 11px; font-weight: 800; letter-spacing: 0.8px; text-transform: uppercase; color: var(--violet); margin-bottom: 4px; }
.ai-sec-b { font-size: 14.5px; line-height: 1.6; color: var(--text); }

/* ---------- Metrik-Detail-Overlay ---------- */

.tile-click { cursor: pointer; -webkit-tap-highlight-color: transparent; transition: border-color 0.15s; }
.tile-click:active { border-color: var(--jade); }
#metric-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(5, 7, 9, 0.85); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center;
}
.mo-inner {
  width: 100%; max-width: 760px; max-height: 88vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--border-strong);
  border-radius: 22px 22px 0 0; padding: 20px 18px max(24px, env(safe-area-inset-bottom));
}
.mo-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.mo-title { font-size: 19px; font-weight: 800; }
.mo-current { font-size: 40px; font-weight: 800; letter-spacing: -1px; }
.mo-current span { font-size: 15px; font-weight: 500; color: var(--muted); }
.mo-trend { font-size: 13px; font-weight: 700; margin-top: 2px; }
.mo-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.sleep-bar { display: flex; height: 22px; border-radius: 7px; overflow: hidden; margin: 6px 0 8px; background: var(--bg-soft); }
.sleep-bar div { height: 100%; }
.sleep-legend { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 14px; font-size: 12.5px; color: var(--muted); }
.sleep-legend div { display: flex; align-items: center; gap: 6px; }
.sl-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.mo-why { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-top: 14px; font-size: 13.5px; color: var(--muted); line-height: 1.55; }
.mo-why-h { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--jade); font-weight: 700; margin-bottom: 5px; }
.mo-item-detail { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.info-dot { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--jade-dim); color: var(--jade); font-size: 10px; font-weight: 800; font-style: italic; vertical-align: 1px; }
.score-click { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.score-click:active { border-color: var(--jade); }
.bw-row { cursor: pointer; }
.bw-row:active td { color: var(--jade); }
.bw-marker-row { cursor: pointer; }

/* ---------- Blutpanel ---------- */

.bw-cat { border-top: 1px solid var(--border); }
.bw-cat summary { display: flex; align-items: center; gap: 8px; padding: 12px 0; cursor: pointer; list-style: none; font-size: 14px; font-weight: 700; }
.bw-cat summary::-webkit-details-marker { display: none; }
.bw-cat summary::before { content: '▸'; color: var(--faint); transition: transform 0.15s; }
.bw-cat[open] summary::before { transform: rotate(90deg); }
.bw-count { font-size: 11px; color: var(--faint); background: var(--bg-soft); border-radius: 999px; padding: 1px 8px; font-weight: 600; }
.bw-fields { padding: 2px 0 10px; }
.bw-cat-title { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--jade); font-weight: 700; margin: 14px 0 4px; }
.bw-cat-title:first-of-type { margin-top: 0; }

/* ---------- Protokolle ---------- */

.iv-item { border-top: 1px solid var(--border); padding: 12px 0; }
.iv-item:first-of-type { border-top: none; }
.iv-paused { opacity: 0.55; }
.iv-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.iv-info { min-width: 0; }
.iv-name { font-size: 15px; font-weight: 700; }
.iv-tag { font-size: 10px; font-weight: 700; color: var(--gold); background: var(--gold-dim); padding: 2px 7px; border-radius: 999px; vertical-align: 2px; }
.iv-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.iv-check {
  width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
  background: var(--bg-soft); border: 1px solid var(--border-strong); color: var(--jade);
  font-size: 18px; font-weight: 800; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.iv-check.on { background: var(--jade-dim); border-color: rgba(52, 211, 153, 0.4); }
.iv-actions { display: flex; gap: 14px; margin-top: 8px; }
.iv-link { background: none; border: none; color: var(--muted); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 2px 0; font-family: var(--font); -webkit-tap-highlight-color: transparent; }
.iv-link.danger { color: var(--red); }
.iv-logform { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-top: 10px; }

/* ---------- Wirkungs-Analyse ---------- */

.ef-compare { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: center; margin: 8px 0 4px; }
.ef-col { text-align: center; }
.ef-label { font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: var(--faint); }
.ef-val { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.ef-val span { font-size: 12px; font-weight: 500; color: var(--muted); }
.ef-n { font-size: 11px; color: var(--faint); }
.ef-arrow { font-size: 22px; font-weight: 800; text-align: center; }
.ef-delta { font-size: 12px; font-weight: 700; white-space: nowrap; }

/* ---------- Makros ---------- */

.macro-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 4px; }
.macro { }
.macro-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.macro-l { font-size: 12px; font-weight: 700; color: var(--muted); }
.macro-v { font-size: 13px; font-weight: 700; }
.macro-v span { font-size: 11px; font-weight: 500; color: var(--faint); }
.macro .pbar { height: 7px; }

/* ---------- Kalorienrechner ---------- */

.tdee-breakdown { background: var(--bg-soft); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 6px 0 12px; }
.tdee-row { display: flex; justify-content: space-between; font-size: 13px; padding: 5px 0; color: var(--muted); }
.tdee-row span:last-child { font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.tdee-total { border-top: 1px solid var(--border-strong); margin-top: 4px; padding-top: 9px; font-size: 14px; }
.tdee-total span:first-child { color: var(--jade); font-weight: 700; }
.tdee-total span:last-child { color: var(--jade); font-size: 16px; }

/* ---------- Trainings-Historie ---------- */

.wkt { border-top: 1px solid var(--border); }
.wkt:first-of-type { border-top: none; }
.wkt summary { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; cursor: pointer; list-style: none; font-size: 14px; font-weight: 650; }
.wkt summary::-webkit-details-marker { display: none; }
.wkt-meta { font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.wkt-body { padding: 0 0 12px; }
.wkt-ex { font-size: 12.5px; color: var(--muted); padding: 3px 0; }

/* ---------- Mahlzeiten-Logbuch ---------- */

.meal-seg button { font-size: 12.5px; padding: 9px 4px; }
.meal-group { margin-bottom: 14px; }
.meal-group:last-child { margin-bottom: 0; }
.meal-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; padding-bottom: 5px; border-bottom: 1px solid var(--border); }
.meal-head span:first-child { font-size: 13px; font-weight: 800; letter-spacing: 0.3px; }
.meal-sum { font-size: 12px; color: var(--jade); font-weight: 600; }
.logitem { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0; }
.li-info { min-width: 0; }
.li-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-qty { color: var(--faint); font-weight: 500; }
.li-macros { font-size: 11.5px; color: var(--muted); }
.li-del { background: transparent; border: none; color: var(--faint); font-size: 15px; cursor: pointer; padding: 4px 6px; -webkit-tap-highlight-color: transparent; }

/* ---------- Lebensmittel-Suche ---------- */

.food-row {
  display: grid; grid-template-columns: 1fr 64px auto 40px; gap: 8px; align-items: center;
  border-top: 1px solid var(--border); padding: 9px 0;
}
.food-row:first-child { border-top: none; }
.food-info { min-width: 0; }
.food-name { font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.food-vals { font-size: 11.5px; color: var(--muted); }
.food-qty { padding: 8px 6px; text-align: center; font-weight: 600; }
.food-unit { font-size: 12px; color: var(--faint); min-width: 22px; }
.food-add { padding: 8px 0; font-size: 17px; font-weight: 800; }

/* ---------- Supplement chips ---------- */

.chips { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.chip {
  font-family: var(--font); font-size: 12.5px; font-weight: 650;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: 12px;
  padding: 10px 4px; cursor: pointer; text-align: center;
  -webkit-tap-highlight-color: transparent; transition: all 0.15s;
}
.chip.on { background: var(--jade-dim); color: var(--jade); border-color: rgba(52, 211, 153, 0.4); }

/* ---------- Quick add buttons ---------- */

.quickrow { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.qbtn {
  font-family: var(--font); font-size: 13px; font-weight: 650;
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: 999px;
  padding: 8px 14px; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.qbtn:active { background: var(--jade-dim); }

/* ---------- Metric tiles ---------- */

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px;
}
.tile .th { display: flex; justify-content: space-between; align-items: baseline; }
.tile .tn { font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--faint); }
.tile .tv { font-size: 19px; font-weight: 800; margin: 2px 0 6px; }
.tile .tv span { font-size: 12px; font-weight: 500; color: var(--muted); }
.spark { width: 100%; height: 36px; display: block; }
.spark-empty { color: var(--faint); font-size: 12px; }

.srcbadge { font-size: 10px; font-weight: 700; letter-spacing: 0.8px; color: var(--blue); }

/* ---------- Gym-Modus ---------- */

.exswap {
  background: var(--bg-soft); border: 1px solid var(--border-strong); color: var(--muted);
  font-size: 13px; border-radius: 8px; padding: 2px 8px; cursor: pointer;
  vertical-align: 2px; margin-left: 4px;
}

.ex-goal {
  font-size: 12.5px; color: var(--gold); font-weight: 650;
  background: var(--gold-dim); border: 1px solid rgba(232, 196, 124, 0.2);
  border-radius: 10px; padding: 7px 10px; margin-bottom: 10px;
}
.ex-goal.up { color: var(--jade); background: var(--jade-dim); border-color: rgba(52, 211, 153, 0.3); }

.setrow { grid-template-columns: 30px 1fr 1fr 40px 32px; }
.setrow .ck {
  background: var(--bg-soft); border: 1px solid var(--border-strong);
  color: var(--faint); font-size: 16px; font-weight: 700;
  border-radius: 10px; padding: 8px 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.setrow.done .ck { background: var(--jade-dim); color: var(--jade); border-color: rgba(52, 211, 153, 0.4); }
.setrow.done input { opacity: 0.55; }

#restbar {
  position: fixed; left: 0; right: 0; bottom: 76px; z-index: 60;
  padding: 0 12px calc(env(safe-area-inset-bottom) * 0.5);
}
#restbar .rb-inner {
  max-width: 736px; margin: 0 auto;
  background: #0e2519; border: 1px solid rgba(52, 211, 153, 0.35);
  border-radius: 16px; padding: 10px 14px;
  display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
#restbar .rb-label { font-size: 11px; color: var(--muted); white-space: nowrap; max-width: 130px; overflow: hidden; text-overflow: ellipsis; }
#restbar .rb-time { font-size: 22px; font-weight: 800; color: var(--jade); font-variant-numeric: tabular-nums; }
#restbar .rb-track { height: 6px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; overflow: hidden; }
#restbar .rb-fill { height: 100%; background: var(--jade); border-radius: 999px; width: 0; transition: width 0.25s linear; }
#restbar .rb-skip {
  font-family: var(--font); font-size: 13px; font-weight: 700;
  background: var(--jade-dim); color: var(--jade);
  border: 1px solid rgba(52, 211, 153, 0.35); border-radius: 999px;
  padding: 8px 14px; cursor: pointer;
}

/* ---------- Tagesempfehlung ---------- */

.reco {
  font-size: 13px; font-weight: 600; line-height: 1.5;
  border-radius: 12px; padding: 10px 12px; margin-top: 12px;
}
.reco-ok { background: var(--jade-dim); color: var(--jade); border: 1px solid rgba(52, 211, 153, 0.3); }
.reco-mid { background: var(--gold-dim); color: var(--gold); border: 1px solid rgba(232, 196, 124, 0.3); }
.reco-warn { background: rgba(248, 113, 113, 0.1); color: #fca5a5; border: 1px solid rgba(248, 113, 113, 0.3); }

/* ---------- Stretching ---------- */

.routine {
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px; margin-bottom: 12px;
}
.rt-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.rt-title { font-size: 15px; font-weight: 750; }
.rt-dur { color: var(--jade); font-weight: 600; font-size: 13px; }
.rt-when { font-size: 12px; color: var(--muted); margin-top: 1px; }
.rt-list { font-size: 11.5px; color: var(--faint); margin-top: 9px; line-height: 1.6; }

#stretch-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: radial-gradient(800px 500px at 50% -10%, rgba(52, 211, 153, 0.10), transparent 60%), #0a0c0f;
  display: flex; align-items: stretch; justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 18px max(20px, env(safe-area-inset-bottom));
}
.sp-inner { width: 100%; max-width: 560px; display: flex; flex-direction: column; }
.sp-top { display: flex; justify-content: space-between; align-items: center; }
.sp-progress { font-size: 12px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--jade); font-weight: 700; }
.sp-close {
  background: var(--bg-soft); border: 1px solid var(--border-strong); color: var(--muted);
  font-size: 15px; border-radius: 999px; width: 36px; height: 36px; cursor: pointer;
}
.sp-bar { height: 4px; background: rgba(255, 255, 255, 0.08); border-radius: 999px; margin: 12px 0; overflow: hidden; }
.sp-bar-fill { height: 100%; background: var(--jade); border-radius: 999px; transition: width 0.4s; }
.sp-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 8px; }
.sp-name { font-size: 26px; font-weight: 800; letter-spacing: -0.5px; }
.sp-side { font-size: 14px; color: var(--gold); font-weight: 600; }
.sp-timer { font-size: 88px; font-weight: 800; line-height: 1; color: var(--jade); font-variant-numeric: tabular-nums; margin: 8px 0; }
.sp-info { font-size: 14px; color: var(--muted); max-width: 420px; line-height: 1.55; }
.sp-controls { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; margin-top: 18px; }
.sp-next { text-align: center; font-size: 12.5px; color: var(--faint); margin-top: 12px; }

.toast {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  background: #0e2e22; color: var(--jade); border: 1px solid rgba(52, 211, 153, 0.4);
  font-size: 14px; font-weight: 600; padding: 11px 22px; border-radius: 999px;
  z-index: 100; opacity: 0; transition: opacity 0.25s; pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

@media (min-width: 640px) {
  #app { padding-top: 30px; }
  .stats { gap: 12px; }
}

/* Epigenetik / TruAge tiles */
.epi-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 6px; }
.epi-tile {
  background: linear-gradient(180deg, var(--card-2), var(--card));
  border: 1px solid rgba(255,255,255,0.06); border-radius: 12px;
  padding: 10px 6px; text-align: center;
}
.epi-tile-val { font-size: 20px; font-weight: 700; color: var(--jade); line-height: 1.1; }
.epi-tile-lab { font-size: 10.5px; color: var(--muted); margin-top: 3px; }
.epi-tile-u { font-size: 9px; color: var(--faint); }
@media (max-width: 380px) { .epi-tile-val { font-size: 17px; } .epi-tile-lab { font-size: 9.5px; } }

/* Einnahme-Zeitpunkt */
.iv-timing-badge { font-size: 10px; font-weight: 700; color: var(--violet); background: rgba(167,139,250,0.14); padding: 1px 7px; border-radius: 8px; vertical-align: middle; }
.iv-timing-sel { font-size: 11px; color: var(--muted); background: var(--card-2); border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; padding: 3px 6px; -webkit-appearance: none; appearance: none; }

.intake-row { font-size: 14px; line-height: 1.5; margin-bottom: 4px; }
.intake-row b { color: var(--text); font-weight: 700; }

.iv-ingredients { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 4px; }
.iv-ing-chip { font-size: 10.5px; color: var(--muted); background: var(--bg-soft); border: 1px solid var(--border); border-radius: 7px; padding: 2px 7px; }

.qlabel { font-size: 11px; font-weight: 700; color: var(--muted); min-width: 52px; display: inline-flex; align-items: center; }
