:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3350;
  --accent: #6c63ff;
  --accent2: #ff6584;
  --upper: #6c63ff;
  --lower: #43e97b;
  --text: #e8eaf6;
  --text-muted: #9196b0;
  --radius: 12px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);

  /* Muscle group colors */
  --mg-brust: #ff6b6b;
  --mg-ruecken: #4ecdc4;
  --mg-schultern: #45b7d1;
  --mg-bizeps: #96ceb4;
  --mg-trizeps: #feca57;
  --mg-quadrizeps: #ff9ff3;
  --mg-hamstring: #54a0ff;
  --mg-gesaess: #ff6584;
  --mg-core: #a29bfe;
  --mg-waden: #fd79a8;
}

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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  max-width: 100vw;
}

.app {
  display: flex;
  height: 100vh;
}

/* Profile overlay */
.profile-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.profile-selector-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px 36px;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
}
.profile-sel-logo {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 8px;
  text-align: center;
}
.profile-sel-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 20px;
  text-align: center;
  color: var(--text-muted);
}
.profile-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 4px;
}
.profile-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.profile-card:hover {
  border-color: var(--accent);
  background: rgba(108,99,255,0.08);
}
.profile-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}
.profile-card-name { font-weight: 600; margin-bottom: 4px; }
.profile-card-types { display: flex; gap: 4px; flex-wrap: wrap; }
.new-profile-section { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 20px; }
.new-profile-section h3 { margin-bottom: 14px; font-size: 1rem; }
.profile-types-editor { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.profile-type-row { display: flex; gap: 8px; align-items: center; }
.profile-type-input { flex: 1; }
.btn-remove-type {
  background: none; border: none; color: var(--accent2);
  cursor: pointer; font-size: 1rem; padding: 4px;
}

/* Sidebar profile indicator */
.sidebar-profile {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
#sidebar-profile-name {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-profile-switch {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.sidebar-profile-switch:hover { border-color: var(--accent); color: var(--accent); }

/* Sidebar */
.sidebar {
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 24px 0;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 24px 28px;
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.logo-icon { font-size: 1.5rem; }

.nav-links { list-style: none; }
.nav-link {
  display: block;
  padding: 12px 24px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  border-left: 3px solid transparent;
  transition: all 0.2s;
}
.nav-link:hover { color: var(--text); background: var(--surface2); }
.nav-link.active { color: var(--accent); border-left-color: var(--accent); background: var(--surface2); }
.nav-icon { display: none; }  /* hidden on desktop, shown on mobile */
.nav-more-item { display: none; } /* only shown on mobile */
.nav-more-menu { display: none; } /* only shown on mobile via JS */

/* Main */
.main {
  flex: 1;
  overflow-y: auto;
  padding: 32px 36px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.page { display: none; }
.page.active { display: block; }

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 16px;
}

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--accent);
}
.stat-sub { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }

/* Motivation Banner */
.motivation-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 20px;
  border-left: 3px solid var(--accent);
  transition: border-color 0.3s;
}
.motivation-banner.mood-fire  { border-left-color: #ff6b6b; }
.motivation-banner.mood-warn  { border-left-color: #feca57; }
.motivation-banner.mood-dead  { border-left-color: #7b809a; }
.motivation-banner.mood-ok    { border-left-color: #43e97b; }
.motivation-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
}
.motivation-text {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
}
.motivation-text b { color: var(--accent); }

/* Forms */
.form-card { max-width: 900px; }

.form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 100px;
}
.form-group.flex-grow { flex: 1; }
.form-group.w-120 { width: 120px; flex-shrink: 0; }
.form-group.w-100 { width: 100px; flex-shrink: 0; }

label {
  font-size: 0.82rem;
  color: var(--text);
  font-weight: 600;
  opacity: 0.8;
}

input, select, textarea {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  font-size: 0.95rem;
  width: 100%;
  transition: border-color 0.2s;
}
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108,99,255,0.15); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.form-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 4px 0 16px;
}

.template-selector-row {
  background: var(--surface2);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 4px;
  border: 1px solid var(--border);
  align-items: flex-end;
}

.exercise-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 12px;
  padding: 16px;
  background: var(--surface2);
  border-radius: 10px;
  border: 1px solid var(--border);
}

.ex-row-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  align-self: flex-end;
  padding-bottom: 4px;
}

.btn-move-exercise {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
  flex-shrink: 0;
}
.btn-move-exercise:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-move-exercise:disabled {
  opacity: 0.25;
  cursor: default;
}

.btn-remove-exercise {
  background: none;
  border: none;
  color: var(--accent2);
  cursor: pointer;
  font-size: 1rem;
  padding: 8px;
  border-radius: 6px;
  line-height: 1;
  transition: background 0.2s;
  flex-shrink: 0;
}
.btn-remove-exercise:hover { background: rgba(255,101,132,0.15); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 20px;
}

