/* Eine schmale Spalte wie ein Trainingsbuch am Rack: Tabs oben, darunter jeweils eine Ansicht */
:root {
  --bg: #eef1f0;
  --surface: #ffffff;
  --sunk: #e3e8e6;
  --fg: #16201d;
  --muted: #5d6b67;
  --line: #d5dcda;
  --accent: #0f7a5c;
  --accent-fg: #ffffff;
  --done: #c2410c;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101614; --surface: #19211e; --sunk: #141b19; --fg: #e8eeec; --muted: #93a39e;
    --line: #2a3532; --accent: #3fc79b; --accent-fg: #08130f; --done: #fb923c; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101614; --surface: #19211e; --sunk: #141b19; --fg: #e8eeec; --muted: #93a39e;
  --line: #2a3532; --accent: #3fc79b; --accent-fg: #08130f; --done: #fb923c; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 16px; line-height: 1.45;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px 96px;
}
.app { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; margin: 0; text-wrap: balance; line-height: 1.1; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-size: 26px; font-weight: 700; letter-spacing: .01em; }
.tabs { display: flex; gap: 4px; background: var(--sunk); padding: 4px; border-radius: 12px; }
.tabs button {
  font: 600 15px var(--body); border: 0; background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 9px; cursor: pointer; position: relative;
}
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--fg); }
.tabs .live::after { content: ""; position: absolute; top: 6px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--done); }
.note { font-size: 14px; color: var(--muted); background: var(--sunk); border-radius: 10px; padding: 10px 12px; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; color: var(--muted); font-weight: 600; }
button { font-family: var(--body); }
button:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.btn {
  font: 600 16px var(--body); border-radius: 12px; padding: 12px 16px; cursor: pointer;
  border: 1.5px solid var(--line); background: var(--surface); color: var(--fg);
  transition: background .15s, border-color .15s, transform .08s;
}
.btn:hover { border-color: var(--accent); }
.btn:active { transform: scale(.98); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.big { font: 700 26px var(--display); letter-spacing: .02em; padding: 18px; width: 100%; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 8px 10px; font-size: 15px; }
.btn.ghost:hover { color: var(--fg); border-color: var(--line); }
.btn.danger[data-armed="1"] { background: var(--done); border-color: var(--done); color: var(--accent-fg); }
.btn:disabled { opacity: .45; cursor: default; transform: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spread { justify-content: space-between; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Workout-Auswahl */
.wlist { display: grid; gap: 12px; }
.wcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.wcard ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 15px; }
.wcard li { display: flex; justify-content: space-between; gap: 12px; }
.wcard li span:last-child { color: var(--muted); white-space: nowrap; }

/* Laufendes Training */
.sess { display: flex; flex-direction: column; gap: 16px; }
.sess-head { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.exname { font-size: clamp(34px, 9vw, 44px); }
.level { color: var(--muted); margin-top: 4px; }
.target { font-family: var(--display); font-size: 22px; font-weight: 600; }
.target b { color: var(--accent); }
.lasttime { font-size: 14px; color: var(--muted); }
.steppers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stepbox { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 6px; align-items: stretch; }
.stepbox .eyebrow { text-align: center; }
.stepper { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 4px; }
.stepper button {
  height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--sunk); color: var(--fg);
  font: 600 20px var(--body); cursor: pointer;
}
.stepper button:active { background: var(--line); }
.stepper input {
  width: 100%; min-width: 0; text-align: center; border: 0; background: transparent; color: var(--fg);
  font: 500 26px var(--mono); font-variant-numeric: tabular-nums; padding: 4px 0; -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.setdots { display: flex; gap: 6px; flex-wrap: wrap; }
.dot {
  min-width: 52px; padding: 6px 8px; border-radius: 10px; border: 1.5px dashed var(--line);
  font: 500 13px var(--mono); text-align: center; color: var(--muted);
}
.dot.ok { border-style: solid; border-color: var(--accent); color: var(--fg); }
.dot.now { border-style: solid; border-color: var(--fg); color: var(--fg); }
.upnext { font-size: 14px; color: var(--muted); }
.upnext summary { cursor: pointer; }
.upnext ol { margin: 8px 0 0; padding-left: 20px; }

/* Pause */
.rest { display: flex; flex-direction: column; align-items: center; gap: 20px; padding-top: 8px; }
.dial { position: relative; width: min(280px, 72vw); aspect-ratio: 1; max-width: 100%; }
.dial svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.dial circle { fill: none; stroke-width: 9; }
.dial .track { stroke: var(--line); }
.dial .prog { stroke: var(--accent); stroke-linecap: round; }
.readout { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.readout .time { font: 500 clamp(52px, 15vw, 72px) var(--mono); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.nextup { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; width: 100%; }
.nextup .target { font-size: 20px; }

/* Abschluss & Verlauf */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.stat .v { font: 500 20px var(--mono); font-variant-numeric: tabular-nums; }
.stat .k { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }
.summary { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; display: grid; gap: 8px; }
.summary div { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.summary div span:last-child { font-family: var(--mono); font-size: 13px; color: var(--muted); text-align: right; }
.log { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.log summary { list-style: none; cursor: pointer; padding: 12px 16px; display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.log summary::-webkit-details-marker { display: none; }
.log summary .d { color: var(--muted); font-size: 14px; }
.log .body { padding: 0 16px 12px; display: grid; gap: 10px; }
.empty { text-align: center; color: var(--muted); padding: 32px 16px; background: var(--surface); border: 1px dashed var(--line); border-radius: 16px; }

/* Programm-Editor */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: 600 15px var(--body); padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); color: var(--fg); cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
label.field { display: grid; gap: 4px; }
.text { font: 500 16px var(--body); padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--fg); width: 100%; min-width: 0; }
.excard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 12px; display: grid; gap: 10px; }
.excard .head { display: grid; grid-template-columns: 28px 1fr auto; gap: 8px; align-items: center; }
.excard .idx { font: 700 20px var(--display); color: var(--muted); text-align: center; }
.excard .tools { display: flex; gap: 2px; }
.excard .tools button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; }
.excard .tools button:hover { border-color: var(--line); color: var(--fg); }
.excard .grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.excard .stepbox { padding: 6px; background: var(--sunk); border: 0; }
.excard .stepper { grid-template-columns: 30px 1fr 30px; gap: 2px; }
.excard .stepper button { height: 34px; font-size: 17px; background: var(--surface); }
.excard .stepper input { font-size: 17px; }
@media (max-width: 480px) { .excard .grid4 { grid-template-columns: 1fr 1fr; } }
/* Übungsbibliothek & Auswahl */
.librow, .pickrow { display: flex; align-items: center; }
.librow .libhead { flex: 1; min-width: 0; padding-left: 4px; }
.pickrow { gap: 4px; }
.pickrow .pickitem { flex: 1; min-width: 0; }
.star { flex: none; width: 44px; height: 44px; border: 0; background: transparent; color: var(--muted); font-size: 22px; cursor: pointer; border-radius: 10px; }
.star[aria-pressed="true"] { color: var(--done); }
.star:hover { background: var(--sunk); }
.librow { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.librow button.libhead {
  width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left;
  padding: 12px 14px; background: transparent; border: 0; color: var(--fg); cursor: pointer; font: 600 17px var(--body); border-radius: 14px;
}
.libhead .sub, .pickitem .sub { display: block; font-weight: 400; font-size: 13px; color: var(--muted); }
.libhead .num, .pickitem .num { font-size: 13px; color: var(--muted); white-space: nowrap; }
select.text { appearance: auto; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 7; max-height: 72vh; display: flex; flex-direction: column;
  background: var(--surface); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; box-shadow: 0 -10px 30px rgb(0 0 0 / .2);
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.sheet .inner { max-width: 560px; margin: 0 auto; width: 100%; display: flex; flex-direction: column; gap: 10px; min-height: 0; flex: 1; }
.picklist { overflow-y: auto; display: grid; gap: 6px; min-height: 0; align-content: start; }
.pickitem {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: left; width: 100%;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg); color: var(--fg); cursor: pointer; font: 600 16px var(--body);
}
.pickitem:hover { border-color: var(--accent); }
.pickitem .plus { font: 700 26px var(--display); color: var(--accent); line-height: 1; }
.pickitem .in { font-size: 12px; color: var(--accent); font-weight: 600; }
@media (max-width: 540px) { .tabs { width: 100%; } .tabs button { flex: 1; padding: 8px 2px; font-size: 14px; } }
.savebar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 12px max(16px, env(safe-area-inset-right, 0px)) calc(12px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
.savebar .inner { max-width: 560px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.savebar .st { font-size: 14px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px)); z-index: 9;
  background: var(--fg); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 600; font-size: 15px;
  max-width: calc(100% - 32px);
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- Ergänzungen Supabase-Version ---- */
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
[hidden] { display: none !important; }
.who { font: 600 14px var(--body); border: 1px solid var(--line); background: var(--surface); color: var(--fg); border-radius: 999px; padding: 6px 12px; cursor: pointer; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabs .badge::after { content: ""; position: absolute; top: 6px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--done); }
.tag { display: inline-block; font: 600 11px var(--body); text-transform: uppercase; letter-spacing: .08em; color: var(--done); border: 1px solid currentColor; border-radius: 6px; padding: 1px 5px; vertical-align: middle; }
.chip.small { font-size: 14px; padding: 6px 12px; }
.chip.review { border-color: var(--done); color: var(--done); }
.chip.review[aria-pressed="true"] { background: var(--done); color: var(--accent-fg); }
.review-box { display: grid; gap: 8px; border-top: 1px dashed var(--line); padding-top: 10px; }
.authcard { max-width: 420px; margin: 24px auto 0; display: grid; gap: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.err { margin: 0; color: var(--done); font-weight: 600; }
.grid3 { width: 100%; display: grid; grid-template-columns: 1fr 1fr 2fr; gap: 8px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.timerbtns { width: 100%; }
.timerbtns .btn { font: 700 24px var(--display); padding: 16px 0; }
.timerbtns .btn span { display: block; font: 500 12px var(--body); letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.dial .prog.done { stroke: var(--done); }
.readout .time.done { color: var(--done); }
.excard .exn { font: 600 17px var(--body); min-width: 0; overflow-wrap: anywhere; }
.summary.flat { border: 0; padding: 0; }
.logmeta { font-size: 13px; color: var(--muted); text-align: right; }
code { font-family: var(--mono); font-size: .9em; }
