/* ═══════════════════════════════════════════════
   STEEL LOG — WORKOUT TRACKER CSS
   Theme: Black, White, Blue
═══════════════════════════════════════════════ */

:root {
  --bg:          #0A0A0A;
  --surface:     #141414;
  --surface2:    #1C1C1C;
  --border:      #2A2A2A;
  --blue:        #2563EB;
  --blue-light:  #3B82F6;
  --blue-glow:   rgba(37, 99, 235, 0.25);
  --text:        #FFFFFF;
  --text-secondary: #8A8A8A;
  --text-dim:    #555555;
  --success:     #22C55E;
  --danger:      #EF4444;
  --warmup-color:#6366F1;
  --drop-color:  #F97316;
  --pr-color:    #F59E0B;

  --radius:      12px;
  --radius-sm:   8px;
  --nav-height:  64px;
  --header-height: 56px;

  --font-head:   'Barlow Condensed', sans-serif;
  --font-body:   'DM Sans', sans-serif;
  --font-mono:   'DM Mono', monospace;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  overflow: hidden;
}

/* ─── SCREENS ──────────────────────────────── */
.screen { position: fixed; inset: 0; overflow: hidden; }
.screen.hidden { display: none; }

/* ─── AUTH ─────────────────────────────────── */
.auth-bg {
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at 50% 0%, rgba(37,99,235,0.3) 0%, transparent 65%);
}

.auth-container {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 100%; padding: 24px;
  overflow-y: auto;
}

.auth-logo { text-align: center; margin-bottom: 36px; }
.logo-icon { font-size: 48px; display: block; margin-bottom: 8px; }
.logo-text {
  font-family: var(--font-head);
  font-size: 42px; font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #fff 40%, var(--blue-light));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.logo-tagline { color: var(--text-secondary); margin-top: 6px; font-size: 14px; }

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%; max-width: 400px;
}

.auth-tabs { display: flex; background: var(--bg); border-radius: var(--radius-sm); padding: 4px; margin-bottom: 20px; }
.auth-tab {
  flex: 1; padding: 9px; border: none; background: transparent;
  color: var(--text-secondary); font-family: var(--font-body);
  font-size: 14px; font-weight: 600; border-radius: 6px; cursor: pointer;
  transition: all .2s;
}
.auth-tab.active { background: var(--blue); color: white; }

/* ─── FORMS ────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); text-transform: uppercase;
  letter-spacing: .05em; margin-bottom: 6px;
}
.form-group input, .form-group textarea, .form-group select {
  width: 100%; background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text); font-family: var(--font-body); font-size: 15px;
  padding: 10px 12px; outline: none; transition: border-color .2s;
}
.form-group input:focus, .form-group textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--blue-glow);
}
.form-group textarea { resize: vertical; min-height: 72px; }

.error-msg { color: var(--danger); font-size: 13px; margin-bottom: 10px; }
.hidden { display: none !important; }
.mt-8 { margin-top: 8px; }

/* ─── BUTTONS ──────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 11px 20px;
  border: none; border-radius: var(--radius-sm);
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: all .18s; text-decoration: none;
}
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-light); box-shadow: 0 0 14px var(--blue-glow); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--blue); color: var(--blue); }
.btn-danger { background: var(--danger); color: white; }
.btn-full { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 13px; }

.icon-btn {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; padding: 6px; border-radius: 6px;
  font-size: 16px; transition: color .2s;
}
.icon-btn:hover { color: var(--text); }

/* ─── APP LAYOUT ───────────────────────────── */
#app-screen {
  display: flex; flex-direction: column;
}

.app-header {
  height: var(--header-height);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; flex-shrink: 0;
  position: sticky; top: 0; z-index: 10;
}
.header-logo {
  font-family: var(--font-head); font-size: 22px; font-weight: 800;
  letter-spacing: .5px;
  /* dark mode: white→blue reads nicely on dark header */
  background: linear-gradient(135deg, #ffffff 0%, var(--blue-light) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
/* Light mode: override the gradient so dark navy→blue is readable on white */
[data-theme="light"] .header-logo {
  background: linear-gradient(135deg, #1E3A8A 0%, var(--blue) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .header-logo {
    background: linear-gradient(135deg, #1E3A8A 0%, var(--blue) 100%);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  }
}
.header-actions { display: flex; gap: 4px; }

.page-container {
  flex: 1; overflow-y: auto;
  padding: 16px 16px calc(var(--nav-height) + 16px);
}

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  height: var(--nav-height);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  /* align-items:flex-start + padding-top so buttons sit in the visible area,
     not sliding into the iOS home-indicator safe zone */
  align-items: flex-start;
  padding: 6px 8px 0;
  z-index: 20;
  /* Never clip corner buttons */
  overflow: visible;
}
.nav-btn {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; padding: 8px 4px;
  font-family: var(--font-body); transition: color .2s;
}
.nav-btn.active { color: var(--blue); }
.nav-icon { font-size: 20px; }
.nav-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.nav-center {
  flex: 0 0 64px; height: 48px;
  background: var(--blue); border-radius: 14px;
  margin: 0 8px;
}
.nav-center:hover { background: var(--blue-light); box-shadow: 0 0 16px var(--blue-glow); }
.nav-icon-center { font-size: 28px; color: white; line-height: 1; }

/* ─── PAGES ────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

.section-title {
  font-family: var(--font-head);
  font-size: 24px; font-weight: 700;
  margin-bottom: 16px;
}
.page-header-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.page-header-row .section-title { margin-bottom: 0; }

/* ─── QUICK STATS ──────────────────────────── */
.quick-stats {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 10px; margin-bottom: 20px;
}
.stat-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 12px; text-align: center;
}
.stat-value {
  font-family: var(--font-mono); font-size: 22px; font-weight: 500;
  color: var(--blue-light); display: block;
}
.stat-label { font-size: 11px; color: var(--text-secondary); margin-top: 2px; text-transform: uppercase; letter-spacing: .04em; }

/* ─── FEED CARDS ───────────────────────────── */
.feed-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px;
  transition: box-shadow .2s;
}
.feed-card:hover { box-shadow: 0 0 12px var(--blue-glow); }

.feed-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 14px 10px;
}
.feed-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--blue); display: flex; align-items: center;
  justify-content: center; font-weight: 700; font-size: 15px;
  flex-shrink: 0;
}
.feed-user-info { flex: 1; }
.feed-username { font-weight: 600; font-size: 14px; }
.feed-time { font-size: 12px; color: var(--text-secondary); }
.feed-title {
  font-family: var(--font-head); font-size: 18px; font-weight: 700;
  padding: 0 14px 8px;
}
.feed-meta {
  display: flex; gap: 16px; padding: 0 14px 10px;
  font-size: 12px; color: var(--text-secondary);
}
.feed-meta span { display: flex; align-items: center; gap: 4px; }
.feed-exercises { padding: 0 14px 10px; }
.feed-ex-row { font-size: 13px; color: var(--text-secondary); padding: 3px 0; }
.feed-ex-row strong { color: var(--text); }
.feed-actions {
  border-top: 1px solid var(--border);
  display: flex; padding: 10px 14px; gap: 16px;
}
.feed-action-btn {
  background: none; border: none; color: var(--text-secondary);
  cursor: pointer; font-size: 13px; font-family: var(--font-body);
  display: flex; align-items: center; gap: 5px; padding: 4px 0;
  transition: color .2s;
}
.feed-action-btn:hover { color: var(--blue-light); }
.feed-action-btn.liked { color: var(--blue-light); }