/* Buttons */
.btn {
  padding: 10px 22px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s;
}
.btn-primary {
  background: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: #5a52e0; transform: translateY(-1px); }
.btn-secondary {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  margin-right: 10px;
}
.btn-secondary:hover { background: var(--border); }
.btn-danger {
  background: rgba(255,101,132,0.15);
  color: var(--accent2);
  border: 1px solid rgba(255,101,132,0.3);
}
.btn-danger:hover { background: rgba(255,101,132,0.3); }

/* Table */
.filter-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.filter-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 0.9rem;
}
.filter-input:focus { outline: none; border-color: var(--accent); }

.table-wrapper { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th {
  text-align: left;
  padding: 10px 12px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:hover td { background: var(--surface2); }
tr:last-child td { border-bottom: none; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-upper { background: rgba(108,99,255,0.2); color: var(--upper); }
.badge-lower { background: rgba(67,233,123,0.2); color: var(--lower); }

/* Muscle group badges */
.mg-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.76rem;
  font-weight: 600;
  background: rgba(108,99,255,0.15);
  color: var(--text-muted);
}
.mg-Brust { background: rgba(255,107,107,0.15); color: var(--mg-brust); }
.mg-Rücken { background: rgba(78,205,196,0.15); color: var(--mg-ruecken); }
.mg-Schultern { background: rgba(69,183,209,0.15); color: var(--mg-schultern); }
.mg-Bizeps { background: rgba(150,206,180,0.15); color: var(--mg-bizeps); }
.mg-Trizeps { background: rgba(254,202,87,0.15); color: var(--mg-trizeps); }
.mg-Quadrizeps { background: rgba(255,159,243,0.15); color: var(--mg-quadrizeps); }
.mg-Hamstring { background: rgba(84,160,255,0.15); color: var(--mg-hamstring); }
.mg-Gesäß { background: rgba(255,101,132,0.15); color: var(--mg-gesaess); }
.mg-Core { background: rgba(162,155,254,0.15); color: var(--mg-core); }
.mg-Waden { background: rgba(253,121,168,0.15); color: var(--mg-waden); }

.action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 10px;
  font-size: 0.8rem;
  margin-right: 4px;
  transition: all 0.2s;
}
.action-btn:hover { border-color: var(--accent); color: var(--accent); }
.action-btn.delete:hover { border-color: var(--accent2); color: var(--accent2); }

/* Chart */
.chart-container {
  position: relative;
  height: 340px;
}

/* Radar Chart */
.radar-card {
  position: relative;
}
.radar-container {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  aspect-ratio: 1;
}
.radar-container canvas {
  width: 100% !important;
  height: 100% !important;
}
.analyse-legends {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
}
.legend-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  flex-shrink: 0;
}
.legend-user { background: var(--accent); }
.legend-ref { background: rgba(255,255,255,0.5); border: 2px dashed rgba(255,255,255,0.6); }

/* Analyse cards side by side */
.card-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.strengths-card, .improvements-card { margin-bottom: 0; }

.strength-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--surface2);
  border-radius: 8px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
}
.strength-rank {
  font-size: 1.2rem;
  font-weight: 700;
  width: 28px;
  flex-shrink: 0;
}
.strength-name { flex: 1; font-weight: 600; }
.strength-pct {
  font-weight: 700;
  font-size: 0.95rem;
}
.strength-pct.good { color: #43e97b; }
.strength-pct.warning { color: #feca57; }
.strength-pct.bad { color: var(--accent2); }

/* Comparison table progress bars */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--surface2);
  border-radius: 4px;
  overflow: hidden;
  min-width: 80px;
}
.progress-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.progress-bar-fill.red { background: var(--accent2); }
.progress-bar-fill.orange { background: #feca57; }
.progress-bar-fill.green { background: #43e97b; }
.progress-pct {
  font-size: 0.85rem;
  font-weight: 700;
  width: 48px;
  flex-shrink: 0;
}
.progress-pct.red { color: var(--accent2); }
.progress-pct.orange { color: #feca57; }
.progress-pct.green { color: #43e97b; }

/* Muscle group checkbox grid */
.mg-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px;
}
.mg-cb-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  padding: 5px 8px;
  background: var(--surface2);
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid var(--border);
  transition: background 0.15s;
}
.mg-cb-label:has(:checked) {
  background: var(--accent)22;
  border-color: var(--accent);
}
.mg-cb-label input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

/* Zielwerte */
.zielwerte-card { margin-bottom: 16px; }
.zielwerte-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 8px;
}
.zielwert-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 8px 12px;
}
.zielwert-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  flex: 1;
  min-width: 0;
}
.zielwert-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.zielwert-input {
  width: 70px;
  padding: 4px 8px;
  font-size: 0.88rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  text-align: right;
}
.zielwert-unit {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* History session cards */
.history-session-card {
  background: var(--surface2);
  border-radius: 12px;
  border: 1px solid var(--border);
  margin-bottom: 12px;
  overflow: hidden;
}
.history-session-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.history-studio {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
}
.history-count {
  font-size: 0.78rem;
  color: var(--text-muted);
}
.history-ex-list {
  display: flex;
  flex-direction: column;
}
.history-ex-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.history-ex-row:last-child { border-bottom: none; }
.history-ex-name {
  flex: 1;
  font-size: 0.9rem;
  font-weight: 500;
}
.history-ex-vals {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}
.history-ex-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.history-ex-group {
  border-bottom: 1px solid var(--border);
}
.history-ex-group:last-child { border-bottom: none; }
.history-ex-group .history-ex-row { border-bottom: none; }
.history-set-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 16px 5px 32px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.history-set-row:last-child { border-bottom: none; }
.history-set-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.8rem;
}

