:root {
  --bg: #08080b;
  --surface: #141419;
  --surface-2: #1e1e26;
  --border: #262630;
  --border-2: #363644;
  --text: #e2ddd6;
  /* 4,7:1 auf --surface. Traegt jedes Label, jede Meta-Zeile und die
     ruhende Navigation — bei 0,7rem ist das die Schwelle, ab der
     Kleintext lesbar bleibt. Der Vorgaenger #68687a lag bei 3,5:1. */
  --text-2: #7e7e90;

  /* Wettkampf-Farbcode (IKSF) — fuer dunklen Grund aufgehellt */
  --bell-8:  #f06bb0;
  --bell-12: #4a90e2;
  --bell-16: #f2c230;
  --bell-20: #a374f0;
  --bell-24: #3ecf6e;
  --bell-28: #f59c48;
  --bell-32: #f0615a;
  --bell-36: #a3a9b4;
  --bell-40: #e8e4dc;

  /* Bandstufen stehen nicht auf der Kilo-Skala und haben im Wettkampfcode
     keine Entsprechung -- trotzdem sollen sie im Training genauso auffallen
     wie eine Bell-Farbe. Orange, weil Kettlebell (Standardgewicht 16 kg)
     gelb ist und beides nebeneinander klar unterscheidbar bleiben soll. */
  --band: #f0883f;

  /* Hue 163, gewaehlt. Gehoert bewusst keiner Bell -- steht aber naeher
     am 24-kg-Wettkampfgruen (23 Grad) als am 12-kg-Blau (49 Grad). Wo
     beide aufeinandertreffen, etwa am erledigten 24-kg-Satz neben der
     Markierung der laufenden Uebung, trennt sie die Form, nicht der
     Farbton: Flaeche und Haken gegen Balken und Rahmen. */
  --accent: #0cf5b3;
  --accent-ink: #05201d;
  --success: var(--bell-24);
  --danger: var(--bell-32);
  --radius-sm: 5px;
  --radius: 10px;
  --touch: 48px;
  --top: 52px;
  --nav: 64px;
}

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

/* Jede Klasse setzt --bell auf die Farbe ihrer Wettkampf-Bell; alles,
   was ein Gewicht zeigt, liest --bell aus. */
.bell-8  { --bell: var(--bell-8); }
.bell-12 { --bell: var(--bell-12); }
.bell-16 { --bell: var(--bell-16); }
.bell-20 { --bell: var(--bell-20); }
.bell-24 { --bell: var(--bell-24); }
.bell-28 { --bell: var(--bell-28); }
.bell-32 { --bell: var(--bell-32); }
.bell-36 { --bell: var(--bell-36); }
.bell-40 { --bell: var(--bell-40); }
.band    { --bell: var(--band); }
/* Core traegt kein Gewicht, also auch keine Wettkampffarbe. */
.core    { --bell: var(--band); }

.kg {
  color: var(--bell, var(--text));
  font-weight: 600;
  font-feature-settings: "tnum" 1;
}

/* Eine Bandstufe ist kein Gewicht — das sagt hier die Form, nicht die Farbe. */
.kg.band {
  color: var(--text);
  font-weight: 500;
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 0.86em;
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  -webkit-tap-highlight-color: transparent;
  padding-top: var(--top);
  padding-bottom: var(--nav);
}

/* ── Top bar ── */
.top-bar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--top);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

/* Dieselbe Spalte wie main — sonst klebt die Wortmarke auf breiten
   Fenstern am Rand und verliert den Bezug zum Inhalt darunter. */
.top-bar-inner {
  height: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Die Wortmarke ist das einzige Element in Syne. Ihre eigenwillige
   Geometrie traegt genau hier, wo ein Logo stehen soll, und nirgends
   sonst — die restliche Oberflaeche bleibt Space Grotesk. */
.app-name {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: 'Syne', 'Space Grotesk', system-ui, sans-serif;
  font-size: 1.06rem;
  font-weight: 800;
  letter-spacing: -0.035em;
  color: var(--text);
}

/* Die Wortmarke ist als einzige Flaeche gesetzt — die Navigations-Icons
   daneben sind alle Strich. Der Unterschied trennt Marke von Bedienung. */
.brand-mark {
  width: 21px;
  height: 21px;
  color: var(--accent);
  flex-shrink: 0;
}

.logout-link {
  font-size: 0.78rem;
  color: var(--text-2);
  text-decoration: none;
  padding: 6px 0;
}
.logout-link:hover { color: var(--text); }

/* ── Bottom nav ── */
.site-nav {
  position: fixed;
  inset: auto 0 0 0;
  height: var(--nav);
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--border);
  z-index: 20;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text-2);
  text-decoration: none;
  font-size: 0.62rem;
  font-weight: 500;
}