/* ─── ROUTINE CARDS ────────────────────────── */
.routine-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px;
  margin-bottom: 10px; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 12px;
  cursor: pointer; transition: box-shadow .2s;
}
.routine-card:hover { box-shadow: 0 0 12px var(--blue-glow); }
.routine-info { flex: 1; }
.routine-name { font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.routine-meta { font-size: 12px; color: var(--text-secondary); }
.muscle-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.muscle-tag {
  background: rgba(37,99,235,0.2); color: var(--blue-light);
  border: 1px solid rgba(37,99,235,0.3);
  border-radius: 20px; padding: 3px 9px; font-size: 11px; font-weight: 600;
}
.routine-actions { display: flex; flex-direction: column; gap: 6px; }

/* ─── ACTIVE WORKOUT OVERLAY ───────────────── */
.overlay {
  position: fixed; inset: 0; background: var(--bg);
  z-index: 100; display: flex; flex-direction: column;
  overflow: hidden;
}
.overlay.hidden { display: none !important; }

.workout-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0;
}
.workout-title-wrap { flex: 1; }
.workout-title-input {
  width: 100%; background: transparent; border: none;
  color: var(--text); font-family: var(--font-head);
  font-size: 20px; font-weight: 700; outline: none;
}
.workout-title-input:focus { color: var(--blue-light); }
.workout-timer-wrap { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.timer-display {
  font-family: var(--font-mono); font-size: 16px; color: var(--blue-light);
}

.workout-body { flex: 1; overflow-y: auto; padding: 12px 16px; }

.workout-footer {
  padding: 12px 16px; border-top: 1px solid var(--border);
  background: var(--surface); flex-shrink: 0;
}

/* ─── EXERCISE CARD (in workout) ───────────── */
.exercise-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); margin-bottom: 12px;
  overflow: hidden;
}
.exercise-card-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.exercise-name-label { font-weight: 700; font-size: 15px; color: var(--blue-light); }
.exercise-muscle-label { font-size: 11px; color: var(--text-secondary); margin-top: 1px; }
.ex-card-actions { display: flex; gap: 6px; }

.prev-info { font-size: 11px; color: var(--text-dim); padding: 6px 14px 4px; }

/* Set table */
.set-table { width: 100%; border-collapse: collapse; }
.set-table th {
  font-size: 10px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-dim); padding: 4px 10px; text-align: center;
}
.set-table th:first-child { text-align: left; padding-left: 14px; width: 44px; }
.set-table th:last-child { width: 44px; }

.set-row td {
  padding: 6px 10px; text-align: center; border-top: 1px solid var(--border);
}
.set-row td:first-child { text-align: left; padding-left: 14px; }
.set-row td:last-child { padding-right: 10px; }

.set-row.completed { background: rgba(37,99,235,0.08); }
.set-row.completed td { opacity: 0.85; }

.set-type-badge {
  display: inline-block; width: 28px; height: 28px; border-radius: 6px;
  font-size: 11px; font-weight: 700; line-height: 28px; text-align: center;
}
.set-type-warmup { background: rgba(99,102,241,0.2); color: var(--warmup-color); }
.set-type-normal { background: var(--surface2); color: var(--text-secondary); }
.set-type-drop { background: rgba(249,115,22,0.2); color: var(--drop-color); }
.set-type-failure { background: rgba(239,68,68,0.15); color: var(--danger); }

.set-input {
  width: 62px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-family: var(--font-mono);
  font-size: 14px; padding: 6px 8px; text-align: center; outline: none;
}
.set-input:focus { border-color: var(--blue); }

.complete-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 2px solid var(--border); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 15px; transition: all .15s; margin: 0 auto;
}
.complete-btn.done { background: var(--blue); border-color: var(--blue); }
.complete-btn.done::after { content: '✓'; color: white; font-weight: 700; }

.pr-badge {
  display: inline-block; background: var(--pr-color);
  color: #000; font-size: 9px; font-weight: 800;
  padding: 2px 5px; border-radius: 4px; margin-left: 4px;
  vertical-align: middle; letter-spacing: .03em;
}

.set-add-row { padding: 8px 14px; }

/* ─── REST TIMER ───────────────────────────── */
.rest-banner {
  /* Lives inside the workout overlay flex column — not fixed to viewport */
  background: var(--surface2);
  border-top: 2px solid var(--blue);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
/* Slide-in animation when timer starts */
.rest-banner:not(.hidden) {
  animation: slideDownBanner .2s ease;
}
@keyframes slideDownBanner {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.rest-banner-content {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
}
.rest-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
.rest-countdown { font-family: var(--font-mono); font-size: 22px; color: var(--blue-light); font-weight: 500; }
.rest-actions { display: flex; gap: 8px; align-items: center; }
.rest-adjust {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: 6px; padding: 5px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.rest-adjust:hover { border-color: var(--blue); color: var(--blue); }
.rest-skip { background: none; border: none; color: var(--text-secondary); font-size: 13px; cursor: pointer; }
.rest-progress-bar { height: 3px; background: var(--border); }
#rest-progress-fill { height: 100%; background: var(--blue); transition: width .9s linear; }

/* ─── MODALS ───────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  z-index: 200; backdrop-filter: blur(2px);
}
.modal {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: var(--surface); border-radius: var(--radius) var(--radius) 0 0;
  border-top: 1px solid var(--border);
  z-index: 210; max-height: 90vh;
  display: flex; flex-direction: column;
  animation: slideUp .25s ease;
}
.modal.hidden { display: none; }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 16px 12px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h3 { font-family: var(--font-head); font-size: 20px; font-weight: 700; }
.modal-body { flex: 1; overflow-y: auto; padding: 16px; }
.modal-footer { padding: 12px 16px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* Exercise Picker */
.search-input {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-body); font-size: 15px;
  padding: 10px 12px; outline: none; margin-bottom: 12px;
}
.search-input:focus { border-color: var(--blue); }

.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  padding: 5px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
  cursor: pointer; transition: all .15s;
}
.chip.active, .chip:hover { background: var(--blue); color: white; border-color: var(--blue); }

.exercise-picker-list { display: flex; flex-direction: column; gap: 2px; }
.exercise-picker-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s;
}
.exercise-picker-item:hover { background: var(--surface2); }
.ex-pick-name { font-weight: 600; font-size: 14px; }
.ex-pick-meta { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.ex-pick-add {
  background: var(--blue); color: white; border: none;
  border-radius: 6px; padding: 6px 12px; font-size: 12px;
  font-weight: 600; cursor: pointer; flex-shrink: 0;
}

/* ─── PROGRESS PAGE ────────────────────────── */
.progress-tabs {
  display: flex; background: var(--surface); border-radius: var(--radius-sm);
  padding: 4px; margin-bottom: 16px; gap: 2px;
}
.ptab {
  flex: 1; padding: 8px; border: none; background: transparent;
  color: var(--text-secondary); font-size: 12px; font-weight: 600;
  border-radius: 6px; cursor: pointer; transition: all .2s;
  font-family: var(--font-body);
}
.ptab.active { background: var(--blue); color: white; }
.ptab-content { display: none; }
.ptab-content.active { display: block; }

/* Stats grid */
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.stats-grid .stat-card { text-align: left; }
.stats-grid .stat-value { font-size: 26px; text-align: left; }

/* Weekly chart */
.weekly-chart { margin-bottom: 20px; }
.chart-title { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 10px; text-transform: uppercase; letter-spacing: .05em; }
.bar-chart { display: flex; gap: 4px; align-items: flex-end; height: 80px; }
.bar-group { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar {
  width: 100%; background: var(--blue); border-radius: 4px 4px 0 0;
  min-height: 4px; transition: height .4s ease;
}
.bar.empty { background: var(--surface2); }
.bar-label { font-size: 10px; color: var(--text-dim); }

/* Muscle distribution */
.muscle-dist { margin-bottom: 20px; }
.muscle-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; border-bottom: 1px solid var(--border);
}
.muscle-row:last-child { border-bottom: none; }
.muscle-name { width: 100px; font-size: 13px; color: var(--text-secondary); flex-shrink: 0; }
.muscle-bar-wrap { flex: 1; background: var(--surface2); border-radius: 4px; height: 8px; overflow: hidden; }
.muscle-bar-fill { height: 100%; background: var(--blue); border-radius: 4px; }
.muscle-sets { font-size: 12px; color: var(--text-dim); width: 40px; text-align: right; font-family: var(--font-mono); }

/* Exercise history rows */
.ex-history-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
  cursor: pointer; transition: box-shadow .2s;
}
.ex-history-card:hover { box-shadow: 0 0 10px var(--blue-glow); }
.ex-history-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.ex-history-pr { font-size: 13px; color: var(--text-secondary); }
.ex-history-pr span { color: var(--blue-light); font-family: var(--font-mono); }