/* Template cards */
.template-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 14px;
}
.template-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.template-name {
  font-size: 1.05rem;
  font-weight: 700;
}
.template-actions { display: flex; gap: 8px; }
.template-exercises {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.tmpl-ex-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 12px;
  font-size: 0.82rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}
.tmpl-ex-chip .mg-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Template checklist */
.tmpl-exercise-checklist {
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  margin-bottom: 4px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.tmpl-check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}
.tmpl-check-item:hover { background: var(--surface2); }
.tmpl-check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}
.tmpl-check-label { font-size: 0.88rem; cursor: pointer; }
.tmpl-check-group { font-size: 0.75rem; color: var(--text-muted); margin-left: auto; }

/* Template order list */
.tmpl-order-section {
  margin-bottom: 4px;
}
.tmpl-order-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 6px;
}
.tmpl-order-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 36px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: var(--surface);
}
.tmpl-order-list:empty::after {
  content: 'Noch keine Übungen ausgewählt';
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 6px 4px;
  display: block;
}
.tmpl-order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--surface2);
}
.tmpl-order-num {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}
.tmpl-order-name {
  font-size: 0.88rem;
  flex: 1;
}
.tmpl-order-btns {
  display: flex;
  gap: 4px;
}
.tmpl-order-btns button {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}
.tmpl-order-btns button:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* PRs */
.pr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.pr-item {
  background: var(--surface2);
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid var(--border);
}
.pr-exercise { font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.pr-value { font-size: 1.3rem; font-weight: 700; color: var(--accent); }
.pr-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

/* Dashboard extras */
.dash-next-card { flex: 1 1 300px; }
.dash-volume-card { flex: 2 1 400px; }

.next-train-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.next-train-row:last-child { border-bottom: none; }
.next-train-info { flex: 1; font-size: 0.88rem; }
.next-train-status {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
}
.next-train-status.ready    { background: rgba(67,233,123,0.15); color: #43e97b; }
.next-train-status.recovering { background: rgba(254,202,87,0.15); color: #feca57; }
.next-train-status.too-soon { background: rgba(255,101,132,0.15); color: #ff6584; }
.next-train-status.overdue  { background: rgba(255,71,87,0.15); color: #ff4757; }

/* Frequency heatmap */
.hm-grid { display: flex; flex-direction: column; gap: 4px; overflow-x: auto; }
.hm-row  { display: flex; gap: 4px; align-items: center; }
.hm-cell {
  min-width: 36px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
}
.hm-label { width: 90px; min-width: 90px; max-width: 90px; justify-content: flex-start; overflow: hidden; }
.hm-header { color: var(--text-muted); font-size: 0.7rem; font-weight: 500; }
.hm-data   { color: #fff; transition: transform 0.1s; cursor: default; }
.hm-data:hover { transform: scale(1.1); }

/* Recent */
.session-card {
  background: var(--surface2);
  border-radius: 10px;
  padding: 14px 18px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
}
.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.session-date { font-weight: 600; }
.session-info { font-size: 0.82rem; color: var(--text-muted); }
.session-exercises { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ex-chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.ex-chip span { color: var(--text); font-weight: 600; }

/* Exercise progress */
.ex-progress-chip {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 3px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}
.ex-progress-chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.ex-progress-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}
.ex-progress-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 90%;
  max-width: 680px;
  box-shadow: var(--shadow);
  max-height: 90vh;
  overflow-y: auto;
}
.modal.modal-sm { max-width: 420px; }
.modal.modal-lg { max-width: 780px; }
.modal h2 { margin-bottom: 20px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  background: var(--accent);
  color: #fff;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(10px);
  transition: all 0.3s;
  z-index: 200;
  cursor: pointer;
  max-width: 400px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--accent2); }

/* Button loading state */
.btn-loading {
  opacity: 0.7;
  pointer-events: none;
  position: relative;
}

/* Confirm dialog */
.confirm-overlay { z-index: 150; }
.confirm-modal { text-align: center; }
.confirm-modal .btn-danger {
  background: var(--accent2);
  color: #fff;
  border: none;
}

/* Duplicate exercise row button */
.btn-copy-exercise {
  background: none;
  border: 1px solid var(--border);
  color: var(--accent);
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.95rem;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.btn-copy-exercise:hover { background: rgba(108,99,255,0.15); }

/* Multi-set exercise layout */
.exercise-row {
  flex-direction: column;
  align-items: stretch;
}
.exercise-header {
  display: flex;
  gap: 12px;
  align-items: flex-end;
}
.exercise-header .form-group.flex-grow {
  flex: 1;
  min-width: 0;
}
.sets-container {
  margin-top: 8px;
}
.sets-header-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 4px 2px;
}
.sets-header-row .set-number {
  width: 50px;
  flex-shrink: 0;
}
.sets-header-row .form-group {
  margin-bottom: 0;
}
.sets-header-row label {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 0;
}
.set-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 4px;
  border-radius: 6px;
  margin-bottom: 2px;
}
.set-row:hover {
  background: rgba(108,99,255,0.04);
}
.set-number {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  width: 50px;
  flex-shrink: 0;
}
.set-row .form-group {
  margin-bottom: 0;
}
.set-row input[type="number"] {
  padding: 6px 8px;
  font-size: 0.9rem;
}
.remove-set-btn {
  background: none;
  border: none;
  color: var(--accent2);
  cursor: pointer;
  font-size: 0.85rem;
  padding: 4px 6px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
  transition: background 0.2s;
}
.remove-set-btn:hover { background: rgba(255,101,132,0.15); }
.remove-set-btn-placeholder {
  width: 26px;
  flex-shrink: 0;
}
.add-set-btn {
  background: none;
  border: 1px dashed var(--border);
  color: var(--accent);
  cursor: pointer;
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 6px;
  transition: background 0.15s, border-color 0.15s;
  align-self: flex-start;
}
.add-set-btn:hover {
  background: rgba(108,99,255,0.08);
  border-color: var(--accent);
}

/* Session delete button in history */
.session-delete-btn {
  margin-left: auto;
  font-size: 0.78rem !important;
  opacity: 0;
  transition: opacity 0.15s;
}
.history-session-card:hover .session-delete-btn { opacity: 1; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 3rem; margin-bottom: 12px; }

/* Profile page */
.profile-page-header {
  display: flex;
  align-items: center;
  gap: 24px;
}
.profile-page-avatar-wrap {
  position: relative;
  flex-shrink: 0;
}
.profile-page-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 2rem;
  font-weight: 700;
}
.avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.avatar-change-btn {
  position: absolute;
  bottom: -4px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: #fff;
  border: 2px solid var(--surface);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.avatar-change-btn:hover { background: #5a52e0; }
.profile-page-name {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.profile-page-email {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

/* Challenge cards */
.challenge-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.challenge-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.challenge-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.challenge-exercise-name {
  font-size: 1.05rem;
  font-weight: 700;
}
.challenge-vs-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-bottom: 8px;
  font-size: 0.95rem;
}
.challenge-player { font-weight: 600; }
.challenge-vs {
  font-weight: 800;
  font-size: 0.85rem;
  color: var(--accent2);
  background: rgba(255,101,132,0.1);
  padding: 2px 10px;
  border-radius: 8px;
}
.challenge-dates {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 8px;
}
.challenge-del-btn {
  opacity: 0;
  transition: opacity 0.15s;
}
.challenge-card:hover .challenge-del-btn { opacity: 1; }

/* Challenge detail */
.challenge-detail-dates {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.challenge-compare {
  display: flex;
  gap: 12px;
  align-items: stretch;
}
.challenge-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.challenge-col-name {
  font-size: 1.1rem;
  font-weight: 700;
  text-align: center;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.challenge-col-stat {
  background: var(--surface2);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
  border: 2px solid transparent;
}
.challenge-col-stat.challenge-winner {
  border-color: #43e97b;
  background: rgba(67,233,123,0.08);
}
.challenge-col-stat.challenge-loser {
  opacity: 0.6;
}
.challenge-big-num {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--accent);
}
.challenge-winner .challenge-big-num { color: #43e97b; }
.challenge-stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}
.challenge-vs-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
  color: var(--accent2);
  writing-mode: vertical-lr;
  padding: 0 4px;
}

/* =====================================================================
   RESPONSIVE – Mobile (≤ 768px)
   ===================================================================== */
@media (max-width: 768px) {

  /* ---- Layout ---- */
  .app { flex-direction: column; }

  /* Sidebar becomes fixed bottom navigation */
  .sidebar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    width: 100%;
    height: auto;
    flex-direction: row;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    border-right: none;
    border-top: 1px solid var(--border);
    z-index: 50;
    overflow: hidden;
    background: var(--surface);
  }
  .logo, .sidebar-profile { display: none; }

  .nav-more-menu {
    position: fixed;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    right: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 8px 0;
    z-index: 60;
    box-shadow: 0 -4px 24px rgba(0,0,0,0.5);
    min-width: 180px;
  }
  .nav-more-link {
    display: block;
    padding: 12px 18px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background 0.15s;
  }
  .nav-more-link:hover, .nav-more-link:active { background: var(--surface2); }

  .nav-links {
    display: flex;
    flex-direction: row;
    width: 100%;
    overflow-x: auto;
    scrollbar-width: none;
    margin: 0;
    padding: 0;
  }
  .nav-links::-webkit-scrollbar { display: none; }

  .nav-links > li {
    flex: 1;
    min-width: 0;
    display: flex;
  }
  .nav-links > li.nav-secondary { display: none !important; }
  .nav-links > li.nav-more-item { display: flex !important; }

  .nav-link {
    flex: 1;
    min-width: 0;
    padding: 8px 2px 6px;
    border-left: none;
    border-top: 2px solid transparent;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0;
    background: none;
    width: 100%;
  }
  .nav-link.active {
    border-left-color: transparent;
    border-top-color: var(--accent);
    background: rgba(108,99,255,0.08);
    color: var(--accent);
  }
  .nav-icon {
    display: block;
    font-size: 1.2rem;
    line-height: 1;
  }
  .nav-label {
    font-size: 0.55rem;
    font-weight: 600;
    color: inherit;
    line-height: 1;
    letter-spacing: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 60px;
    display: block;
  }

  /* Main content – full width, padding-bottom for bottom nav */
  .main {
    padding: 16px 12px calc(64px + env(safe-area-inset-bottom, 0px) + 12px);
    width: 100%;
    overflow-x: hidden;
    max-width: 100vw;
  }

  /* ---- Typography ---- */
  .page-title { font-size: 1.25rem; margin-bottom: 14px; }
  .card { padding: 14px; margin-bottom: 14px; }
  .card-title { margin-bottom: 10px; font-size: 0.88rem; }

  /* ---- Stats ---- */
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 12px;
  }
  .stat-card { padding: 14px; }
  .stat-label { font-size: 0.7rem; margin-bottom: 4px; }
  .stat-value { font-size: 1.4rem; }

  /* ---- Motivation banner ---- */
  .motivation-banner { padding: 12px 14px; gap: 10px; }
  .motivation-icon { font-size: 1.3rem; }
  .motivation-text { font-size: 0.84rem; }

  /* ---- Card rows (side-by-side → stacked) ---- */
  .card-row { grid-template-columns: 1fr; gap: 12px; margin-bottom: 12px; }
  .dash-next-card, .dash-volume-card { flex: none; width: 100%; }

  /* ---- Next training readiness ---- */
  .next-train-row { gap: 8px; padding: 10px 0; }
  .next-train-info { font-size: 0.82rem; min-width: 0; }
  .next-train-status { font-size: 0.72rem; padding: 3px 8px; white-space: nowrap; }

  /* ---- Exercise rows in log form ---- */
  .exercise-row {
    padding: 12px;
  }
  .exercise-header {
    flex-wrap: wrap;
    gap: 8px;
  }
  .exercise-header .form-group.flex-grow {
    flex-basis: 100%;
    width: 100%;
  }
  .ex-row-actions {
    align-self: flex-end;
    gap: 2px;
  }
  .btn-move-exercise, .btn-copy-exercise { width: 32px; height: 32px; }
  .btn-remove-exercise { padding: 6px; font-size: 1.1rem; }
  .set-row { gap: 6px; }
  .set-number { width: 42px; font-size: 0.78rem; }
  .sets-header-row .set-number { width: 42px; }
  .sets-header-row label { font-size: 0.72rem; }

  /* ---- Form ---- */
  .form-card { max-width: 100%; }
  .form-row {
    gap: 8px;
    flex-direction: column;
  }
  .form-row.session-meta-row {
    flex-direction: row;
    flex-wrap: wrap;
  }
  .session-meta-row .form-group { flex: 1; min-width: 90px; }
  .form-group { min-width: 0; }
  .form-group.w-120, .form-group.w-100 { width: 100%; flex: none; }
  .set-row .form-group.w-120, .set-row .form-group.w-100 { width: auto; flex: 1; min-width: 0; }
  .sets-header-row .form-group.w-120, .sets-header-row .form-group.w-100 { width: auto; flex: 1; min-width: 0; }
  .template-selector-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px;
    align-items: flex-end;
  }
  .template-selector-row .form-group {
    flex: 1 1 100%;
    min-width: 0;
  }
  .template-selector-row .btn-accent {
    width: 100%;
    padding: 12px;
    justify-content: center;
  }
  .form-actions { gap: 8px; }
  .form-actions .btn { flex: 1; text-align: center; }
  input, select, textarea {
    font-size: 16px; /* prevent iOS zoom on focus */
    padding: 10px 12px;
  }

  /* ---- Buttons: larger touch targets ---- */
  .btn { padding: 12px 18px; font-size: 0.9rem; }
  .btn-secondary { margin-right: 0; }

  /* ---- Modals as bottom sheets ---- */
  .modal-overlay { align-items: flex-end; }
  .modal {
    width: 100%;
    max-width: 100%;
    border-radius: 20px 20px 0 0;
    max-height: 92vh;
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .modal h2 { font-size: 1.1rem; }
  .confirm-modal .form-actions { flex-direction: row; }
  .confirm-modal .form-actions .btn { width: auto; flex: 1; }

  /* ---- MG checkbox grid in exercise modal ---- */
  .mg-checkbox-grid { grid-template-columns: 1fr 1fr; gap: 4px; }
  .mg-cb-label { padding: 8px 8px; font-size: 0.82rem; }

  /* ---- Template modal: 1-col checklist ---- */
  .tmpl-exercise-checklist { grid-template-columns: 1fr; }
  .template-header { flex-direction: column; align-items: flex-start; gap: 10px; }
  .template-actions { width: 100%; display: flex; gap: 8px; }
  .template-actions .btn { flex: 1; text-align: center; }
  .template-card { padding: 14px 16px; }
  .template-name { font-size: 0.95rem; }

  /* ---- Filters ---- */
  .filter-bar {
    flex-direction: column;
    gap: 8px;
  }
  .filter-bar .btn { width: 100%; }
  .filter-input { width: 100%; }

  /* ---- Tables: horizontal scroll with hint ---- */
  .table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -14px;
    padding: 0 14px;
  }
  table { font-size: 0.82rem; min-width: 500px; }
  th { padding: 8px 10px; font-size: 0.7rem; }
  td { padding: 9px 10px; }

  /* ---- History ---- */
  .history-session-head { padding: 10px 12px; gap: 6px; }
  .history-studio { font-size: 0.78rem; }
  .history-count { font-size: 0.72rem; }
  .history-ex-row {
    gap: 6px;
    padding: 8px 12px;
    flex-wrap: wrap;
  }
  .history-ex-name { flex-basis: 100%; order: -1; font-size: 0.85rem; }
  .history-ex-vals { font-size: 0.82rem; }
  .history-ex-actions { margin-left: auto; }
  .history-ex-actions .action-btn { padding: 6px 10px; font-size: 0.75rem; }
  .history-set-row { padding: 4px 12px 4px 28px; gap: 6px; }
  .session-delete-btn { opacity: 1 !important; font-size: 0.72rem !important; padding: 5px 8px !important; }
  .mg-badge { font-size: 0.68rem; padding: 2px 7px; }

  /* ---- Heatmap: smaller cells, horizontal scroll ---- */
  .hm-cell { min-width: 28px; height: 26px; font-size: 0.65rem; }
  .hm-label { width: 60px; min-width: 60px; max-width: 60px; font-size: 0.65rem; }
  .hm-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* ---- Charts: compact height on mobile ---- */
  .chart-container { height: 200px; }
  #page-progress .chart-container { height: 220px; }

  /* ---- Radar chart ---- */
  .radar-container { max-width: 100%; aspect-ratio: 1; }
  .analyse-legends { font-size: 0.78rem; gap: 4px; margin-top: 10px; }

  /* ---- Strength/Improvement items ---- */
  .strength-item { padding: 8px 10px; gap: 8px; }
  .strength-rank { font-size: 1rem; width: 24px; }
  .strength-name { font-size: 0.88rem; }
  .strength-pct { font-size: 0.85rem; }

  /* ---- Progress bars ---- */
  .progress-bar-bg { min-width: 50px; }
  .progress-pct { width: 40px; font-size: 0.78rem; }

  /* ---- PRs ---- */
  .pr-grid { grid-template-columns: 1fr; gap: 8px; }

  /* ---- Dashboard recent workouts ---- */
  .session-card { padding: 12px 14px; }
  .session-exercises { gap: 4px; }
  .ex-chip { font-size: 0.75rem; padding: 2px 8px; }

  /* ---- Bodyweight tracking ---- */
  .bw-tracking-card .form-row { flex-direction: row; flex-wrap: wrap; }
  .bw-tracking-card .form-group { flex: 1; min-width: 100px; }

  /* ---- Toast – above bottom nav ---- */
  .toast {
    bottom: calc(68px + env(safe-area-inset-bottom, 0px));
    right: 12px;
    left: 12px;
    text-align: center;
    max-width: none;
    font-size: 0.85rem;
    padding: 10px 16px;
  }

  /* ---- Profile overlay ---- */
  .profile-overlay { padding: 0; align-items: flex-end; }
  .profile-selector-box {
    border-radius: 20px 20px 0 0;
    padding: 28px 20px calc(20px + env(safe-area-inset-bottom, 0px));
    max-height: 95vh;
    border-bottom: none;
  }

  /* ---- Action buttons – larger touch targets ---- */
  .action-btn { padding: 7px 12px; font-size: 0.82rem; }

  /* ---- Empty state ---- */
  .empty-state { padding: 32px 16px; }
  .empty-state .icon { font-size: 2.4rem; }

  /* ---- Badges compact ---- */
  .badge { font-size: 0.72rem; padding: 2px 8px; }

  /* ---- Profile page ---- */
  .profile-page-header { flex-direction: column; text-align: center; gap: 14px; }
  .profile-page-avatar { width: 80px; height: 80px; font-size: 1.5rem; }
  .profile-page-name { font-size: 1.15rem; }

  /* ---- Challenge detail ---- */
  .challenge-compare { flex-direction: column; gap: 16px; }
  .challenge-vs-divider { writing-mode: horizontal-tb; padding: 4px 0; }
  .challenge-big-num { font-size: 1.3rem; }
  .challenge-del-btn { opacity: 1 !important; }
}

/* Extra-small screens (≤ 400px) */
@media (max-width: 400px) {
  .nav-label { display: none; }
  .nav-icon { font-size: 1.35rem; }
  .nav-link { padding: 10px 2px 8px; min-width: 0; }

  .stats-grid { grid-template-columns: 1fr 1fr; gap: 6px; }
  .stat-card { padding: 10px; }
  .stat-value { font-size: 1.2rem; }
  .stat-label { font-size: 0.65rem; }

  .main { padding: 12px 8px calc(60px + env(safe-area-inset-bottom, 0px) + 8px); }
  .card { padding: 10px; margin-bottom: 10px; }

  .exercise-row { padding: 10px; gap: 6px; }
  .history-session-head { padding: 8px 10px; }
  .history-ex-row { padding: 7px 10px; }
  .history-set-row { padding: 3px 10px 3px 24px; }

  .motivation-banner { padding: 10px 12px; }
  .motivation-text { font-size: 0.8rem; }

  .mg-checkbox-grid { grid-template-columns: 1fr 1fr; }

  table { min-width: 420px; font-size: 0.78rem; }

  .activity-row { padding: 8px 10px; }
}

/* ── Activities ────────────────────────────────────────────────────── */

.activity-month-group { margin-bottom: 16px; }
.activity-month-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; font-weight: 600; font-size: 0.9rem;
  border-bottom: 1px solid var(--border);
}

.activity-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}
.activity-row:hover { background: var(--surface2); }
.activity-row:last-child { border-bottom: none; }

