:root {
  --bg: #16181C;
  --bg-elevated: #1E2126;
  --bg-card: #22262C;
  --border: #33383F;
  --border-soft: #2A2E34;
  --text: #EDEFF2;
  --text-dim: #9BA1AA;
  --text-faint: #656B74;
  --accent: #E2472A;
  --accent-dim: #7A2B1E;
  --accent-glow: rgba(226, 71, 42, 0.18);
  --success: #4CAF7D;
  --warn: #D9A441;
  --radius-lg: 12px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.25), 0 3px 10px rgba(0, 0, 0, 0.2);
  --shadow-pop: 0 6px 18px rgba(0, 0, 0, 0.32);
  --topbar-bg: rgba(22, 24, 28, 0.85);
  --radius: 6px;
  --font-display: 'Oswald', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
}

.app-shell {
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
  padding: 18px 20px 0;
}

.brand-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

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

.lang-toggle {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.lang-toggle:hover { color: var(--text); border-color: var(--border); }

.brand-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--text);
}

.brand-mark::before {
  content: '●';
  color: var(--accent);
  margin-right: 8px;
  font-size: 12px;
}

.brand-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-faint);
}

.tabs {
  display: flex;
  gap: 4px;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s;
}

.tab-btn:hover { color: var(--text); }

.tab-btn.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ---------- Content / panels ---------- */
.content {
  flex: 1;
  padding: 20px 20px 80px;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 16px;
}

h3 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--text);
}

/* ---------- Selector row ---------- */
.selector-row {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.selector-group label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.selector-group.grow { flex: 1; min-width: 140px; }

.pill-select {
  display: flex;
  gap: 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 3px;
}

.pill {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.pill:hover { color: var(--text); }

.pill.active {
  background: var(--accent);
  color: #fff;
}

.cycle-nav {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.cycle-pill {
  width: auto;
  padding: 0 12px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.pill.logged {
  position: relative;
}

.pill.logged::after {
  content: "";
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

.pill.logged.active::after {
  background: #fff;
}

.date-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius);
  width: 100%;
  height: 38px;
}

.date-input:focus { outline: 1px solid var(--accent); }

/* ---------- Time range ---------- */
.time-range {
  display: flex;
  align-items: center;
  gap: 6px;
}

.time-sep {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 12px;
}

.time-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 8px;
  border-radius: var(--radius);
  width: 108px;
  height: 38px;
}

.time-input:focus { outline: 1px solid var(--accent); }

/* ---------- Session header ---------- */
.session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 8px;
}

.session-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
}

.mode-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 3px;
}

.mode-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn.active {
  background: var(--accent);
  color: #fff;
}

/* ---------- Progress ring ---------- */
.progress-ring-wrap {
  position: relative;
  width: 72px;
  height: 72px;
  margin: 8px 0 20px;
}

.progress-ring { transform: rotate(-90deg); }

.ring-bg {
  fill: none;
  stroke: var(--border-soft);
  stroke-width: 6;
}

.ring-fg {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 188.4;
  stroke-dashoffset: 188.4;
  transition: stroke-dashoffset 0.4s ease;
}

.ring-label {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Blocks ---------- */
.blocks-container { display: flex; flex-direction: column; gap: 14px; margin-bottom: 20px; }

.block-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  overflow: hidden;
}

.block-label {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--accent);
  padding: 12px 14px 8px;
  text-transform: uppercase;
}

.exercise-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-top: 1px solid var(--border-soft);
}

.exercise-row.done { background: rgba(76, 175, 125, 0.06); }

.checkbox {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--border);
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.checkbox.checked {
  background: var(--success);
  border-color: var(--success);
}

.checkbox svg { width: 14px; height: 14px; opacity: 0; transition: opacity 0.1s; }
.checkbox.checked svg { opacity: 1; }

.exercise-info { flex: 1; min-width: 0; }

.exercise-name {
  font-size: 14px;
  color: var(--text);
  line-height: 1.3;
}

.exercise-target {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
}

