/* Hocus Chokus Trainingstagebuch – Optik nach dem Muster des Hocus Chokus Timers:
   dunkle Kopfzeile, Hocus-Rot #c1121f als Akzent, Karten 10 px, Bedienelemente 8 px, keine Pillen. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface2: #f7f7f9;
  --text: #1b1c1e;
  --text2: #66686d;
  --line: #e4e7eb;
  --primary: #c1121f;
  --primary-soft: #fbe9ea;
  --dark: #17181a;
  --tonal: #eceef1;
  --gold: #d9a400;
  --r-card: 10px;
  --r-ctl: 8px;
  --nav-h: 60px;
  --shadow: 0 1px 2px rgba(20,22,30,.06), 0 2px 10px rgba(20,22,30,.05);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--text);
  font-family: Roboto, "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.35; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
body.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); }
input, textarea, select { font: inherit; color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; }
[hidden] { display: none !important; }
.ic { width: 24px; height: 24px; fill: currentColor; vertical-align: middle; flex: none; }
.ic.small { width: 16px; height: 16px; }
.muted { color: var(--text2); }
a { color: var(--primary); }

/* ---------- Kopfzeile ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 4px;
  min-height: 60px; padding: 4px 8px 4px 12px; padding-top: calc(4px + env(safe-area-inset-top));
  background: var(--dark); color: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.25);
}
.topbar .title { flex: 1; min-width: 0; display: flex; flex-direction: column; justify-content: center; line-height: 1.2; }
.topbar .title .tt { font-size: 18px; font-weight: 700; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title small { font-size: 12.5px; color: #b9bcc3; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .ibtn { color: #fff; }
.topbar .ibtn:active { background: rgba(255,255,255,.12); }
.topbar .logo { width: 38px; height: 38px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px #fff; object-fit: cover; margin-right: 10px; flex: none; }

/* ---------- Untere Navigation ---------- */
#bnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; display: flex;
  background: var(--surface); border-top: 1px solid var(--line);
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
}
#bnav button { position: relative; flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--text2); padding: 0 2px; }
#bnav button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
#bnav button .ic { width: 24px; height: 24px; }
#bnav button.on { color: var(--primary); }
#bnav button.on::after { content: ''; position: absolute; top: -1px; left: 22%; right: 22%; height: 3px; background: var(--primary); border-radius: 0 0 2px 2px; }