.activity-icon { font-size: 1.5rem; flex-shrink: 0; }
.activity-info { flex: 1; min-width: 0; }
.activity-name { font-weight: 600; font-size: 0.95rem; }
.activity-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }

.btn-icon {
  background: none; border: none; cursor: pointer;
  font-size: 1rem; padding: 4px; border-radius: 6px;
  opacity: 0.5; transition: opacity 0.15s;
}
.btn-icon:hover { opacity: 1; }

.activity-week-summary {
  padding: 10px 4px 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.activity-week-stats {
  display: flex; flex-wrap: wrap; gap: 4px 12px;
  font-size: 0.85rem;
}
.activity-load-hint {
  font-size: 0.8rem; font-weight: 600; margin-top: 6px;
  padding: 4px 10px; border-radius: 6px; display: inline-block;
}
.activity-load-hint.load-high { background: #ff6b6b22; color: #ff6b6b; }
.activity-load-hint.load-good { background: #00b89422; color: #00b894; }
.activity-load-hint.load-low  { background: #feca5722; color: #daa520; }

.activity-row-compact {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--border);
}
.activity-row-compact:last-child { border-bottom: none; }
.activity-icon-sm { font-size: 1.2rem; }

/* ── Live Training Mode ─────────────────────────────────────────────── */
.btn-accent {
  background: linear-gradient(135deg, #6c63ff, #ff6584);
  color: #fff;
  border: none;
  font-weight: 600;
}
.btn-accent:hover { opacity: 0.9; }

#live-training-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.live-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.live-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.live-close-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.live-close-btn:hover { background: var(--surface2); color: var(--text); }
.live-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  flex: 1;
  min-width: 0;
}
.live-exercise-select {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 8px;
  width: 100%;
  max-width: 100%;
  cursor: pointer;
}

/* Big stopwatch tile */
.live-stopwatch-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  width: 100%;
  max-width: 600px;
  margin-top: 16px;
}
.live-sw-time {
  font-size: 4rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--accent);
  line-height: 1.1;
  margin-bottom: 20px;
}
.live-sw-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.live-sw-btn {
  border: none;
  color: #fff;
  height: 72px;
  border-radius: 16px;
  font-size: 1.4rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: opacity 0.15s;
  padding: 0 40px;
}
.live-sw-btn:hover { opacity: 0.85; }
.live-sw-btn-start { background: var(--accent); flex: 2; }
.live-sw-btn-start.running { background: #ff6b6b; }
.live-sw-btn-reset { background: var(--surface2); color: var(--text-muted); border: 1px solid var(--border); flex: 1; }
.live-sw-btn-reset:hover { background: var(--border); color: var(--text); }

.live-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.live-reorder {
  display: flex;
  align-items: center;
  gap: 6px;
}
.live-reorder-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.live-reorder-btn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.live-reorder-btn:disabled { opacity: 0.3; cursor: default; }

.live-progress-bar {
  height: 4px;
  background: var(--surface2);
  flex-shrink: 0;
}
.live-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ff6584);
  transition: width 0.3s ease;
  width: 0%;
}