.actual-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 8px;
  border-radius: 4px;
  width: 84px;
  text-align: right;
}

.actual-input::placeholder { color: var(--text-faint); }
.actual-input:focus { outline: 1px solid var(--accent); }

.sets-wrap {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  justify-content: flex-end;
  max-width: 168px;
}

.set-input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 6px 4px;
  border-radius: 4px;
  width: 34px;
  text-align: center;
}

.set-input::placeholder { color: var(--text-faint); }
.set-input:focus { outline: 1px solid var(--accent); }

.chart-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- Body weight tracker ---------- */

.weight-field {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 10px;
  border-radius: var(--radius);
}

.weight-field:focus { outline: 1px solid var(--accent); }

.weight-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 6px;
  border-bottom: 1px solid var(--border-soft);
  font-family: var(--font-mono);
  font-size: 12px;
}

.weight-row:last-child { border-bottom: none; }
.weight-row-date { color: var(--text-dim); }
.weight-row-value { font-weight: 700; }
.weight-row .history-delete { margin-inline-start: auto; }

.bare-min-note {
  font-size: 11px;
  color: var(--text-faint);
  padding: 8px 14px 12px;
  font-style: italic;
}

/* ---------- Notes ---------- */
.notes-row { margin-bottom: 20px; }

.notes-row label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-faint);
  margin-bottom: 6px;
}

.optional { text-transform: none; letter-spacing: 0; color: var(--text-faint); }

.notes-row textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 10px 12px;
  border-radius: var(--radius);
  resize: vertical;
  min-height: 60px;
}

.notes-row textarea:focus { outline: 1px solid var(--accent); }