.nav-item svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  stroke-width: 1.75;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.active { color: var(--accent); }

/* ── Main ── */
main {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 8px;
}

/* ── Typography ── */
h1 {
  font-size: 1.4rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 20px;
}

h2 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
  margin: 28px 0 10px;
}

h3 {
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 20px 0 8px;
  color: var(--text);
}

/* ── Buttons ── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 20px;
  height: var(--touch);
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
}
.btn-primary:active { opacity: 0.8; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 20px;
  height: var(--touch);
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  text-decoration: none;
}
.btn-secondary:active { background: var(--surface); }

.btn-sm {
  height: 36px;
  padding: 0 14px;
  font-size: 0.82rem;
  width: auto;
  border-radius: var(--radius-sm);
}

.btn-danger-text { color: var(--danger) !important; border-color: transparent; }

/* ── Stack ── */
.stack > * + * { margin-top: 10px; }
.stack-lg > * + * { margin-top: 16px; }

/* ── Inputs ── */
input[type="text"],
input[type="password"],
input[type="number"],
input[type="search"],
select {
  width: 100%;
  height: var(--touch);
  padding: 0 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}
input[type="number"] { font-feature-settings: "tnum" 1; -moz-appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:focus, select:focus { border-color: var(--accent); }

label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-2);
  margin-bottom: 6px;
}

/* ── Card ── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* ── List items ── */
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: var(--text);
  gap: 12px;
}
.list-item:last-child { border-bottom: none; }
a.list-item:hover { background: var(--surface-2); }

/* ── Stat grid ── */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.stat-value {
  display: block;
  font-size: 1.8rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  font-feature-settings: "tnum" 1;
  line-height: 1;
  margin-bottom: 6px;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  color: var(--text-2);
  font-weight: 500;
}

/* Die Stats-Seite zeigt Eckdaten, keine Kennzahlen zum Weiterklicken: drei
   ruhige, zentrierte Kacheln statt zwei grosser. Stand frueher als zweite,
   globale Definition im <style> der Seite und hat das Dashboard mit
   ueberschrieben — als Modifier trifft es nur noch, was es treffen soll. */
.stat-grid.compact { grid-template-columns: repeat(3, 1fr); gap: 12px; }
.stat-grid.compact .stat-card { text-align: center; }
.stat-grid.compact .stat-value { font-size: 1.5rem; font-weight: 700; margin-bottom: 4px; }
.stat-grid.compact .stat-label { font-size: 0.75rem; }

@media (max-width: 480px) {
  .stat-grid.compact { grid-template-columns: 1fr 1fr; }
}

/* ── Stats: Uebungskachel ── */
.ex-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.ex-stat-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  flex-wrap: wrap;
  gap: 4px;
}

.ex-stat-name { font-weight: 600; font-size: 1rem; margin: 0; }
.ex-stat-count { font-size: 0.8rem; color: var(--text-2); margin: 0; }

.ex-stat-prs {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 0.82rem;
  color: var(--text-2);
}
.ex-stat-prs strong { color: var(--text); }

/* ── Dashboard ── */
.greeting {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin-bottom: 24px;
}

.session-date { font-size: 0.88rem; }
.session-meta { font-size: 0.78rem; color: var(--text-2); font-feature-settings: "tnum" 1; }

/* ── Active session ── */
.session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.session-header h1 { margin-bottom: 0; }

.session-timer {
  font-size: 1.4rem;
  font-weight: 600;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.03em;
  color: var(--text);
}