/* ---------- Bausteine ---------- */
.body { padding: 10px 12px 40px; }
.ibtn { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r-ctl); color: var(--text2); flex: none; }
.ibtn:active { background: rgba(0,0,0,.06); }
.ibtn.dark { color: var(--text); }
.ibtn.tonal { background: var(--tonal); color: var(--text); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 40px; padding: 0 16px; border-radius: var(--r-ctl); font-size: 15px; font-weight: 600; white-space: nowrap; flex: none; }
.btn .ic { width: 20px; height: 20px; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:active { background: #a30f1a; }
.btn.tonal { background: var(--tonal); color: var(--text); }
.btn.tonal:active { background: #dfe2e7; }
.btn.text { color: var(--primary); padding: 0 10px; }
.btn.block { width: 100%; margin-top: 4px; }
.btn.big { flex: 1; height: 48px; font-size: 16px; }
.btn.small { height: 34px; font-size: 13.5px; padding: 0 12px; }
.card { background: var(--surface); border-radius: var(--r-card); border: 1px solid var(--line); }
.rows { padding: 2px 0; margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 12px 6px 16px; width: 100%; text-align: left; }
.row + .row { border-top: 1px solid var(--line); }
.row .lbl { flex: 1; min-width: 0; font-size: 16px; text-align: left; }
.row .lbl small { display: block; color: var(--text2); font-size: 13px; margin-top: 1px; font-weight: 400; }
.row .value { display: inline-flex; align-items: center; gap: 2px; color: var(--text2); font-size: 15px; padding: 6px 0 6px 6px; }
.row .value .ic { width: 20px; height: 20px; }
.row > .ic { color: var(--text2); }
button.row:active { background: var(--surface2); }
.row.exrow .lbl { padding: 6px 0; }
.row.exrow > .ic { color: #c9ccd3; }
.row.exrow .ic.pr { color: var(--gold); }
.section-title { display: flex; align-items: center; font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); margin: 18px 8px 8px; }
.hint { margin: 0 4px 10px; font-size: 13px; color: var(--text2); line-height: 1.4; }
.hint.in { margin: 4px 16px 10px; }
.empty { text-align: center; color: var(--text2); padding: 40px 16px; }
.empty .ic { width: 48px; height: 48px; color: #c9ccd3; margin-bottom: 8px; }
.empty p { margin: 0; line-height: 1.5; }
.empty.small { padding: 22px 12px; font-size: 14.5px; }
.chip, .chipbtn { display: inline-flex; align-items: center; height: 34px; padding: 0 12px; border-radius: var(--r-ctl); border: 1.5px solid var(--line); background: var(--surface); font-size: 13.5px; font-weight: 600; color: var(--text); white-space: nowrap; }
.chipbtn.on { background: var(--dark); color: #fff; border-color: var(--dark); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 0 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding: 2px 0 10px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.segm { display: inline-flex; background: var(--tonal); border-radius: var(--r-ctl); padding: 3px; }
.segm button { height: 30px; padding: 0 10px; border-radius: 6px; font-size: 13px; font-weight: 600; color: var(--text2); }
.segm button.on { background: #fff; color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.15); }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch .track { position: absolute; inset: 0; border-radius: 14px; background: #c9ccd3; transition: background .15s; }
.switch .knob { position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: left .15s; }
.switch input:checked ~ .track { background: var(--primary); }
.switch input:checked ~ .knob { left: 23px; }
.catdot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-right: 8px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); vertical-align: 1px; }
.section-title .catdot { width: 9px; height: 9px; }
.ic.pr { width: 18px; height: 18px; color: var(--gold); }
.ic.cm { width: 16px; height: 16px; color: var(--text2); }
.ic.heart-red { color: var(--primary); }
.add-dashed { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 50px; border: 2px dashed #c9ccd3; border-radius: var(--r-card); color: var(--text2); font-weight: 600; margin: 4px 0 12px; }
.searchbar { display: flex; align-items: center; gap: 8px; padding: 2px 4px 2px 14px; margin-bottom: 10px; }
.searchbar > .ic { color: var(--text2); }
.searchbar input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 16px; padding: 12px 0; -webkit-appearance: none; appearance: none; }
input[type=search]::-webkit-search-cancel-button, input[type=search]::-webkit-search-decoration { -webkit-appearance: none; display: none; }
.version { color: var(--text2); font-size: 13px; text-align: center; margin: 28px 0 0; line-height: 1.6; }
.version img { width: 40px; height: 40px; border-radius: 50%; display: block; margin: 0 auto 8px; box-shadow: var(--shadow); }

/* ---------- Tagesansicht ---------- */
.day-body { touch-action: pan-y; }
.datebar { display: flex; align-items: center; margin: 2px 0 12px; padding: 4px; }
.datebar .datebtn { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 6px; border-radius: var(--r-ctl); }
.datebar .datebtn:active { background: var(--surface2); }
.datebar .dl { font-size: 17px; font-weight: 700; }
.datebar .ds { font-size: 12.5px; color: var(--primary); font-weight: 600; }
.wcomment { display: flex; gap: 10px; align-items: flex-start; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 10px; color: var(--text2); font-size: 14.5px; line-height: 1.4; }
.wcomment .ic { color: var(--primary); width: 20px; height: 20px; }
.wcomment span { white-space: pre-wrap; }
.excard { margin-bottom: 10px; overflow: hidden; }
.exhead { display: flex; align-items: center; gap: 2px; padding: 8px 4px 2px 14px; cursor: pointer; }
.exhead .exname { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; line-height: 1.25; padding: 6px 0; word-break: break-word; }
.exhead .more { color: var(--text2); }
.setlist { padding: 0 14px 10px; cursor: pointer; }
.setline { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: 15px; }
.setline .num, .setrow .num, .prow .num { width: 22px; height: 22px; border-radius: 6px; background: var(--tonal); color: var(--text2); font-size: 12.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.setline .val { flex: 1; font-variant-numeric: tabular-nums; }
.setline.muted { color: var(--text2); font-size: 14px; }
.day-actions { display: flex; gap: 10px; margin: 14px 0 6px; }
.remind { padding: 14px 16px; margin-bottom: 10px; border-left: 4px solid #f28c28; }
.remind .rh { display: flex; align-items: center; gap: 8px; font-size: 16px; }
.remind .rh .ic { color: #f28c28; }
.remind p { margin: 6px 0 10px; color: var(--text2); font-size: 14.5px; line-height: 1.45; }
.remind .ra { display: flex; justify-content: flex-end; gap: 6px; }
.sort-mode .setlist { display: none; }
.sort-mode .exhead { padding-bottom: 8px; }

/* ---------- Trainingsbildschirm ---------- */
.tabs { position: sticky; top: calc(60px + env(safe-area-inset-top)); z-index: 19; display: flex; background: var(--dark); padding: 0 4px; box-shadow: 0 2px 10px rgba(0,0,0,.25); }
.tabs button { flex: 1; height: 44px; font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #b9bcc3; border-bottom: 3px solid transparent; }
.tabs button.on { color: #fff; border-bottom-color: var(--primary); }
.entry { padding: 12px 14px 12px; margin-bottom: 10px; }
.frow { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.frow label { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); line-height: 1.25; }
.fctl { display: flex; align-items: center; gap: 6px; }
.fbtn { width: 46px; height: 46px; border-radius: var(--r-ctl); background: var(--tonal); color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.fbtn:active { background: #dfe2e7; }
.fctl input { width: 104px; height: 46px; text-align: center; font-size: 22px; font-weight: 600; border: 1.5px solid var(--line); border-radius: var(--r-ctl); background: var(--surface2); outline: none; font-variant-numeric: tabular-nums; }
.fctl input:focus { border-color: var(--primary); }
.eactions { display: flex; gap: 10px; margin-top: 12px; }
.eactions .btn { flex: 1; height: 46px; }
.setcard { padding: 4px 6px; margin-bottom: 10px; }
.setrow { display: flex; align-items: center; gap: 10px; padding: 2px 2px 2px 10px; border-radius: 8px; min-height: 46px; cursor: pointer; }
.setrow.on { background: var(--primary-soft); }
.setrow .val { flex: 1; font-size: 17px; font-variant-numeric: tabular-nums; }
.setrow .cbtn { color: #c9ccd3; width: 42px; height: 42px; }
.setrow .cbtn.has { color: var(--primary); }
.setc { margin: -2px 0 8px 42px; font-size: 13.5px; color: var(--text2); white-space: pre-wrap; }
.notes, .lastcard { padding: 12px 14px; margin-bottom: 10px; width: 100%; text-align: left; display: block; }
.nh { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); }
.nh .ic { width: 18px; height: 18px; }
.notes p { margin: 6px 0 0; font-size: 14.5px; white-space: pre-wrap; line-height: 1.45; }
.lastsets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.lastsets span { background: var(--tonal); border-radius: 6px; padding: 4px 8px; font-size: 13.5px; font-variant-numeric: tabular-nums; }
.hist { padding: 2px 14px 10px; margin-bottom: 10px; }
.hist .hh { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 8px 0 6px; }
.hist .hh b { flex: 1; min-width: 0; font-size: 15px; }
.hist .hh small { color: var(--text2); font-size: 12.5px; white-space: nowrap; }
.hist .hh .ic { color: #c9ccd3; width: 20px; height: 20px; }
.chartcard { padding: 12px 10px 10px; }
.ch { display: flex; align-items: baseline; gap: 8px; padding: 0 4px 8px; }
.ch b { font-size: 15px; }
.ch small { color: var(--text2); font-size: 12.5px; }
.chart { width: 100%; height: auto; display: block; aspect-ratio: 360 / 220; }
.chart .grid { stroke: #e4e7eb; stroke-width: 1; }
.chart .ylab { font-size: 10px; fill: #66686d; text-anchor: end; }
.chart .xlab { font-size: 10px; fill: #66686d; text-anchor: middle; }
.chart .area { fill: rgba(193,18,31,.08); }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.chart .pt { fill: #fff; stroke: var(--primary); stroke-width: 2; cursor: pointer; }
.chart .pt.on { fill: var(--primary); }
.tip { text-align: center; font-size: 13.5px; color: var(--text2); padding-top: 6px; }
.ranges { margin: 0 0 10px; display: flex; width: 100%; }
.ranges button { flex: 1; }
.bigrec { padding: 14px 16px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 2px; }
.bigrec small { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text2); }
.bigrec b { font-size: 28px; font-weight: 700; line-height: 1.2; }
.bigrec span { font-size: 14px; color: var(--text2); }
.rectable { width: 100%; border-collapse: collapse; }
.rectable th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text2); padding: 12px 14px 6px; font-weight: 700; }
.rectable td { padding: 8px 14px; border-top: 1px solid var(--line); font-size: 15px; vertical-align: top; }
.rectable td small { display: block; color: var(--text2); font-size: 12px; }
.rectable td:first-child { font-weight: 700; width: 56px; }
.rectable + .hint { margin: 8px 14px 12px; }

/* ---------- Kalender ---------- */
.calcard { padding: 6px 8px 10px; margin-bottom: 12px; touch-action: pan-y; }
.monthnav { display: flex; align-items: center; justify-content: space-between; padding: 2px 2px 6px; }
.monthnav b { font-size: 17px; }
.grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.grid.head span { text-align: center; font-size: 11.5px; font-weight: 700; color: var(--text2); text-transform: uppercase; padding: 4px 0 6px; }
.cell { display: flex; flex-direction: column; align-items: center; justify-content: flex-start; height: 54px; border-radius: 8px; padding-top: 5px; }
.cell .dn { font-size: 14.5px; font-weight: 500; width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.cell.today .dn { background: var(--dark); color: #fff; font-weight: 700; }
.cell.has { background: var(--surface2); }
.cell:active { background: var(--tonal); }
.cell .dots { display: flex; gap: 3px; height: 8px; margin-top: 3px; }
.cell .dots i { width: 6px; height: 6px; border-radius: 50%; display: block; }
.calfoot { text-align: center; font-size: 13px; color: var(--text2); padding-top: 8px; }

/* ---------- Vorlagen ---------- */
.routine { margin-bottom: 10px; overflow: hidden; }
.rhead { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px 14px; }
.rhead .ic { color: var(--text2); }
.rhead .nm { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; }
.rhead:disabled { cursor: default; }
.rnotes { margin: 0; padding: 0 14px 8px; font-size: 14px; color: var(--text2); white-space: pre-wrap; }
p.card.rnotes { padding: 12px 14px; margin: 0 0 10px; }
.rsec { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line); }
.rsec .lbl { flex: 1; min-width: 0; font-size: 15px; font-weight: 600; }
.rsec .lbl small { display: block; font-weight: 400; color: var(--text2); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rsec.muted { color: var(--text2); font-size: 14px; }
.section { margin-bottom: 10px; overflow: hidden; }
.shead { display: flex; align-items: center; gap: 4px; padding: 4px 6px 4px 14px; border-bottom: 1px solid var(--line); }
.shead .nm { flex: 1; min-width: 0; text-align: left; font-size: 16px; font-weight: 700; padding: 10px 0; display: flex; align-items: center; gap: 6px; }
.shead .nm .ic { color: #c9ccd3; }
.row.item .lbl { padding: 4px 0; }
.row.muted { color: var(--text2); font-size: 14px; min-height: 44px; }
.sfoot { padding: 8px 10px 10px; }
.prow { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.prow input { flex: 1; min-width: 0; width: 60px; height: 40px; text-align: center; border: 1.5px solid var(--line); border-radius: var(--r-ctl); background: var(--surface2); font-size: 16px; outline: none; }
.prow input:focus { border-color: var(--primary); }
.prow .ibtn { width: 36px; height: 36px; }
.plan { margin: 6px 0 8px; }

/* ---------- Menüs, Dialoge, Toast, Sheet ---------- */
#overlay { position: fixed; inset: 0; z-index: 50; background: rgba(20,22,30,.35); }
#overlay.clear { background: transparent; }
.menu { position: absolute; min-width: 220px; background: var(--surface); border-radius: 12px; padding: 6px; box-shadow: 0 6px 24px rgba(20,22,30,.22); z-index: 51; }
.menu button { display: flex; align-items: center; width: 100%; text-align: left; padding: 12px 14px; font-size: 16px; border-radius: 8px; }
.menu button .ic { width: 20px; height: 20px; margin-right: 12px; color: var(--text2); }
.menu button:active { background: var(--tonal); }
.menu button.danger { color: var(--primary); }
.menu button.danger .ic, .menu button .ic.heart-red { color: var(--primary); }
.dialog { position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%); width: min(92vw, 420px); max-height: 90vh; overflow: auto; background: var(--surface); border-radius: 18px; padding: 22px 22px 12px; box-shadow: 0 12px 40px rgba(20,22,30,.3); }
.dialog h3 { margin: 0 0 12px; font-size: 19px; font-weight: 600; }
.dialog p { margin: 0 0 12px; font-size: 16px; color: var(--text); line-height: 1.45; }
.dialog p.sub { margin: -8px 0 12px; color: var(--text2); font-size: 14px; }
.dialog p.muted { color: var(--text2); font-size: 14.5px; }
.dialog > input[type=text], .dialog > input[type=date] { width: 100%; font-size: 20px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--r-ctl); background: var(--surface2); outline: none; }
.dialog > input:focus { border-color: var(--primary); }
.dialog textarea { width: 100%; font-size: 15px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--r-ctl); background: var(--surface2); outline: none; resize: vertical; line-height: 1.4; }
.dialog textarea:focus { border-color: var(--primary); }
.dialog .actions { display: flex; justify-content: flex-end; gap: 4px; margin-top: 14px; flex-wrap: wrap; }
.dialog .actions button { padding: 10px 14px; color: var(--primary); font-weight: 600; border-radius: var(--r-ctl); }
.dialog .actions button:active { background: var(--primary-soft); }
.dialog .list { margin: 0 -8px; max-height: 55vh; overflow: auto; }
.dialog .list button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 12px 12px; font-size: 16px; border-radius: var(--r-ctl); }
.dialog .list button > span { flex: 1; min-width: 0; }
.dialog .list button span small { display: block; font-size: 12.5px; color: var(--text2); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dialog .list button.on { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.dialog .list button.danger { color: var(--primary); }
.dialog.form { padding: 18px 18px 10px; }
.fl { display: block; margin: 0 0 12px; font-size: 13px; font-weight: 600; color: var(--text2); }
.fl small { font-weight: 400; }
.fl input, .fl select, .fl textarea { display: block; width: 100%; margin-top: 5px; font-size: 16px; color: var(--text); padding: 10px 12px; border: 1.5px solid var(--line); border-radius: var(--r-ctl); background: var(--surface2); outline: none; font-weight: 400; }
.fl input:focus, .fl select:focus, .fl textarea:focus { border-color: var(--primary); }
.selrow { display: flex; gap: 6px; align-items: stretch; margin-top: 5px; }
.selrow select { margin-top: 0; flex: 1; min-width: 0; }
.selrow .ibtn { width: 46px; height: 46px; }
.palette { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px 6px; padding: 6px 10px 4px; }
.palette.inline { padding: 8px 0 0; }
.swatch { width: 40px; height: 40px; border-radius: 50%; position: relative; box-shadow: inset 0 0 0 1px rgba(0,0,0,.14); margin: 0 auto; display: block; }
.swatch.on::after { content: ''; position: absolute; inset: -5px; border: 3px solid var(--text); border-radius: 50%; }
.catlist .crow { display: flex; align-items: center; gap: 8px; padding: 6px 4px; }
.catlist .crow .lbl { flex: 1; min-width: 0; font-size: 16px; text-align: left; padding: 6px 0; }
.catlist .crow .lbl small { display: block; font-size: 12.5px; color: var(--text2); }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; background: var(--dark); color: #fff; padding: 12px 18px; border-radius: 10px; font-size: 15px; max-width: 90vw; box-shadow: 0 4px 16px rgba(0,0,0,.3); text-align: center; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); padding: 8px 8px calc(16px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; box-shadow: 0 -6px 24px rgba(20,22,30,.2); }
.sheet .grip { width: 36px; height: 4px; border-radius: 2px; background: #d5d7dc; margin: 4px auto 12px; }
.sheet h3 { margin: 0 12px 8px; font-size: 17px; font-weight: 600; }

/* ---------- Körperwerte ---------- */
.mcard { display: block; width: 100%; text-align: left; padding: 12px 14px; margin-bottom: 10px; }
.mcard:active { background: var(--surface2); }
.mh { display: flex; align-items: baseline; gap: 8px; }
.mh .mn { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; }
.mh .mgoal { font-size: 12.5px; color: var(--text2); white-space: nowrap; }
.mv { display: flex; align-items: baseline; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.mv b { font-size: 26px; font-weight: 700; line-height: 1.2; }
.mv.muted { font-size: 14.5px; margin-top: 6px; }
.md { font-size: 13px; color: var(--text2); margin-top: 2px; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 13.5px; font-weight: 600; color: var(--text2); white-space: nowrap; }
.delta .ic { width: 18px; height: 18px; }
.delta.good { color: #1f9d4c; }
.delta.bad { color: var(--primary); }
.brow .bv { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; flex: none; }
.brow .bv b { font-size: 16px; font-variant-numeric: tabular-nums; }
.brow .bv .delta { font-size: 12.5px; }
.brow .lbl small { white-space: pre-wrap; }
.dialog .valrow { margin-top: 6px; justify-content: center; }
.dialog .valrow input { width: 130px; }
.fl.two { display: flex; gap: 10px; }
.fl.two label { flex: 1; min-width: 0; font-size: 13px; font-weight: 600; color: var(--text2); }
.fl.two input { display: block; width: 100%; margin-top: 5px; font-size: 16px; color: var(--text); padding: 10px 8px; border: 1.5px solid var(--line); border-radius: var(--r-ctl); background: var(--surface2); outline: none; font-weight: 400; }
.fl.two input:focus { border-color: var(--primary); }
.fl .chips { padding: 6px 0 2px; gap: 6px; }
.chipbtn.small { height: 30px; padding: 0 10px; font-size: 12.5px; font-weight: 500; }
.dialog .goalsegm { margin-top: 6px; display: flex; width: 100%; }
.dialog .goalsegm button { flex: 1; padding: 0 4px; }
.fl small.inl { display: inline; color: var(--text2); font-weight: 400; }
.catlist .crow .lbl small.inl { display: inline; }
.chart .goal { stroke: #1f9d4c; stroke-width: 1.5; stroke-dasharray: 5 4; }
.btn.big.block { display: flex; width: 100%; margin: 4px 0 12px; }

/* ---------- Einstellungen / Mehr ---------- */
.danger-zone { margin-top: 16px; }
.danger-zone .row { color: var(--primary); }
.danger-zone .row > .ic { color: var(--primary); }
.settings-body .row .segm { flex: none; }

/* ---------- Desktop: Inhalt und Leisten auf eine 640-px-Spalte zentrieren ---------- */
@media (min-width: 640px) {
  .body { max-width: 640px; margin: 0 auto; }
  .topbar { padding-left: max(12px, calc((100% - 640px) / 2 + 12px)); padding-right: max(8px, calc((100% - 640px) / 2 + 8px)); }
  .tabs { padding-left: max(4px, calc((100% - 640px) / 2 + 4px)); padding-right: max(4px, calc((100% - 640px) / 2 + 4px)); }
  #bnav { left: 50%; right: auto; width: 640px; transform: translateX(-50%); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}