/* ---------- Save button ---------- */
.save-btn {
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.save-btn:hover { background: #F0562F; }
.save-btn:active { transform: scale(0.99); }

.save-confirm {
  text-align: center;
  color: var(--success);
  font-family: var(--font-mono);
  font-size: 13px;
  margin-top: 10px;
  opacity: 0;
  transition: opacity 0.3s;
}

.save-confirm.show { opacity: 1; }

/* ---------- History ---------- */
.history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.history-stats {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.history-list { display: flex; flex-direction: column; gap: 10px; }

.history-item {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.history-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  padding: 4px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.history-badge.bare {
  color: var(--warn);
  border-color: rgba(217, 164, 65, 0.3);
}

.history-main { flex: 1; min-width: 0; }

.history-title { font-size: 14px; font-weight: 500; }
.history-date { font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.history-notes { font-size: 12px; color: var(--text-dim); margin-top: 4px; font-style: italic; }

.history-pct {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  min-width: 48px;
  text-align: right;
}

.history-delete {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px;
  font-size: 16px;
  line-height: 1;
}

.history-delete:hover { color: var(--accent); }

.history-empty {
  color: var(--text-faint);
  font-size: 14px;
  text-align: center;
  padding: 40px 20px;
}

/* ---------- Progress stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.stat-box {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent);
}

.stat-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-top: 4px;
}

.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 16px;
}

.progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.progress-header h2 { margin: 0; }

.granularity-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 3px;
}

.gran-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.gran-btn.active {
  background: var(--accent);
  color: #fff;
}

.pr-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}

.pr-list::-webkit-scrollbar { width: 6px; }
.pr-list::-webkit-scrollbar-track { background: transparent; }
.pr-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.pr-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 4px;
}

.pr-name {
  font-size: 13px;
  color: var(--text);
  flex: 1;
  min-width: 0;
}

.pr-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.pr-date {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-faint);
  white-space: nowrap;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 16px;
  margin-top: 12px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-dim);
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend-age {
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 10px;
}

.pr-gain {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.pr-gain.up { color: var(--success); }
.pr-gain.down { color: var(--warn); }

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 8px;
}

.chart-header select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 6px 8px;
  border-radius: 4px;
}

.chart-empty {
  color: var(--text-faint);
  font-size: 13px;
  text-align: center;
  padding: 30px 10px;
  display: none;
}

/* ---------- Heatmap ---------- */
.heatmap {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14px, 1fr));
  gap: 3px;
}

.heat-cell {
  aspect-ratio: 1;
  border-radius: 2px;
  background: var(--border-soft);
}

.heat-cell[data-level="1"] { background: rgba(226, 71, 42, 0.25); }
.heat-cell[data-level="2"] { background: rgba(226, 71, 42, 0.5); }
.heat-cell[data-level="3"] { background: rgba(226, 71, 42, 0.75); }
.heat-cell[data-level="4"] { background: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .session-title { font-size: 20px; }
  .brand-mark { font-size: 18px; }
}

/* ---------- Focus visibility ---------- */
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Visual polish ---------- */
body {
  transition: background-color 0.25s ease, color 0.25s ease;
}

.topbar {
  background: var(--topbar-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.block-card,
.chart-card,
.history-item,
.stat-box {
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.ring-fg { filter: drop-shadow(0 0 6px var(--accent-glow)); }

.save-btn {
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 16px var(--accent-glow);
}

.save-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-glow);
}

.pill.active,
.mode-btn.active,
.gran-btn.active {
  box-shadow: 0 2px 10px var(--accent-glow);
}

.checkbox { transition: all 0.15s; }
.checkbox:hover { transform: scale(1.1); }
.checkbox svg { transform: scale(0.5); transition: opacity 0.15s, transform 0.15s; }
.checkbox.checked svg { transform: scale(1); }

.history-delete {
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.history-delete:hover { background: var(--bg-elevated); }

/* ---------- Theme switch ---------- */
.theme-switch {
  position: relative;
  width: 46px;
  height: 26px;
  flex: none;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 13px;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s, border-color 0.2s;
}

.theme-switch:hover { border-color: var(--border); }

.theme-switch-knob {
  position: absolute;
  top: 2px;
  inset-inline-start: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: inset-inline-start 0.2s ease;
}

.theme-switch.light .theme-switch-knob { inset-inline-start: calc(100% - 22px); }

.theme-switch svg {
  position: absolute;
  width: 12px;
  height: 12px;
  stroke: #fff;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 0.2s;
}

.theme-switch .icon-sun { opacity: 0; }
.theme-switch.light .icon-sun { opacity: 1; }
.theme-switch .icon-moon { opacity: 1; }
.theme-switch.light .icon-moon { opacity: 0; }

/* ---------- Language switch ---------- */
.lang-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  flex: none;
  transition: all 0.15s;
}

.lang-btn:hover {
  color: var(--accent);
  border-color: var(--border);
}

.lang-btn svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- User bar ---------- */
.user-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.user-bar-name {
  color: var(--text-dim);
  font-weight: 500;
}

.user-bar-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.15s;
}

.user-bar-btn:hover { color: var(--text); border-color: var(--border); }

.user-bar-logout {
  color: var(--text-faint);
  text-decoration: none;
  font-size: 11px;
  transition: color 0.15s;
}

.user-bar-logout:hover { color: var(--accent); }

/* ---------- Competitive tab ---------- */
.competitive-header { margin-bottom: 16px; }
.competitive-header h2 { margin: 0; }

/* Card wrapper */
.comp-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 16px;
}

.comp-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.comp-card-header h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

/* Settings card */
.settings-card-body {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.settings-card-body .settings-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.settings-icon {
  font-size: 20px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border-radius: 50%;
  flex-shrink: 0;
}

.settings-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.settings-desc {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Toggle */
.toggle-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  flex-shrink: 0;
}

.toggle-input { display: none; }

.toggle-slider {
  position: relative;
  width: 40px;
  height: 22px;
  background: var(--border-soft);
  border-radius: 11px;
  transition: background 0.2s;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.toggle-input:checked + .toggle-slider {
  background: var(--accent);
}

.toggle-input:checked + .toggle-slider::after {
  transform: translateX(18px);
  background: #fff;
}

/* Metric pills */
.lb-metric-pills {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.metric-pill {
  width: auto !important;
  padding: 0 12px !important;
  font-size: 12px !important;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Podium */
.lb-podium {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 8px;
  margin-bottom: 16px;
  min-height: 0;
}

.lb-podium:empty { display: none; }

.lb-podium-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  text-align: center;
  min-width: 80px;
  position: relative;
}

.lb-podium-item.podium-1 {
  border-color: #FFD700;
  padding-top: 16px;
  min-width: 100px;
}

.lb-podium-item.podium-2 { border-color: #C0C0C0; }
.lb-podium-item.podium-3 { border-color: #CD7F32; }

.lb-podium-medal {
  font-size: 24px;
  line-height: 1;
}

.lb-podium-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 90px;
}

.lb-podium-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}

.lb-podium-item.podium-1 .lb-podium-value { font-size: 20px; }

/* Leaderboard list (4th place onward) */
.leaderboard-list {
  overflow: hidden;
}

.leaderboard-list:empty { display: none; }

.lb-header, .lb-row {
  display: grid;
  grid-template-columns: 40px 1fr 80px;
  padding: 10px 12px;
  align-items: center;
  font-size: 13px;
}

.lb-header {
  font-weight: 600;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border-soft);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.lb-row {
  border-bottom: 1px solid var(--border-soft);
  color: var(--text);
  transition: background 0.15s;
}

.lb-row:last-child { border-bottom: none; }

.lb-row.lb-me {
  background: var(--accent-glow);
  border-left: 3px solid var(--accent);
  font-weight: 600;
}

.lb-rank { text-align: center; font-weight: 600; }
.lb-value { text-align: end; font-family: var(--font-mono); }

.lb-footer {
  padding: 10px 12px;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--border-soft);
}

.lb-empty {
  text-align: center;
  padding: 20px 12px;
  color: var(--text-dim);
  font-size: 13px;
}

.lb-empty .lb-empty-icon {
  font-size: 28px;
  display: block;
  margin-bottom: 6px;
  opacity: 0.5;
}

/* Achievements */
/* Exercise Comparison */
.exercise-comparison {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ex-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 14px;
}

.ex-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 10px;
}

.ex-empty {
  font-size: 12px;
  color: var(--text-dim);
  font-style: italic;
}

.ex-user-row {
  display: grid;
  grid-template-columns: 140px 1fr 50px 36px;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.ex-user-row.is-me {
  background: var(--bg-accent-subtle);
  border-left: 3px solid var(--accent);
}

.ex-username {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ex-bar-track {
  height: 8px;
  background: var(--bg-card);
  border-radius: 4px;
  overflow: hidden;
}

.ex-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.ex-pr {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent);
  text-align: right;
  font-family: var(--font-mono);
}

.ex-sessions {
  font-size: 11px;
  color: var(--text-dim);
  text-align: right;
  font-family: var(--font-mono);
}

/* Compare */
.compare-controls {
  margin-bottom: 14px;
}

.compare-view:empty { display: none; }

.compare-card {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 16px;
}

.compare-vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: start;
}

.compare-side {
  text-align: center;
}

.compare-side h4 {
  margin: 0 0 12px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

.compare-side.is-me h4 {
  color: var(--accent);
}

.compare-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dim);
  padding-top: 28px;
}

.compare-stat-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
}

.compare-stat-label {
  width: 70px;
  text-align: right;
  color: var(--text-dim);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.compare-stat-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.compare-stat-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.compare-stat-fill.is-me { background: var(--accent); }
.compare-stat-fill:not(.is-me) { background: var(--text-dim); }

.compare-stat-val {
  width: 40px;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.compare-prs-section {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.compare-prs-section h5 {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.compare-pr-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compare-pr-tag {
  font-size: 11px;
  padding: 3px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  color: var(--text);
  font-family: var(--font-mono);
}

.compare-ach-section {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.compare-ach-bar {
  flex: 1;
  height: 6px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
}

.compare-ach-fill {
  height: 100%;
  background: var(--warn);
  border-radius: 3px;
}

.compare-ach-text {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  flex-shrink: 0;
}

/* ---------- Admin modal ---------- */
.admin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.admin-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-pop);
  padding: 24px;
  width: 100%;
  max-width: 440px;
  max-height: 80vh;
  overflow-y: auto;
}

.admin-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.admin-modal-header h2 { margin: 0; }

.admin-close {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 24px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.admin-close:hover { color: var(--accent); }

.admin-add-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.admin-add-row input {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius);
  flex: 1;
  min-width: 0;
}

.admin-add-row input:focus { outline: 1px solid var(--accent); }

.admin-plan-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: var(--radius);
  min-width: 0;
  cursor: pointer;
}

.admin-plan-select:focus { outline: 1px solid var(--accent); }

.admin-add-btn {
  background: var(--accent);
  color: #fff;
  border: none;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}

.admin-add-btn:hover { background: #F0562F; }

.admin-error {
  color: var(--accent);
  font-size: 12px;
  margin-bottom: 12px;
  display: none;
}

.admin-error.show { display: block; }

.admin-user-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-user-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
}

.admin-user-row .admin-user-name {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text);
}

.admin-user-row .admin-user-badge {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--accent);
  background: var(--accent-dim);
  padding: 2px 8px;
  border-radius: 3px;
}

.admin-user-row .admin-user-delete {
  background: none;
  border: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
}

.admin-user-row .admin-user-delete:hover { color: var(--accent); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---------- Mobile ---------- */
/* ---------- Manual PRs ---------- */
.manual-pr-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.manual-pr-list .muted {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  padding: 10px 0;
}

.manual-pr-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border-radius: 8px;
  border: 1px solid var(--border-soft);
}

.manual-pr-exercise {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.manual-pr-value {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}

.manual-pr-date {
  font-size: 12px;
  color: var(--text-dim);
  font-family: var(--font-mono);
  min-width: 75px;
  text-align: right;
}

.manual-pr-delete {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}
.manual-pr-delete:hover {
  color: #e74c3c;
  background: rgba(231, 76, 60, 0.1);
}

.manual-pr-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.manual-pr-form select,
.manual-pr-form input {
  flex: 1;
  min-width: 0;
}

.manual-pr-error {
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  border-radius: 6px;
  color: #e74c3c;
  font-size: 12px;
}

@media (max-width: 600px) {
  .content { padding: 14px 14px 90px; }
  .topbar { padding: 12px 14px 0; }
  .brand-row { margin-bottom: 10px; }
  .brand-sub { display: none; }
  .tab-btn { flex: 1; padding: 12px 8px; font-size: 13px; }

  /* Week / Day pills inline, date gets its own full-width row */
  .selector-row { gap: 8px; }
  .selector-group.grow { min-width: 100%; order: 3; }
  .pill { width: 40px; height: 40px; }
  .date-input { height: 46px; font-size: 16px; } /* 16px prevents iOS focus zoom */
  .time-range { width: 100%; }
  .time-input { flex: 1; min-width: 0; width: auto; height: 46px; font-size: 16px; }

  .session-title { font-size: 19px; }
  .mode-btn { padding: 10px 12px; }
  .gran-btn { padding: 10px 12px; }

  /* Exercise rows: name line, then set inputs on their own line */
  .exercise-row { flex-wrap: wrap; row-gap: 8px; padding: 10px 12px; }
  .checkbox { width: 26px; height: 26px; min-width: 26px; }
  .exercise-info { flex: 1; }
  .sets-wrap { max-width: none; width: 100%; justify-content: flex-start; padding-inline-start: 38px; }
  .set-input { width: 44px; height: 40px; font-size: 16px; }

  .notes-row textarea { font-size: 16px; }

  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .stat-value { font-size: 22px; }

  .chart-card { padding: 12px; }
  .chart-header select { padding: 9px 10px; font-size: 16px; }

  .history-item { padding: 12px; gap: 10px; }
  .history-pct { font-size: 14px; min-width: 42px; }

  .save-btn { padding: 15px; font-size: 15px; }
}