/* Die Uebung ist die Kapitelueberschrift ihres Blocks, kein weiterer Satz:
   eigene Flaeche, kraeftigere Trennlinie als die Hairlines der Satzzeilen
   darunter und ein Akzentstrich an der Kante. Ohne diese drei Signale
   laeuft im Training eine Uebung optisch in die naechste. */
.exercise-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 10px;
  padding: 14px 16px 13px 19px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-2);
  /* Neutral, solange diese Uebung nicht dran ist. Die Akzentfarbe ist
     der laufenden vorbehalten -- traegt sie jede Zeile, sagt sie nichts. */
  box-shadow: inset 3px 0 0 var(--border-2);
  /* Beim Scrollen bleibt die Uebung unter der Top-Bar stehen, bis ihr
     letzter Satz durch ist — waehrend eines langen Blocks weiss man sonst
     nach drei Saetzen nicht mehr, worin man gerade steckt. Der Block
     begrenzt das Kleben von selbst: sein Rand ist der Containing Block,
     also schiebt die naechste Uebung die vorige heraus.
     Dazu muss .exercise-block clip statt hidden sein — hidden waere ein
     Scroll-Container und damit der Scrollport, an dem sticky misst. */
  position: sticky;
  top: var(--top);
  z-index: 2;
}
/* Der Name bekommt die Zeile fuer sich. Neben Pausenstepper und
   Skip-Knopf blieben ihm gut hundert Pixel, und "Clean & Press /
   Umsetzen und Stossen" brach darin auf vier Zeilen um. */
.exercise-title-row .exercise-title-main {
  flex: 1 1 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.exercise-title-text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* Freigestelltes 3D-Icon der Uebung. Es steht neben dem Namen, der seine
   Zeile fuer sich hat -- die Kachel darf deshalb Groesse haben, ohne dem
   Namen Platz wegzunehmen. */
.exercise-thumb {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 auto;
}
.rest-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 0.8rem;
}
.rest-adj {
  width: 26px;
  height: 26px;
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.rest-adj:active { background: var(--border); }
.rest-disp {
  min-width: 34px;
  text-align: center;
  font-feature-settings: "tnum" 1;
}

.rest-countdown {
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  padding: 22px 16px 18px;
  text-align: center;
}
.rest-countdown-time {
  display: block;
  font-size: 3.2rem;
  font-weight: 700;
  letter-spacing: -0.05em;
  font-feature-settings: "tnum" 1;
  color: var(--accent);
  line-height: 1;
}
.rest-countdown-label {
  display: block;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-2);
  margin-top: 4px;
}
.rest-skip {
  margin-top: 12px;
  background: transparent;
  border: 1px solid var(--border-2);
  color: var(--text-2);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
}
.rest-skip:active { background: var(--border); }

/* Der Abstand zwischen zwei Bloecken ist doppelt so gross wie der Rhythmus
   der Satzzeilen im Block — erst dadurch gruppieren die Saetze sichtbar
   unter ihrer Uebung statt als eine durchlaufende Liste. */
.exercise-block {
  background: var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  /* clip, nicht hidden: schneidet genauso an der abgerundeten Kante ab,
     macht den Block aber nicht zum Scroll-Container — sonst haette die
     klebende Titelzeile keinen Scrollport ausser sich selbst. */
  overflow: clip;
  margin-bottom: 22px;
}

.exercise-title {
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
}

.set-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: none; }

.set-num {
  font-size: 0.7rem;
  color: var(--text-2);
  min-width: 40px;
  flex-shrink: 0;
}

.set-numbers {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 500;
  font-feature-settings: "tnum" 1;
  letter-spacing: -0.01em;
}