/* Body measurements */
.measure-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.measurement-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.measurement-name { font-size: 13px; color: var(--text-secondary); }
.measurement-val { font-family: var(--font-mono); font-size: 15px; color: var(--text); }

/* Calendar */
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.calendar-month { font-family: var(--font-head); font-size: 22px; font-weight: 700; }
.calendar-nav { background: var(--surface); border: 1px solid var(--border); color: var(--text); border-radius: 6px; padding: 5px 12px; cursor: pointer; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-header { text-align: center; font-size: 11px; color: var(--text-dim); font-weight: 700; padding: 4px 0; }
.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 13px; cursor: pointer;
  transition: background .15s;
}
.cal-day:hover { background: var(--surface2); }
.cal-day.has-workout { background: var(--blue); color: white; font-weight: 700; }
.cal-day.today { border: 2px solid var(--blue-light); }
.cal-day.empty { cursor: default; }
.streak-badge {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 12px;
}
.streak-fire { font-size: 28px; }
.streak-num { font-family: var(--font-head); font-size: 32px; font-weight: 800; color: var(--pr-color); }
.streak-label { font-size: 13px; color: var(--text-secondary); }

/* ─── PROFILE ──────────────────────────────── */
.profile-header {
  text-align: center; padding: 24px 0 16px;
}
.profile-avatar {
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--blue); border: 3px solid var(--blue);
  box-shadow: 0 0 16px var(--blue-glow);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; font-weight: 700; margin: 0 auto 12px;
}
.profile-username { font-family: var(--font-head); font-size: 28px; font-weight: 800; }
.profile-bio { color: var(--text-secondary); font-size: 14px; margin-top: 4px; }
.profile-stats {
  display: flex; justify-content: space-around; align-items: stretch;
  gap: 2px; margin-top: 16px; width: 100%;
}
/* Both .profile-stat (div) and .profile-stat-btn (button) use the same layout */
.profile-stat,
.profile-stat-btn {
  flex: 1; text-align: center; min-width: 0;
  /* Reset button defaults */
  background: none; border: none; cursor: default;
  font-family: var(--font-body);
  padding: 8px 4px; border-radius: var(--radius-sm);
}
.profile-stat-btn { cursor: pointer; }
.profile-stat-btn:hover { background: var(--surface2); }
.profile-stat-num {
  font-family: var(--font-mono); font-size: 20px;
  color: var(--blue-light); display: block;
}
.profile-stat-label { font-size: 10px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: .04em; }
.profile-actions { display: flex; gap: 8px; margin-top: 14px; }

/* Profile workout history */
.history-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 10px;
  cursor: pointer; transition: box-shadow .2s;
}
.history-card:hover { box-shadow: 0 0 10px var(--blue-glow); }
.history-date { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.history-title { font-weight: 700; font-size: 16px; font-family: var(--font-head); }
.history-meta { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

/* ─── ROUTINE BUILDER ──────────────────────── */
.routine-ex-item {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 12px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px;
}
.routine-ex-name { flex: 1; font-weight: 600; font-size: 14px; }
.routine-ex-config { display: flex; gap: 6px; align-items: center; }
.routine-ex-config input {
  width: 44px; background: var(--bg); border: 1px solid var(--border);
  border-radius: 5px; color: var(--text); font-family: var(--font-mono);
  font-size: 13px; padding: 5px; text-align: center; outline: none;
}
.routine-ex-config label { font-size: 11px; color: var(--text-secondary); }

/* ─── EMPTY STATE ──────────────────────────── */
.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-secondary);
}
.empty-state p:first-child { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 15px; }

/* ─── FINISH SUMMARY ───────────────────────── */
.finish-stats {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 10px; margin-bottom: 16px;
}
.finish-stat {
  background: var(--surface2); border-radius: var(--radius-sm);
  padding: 14px; text-align: center;
}
.finish-stat-num {
  font-family: var(--font-mono); font-size: 24px;
  color: var(--blue-light); display: block;
}
.finish-stat-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; }

/* ─── WORKOUT DETAIL MODAL ─────────────────── */
.detail-ex-section { margin-bottom: 14px; }
.detail-ex-name { font-weight: 700; color: var(--blue-light); margin-bottom: 6px; }
.detail-set-row {
  display: flex; gap: 16px; font-size: 13px;
  color: var(--text-secondary); padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.detail-set-row:last-child { border-bottom: none; }
.detail-set-row span:first-child { color: var(--text-dim); width: 20px; }

/* ─── SCROLLBAR ────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--blue); }

/* ─── TOAST ────────────────────────────────── */
.toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 10px 18px;
  font-size: 14px; font-weight: 500; z-index: 300;
  animation: toastIn .2s ease; white-space: nowrap;
}
.toast.success { border-color: var(--success); color: var(--success); }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.pr { border-color: var(--pr-color); color: var(--pr-color); }
@keyframes toastIn { from { opacity: 0; top: 60px; } to { opacity: 1; top: 70px; } }

/* ─── RESPONSIVE / DESKTOP ─────────────────── */
@media (min-width: 600px) {
  .page-container { max-width: 600px; margin: 0 auto; }
  .bottom-nav { max-width: 600px; left: 50%; transform: translateX(-50%); }
  .modal { max-width: 600px; left: 50%; transform: translateX(-50%); right: auto; width: 100%; }
  .workout-overlay { max-width: 600px; margin: 0 auto; left: 50%; transform: translateX(-50%); right: auto; }
}

/* ═══════════════════════════════════════════════
   PWA / INSTALL STYLES
═══════════════════════════════════════════════ */

/* Safe area insets for iPhone notch / Dynamic Island */
.app-header {
  padding-top: max(0px, env(safe-area-inset-top));
  height: calc(var(--header-height) + env(safe-area-inset-top, 0px));
}
.bottom-nav {
  padding-bottom: env(safe-area-inset-bottom, 0px);
  height: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px));
}
.page-container {
  padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 16px);
}

/* Install prompt banner */
.pwa-banner {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 8px);
  left: 12px; right: 12px;
  background: var(--surface2);
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  box-shadow: 0 4px 24px rgba(37,99,235,0.3);
  z-index: 150;
  animation: toastIn .3s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  gap: 10px;
}
.pwa-banner.hidden { display: none !important; }

.pwa-banner-content {
  display: flex; align-items: center; gap: 12px; flex: 1;
}
.pwa-icon { font-size: 28px; flex-shrink: 0; }
.pwa-text {
  display: flex; flex-direction: column; gap: 2px;
}
.pwa-text strong { font-size: 14px; color: var(--text); }
.pwa-text span   { font-size: 12px; color: var(--text-secondary); }

.pwa-banner-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

@media (min-width: 600px) {
  .pwa-banner { max-width: 576px; left: 50%; transform: translateX(-50%); right: auto; }
}

/* ─── DELETE BUTTON ON CARDS ───────────────── */
.history-card { position: relative; }
.history-card-inner { flex: 1; }
.card-delete-btn {
  background: none; border: none;
  color: var(--text-dim); cursor: pointer;
  font-size: 16px; padding: 4px 6px;
  border-radius: 6px; transition: color .15s, background .15s;
  flex-shrink: 0; align-self: flex-start;
}
.card-delete-btn:hover { color: var(--danger); background: rgba(239,68,68,0.1); }

.history-card-row {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 8px;
}

