:root { color-scheme: dark; --ac: #f2f1ec; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: #121214; color: #f2f1ec;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 560px; margin: 0 auto; padding: 28px 20px calc(84px + env(safe-area-inset-bottom)); }
h1 { font-size: 1.1rem; font-weight: 700; }
a { color: inherit; text-decoration: none; }

/* ---------- Prominenter Input: Mobile oben / Desktop unten ---------- */
form.add.prom {
  position: sticky; top: 0; z-index: 30;
  margin: 0 -20px 20px; padding: 12px 20px 16px;
  background: linear-gradient(#121214 82%, rgba(18,18,20,.92));
}
form.add.prom input { padding: 14px 15px; font-size: 1.05rem; }
form.add.prom button { padding: 14px 22px; font-size: 1.05rem; }
@media (min-width: 700px) {
  form.add.prom {
    position: fixed; top: auto; bottom: calc(72px + env(safe-area-inset-bottom));
    left: 50%; transform: translateX(-50%); width: min(560px, calc(100vw - 40px));
    margin: 0; padding: 16px 0 8px;
    background: linear-gradient(rgba(18,18,20,0), #121214 40%);
  }
  main { padding-bottom: 220px; }
}

/* ---------- Nav ---------- */
#nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 40;
  display: flex; justify-content: center; gap: 6px;
  background: #121214;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
#nav a {
  padding: 9px 22px; border-radius: 999px; color: #5f5f65;
  display: flex; align-items: center; justify-content: center;
}
#nav a.on { background: var(--ac); color: #121214; }
@media (max-width: 480px) {
  #nav { gap: 2px; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  #nav a { padding: 8px 13px; }
}
.icon { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }

/* ---------- Formen ---------- */
form.add { display: grid; gap: 12px; margin-bottom: 36px; }
.row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; }
input, textarea {
  width: 100%; padding: 11px 12px; border-radius: 8px; font-size: 1rem;
  border: none; background: rgba(242,241,236,.08); color: #f2f1ec;
  font-family: inherit;
}
input::placeholder, textarea::placeholder { color: #6f6f75; }
input:focus { outline: none; background: rgba(242,241,236,.13); }
button {
  padding: 11px 17px; border: none; border-radius: 8px; cursor: pointer;
  background: var(--ac); color: #121214; font-weight: 700; font-size: 1rem;
}
button:active { transform: scale(.97); }

/* ---------- Topbar ---------- */
.top-nav { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 20px; }
.top-nav h1 { flex: 1; text-align: center; }
.kwg { display: flex; align-items: center; gap: 0; }
.kwg h1 { padding: 0 4px; min-width: 86px; }
.navbtn {
  width: 40px; height: 40px; padding: 0; border-radius: 999px;
  background: none; color: #8f8f95;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  cursor: pointer;
}
.navbtn:active { transform: scale(.94); background: rgba(242,241,236,.08); }
.navbtn .icon { width: 21px; height: 21px; }
.navbtn.ghost { visibility: hidden; }

/* ---------- Drill-down: Jahre / Monate ---------- */
.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 8px; margin-bottom: 36px; }
.tile {
  padding: 18px 4px; text-decoration: none;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  border-radius: 10px;
}
.tile.cur { outline: 1.5px solid rgba(242,241,236,.45); }
.tile.dim { opacity: .35; }
.tile .t-big { font-size: 1rem; font-weight: 600; }
.tile .t-sub { color: #7a7a80; font-size: .76rem; display: flex; align-items: center; gap: 4px; }
.tile .t-sub .icon { width: 12px; height: 12px; stroke-width: 2.4; }

/* ---------- Listenzeilen (Woche / Monat) ---------- */
.daycard, .wk-head {
  display: flex; align-items: center; width: 100%; text-align: left; gap: 8px;
  background: none; border: none; border-radius: 8px;
  padding: 13px 6px; color: #f2f1ec; font-family: inherit; font-size: 1rem; cursor: pointer;
}
.daycard .info, .wk-head .info { flex: 1; min-width: 0; }
.hspace { flex: 1; }
.d-date { font-weight: 400; font-size: .98rem; }
.d-sub { color: #7a7a80; font-size: .82rem; margin-top: 3px; }
.chev { color: #55555b; display: inline-flex; }
.daycard.off, .wk-head.off { opacity: .32; }
.edt-pure {
  background: none; padding: 5px; width: 30px; height: 30px; border-radius: 8px;
  color: #8f8f95; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.edt-pure .icon { width: 16px; height: 16px; }
.edt-pure:hover, .edt-pure:focus { color: #f2f1ec; outline: none; }
.edt-pure.done { color: var(--ac); }

/* Wochen-Akkordeon */
.wk-day.cur > .wk-head .d-date { font-weight: 700; color: #fff; }
.wk-head .chev { transition: transform .15s ease; }
.wk-day.open .chev { transform: rotate(90deg); }
.wk-body { padding: 4px 6px 18px 18px; }
.wkb-ex { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.wkb-img { width: 38px; height: 38px; object-fit: cover; border-radius: 6px; background: rgba(242,241,236,.06); flex-shrink: 0; }
.wkb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 400; font-size: .92rem; color: #c9c8c2; }
.wkb-sets { font-weight: 400; font-size: .86rem; color: #8f8f95; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wk-actions { display: flex; align-items: center; padding-top: 10px; }
.wki { color: #7a7a80; font-size: .84rem; margin-right: auto; padding-left: 50px; }
.wkv { font-variant-numeric: tabular-nums; color: #d9d8d3; font-size: .9rem; }
.mini.ok, button.mini.ok { background: var(--ac); color: #121214; }
.wkb-editvals { display: flex; flex-direction: column; gap: 3px; align-items: flex-end; }
.evr { display: flex; align-items: center; gap: 5px; color: #7a7a80; font-size: .84rem; }
.eik, .eiw {
  width: 58px; padding: 5px 7px; border-radius: 6px;
  border: 1px solid var(--ac); background: rgba(242,241,236,.05);
  color: #f2f1ec; font-size: .9rem; text-align: right;
  font-family: inherit;
}
.eik:focus, .eiw:focus { outline: none; background: rgba(242,241,236,.12); }
input[type="number"].eik::-webkit-outer-spin-button,
input[type="number"].eiw::-webkit-inner-spin-button { -webkit-appearance: none; }
.eik, .eiw { -moz-appearance: textfield; appearance: textfield; }

/* ---------- Tagesansicht (Bearbeitung) ---------- */
.ex-block { padding: 18px 0 8px; }
.ex-block:first-of-type { padding-top: 6px; }
.ex-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.eximg { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; background: rgba(242,241,236,.06); flex-shrink: 0; }
.ex-name { font-weight: 400; font-size: .96rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-meta { color: #7a7a80; font-size: .8rem; white-space: nowrap; }
ul.sets { list-style: none; }
ul.sets li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 7px 0 7px 54px; font-variant-numeric: tabular-nums; font-size: .95rem; color: #d9d8d3;
}
ul.sets li .acts { display: flex; gap: 0; }
.edt, .del {
  width: 34px; height: 34px; padding: 0; background: none; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
}
.edt { color: #7a7a80; } .del { color: #55555b; }
.del:hover, .del:focus { color: #ff5d73; }
.edt:hover, .edt:focus { color: #f2f1ec; }
ul.sets li .icon { width: 16px; height: 16px; }
ul.sets li.editing {
  display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 6px; align-items: center; padding-left: 50px;
}
ul.sets li.editing input { padding: 8px 10px; font-size: .93rem; }
ul.sets li.editing button {
  padding: 0; width: 34px; height: 34px; display: inline-flex;
  align-items: center; justify-content: center;
}
ul.sets li.editing .e-ok { background: #7bd88f; color: #121214; }
ul.sets li.editing .e-cx { background: rgba(242,241,236,.1); color: #f2f1ec; }
.total { color: #7a7a80; font-size: .84rem; text-align: right; padding: 2px 4px 0; }

/* ---------- Körper ---------- */
.b-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 6px;
}
.b-val { font-weight: 400; font-variant-numeric: tabular-nums; }
.b-diff { font-size: .8rem; margin-left: 10px; }
.up { color: #7bd88f; } .down { color: #ff8f6b; }
.b-note { color: #7a7a80; font-size: .84rem; margin-left: 12px; }
.b-right { display: flex; align-items: center; gap: 12px; }
.b-right .del { width: 32px; height: 32px; }
.b-row + .b-row { border-top: none; }

/* ---------- Einstellungen ---------- */
.card { padding: 24px 0 6px; }
.card + .card { margin-top: 4px; }
.card h3 { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: #7a7a80; margin-bottom: 14px; }
.card p { color: #8f8f95; font-size: .86rem; margin-bottom: 16px; line-height: 1.5; }
.btn-danger { width: 100%; background: rgba(255,93,115,.12); color: #ff5d73; }

/* ---------- Übungspicker / Katalog ---------- */
.exwrap { position: relative; }
.sugg {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  background: #1c1c20; border-radius: 10px;
  max-height: 288px; overflow-y: auto; overflow-x: hidden;
}
.sugg-item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; cursor: pointer;
}
.sugg-item.on, .sugg-item:hover { background: rgba(242,241,236,.07); }
.sugg-item img, .sugg-ph {
  width: 40px; height: 40px; border-radius: 6px; object-fit: cover;
  background: rgba(242,241,236,.06); flex-shrink: 0; display: block;
}
.sugg-name { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sugg-none { padding: 11px; color: #6f6f75; font-size: .84rem; text-align: center; }
.stb { background: none; padding: 2px 1px; border-radius: 6px; }
.st { width: 13px; height: 13px; fill: none; stroke: #55555b; stroke-width: 1.6; display: block; }
.st.on { fill: var(--ac); stroke: var(--ac); }
.favb { background: none; padding: 4px; border-radius: 8px; flex-shrink: 0; display: flex; }
.ht { width: 15px; height: 15px; fill: none; stroke: #55555b; stroke-width: 1.6; display: block; }
.favb.on .ht { fill: var(--ac); stroke: var(--ac); }

/* ---------- Übungskatalog ---------- */
.cat-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 6px;
}
.cat-row img, .cat-row .sugg-ph { width: 44px; height: 44px; border-radius: 6px; object-fit: cover; background: rgba(242,241,236,.06); flex-shrink: 0; }
.cat-row .sugg-name { flex: 1; min-width: 0; }
.btn-more {
  width: 100%; margin: 12px 0 0; padding: 13px;
  background: rgba(242,241,236,.07); color: #8f8f95; font-weight: 600;
}

/* ---------- Filter-Chips (wrappen – nichts bleibt unerreichbar) ---------- */
.chips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-bottom: 10px;
}
.chip {
  padding: 8px 15px; border-radius: 999px;
  background: none; color: #7a7a80; font-size: .82rem;
  border: none; cursor: pointer; font-family: inherit;
}
@media (max-width: 480px) {
  .chip { padding: 7px 12px; font-size: .8rem; }
  .chips { gap: 5px; margin-bottom: 8px; }
}
.chip.on { background: var(--ac); color: #121214; font-weight: 600; }

.empty { color: #6f6f75; text-align: center; padding: 44px 0; }

/* ---------- Switch ---------- */
.togglrow { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.switch { position: relative; width: 44px; height: 25px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.slid { position: absolute; inset: 0; border-radius: 999px; background: rgba(242,241,236,.15); transition: background .18s ease; }
.slid::before {
  content: ""; position: absolute; width: 19px; height: 19px; border-radius: 50%;
  background: #f2f1ec; top: 3px; left: 3px; transition: transform .18s ease-out;
}
.switch input:checked + .slid { background: var(--ac); }
.switch input:checked + .slid::before { background: #121214; transform: translateX(19px); }

/* ---------- Account ---------- */
.acc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.acc-mail { font-size: .92rem; color: #d9d8d3; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-sync { color: #7a7a80; font-size: .82rem; margin-top: 10px; }
.acc-hint { color: #8f8f95; font-size: .86rem; margin-bottom: 12px; }
.acc-status { color: var(--ac); font-size: .84rem; margin-top: 10px; }
.auth-alt { display: flex; gap: 8px; margin-top: 8px; }
.auth-alt .chip { padding: 6px 12px; font-size: .8rem; }

/* ---------- Audit-Fixes: Fokus & Reduced Motion ---------- */
button:focus-visible, .chip:focus-visible, .navbtn:focus-visible, .edt-pure:focus-visible,
.mini:focus-visible, input:focus-visible, select:focus-visible, #nav a:focus-visible {
  outline: 2px solid var(--ac); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  #zoomer, .pfill, .wk-head .chev, button, .navbtn { transition: none !important; animation: none !important; }
}

/* ---------- Bild-Zoom-Overlay ---------- */
#zoomer {
  position: fixed; z-index: 200; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  background: #17171a; border-radius: 10px; padding: 10px;
  opacity: 0; transform: scale(.95);
  transition: opacity .15s ease-out, transform .15s ease-out;
  box-shadow: 0 14px 44px rgba(0,0,0,.55);
}
#zoomer.on { opacity: 1; transform: scale(1); }
#zoomer img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; }

/* ---------- Food / Fasten ---------- */
.fastcard { padding-top: 4px; }
.ftimer {
  font-size: 2.7rem; font-weight: 200; letter-spacing: .01em;
  font-variant-numeric: tabular-nums; text-align: center;
  padding: 22px 0 8px;
}
.pbar { height: 6px; border-radius: 999px; background: rgba(242,241,236,.08); overflow: hidden; margin-top: 10px; }
.pfill { height: 100%; width: 0%; background: var(--ac); border-radius: 999px; transition: width .5s linear; }
.fsub { text-align: center; color: #8f8f95; font-size: .88rem; margin-top: 10px; }
.flab { display: grid; gap: 7px; font-size: .85rem; color: #c9c8c2; margin-bottom: 14px; }
.sechead { font-size: .78rem; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: #7a7a80; margin-bottom: 8px; }

/* ---------- Statistik ---------- */
.chart {
  width: 100%; height: 190px; display: block;
  background: rgba(242,241,236,.045); border-radius: 10px;
}
.chart path.ln { fill: none; stroke-linejoin: round; stroke-linecap: round; }
.axis { display: flex; justify-content: space-between; color: #7a7a80; font-size: .78rem; padding: 5px 2px 0; }
#stLegend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 12px 2px 0; }
.lgd { display: inline-flex; align-items: center; gap: 7px; font-size: .84rem; color: #d9d8d3; }
.lgd i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.lgd em { font-style: normal; color: #8f8f95; font-variant-numeric: tabular-nums; }
.accdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; vertical-align: baseline; }

/* ---------- Einstellungen: Ordnen / Regeln / Wheel ---------- */
#wheel { border-radius: 50%; display: block; cursor: crosshair; touch-action: none; }
.sliders { display: grid; gap: 8px; margin-top: 12px; }
.sliders label { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; font-size: .88rem; color: #c9c8c2; }
input[type="range"] { width: 100%; accent-color: var(--ac); background: none; padding: 0; }
.ordrow, .rulerow, .ovrow {
  display: flex; align-items: center; gap: 8px; padding: 5px 0;
}
.ordrow + .ordrow, .rulerow + .rulerow, .ovrow + .ovrow { border-top: 1px solid rgba(242,241,236,.05); }
.ord-ic { color: #8f8f95; display: inline-flex; }
.ord-name { flex: 1; font-size: .93rem; }
.mini {
  padding: 0; width: 34px; height: 34px; border-radius: 9px;
  background: rgba(242,241,236,.08); color: #c9c8c2;
  display: inline-flex; align-items: center; justify-content: center;
}
.mini .icon { width: 15px; height: 15px; }
.mini:disabled { opacity: .3; }
.mini.wide { width: 100%; padding: 10px; font-size: .88rem; color: #8f8f95; }
.rulerow input.rk {
  flex: 1; min-width: 0; padding: 9px 11px; font-size: .92rem;
}
.rulerow select {
  width: 108px; padding: 9px 8px; border-radius: 8px; font-size: .9rem;
  border: none; background: rgba(242,241,236,.08); color: #f2f1ec;
}
#ovPick button { background: none; color: #c9c8c2; font-weight: 600; font-size: .85rem; padding: 8px 12px; }
#ovPick button:hover { background: rgba(242,241,236,.08); }