.set-row-done {
  background: rgba(255, 255, 255, 0.025);
  background: color-mix(in srgb, var(--bell, #3ecf6e) 9%, transparent);
  border-left: 3px solid var(--bell, var(--success));
  padding-left: 13px;
}

.set-done-indicator {
  font-size: 0.72rem;
  color: var(--success);
  font-weight: 600;
}

.rest-timer {
  font-size: 0.75rem;
  color: var(--text-2);
  font-feature-settings: "tnum" 1;
  min-width: 36px;
  text-align: right;
}

/* Set form — stepper layout */
.set-form-card {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.set-form-card:last-child { border-bottom: none; }

.set-form-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: 0.02em;
  margin-bottom: 12px;
}

.stepper-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}

.stepper-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stepper-group label {
  font-size: 0.65rem;
  color: var(--text-2);
  margin-bottom: 0;
}

.stepper {
  display: flex;
  align-items: stretch;
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  border-radius: var(--radius-sm);
  overflow: hidden;
  height: 48px;
}

.stepper-btn {
  width: 44px;
  height: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stepper-btn:active { background: var(--border-2); }

.stepper-input {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: none;
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 0;
  background: transparent;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--text);
  font-feature-settings: "tnum" 1;
  padding: 0;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
}

.add-exercise-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}
.add-exercise-row select { flex: 1; height: 44px; }
.add-exercise-btn { width: auto; padding: 0 16px; height: 44px; flex-shrink: 0; }

/* ── Workout plan ── */
.exercise-plan-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}
.exercise-plan-row:last-child { border-bottom: none; }
.exercise-plan-name { font-size: 0.88rem; }
.exercise-plan-detail { font-size: 0.8rem; color: var(--text-2); font-feature-settings: "tnum" 1; white-space: nowrap; }

/* ── New workout form ── */
.form-group { margin-bottom: 14px; }

.exercise-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}

.exercise-row-header {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
}
.exercise-row-header select { flex: 1; }

.set-specs-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.set-spec-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.set-spec-label {
  font-size: 0.7rem;
  color: var(--text-2);
  font-feature-settings: "tnum" 1;
  min-width: 26px;
  flex-shrink: 0;
}

.set-spec-inputs {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 1;
}

.set-spec-input {
  width: 58px !important;
  height: 36px !important;
  text-align: center;
  padding: 0 6px !important;
  flex-shrink: 0;
}

.set-spec-unit {
  font-size: 0.78rem;
  color: var(--text-2);
  flex-shrink: 0;
}

.set-remove-btn {
  width: 28px;
  height: 28px;
  background: transparent;
  border: none;
  color: var(--text-2);
  font-size: 0.8rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: inherit;
  margin-left: auto;
}
.set-remove-btn:hover { color: var(--danger); }

/* ── Template detail — per-set chips ── */
.set-specs-detail {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}
.set-spec-chip {
  font-size: 0.7rem;
  color: var(--bell, var(--text-2));
  font-feature-settings: "tnum" 1;
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 3px;
}

.form-3col {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 8px;
}

/* ── History exercise detail ── */
.history-exercise {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 10px;
}

.history-exercise-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.history-exercise-name { font-size: 0.88rem; font-weight: 600; }
.history-exercise-vol { font-size: 0.78rem; color: var(--text-2); flex: 1; }
.delta { font-size: 0.75rem; font-weight: 600; }
.delta-pos { color: var(--success); }
.delta-neg { color: var(--danger); }

.history-sets {
  display: grid;
  grid-template-columns: 76px 1fr 1fr;
}
/* Ohne Gewichtsspalte bleiben zwei. */
.history-sets-2 { grid-template-columns: 76px 1fr; }

.history-set-cell {
  padding: 9px 16px;
  font-size: 0.82rem;
  font-feature-settings: "tnum" 1;
  border-bottom: 1px solid var(--border);
}
.history-set-cell.muted { color: var(--text-2); }
.history-set-last .history-set-cell { border-bottom: none; }

.side-volumes {
  display: flex;
  gap: 16px;
  padding: 8px 16px 10px;
  font-size: 0.78rem;
  color: var(--text-2);
  font-feature-settings: "tnum" 1;
}

/* ── PR list ── */
.pr-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.pr-item:last-child { border-bottom: none; }
.pr-name { font-size: 0.88rem; font-weight: 600; margin-bottom: 4px; }
.pr-stats { font-size: 0.78rem; color: var(--text-2); font-feature-settings: "tnum" 1; }

/* ── Chart section ──
   Chart.js rechnet seine Hoehe sonst aus dem Seitenverhaeltnis der
   Leinwand — auf einer breiten Flaeche wird aus einem Balkendiagramm
   dadurch eine Wand. Die Hoehe steht hier, das Diagramm fuellt sie
   (dazu maintainAspectRatio: false in den Vorlagen). */