/* ─── REST TIMER PICKER POPUP ──────────────── */
.rest-picker-popup {
  background: var(--surface2);
  border: 1px solid var(--blue);
  border-radius: var(--radius);
  margin: 8px 0;
  padding: 14px;
  animation: slideDownBanner .2s ease;
}
.rest-picker-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; font-size: 13px; color: var(--text-secondary);
}
.rest-picker-options {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  margin-bottom: 10px;
}
.rest-option-btn {
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); border-radius: var(--radius-sm);
  padding: 8px 4px; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all .15s; font-family: var(--font-mono);
}
.rest-option-btn:hover { border-color: var(--blue); color: var(--blue); }
.rest-option-btn.active { background: var(--blue); border-color: var(--blue); color: white; }
.rest-picker-footer { display: flex; gap: 8px; align-items: center; }

/* Rest timer label on exercise card button */
.rest-timer-btn { font-size: 12px; display: flex; align-items: center; gap: 3px; }
.rest-timer-label { font-family: var(--font-mono); color: var(--blue-light); }
.ex-card-actions { gap: 4px; }

/* ─── ROUTINE UPDATE DIFF ───────────────────── */
.diff-row {
  padding: 8px 10px; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 6px;
}
.diff-row.removed { background: rgba(239,68,68,0.1); color: #FCA5A5; }
.diff-row.added   { background: rgba(34,197,94,0.1);  color: #86EFAC; }

/* ─── USER SEARCH ───────────────────────────── */
.user-search-results { margin-top: 4px; }

.user-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .15s;
  border-bottom: 1px solid var(--border);
}
.user-card:hover { background: var(--surface2); }
.user-card:last-child { border-bottom: none; }

.user-card-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--blue); border: 2px solid var(--blue);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 16px; flex-shrink: 0;
}
.user-card-info { flex: 1; min-width: 0; }
.user-card-name  { font-weight: 700; font-size: 15px; }
.user-card-meta  { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }
.user-card-bio   { font-size: 12px; color: var(--text-dim); margin-top: 2px;
                   white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ═══════════════════════════════════════════════
   MINIMIZE WORKOUT / MINI BUBBLE
═══════════════════════════════════════════════ */
.mini-workout-bubble {
  position: fixed;
  bottom: calc(var(--nav-height) + env(safe-area-inset-bottom, 0px) + 10px);
  right: 14px;
  background: var(--surface2);
  border: 1px solid var(--blue);
  border-radius: 14px;
  padding: 10px 14px 10px 12px;
  z-index: 95;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(37,99,235,0.35);
  display: flex;
  align-items: center;
  gap: 10px;
  transition: transform .15s, box-shadow .15s;
}
.mini-workout-bubble:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(37,99,235,0.45); }
.mini-workout-bubble.hidden { display: none !important; }
.mini-bubble-info { display: flex; flex-direction: column; gap: 2px; }
.mini-workout-name {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-secondary);
  max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mini-timer-row { display: flex; align-items: center; gap: 7px; }
.mini-timer { font-family: var(--font-mono); font-size: 17px; color: var(--blue-light); font-weight: 500; }
.mini-rest  { font-family: var(--font-mono); font-size: 13px; color: var(--pr-color); }
.mini-rest.hidden { display: none !important; }
.mini-expand-icon { font-size: 18px; color: var(--text-secondary); flex-shrink: 0; }

/* ═══════════════════════════════════════════════
   WORKOUT HEADER DROPDOWN MENU
═══════════════════════════════════════════════ */
.workout-menu-wrap { position: relative; }
.workout-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  z-index: 200;
  min-width: 170px;
  overflow: hidden;
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
}
.workout-dropdown.hidden { display: none !important; }
.dropdown-item {
  display: block; width: 100%; padding: 12px 16px;
  background: none; border: none; color: var(--text);
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  text-align: left; cursor: pointer; transition: background .12s;
}
.dropdown-item:hover { background: var(--surface); }
.danger-item { color: var(--danger) !important; }

/* ═══════════════════════════════════════════════
   FINISH / POST MODAL STYLES
═══════════════════════════════════════════════ */
.finish-datetime {
  text-align: center;
  font-size: 12px;
  color: var(--text-secondary);
  padding: 6px 10px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin: -4px 0 14px;
}

/* Photo drop zone */
.photo-drop-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  overflow: hidden;
  transition: border-color .2s;
  position: relative;
}
.photo-drop-zone:hover { border-color: var(--blue); }
.photo-preview-empty {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; padding: 20px 16px;
  color: var(--text-secondary); font-size: 13px;
}
.photo-preview-img {
  width: 100%; max-height: 220px; object-fit: cover; display: block;
}
.photo-preview-video { width: 100%; max-height: 220px; display: block; }
.photo-remove-row {
  position: absolute; top: 6px; right: 6px;
}
.photo-remove-btn {
  background: rgba(0,0,0,0.65); border: none; color: white;
  border-radius: 50%; width: 26px; height: 26px;
  cursor: pointer; font-size: 13px; line-height: 26px; text-align: center;
}

/* Visibility selector */
.visibility-row { display: flex; gap: 8px; }
.vis-opt { flex: 1; cursor: pointer; }
.vis-opt input { display: none; }
.vis-opt-inner {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 12px 8px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); transition: all .15s;
}
.vis-opt input:checked + .vis-opt-inner {
  border-color: var(--blue); background: rgba(37,99,235,0.12);
}
.vis-opt-icon  { font-size: 22px; }
.vis-opt-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.vis-opt input:checked + .vis-opt-inner .vis-opt-label { color: var(--blue-light); }

/* Discard button danger style */
.discard-btn { color: var(--danger) !important; border-color: rgba(239,68,68,0.4) !important; }
.discard-btn:hover { background: rgba(239,68,68,0.08) !important; border-color: var(--danger) !important; }

/* ═══════════════════════════════════════════════
   FEED CARD — NOTES + PHOTO
═══════════════════════════════════════════════ */
.feed-notes {
  padding: 0 14px 10px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  font-style: italic;
  border-left: 2px solid var(--border);
  margin: 0 14px 8px;
  padding: 4px 10px;
}
.feed-photo-wrap { overflow: hidden; border-radius: 0; }
.feed-photo {
  width: 100%; max-height: 320px; object-fit: cover;
  display: block; border-top: 1px solid var(--border);
}
.feed-video {
  width: 100%; max-height: 320px; display: block;
  border-top: 1px solid var(--border);
}

/* ═══════════════════════════════════════════════
   STATISTICS TAB
═══════════════════════════════════════════════ */
.stats-filter-row { margin-bottom: 16px; }
.stats-period-select {
  width: 100%; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-body); font-size: 14px; padding: 10px 12px;
  outline: none; cursor: pointer;
}
.stats-period-select:focus { border-color: var(--blue); }

.stats-list { display: flex; flex-direction: column; gap: 2px; }

.stats-ex-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.stats-ex-rank {
  font-family: var(--font-mono); font-size: 18px; font-weight: 700;
  color: var(--text-dim); min-width: 24px; text-align: center;
}
.stats-ex-info { flex: 1; min-width: 0; }
.stats-ex-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.stats-ex-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.stats-bar-wrap {
  height: 4px; background: var(--border); border-radius: 4px; overflow: hidden;
}
.stats-bar-fill { height: 100%; background: var(--blue); border-radius: 4px; }
.stats-ex-count { text-align: right; flex-shrink: 0; }
.stats-count-num {
  display: block; font-family: var(--font-mono); font-size: 22px;
  color: var(--blue-light); font-weight: 500;
}
.stats-count-label { display: block; font-size: 10px; color: var(--text-secondary); text-transform: uppercase; }
.stats-sets-label  { display: block; font-size: 11px; color: var(--text-dim); margin-top: 2px; }

/* ═══════════════════════════════════════════════
   EXERCISE INFO MODAL
═══════════════════════════════════════════════ */
/* Reuses existing .muscle-tag, .stat-card, .chart-title, .measurement-row styles */

/* ═══════════════════════════════════════════════
   EXERCISE CARD — CLICKABLE NAME BUTTON
═══════════════════════════════════════════════ */
.exercise-name-btn {
  background: none; border: none;
  color: var(--blue-light); font-weight: 700; font-size: 15px;
  cursor: pointer; padding: 0; text-align: left;
  transition: color .15s;
}
.exercise-name-btn:hover { color: var(--text); text-decoration: underline; }