.live-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.live-exercise-card {
  width: 100%;
  max-width: 600px;
}
.live-ex-header {
  text-align: center;
  margin-bottom: 20px;
}
.live-ex-detail {
  text-align: center;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.live-ex-name {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.live-ex-muscle {
  font-size: 0.9rem;
  color: var(--text-muted);
}
.live-ex-last {
  display: inline-block;
  margin-top: 8px;
  padding: 6px 16px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.live-input-area {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
}
.live-input-row {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}
.live-input-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.live-input-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.live-input-group input {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  padding: 16px 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: var(--surface2);
  color: var(--text);
  width: 100%;
}
.live-input-group input:focus {
  border-color: var(--accent);
  outline: none;
}

/* Multi-set support */
.live-sets-list {
  margin-bottom: 12px;
}
.live-set-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 6px;
  font-size: 0.9rem;
}
.live-set-label {
  font-weight: 600;
  margin-right: 8px;
  color: var(--text-muted);
  min-width: 52px;
}
.live-set-values {
  flex: 1;
  color: var(--text);
}
.live-set-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
  border-radius: 4px;
}
.live-set-delete:hover {
  color: var(--danger);
  background: var(--surface2);
}
.live-set-counter {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}
.live-add-set-btn {
  width: 100%;
  padding: 10px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}
.live-add-set-btn:hover {
  opacity: 0.9;
}
.live-last-sets {
  opacity: 0.6;
  font-size: 0.85rem;
  margin-top: 4px;
}

/* Sticky live button when scrolled past */
.live-sticky-btn {
  position: sticky;
  top: 0;
  z-index: 50;
  display: none;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  margin: 0 -36px;
  padding-left: 36px;
  padding-right: 36px;
}
.live-sticky-btn .btn-accent {
  width: 100%;
  padding: 12px;
  font-size: 1rem;
}
.live-sticky-btn.visible { display: block; }

@media (max-width: 768px) {
  .live-sticky-btn { margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
}
@media (max-width: 400px) {
  .live-sticky-btn { margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
}

.live-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.live-nav-btn {
  min-width: 120px;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 600;
}
.live-nav-counter {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Live training resume banner */
.live-resume-banner {
  background: linear-gradient(135deg, #6c63ff22, #ff658422);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.live-resume-banner .live-resume-text {
  flex: 1;
  min-width: 200px;
}
.live-resume-banner .live-resume-text strong {
  display: block;
  margin-bottom: 2px;
}
.live-resume-banner .live-resume-text span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .live-header { padding: 10px 14px; }
  .live-body { padding: 14px; }
  .live-ex-name { font-size: 1.3rem; }
  .live-input-group input { font-size: 1.6rem; padding: 14px 8px; }
  .live-nav-btn { min-width: 90px; padding: 10px 14px; font-size: 0.9rem; }
  .live-sw-time { font-size: 3rem; }
  .live-sw-btn { height: 60px; font-size: 1.2rem; padding: 0 24px; }
  .live-stopwatch-tile { padding: 18px; }
  .live-sw-buttons { gap: 10px; }
  .live-input-row { gap: 10px; }
  .live-input-area { padding: 14px; }
}

/* Session chevron for collapsible history cards */
.session-chevron {
  display: inline-block;
  width: 16px;
  font-size: 0.8em;
  color: var(--text-muted);
  transition: transform 0.2s;
}