.chart-wrap { margin-bottom: 24px; }
.chart-box { position: relative; height: 210px; }
.chart-box-flat { height: 150px; }
.chart-box-sm { height: 140px; }
.chart-title { font-size: 0.85rem; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 10px; }

/* ── Login (standalone) ── */
.login-page {
  background: var(--bg);
  font-family: 'Space Grotesk', system-ui, sans-serif;
  font-size: 15px;
  color: var(--text);
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  -webkit-tap-highlight-color: transparent;
}

.login-box { width: 100%; max-width: 340px; }

.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Syne', 'Space Grotesk', system-ui, sans-serif;
  font-size: 1.6rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 36px;
}
.login-logo .brand-mark { width: 26px; height: 26px; }

.login-box .form-group { margin-bottom: 10px; }
.error { font-size: 0.82rem; color: var(--danger); margin-bottom: 10px; }

/* ── Empty state ── */
.empty { color: var(--text-2); font-size: 0.88rem; padding: 28px 0; }

/* ── Htmx ── */
.htmx-swapping { opacity: 0; transition: opacity 0.1s ease-out; }
.htmx-settling { opacity: 1; transition: opacity 0.2s ease-in; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-thumb { background: var(--border-2); }

.exercise-filter { margin-bottom: 16px; }

/* ── Uebungsliste: Stern, Name, Geraete-Badge ── */
.exercise-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.exercise-list-row:last-child { border-bottom: none; }
.exercise-list-row[hidden] { display: none; }

.exercise-list-name { flex: 1; min-width: 0; font-size: 0.88rem; }

.fav-star {
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1.25rem;
  line-height: 1;
  width: 32px;
  height: 32px;
  cursor: pointer;
  flex-shrink: 0;
}
.fav-star-on { color: var(--accent); }

.equip-badge {
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--bell, var(--text-2));
  flex-shrink: 0;
  white-space: nowrap;
}
/* Geraete-Badges leihen sich ihre Farbe aus dem Wettkampfcode, ohne ein
   Gewicht zu meinen: Kettlebell traegt das 16er-Gelb, egal mit wieviel Kilo
   gearbeitet wird. Core nimmt entsprechend das 32er-Rot. Ein eigenes Rot
   waere ohnehin nicht zu haben -- zwischen 8er-Pink und 32er-Rot liegen nur
   34 Grad, jeder Ton dazwischen sieht nach einer Bell aus, die es nicht
   gibt. Band bleibt die Ausnahme: dort sagt Grau, dass es keine Kilo-Skala
   gibt -- eine Aussage ueber das Gewicht, keine Kategorie. */
.equip-badge-kettlebell { --bell: var(--bell-16); }
.equip-badge-band { --bell: var(--band); }
.equip-badge-core { --bell: var(--bell-32); }

/* Noch nicht drangekommener Satz: dieselbe Zeilenform wie ein fertiger,
   nur ohne Haken und gedaempft. Die ganze Zeile hoert auf Klicks, ohne
   wie ein Knopf auszusehen. */
.set-row-planned {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  font-family: inherit;
  font-size: inherit;
  text-align: left;
  cursor: pointer;
  color: var(--text-2);
}
.set-row-planned:last-child { border-bottom: none; }
.set-row-planned .set-numbers { font-weight: 400; color: var(--text-2); }
.set-row-planned .kg { color: inherit; font-weight: 500; }
.set-row-planned:hover { background: var(--surface-2); color: var(--text); }
.set-row-planned:active { background: var(--surface-2); }

/* Die Uebung, in der gerade gearbeitet wird -- derselbe Inset-Balken,
   mit dem eine uebersprungene Uebung markiert ist, nur im Akzent.
   Beim Absolvieren des letzten Satzes wandert er sichtbar nach unten. */
.exercise-block-current .exercise-title-row {
  box-shadow: inset 3px 0 0 var(--accent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface-2));
}