/* ═══════════════════════════════════════════════
   MINI BUBBLE — UPDATED
═══════════════════════════════════════════════ */
.mini-rest-row {
  display: flex; align-items: center; gap: 5px;
}
#mini-rest-icon {
  font-size: 14px; color: var(--text-dim);
}
.mini-rest-val {
  font-family: var(--font-mono); font-size: 18px;
  color: var(--text-secondary); font-weight: 500;
}

/* ═══════════════════════════════════════════════
   SETTINGS OVERLAY
═══════════════════════════════════════════════ */
.settings-overlay {
  background: var(--bg);
  z-index: 110;
  display: flex; flex-direction: column;
}
.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.settings-title {
  font-family: var(--font-head); font-size: 20px; font-weight: 700;
}
.settings-body {
  flex: 1; overflow-y: auto;
  padding: 16px;
  display: flex; flex-direction: column; gap: 16px;
}
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.settings-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-secondary);
  padding: 10px 16px 6px; background: var(--surface2);
  border-bottom: 1px solid var(--border);
}
.settings-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.settings-item:last-child { border-bottom: none; }
.settings-item-btn { cursor: pointer; transition: background .15s; }
.settings-item-btn:hover { background: var(--surface2); }
.settings-item-label { font-size: 14px; font-weight: 500; }
.settings-item-value { font-size: 14px; color: var(--text-secondary); }
.settings-item-arrow { font-size: 13px; color: var(--text-dim); }
.settings-item-danger .settings-item-label { color: var(--danger); }

/* Weight unit toggle */
.unit-toggle { display: flex; background: var(--bg); border-radius: 8px; padding: 3px; gap: 2px; }
.unit-btn {
  padding: 6px 16px; border: none; background: transparent;
  color: var(--text-secondary); font-family: var(--font-body);
  font-size: 13px; font-weight: 700; border-radius: 6px;
  cursor: pointer; transition: all .15s;
}
.unit-btn.active { background: var(--blue); color: white; }

/* Notification preference toggles */
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; cursor: pointer; inset: 0;
  background: var(--border); border-radius: 24px;
  transition: background .2s;
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 18px; height: 18px; border-radius: 50%;
  left: 3px; bottom: 3px;
  background: white; transition: transform .2s;
}
.toggle-switch input:checked + .toggle-slider { background: var(--blue); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ═══════════════════════════════════════════════
   NOTIFICATION PANEL
═══════════════════════════════════════════════ */
.notif-backdrop {
  position: fixed; inset: 0;
  z-index: 119;
}
.notif-backdrop.hidden { display: none !important; }

.notif-panel {
  position: fixed;
  top: var(--header-height);
  right: 0; left: 0;
  max-width: 420px;
  margin: 0 auto;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  z-index: 120;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: slideDownBanner .2s ease;
}
.notif-panel.hidden { display: none !important; }

.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.notif-panel-title { font-weight: 700; font-size: 15px; }
.notif-list { flex: 1; overflow-y: auto; }

.notif-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .15s;
}
.notif-item:hover { background: var(--surface2); }
.notif-item.unread { background: rgba(37,99,235,0.06); }
.notif-item:last-child { border-bottom: none; }

.notif-icon { font-size: 20px; flex-shrink: 0; margin-top: 2px; }
.notif-content { flex: 1; }
.notif-msg { font-size: 13px; line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.notif-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0; margin-top: 5px;
}

/* Bell badge */
.notif-bell-wrap { position: relative; }
.notif-badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--danger); color: white;
  font-size: 9px; font-weight: 800;
  border-radius: 10px; padding: 1px 4px;
  min-width: 16px; text-align: center;
  line-height: 14px;
}

/* ═══════════════════════════════════════════════
   SHARE BUTTON ON FEED CARDS
═══════════════════════════════════════════════ */
.feed-action-btn.share-btn { margin-left: auto; }

/* ═══════════════════════════════════════════════
   COMMENTS — TIMESTAMPS + CLICKABLE PROFILES
═══════════════════════════════════════════════ */
.comment-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.comment-item:last-child { border-bottom: none; }
.comment-meta {
  display: flex; align-items: center; gap: 8px; margin-bottom: 3px;
}
.comment-author-btn {
  background: none; border: none;
  color: var(--blue-light); font-weight: 700; font-size: 13px;
  cursor: pointer; padding: 0; font-family: var(--font-body);
  transition: color .15s;
}
.comment-author-btn:hover { color: var(--text); text-decoration: underline; }
.comment-time {
  font-size: 11px; color: var(--text-dim);
}
.comment-text { font-size: 13px; color: var(--text-secondary); line-height: 1.4; }

/* Custom exercise badge in picker */
.ex-custom-badge {
  background: rgba(99,102,241,0.2); color: #A5B4FC;
  border-radius: 4px; padding: 1px 6px; font-size: 10px;
  font-weight: 700; margin-left: 4px; text-transform: uppercase;
}

/* ═══════════════════════════════════════════════
   BOTTOM SHEETS (shared base)
═══════════════════════════════════════════════ */
.sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 300; backdrop-filter: blur(2px);
}
.sheet-backdrop.hidden { display: none !important; }

.bottom-sheet {
  position: fixed; bottom: 0; left: 0; right: 0;
  max-width: 600px; margin: 0 auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  border-top: 1px solid var(--border);
  z-index: 310;
  padding: 0 16px 24px;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  animation: sheetSlideUp .25s cubic-bezier(.32,.72,0,1);
}
.bottom-sheet.hidden { display: none !important; }
@keyframes sheetSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border); border-radius: 4px;
  margin: 10px auto 16px;
}
.sheet-title {
  font-family: var(--font-head); font-size: 20px; font-weight: 700;
  text-align: center; margin-bottom: 16px;
}

/* ═══════════════════════════════════════════════
   SHARE SHEET
═══════════════════════════════════════════════ */
.share-preview-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px; padding: 12px;
  background: var(--surface2); border-radius: var(--radius);
}
.share-preview-icon { font-size: 28px; flex-shrink: 0; }
.share-preview-title { font-weight: 700; font-size: 15px; }
.share-preview-meta  { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }

.share-canvas-wrap {
  width: 100%; border-radius: var(--radius); overflow: hidden;
  margin-bottom: 16px; background: #0A0A0A;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.share-canvas-wrap canvas { width: 100%; height: auto; display: block; }

.share-actions-grid {
  display: flex; gap: 10px; margin-bottom: 12px;
}
.share-action {
  flex: 1; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px 8px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  transition: background .15s, border-color .15s;
}
.share-action:hover { background: var(--blue); border-color: var(--blue); }
.share-action-icon  { font-size: 22px; }
.share-action-label { font-size: 12px; font-weight: 600; color: var(--text-secondary); }
.share-action:hover .share-action-label { color: white; }

/* ═══════════════════════════════════════════════
   SET TYPE SHEET
═══════════════════════════════════════════════ */
.set-type-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 4px; }

.set-type-option {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  cursor: pointer; transition: background .12s;
}
.set-type-option:hover { background: var(--surface2); }
.set-type-option.selected { background: rgba(37,99,235,0.12); }

.sto-indicator {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0; transition: all .15s;
}
.set-type-option.selected .sto-indicator {
  background: var(--blue); border-color: var(--blue);
}
.sto-badge-pill {
  min-width: 32px; height: 28px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.sto-badge-pill.warmup  { background: rgba(99,102,241,0.2);  color: var(--warmup-color); }
.sto-badge-pill.normal  { background: var(--surface2);       color: var(--text-secondary); }
.sto-badge-pill.drop    { background: rgba(249,115,22,0.2);  color: var(--drop-color); }
.sto-badge-pill.failure { background: rgba(239,68,68,0.15);  color: var(--danger); }

.sto-info { flex: 1; }
.sto-name { font-size: 15px; font-weight: 600; }
.sto-desc { font-size: 12px; color: var(--text-secondary); margin-top: 1px; }

.sto-help-btn {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface2);
  color: var(--text-secondary); font-size: 11px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .15s;
}
.sto-help-btn:hover { background: var(--blue); color: white; border-color: var(--blue); }

.set-type-divider { height: 1px; background: var(--border); margin: 8px 0; }

.set-type-remove-btn {
  width: 100%; background: none; border: none;
  color: var(--danger); font-family: var(--font-body);
  font-size: 15px; font-weight: 600;
  padding: 12px 14px; text-align: left; cursor: pointer;
  border-radius: var(--radius-sm); transition: background .12s;
}
.set-type-remove-btn:hover { background: rgba(239,68,68,0.1); }

.set-type-info-box {
  background: var(--surface2); border: 1px solid var(--blue);
  border-radius: var(--radius-sm); padding: 12px 14px;
  font-size: 13px; color: var(--text-secondary); line-height: 1.5;
  margin-top: 10px; animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }

/* ═══════════════════════════════════════════════
   ROUTINE BUILDER — PER-SET ROWS
═══════════════════════════════════════════════ */
.routine-ex-item {
  /* Same as .exercise-card in the active workout */
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
.routine-ex-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}
.routine-ex-name { font-weight: 700; font-size: 15px; }
.routine-ex-card-section {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.routine-ex-notes-label,
.routine-ex-rest-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-dim); display: block; margin-bottom: 6px;
}
.routine-ex-notes-textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text); font-family: var(--font-body);
  font-size: 13px; padding: 8px 10px; resize: none; outline: none; min-height: 44px;
}
.routine-ex-rest-trigger {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text-secondary); font-family: var(--font-body);
  font-size: 13px; padding: 7px 12px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
}

.rb-set-header {
  display: grid; grid-template-columns: 28px 1fr 1fr 32px;
  gap: 8px; padding: 5px 12px;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-dim);
}
.rb-set-row {
  display: grid; grid-template-columns: 28px 1fr 1fr 32px;
  gap: 8px; align-items: center;
  padding: 6px 12px; border-top: 1px solid var(--border);
}
.rb-set-num {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text-secondary); text-align: center;
}
.rb-input {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; color: var(--text);
  font-family: var(--font-mono); font-size: 13px;
  padding: 6px 8px; text-align: center; outline: none;
  width: 100%;
}
.rb-input:focus { border-color: var(--blue); }
.rb-remove-set-btn {
  background: none; border: none; color: var(--text-dim);
  cursor: pointer; font-size: 14px; padding: 4px;
  border-radius: 4px; transition: color .12s;
}
.rb-remove-set-btn:hover { color: var(--danger); }
.rb-add-set-row {
  padding: 8px 12px;
  border-top: 1px solid var(--border);
}
.rb-add-set-btn {
  background: none; border: 1px dashed var(--border);
  color: var(--text-secondary); border-radius: 6px;
  padding: 7px; width: 100%; font-size: 13px;
  cursor: pointer; transition: all .15s; font-family: var(--font-body);
}
.rb-add-set-btn:hover { border-color: var(--blue); color: var(--blue); }

/* Set type badge in active workout — now a button */
.set-type-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; border-radius: 6px;
  font-size: 11px; font-weight: 800;
  cursor: pointer; border: none;
  transition: opacity .15s;
}
.set-type-trigger:hover { opacity: .8; }
.set-type-trigger.warmup  { background: rgba(99,102,241,0.2);  color: var(--warmup-color); }
.set-type-trigger.normal  { background: var(--surface2);       color: var(--text-secondary); }
.set-type-trigger.drop    { background: rgba(249,115,22,0.2);  color: var(--drop-color); }
.set-type-trigger.failure { background: rgba(239,68,68,0.15);  color: var(--danger); }

/* ═══════════════════════════════════════════════
   NUMBER INPUTS — REMOVE SPINNER ARROWS APP-WIDE
   User wants to just type the number, no up/down
   stepper arrows on weight/reps fields anywhere.
═══════════════════════════════════════════════ */
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* ═══════════════════════════════════════════════
   ROUTINE BUILDER — REDESIGNED CARD LAYOUT
═══════════════════════════════════════════════ */
.routine-ex-dropdown-wrap { position: relative; }
.routine-ex-dots-btn { font-size: 18px; }

.routine-ex-card-section {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.routine-ex-notes-label,
.routine-ex-rest-label {
  display: block;
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-dim);
  margin-bottom: 6px;
}
.routine-ex-notes-textarea {
  width: 100%; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-family: var(--font-body);
  font-size: 13px; padding: 8px 10px;
  resize: vertical; min-height: 36px; outline: none;
}
.routine-ex-notes-textarea:focus { border-color: var(--blue); }
.routine-ex-notes-textarea::placeholder { color: var(--text-dim); }

.routine-ex-rest-trigger {
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 8px; color: var(--blue-light);
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  padding: 8px 12px; cursor: pointer; transition: border-color .15s;
}
.routine-ex-rest-trigger:hover { border-color: var(--blue); }

/* ── Reorder mode ── */
.reorder-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(37,99,235,0.12); border: 1px solid var(--blue);
  border-radius: var(--radius-sm); padding: 10px 12px;
  margin-bottom: 10px; font-size: 13px; font-weight: 600;
  color: var(--blue-light);
}
.reorder-banner.hidden { display: none !important; }

.reorder-move-group { display: flex; gap: 4px; }
.reorder-move-btn {
  width: 30px; height: 30px; border-radius: 6px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 12px; cursor: pointer;
  transition: all .15s;
}
.reorder-move-btn:hover:not(:disabled) { border-color: var(--blue); color: var(--blue-light); }
.reorder-move-btn:disabled { opacity: .3; cursor: not-allowed; }

/* ─── Feed user profile button ────────────────── */
.feed-user-btn {
  display: flex; align-items: center; gap: 10px;
  background: none; border: none; cursor: pointer;
  padding: 0; text-align: left;
  transition: opacity .15s;
}
.feed-user-btn:hover { opacity: .75; }
/* Re-apply existing feed-avatar/username styles on the button's children */
.feed-user-btn .feed-username { font-weight: 700; font-size: 14px; color: var(--text); }

/* ═══════════════════════════════════════════════
   PROGRAM LIBRARY
═══════════════════════════════════════════════ */
.program-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 14px; margin-bottom: 10px; background: var(--surface);
  cursor: pointer; transition: border-color .15s;
}
.program-card:hover { border-color: var(--blue); }
.program-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.program-card-name { font-weight: 700; font-size: 16px; margin-bottom: 5px; }
.program-card-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--text-secondary); align-items: center; }
.program-card-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0; }
.program-badge {
  border-radius: 6px; padding: 2px 8px;
  font-size: 11px; font-weight: 700; display: inline-block;
}

.program-detail-meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--text-secondary); margin-bottom: 8px; }
.program-note {
  background: rgba(37,99,235,0.08); border: 1px solid rgba(37,99,235,0.3);
  border-radius: var(--radius-sm); padding: 10px 12px;
  font-size: 13px; color: var(--blue-light); margin-bottom: 14px; line-height: 1.5;
}