/* Übersprungene Sätze und Übungen */
.set-row-skipped {
  border-left: 3px solid var(--border-2);
  padding-left: 13px;
  opacity: 0.55;
}
.set-row-skipped .set-numbers {
  font-size: 0.85rem;
  font-weight: 400;
  font-style: italic;
  color: var(--text-2);
}

.set-undo, .exercise-skip {
  border: 1px solid var(--border-2);
  background: var(--surface-2);
  color: var(--text-2);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.72rem;
  padding: 5px 9px;
  cursor: pointer;
  flex-shrink: 0;
}
.set-undo:active, .exercise-skip:active { background: var(--border); }

.exercise-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.set-form-actions {
  display: flex;
  align-items: stretch;
  gap: 8px;
}
.set-form-actions .btn-primary { flex: 1; }
.btn-skip {
  border: 1px solid var(--border-2);
  background: transparent;
  color: var(--text-2);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 0 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-skip:active { background: var(--surface-2); }

.exercise-block-skipped .exercise-title-text { color: var(--text-2); }
/* Eine ausgelassene Uebung behaelt die Gliederung, verliert aber den Akzent. */
.exercise-block-skipped .exercise-title-row { box-shadow: inset 3px 0 0 var(--border-2); }
.skipped-badge, .history-skipped {
  font-size: 0.65rem;
  color: var(--text-2);
  border: 1px solid var(--border-2);
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════════════════
   Desktop — ab hier wird aus der Spalte eine Flaeche.

   Ein einziger Breakpoint. Alles darunter bleibt unangetastet: die
   Ansicht, mit der waehrend des Trainings geloggt wird, soll sich von
   dieser Datei nicht ueberraschen lassen.
   ════════════════════════════════════════════════════════════════════ */
@media (min-width: 900px) {
  :root { --side: 208px; }

  body { padding-bottom: 0; padding-left: var(--side); }

  /* Die Leiste laeuft ueber die volle Breite; die Wortmarke steht damit
     ueber der Navigationsspalte und nicht irgendwo in der Mitte. */
  .top-bar-inner { max-width: none; padding: 0 20px; }

  /* ── Aus der Bottom-Nav wird die Seitenspalte ── */
  .site-nav {
    inset: var(--top) auto 0 0;
    width: var(--side);
    height: auto;
    flex-direction: column;
    padding: 14px 0;
    gap: 1px;
    border-top: none;
    border-right: 1px solid var(--border);
    overflow-y: auto;
  }

  .nav-item {
    flex: 0 0 auto;
    flex-direction: row;
    justify-content: flex-start;
    gap: 13px;
    height: 42px;
    /* 17 + 3px Rahmen = 20px, dieselbe Kante wie die Wortmarke darueber */
    padding: 0 16px 0 17px;
    font-size: 0.85rem;
    border-left: 3px solid transparent;
  }

  .nav-item:hover { color: var(--text); background: var(--surface); }

  /* Derselbe Balken, mit dem ein erledigter Satz markiert wird — die
     Oberflaeche kennt diese Geste schon, sie muss nichts Neues lernen. */
  .nav-item.active {
    border-left-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
  }

  .nav-item svg { width: 19px; height: 19px; }

  /* ── Inhaltsflaeche ── */
  main { max-width: 1100px; padding: 34px 32px 56px; }

  /* Formulare und die laufende Session werden breit nicht besser.
     Sie behalten eine Spalte, die man in einem Blick lesen kann. */
  body.page-narrow main { max-width: 760px; }

  h1 { font-size: 1.75rem; margin-bottom: 24px; }
  .greeting { font-size: 2.1rem; margin-bottom: 28px; }

  /* ── Zeiger statt Finger ── */
  .btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
  .btn-secondary:hover { background: var(--surface); border-color: var(--border-2); }
  .exercise-list-row:hover { background: var(--surface-2); }
  .fav-star:hover { color: var(--accent); }

  /* Ein Knopf ueber 1100px ist kein Knopf mehr, sondern ein Balken. */
  .btn-primary, .btn-secondary { width: auto; min-width: 200px; }
  /* Am Desktop ist Platz da, und aus zwei Metern Abstand zum Bildschirm
     ist eine 52er-Kachel wieder klein. */
  .exercise-thumb { width: 64px; height: 64px; }

  /* Ein Stepper fuer eine zweistellige Zahl braucht keine halbe
     Bildschirmbreite -- er wuerde nur leerer aussehen. */
  .stepper-row { max-width: 470px; }

  /* Knoepfe, die in einer Zeile mitlaufen, bleiben so breit wie ihr Wort. */
  .btn-sm, .add-exercise-btn, .set-form-actions .btn-primary { min-width: 0; }
  .login-box .btn-primary { width: 100%; }

  /* Aktionspaare stehen nebeneinander, solange sie zusammengehoeren. */
  .actions {
    display: flex;
    gap: 12px;
    max-width: 480px;
  }
  .actions > * { flex: 1; margin-top: 0; }
  .actions .btn-primary, .actions .btn-secondary { width: 100%; min-width: 0; }

  /* ── Dashboard ──
     Drei Bloecke, im Markup in der Reihenfolge des Handys. Hier werden
     sie gelegt: links Handeln und Zahlen, rechts die Kurve ueber beide
     Reihen, darunter links die Listen. */
  .dash-grid {
    display: grid;
    grid-template-columns: 1fr 1.2fr;
    gap: 32px;
    align-items: start;
  }
  .dash-main { grid-column: 1; grid-row: 1; }
  .dash-load { grid-column: 2; grid-row: 1; }
  .dash-load > h2:first-child { margin-top: 0; }

  /* Die Listen tragen keine zweite Spalte neben sich — sie legen sich
     unter beide und teilen die Breite untereinander auf. */
  .dash-lists {
    grid-column: 1 / -1;
    grid-row: 2;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 0 32px;
    align-items: start;
  }
  .dash-lists h2 { margin-top: 0; }

  /* ── Kennzahlen ──
     So viele Kacheln nebeneinander, wie die Spalte traegt — aber keine
     Kachel breiter, als ihre Zahl es rechtfertigt. */
  .stat-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    max-width: 720px;
  }
  .stat-grid.compact { max-width: 720px; }
  .dash-main .stat-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); max-width: none; }
  .dash-load .stat-grid { grid-template-columns: 1fr 1fr; max-width: none; }

  /* Eine Zahl bricht nicht um. */
  .list-item .session-meta { white-space: nowrap; }

  .chart-box { height: 300px; }
  .chart-box-flat { height: 260px; }
  .chart-box-sm { height: 165px; }

  /* ── Stats: Uebungskacheln ── */
  .ex-stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 16px;
    align-items: start;
  }
  .ex-stat-card { margin-bottom: 0; }

  /* ── Verlauf: Uebungen einer Session ── */
  .history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
    gap: 12px;
    align-items: start;
  }
  .history-exercise { margin-bottom: 0; }
  /* "Satz 1 L" braucht mehr als die 76px, die am Handy reichen. */
  .history-sets { grid-template-columns: 110px 1fr 1fr; }
  .history-exercise-vol { white-space: nowrap; }

  /* ── Uebungsliste: Gruppen nebeneinander ── */
  .exercise-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 28px;
    align-items: start;
  }
  .exercise-group > h2 { margin-top: 0; }

  /* ── Trainingsplan: Aktionen links, Plan rechts ── */
  .detail-grid {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 24px 32px;
    align-items: start;
    max-width: 980px;
  }
  .detail-head { grid-column: 1; grid-row: 1; }
  .detail-body { grid-column: 2; grid-row: 1; }
  /* Loeschen steht unter beidem, nicht neben dem Plan — sonst schwebt der
     Knopf mitten in der linken Spalte, als haette ihn jemand vergessen. */
  .detail-foot { grid-column: 1 / -1; grid-row: 2; margin-top: 0 !important; }
  .detail-body > h2:first-child { margin-top: 0; }
  .detail-head .btn-primary, .detail-head .btn-secondary { width: 100%; }

  /* Fuer die Maus greifbar — 3px sind eine Kante, kein Griff. */
  ::-webkit-scrollbar { width: 11px; }
  ::-webkit-scrollbar-thumb {
    background: var(--border-2);
    border: 3px solid var(--bg);
    border-radius: 6px;
  }
  ::-webkit-scrollbar-thumb:hover { background: var(--text-2); }
}