.program-day-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; margin-bottom: 10px;
}
.program-day-name {
  background: var(--surface2); padding: 10px 12px;
  font-weight: 700; font-size: 14px; border-bottom: 1px solid var(--border);
}
.program-day-exercise {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.program-day-exercise:last-child { border-bottom: none; }
.program-ex-name { font-size: 13px; }
.program-ex-sets { font-family: var(--font-mono); font-size: 12px; color: var(--blue-light); font-weight: 600; }
.program-ex-note { font-size: 11px; color: var(--text-dim); padding: 2px 12px 6px; font-style: italic; }

/* diff-row changed style for set count changes */
.diff-row.changed { color: var(--drop-color); }

/* ═══════════════════════════════════════════════
   LIGHT THEME
═══════════════════════════════════════════════ */
:root[data-theme="light"] {
  --bg:             #F4F4F4;
  --surface:        #FFFFFF;
  --surface2:       #EFEFEF;
  --border:         #D1D5DB;
  --text:           #111827;
  --text-secondary: #4B5563;
  --text-dim:       #9CA3AF;
  --warmup-color:   #6366F1;
  --drop-color:     #F97316;
  --pr-color:       #F59E0B;
  --blue:           #2563EB;
  --blue-light:     #1D4ED8;
  --blue-glow:      rgba(37, 99, 235, 0.15);
  --success:        #16A34A;
  --danger:         #DC2626;
  --nav-bg:         #FFFFFF;
  --header-bg:      #FFFFFF;
}

/* System auto-light (when no explicit theme is set) */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]):not([data-theme="light"]) {
    --bg:             #F4F4F4;
    --surface:        #FFFFFF;
    --surface2:       #EFEFEF;
    --border:         #D1D5DB;
    --text:           #111827;
    --text-secondary: #4B5563;
    --text-dim:       #9CA3AF;
    --warmup-color:   #6366F1;
    --drop-color:     #F97316;
    --pr-color:       #F59E0B;
    --blue:           #2563EB;
    --blue-light:     #1D4ED8;
    --blue-glow:      rgba(37, 99, 235, 0.15);
    --success:        #16A34A;
    --danger:         #DC2626;
    --nav-bg:         #FFFFFF;
    --header-bg:      #FFFFFF;
  }
}

/* ═══════════════════════════════════════════════
   EXERCISE DOTS MENU — in active workout
═══════════════════════════════════════════════ */
.ex-dots-wrap { position: relative; }
.ex-dots-btn  { font-size: 18px; line-height: 1; }
.ex-dropdown  {
  position: absolute; top: calc(100% + 4px); right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); z-index: 200; min-width: 180px;
  overflow: hidden; box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}
.ex-dropdown.hidden { display: none !important; }
.ex-dropdown .dropdown-item { padding: 12px 16px; }

/* ═══════════════════════════════════════════════
   PROFILE PICTURES
═══════════════════════════════════════════════ */
.feed-avatar-img,
.profile-avatar-img,
.comment-avatar-img {
  border-radius: 50%;
  object-fit: cover;
  background: var(--surface2);
}
.feed-avatar-img   { width: 40px; height: 40px; }
.profile-avatar-img { width: 80px; height: 80px; border: 3px solid var(--blue); cursor: pointer; }
.avatar-upload-wrap {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.avatar-upload-preview {
  width: 56px; height: 56px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--surface2);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; color: var(--text-secondary);
  overflow: hidden; flex-shrink: 0;
}
.avatar-upload-preview img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar-upload-btn-wrap { display: flex; flex-direction: column; gap: 4px; }
.avatar-upload-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-dim);
}

/* ─── Image lightbox ──────────────────────── */
.img-lightbox {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(0,0,0,0.92);
  display: flex; align-items: center; justify-content: center;
}
.img-lightbox.hidden { display: none !important; }
/* Wrapper makes the close button position: absolute within the image bounds */
.lightbox-inner {
  position: relative;
  display: inline-flex;
}
.img-lightbox img {
  max-width: 96vw; max-height: 92vh;
  border-radius: 4px; object-fit: contain; display: block;
}
.img-lightbox-close {
  /* Fixed to viewport top-right so it's always visible and tappable on iOS */
  position: fixed; top: 18px; right: 18px;
  background: rgba(20,20,20,0.9); border: 2px solid rgba(255,255,255,0.5);
  color: white; font-size: 20px; font-weight: 800; line-height: 1;
  border-radius: 50%; width: 44px; height: 44px;
  cursor: pointer;
  /* Must be above lightbox z-index (500) */
  z-index: 600;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  /* Bigger tap target via padding */
  box-sizing: border-box;
}
.img-lightbox-close:active { background: rgba(220,38,38,0.9); }

/* ═══════════════════════════════════════════════
   THEME SELECTOR IN SETTINGS
═══════════════════════════════════════════════ */
.theme-toggle { display: flex; gap: 6px; }
.theme-btn {
  flex: 1; padding: 8px 4px;
  background: var(--bg); border: 2px solid var(--border);
  border-radius: 8px; cursor: pointer; font-size: 12px;
  font-weight: 700; color: var(--text-secondary);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: all .15s;
}
.theme-btn .theme-icon { font-size: 18px; }
.theme-btn.active { border-color: var(--blue); background: rgba(37,99,235,.1); color: var(--blue-light); }

/* ═══════════════════════════════════════════════
   WORKOUT REORDER MODE
═══════════════════════════════════════════════ */
.reorder-ex-row {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 14px;
  margin-bottom: 8px;
}
.reorder-ex-name { font-weight: 600; font-size: 15px; flex: 1; }

/* ═══════════════════════════════════════════════
   SVG ICON SYSTEM — base styles
═══════════════════════════════════════════════ */
.icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  /* icons inherit currentColor for stroke/fill */
}
.nav-icon .icon   { color: inherit; }
.feed-action-btn  { display: inline-flex; align-items: center; gap: 5px; }
.feed-action-btn.liked { color: #EF4444; }

/* ─── Auth page — solid blue barbell ─────────── */
.auth-barbell-icon {
  display: flex; justify-content: center; margin-bottom: 10px;
}

/* ─── Exercise info modal — media section ─────── */
.ex-info-media {
  background: var(--bg);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: 4px;
  min-height: 120px;
  display: flex; align-items: center; justify-content: center;
}
.ex-info-media-loading {
  display: flex; flex-direction: column; align-items: center;
  gap: 6px; color: var(--text-dim); font-size: 12px; padding: 20px;
}
.ex-info-img {
  width: 100%;
  height: auto;
  /* Constrain to a sensible height so image fits on screen */
  max-height: 180px;
  object-fit: contain; display: block;
  cursor: zoom-in; background: var(--bg);
  border-radius: 4px;
}
.ex-info-img-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 10px; background: var(--surface2);
  font-size: 12px; color: var(--text-secondary);
}
.ex-img-prev, .ex-img-next {
  background: none; border: 1px solid var(--border);
  color: var(--text); border-radius: 6px;
  padding: 3px 10px; cursor: pointer; font-size: 14px;
  transition: all .15s;
}
.ex-img-prev:hover:not(:disabled), .ex-img-next:hover:not(:disabled) { border-color: var(--blue); color: var(--blue); }
.ex-img-prev:disabled, .ex-img-next:disabled { opacity: .3; cursor: not-allowed; }

/* ─── Settings overlay full scroll ─────────────── */
.settings-body {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
/* Ensure each section's content doesn't clip */
.settings-section { overflow: visible; }

/* ─── Exercise picker row hover ─────────────────── */
.ex-pick-info-trigger:hover { opacity: .8; }

/* Profanity filter settings description */
.settings-item-sub {
  font-size: 11px; color: var(--text-dim);
  margin-top: 2px;
}

/* ═══════════════════════════════════════════════
   WORKOUTS PAGE — Start Empty Workout button
═══════════════════════════════════════════════ */
.btn-start-empty {
  width: 100%; margin-bottom: 20px;
  background: linear-gradient(135deg, var(--blue) 0%, #1D4ED8 100%);
  border: none; border-radius: var(--radius);
  color: white; font-family: var(--font-head);
  font-size: 18px; font-weight: 700; letter-spacing: .3px;
  padding: 16px 20px;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37,99,235,0.35);
  transition: opacity .15s, transform .1s;
}
.btn-start-empty:hover { opacity: .9; transform: translateY(-1px); }
.btn-start-empty:active { transform: translateY(0); }

.workouts-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .07em; color: var(--text-dim);
  margin-bottom: 10px;
}

/* ─── Follower list in modal ─────────────────── */
.follow-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--border);
  cursor: pointer; transition: opacity .15s;
}
.follow-card:last-child { border-bottom: none; }
.follow-card:hover { opacity: .75; }
.follow-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  object-fit: cover; flex-shrink: 0;
}
.follow-avatar-initials {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface2); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 700; color: var(--text-secondary);
  flex-shrink: 0;
}
.follow-info { flex: 1; min-width: 0; }
.follow-username { font-weight: 700; font-size: 14px; }
.follow-bio { font-size: 12px; color: var(--text-secondary); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── Profile stat as clickable button ──────── */
.profile-stat-btn {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 12px; border-radius: var(--radius-sm);
  transition: background .15s;
}
.profile-stat-btn:hover { background: var(--surface2); }

/* ═══════════════════════════════════════════════
   WORKOUTS PAGE — QUICK START GRID
═══════════════════════════════════════════════ */
.workouts-subsection-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 10px;
}
.quick-start-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px; margin-bottom: 20px;
}
.qs-card {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px;
  aspect-ratio: 1;
  background: color-mix(in srgb, var(--qs-color, var(--blue)) 12%, var(--surface));
  border: 1.5px solid color-mix(in srgb, var(--qs-color, var(--blue)) 30%, transparent);
  border-radius: 12px;
  color: var(--qs-color, var(--blue));
  cursor: pointer; transition: transform .12s, opacity .12s;
  padding: 6px 4px;
}
.qs-card:hover { opacity: .85; transform: scale(1.03); }
.qs-card:active { transform: scale(.97); }
.qs-card-label {
  font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; text-align: center; line-height: 1.2;
  color: var(--text-secondary);
}

/* ─── Quick-start workout cards in modal ─── */
.qs-workout-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  overflow: hidden; margin-bottom: 14px;
}
.qs-workout-name {
  background: var(--surface2); padding: 10px 14px;
  font-weight: 700; font-size: 15px;
  border-bottom: 1px solid var(--border);
}
.qs-ex-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.qs-ex-row:last-of-type { border-bottom: none; }
.qs-ex-name { flex: 1; }
.qs-ex-sets { font-family: var(--font-mono); font-size: 12px; color: var(--blue-light); font-weight: 600; }
.qs-workout-actions {
  display: flex; gap: 8px; padding: 10px 14px;
  border-top: 1px solid var(--border); background: var(--surface2);
}

/* ─── Timestamp icon in finish summary ─── */
.finish-timestamp { display: flex; align-items: center; gap: 6px; }

/* ─── Workout saved toast ─── */
.toast-saved { background: var(--success); }

/* ─── Vis option icon sizing ─── */
.vis-opt-icon { display: inline-flex; align-items: center; justify-content: center; }
.vis-opt-icon .icon { width: 20px; height: 20px; }

/* ═══════════════════════════════════════════════
   WORKOUTS PAGE — FOLDER SECTIONS
═══════════════════════════════════════════════ */
.routines-section-hdr {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.routines-actions-row {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.routines-actions-row .btn { flex: 1; justify-content: center;
  display: flex; align-items: center; gap: 6px; }

.routine-folder-section { margin-bottom: 4px; }

.routine-folder-header {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 11px 14px;
  cursor: pointer; text-align: left; font-family: var(--font-body);
  transition: background .12s;
  margin-bottom: 0;
}
.routine-folder-header.expanded {
  border-bottom-left-radius: 0; border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}
.routine-folder-header:hover { background: var(--surface2); }

.routine-folder-icon { color: var(--blue-light); flex-shrink: 0; }
.routine-folder-name { flex: 1; font-weight: 700; font-size: 14px; }
.routine-folder-count {
  font-size: 11px; color: var(--text-dim);
  background: var(--surface2); border-radius: 10px;
  padding: 1px 8px; font-family: var(--font-mono);
}
.routine-folder-chevron { color: var(--text-dim); flex-shrink: 0; }

.routine-folder-content {
  border: 1px solid var(--border);
  border-top: none;
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
  padding: 8px;
  margin-bottom: 8px;
  background: var(--bg);
}
.routine-folder-content .routine-card { margin-bottom: 8px; }
.routine-folder-content .routine-card:last-child { margin-bottom: 0; }

/* ─── Explore modal tabs ─── */
.explore-tabs {
  display: flex; border-bottom: 1px solid var(--border);
}
.explore-tab {
  flex: 1; padding: 13px;
  background: none; border: none; border-bottom: 2px solid transparent;
  font-family: var(--font-body); font-size: 14px; font-weight: 600;
  color: var(--text-secondary); cursor: pointer; margin-bottom: -1px;
  transition: all .15s;
}
.explore-tab.active { color: var(--blue); border-bottom-color: var(--blue); }

/* ═══════════════════════════════════════════════
   FOLDER DROPDOWN  (in New/Edit Routine modal)
═══════════════════════════════════════════════ */
.folder-dropdown-wrap { position: relative; }

.folder-dropdown-trigger {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-family: var(--font-body); font-size: 15px;
  padding: 10px 12px; cursor: pointer; text-align: left;
  transition: border-color .15s;
}
.folder-dropdown-trigger:focus,
.folder-dropdown-trigger.open { border-color: var(--blue); outline: none; }
.folder-dropdown-arrow { color: var(--text-dim); flex-shrink: 0; }

.folder-dropdown-list {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); z-index: 300;
  max-height: 220px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
  -webkit-overflow-scrolling: touch;
}
.folder-dropdown-list.hidden { display: none; }

.folder-dropdown-item {
  padding: 13px 16px; cursor: pointer;
  font-size: 14px; font-weight: 500;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
  transition: background .1s;
}
.folder-dropdown-item:last-child { border-bottom: none; }
.folder-dropdown-item:hover,
.folder-dropdown-item.selected { background: rgba(37,99,235,.1); color: var(--blue-light); }
.folder-dropdown-item .folder-dropdown-icon { color: var(--blue-light); flex-shrink: 0; }

/* ─── Bottom safe-area padding fixes ─────────── */
.modal-footer {
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px)) !important;
}
.settings-body {
  padding-bottom: max(24px, env(safe-area-inset-bottom, 24px));
}

/* ─── New Folder Modal — bigger text/inputs ─── */
#new-folder-modal .modal-body { padding: 20px 20px 8px; }
#new-folder-modal .modal-body p { font-size: 16px; margin-bottom: 16px; }
#new-folder-name-input {
  font-size: 18px !important; padding: 14px 16px !important;
  border-radius: 10px; width: 100%; box-sizing: border-box;
}
#new-folder-confirm-btn {
  font-size: 17px !important; padding: 16px !important;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
#new-folder-modal .modal-footer {
  padding: 12px 20px max(20px, env(safe-area-inset-bottom, 20px)) !important;
}

/* ─── Empty folder hint ──────────────────────── */
.folder-empty-hint {
  padding: 14px 16px;
  font-size: 13px; color: var(--text-dim);
  font-style: italic;
}
.folder-empty-hint strong { color: var(--text-secondary); font-style: normal; }

/* ═══════════════════════════════════════════════
   SETTINGS PANEL NAVIGATION
═══════════════════════════════════════════════ */
.settings-panel {
  display: flex; flex-direction: column; height: 100%;
}
.settings-sub-panel.hidden { display: none; }
.settings-root-panel.hidden { display: none; }

.settings-nav-row {
  cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: rgba(37,99,235,0.12);
  touch-action: manipulation;
}
.settings-nav-row:active { background: var(--surface2); }
.settings-nav-left {
  display: flex; align-items: center; gap: 12px;
}
.settings-nav-icon { color: var(--blue-light); flex-shrink: 0; display: flex; }
.settings-nav-chevron { color: var(--text-dim); }

/* Theme checkmark */
.theme-check { color: var(--blue); font-weight: 700; font-size: 16px; }
.theme-check.hidden { display: none; }

/* FAQ items */
.settings-faq-item {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
.settings-faq-item:last-child { border-bottom: none; }
.settings-faq-q { font-weight: 700; font-size: 14px; margin-bottom: 6px; }
.settings-faq-a { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

/* Settings icon update — use sliders icon */
#header-icon-settings .icon { color: var(--text-secondary); }

/* Radio as toggle-style */
.radio-slider { position: relative; }
