/* ═══════════════════════════════════════════════════════════
   IronLog — Design System
   Style guide: HeavyMetal / dark, minimal, data-focused
   ═══════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@400;500;600;700;800&family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300&display=swap');

/* ── Variables ─────────────────────────────────────────── */
:root {
  --bg:       #0a0a0a;
  --surface:  #111111;
  --surface2: #1a1a1a;
  --surface3: #222222;
  --surface4: #2a2a2a;
  --border:   #2a2a2a;
  --border2:  #333333;
  --text:     #f0f0f0;
  --muted:    #666666;
  --muted2:   #888888;
  --accent:        #c8f135;
  --accent-dim:    #9ab826;
  --accent-glow:   rgba(200,241,53,.08);
  --accent-glow-md:rgba(var(--accent-rgb),.15);
  --accent-rgb:    200,241,53;
  --accent2:  #5de8d0;
  --accent3:  #f1a435;
  --accent4:  #f13560;
  --purple:   #b47fff;
  --radius:   4px;
  --radius2:  8px;
  --sidebar:  260px;
  --mobnav:   90px;
  --col-chest:     #f13560;
  --col-back:      #5de8d0;
  --col-lats:      #5de8d0;
  --col-shoulders: #b47fff;
  --col-biceps:    #f1a435;
  --col-triceps:   #ff9f43;
  --col-quads:     #c8f135;
  --col-hamstrings:#ff7fd4;
  --col-glutes:    #34d399;
  --col-calves:    #a3e635;
  --col-core:      #22d3ee;
  --col-traps:     #2dd4bf;
  --col-cardio:    #c8f135;
  --col-full:      #ff7fd4;
  --col-upper:     #b47fff;
}

/* ── Reset ─────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  height: 100%;
  height: 100dvh;
  font-size: 14px;
  overscroll-behavior: none;
}
body {
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  display: flex;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}
a { color: var(--accent); text-decoration: none; }
button { cursor: pointer; font-family: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; }
::selection { background: var(--accent); color: #000; }
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ── Mobile-native base behaviours ─────────────────────── */
* { -webkit-tap-highlight-color: transparent; }
a, button, [role="button"] { -webkit-touch-callout: none; }
button:focus-visible, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Buttons always respond to taps — never inherit pan-y from scroll containers */
button, .btn {
  touch-action: manipulation;
}
@media (hover: none) {
  button:focus, .btn:focus, .nav-item:focus, .mob-item:focus { outline: none; }
}

/* Disable text selection everywhere; re-enable on inputs */
* { -webkit-user-select: none; user-select: none; }
input, textarea, select { -webkit-user-select: text; user-select: text; }

/* Explicit scroll-axis hints so nested scrollers don't trap vertical touch */
.panel       { touch-action: pan-y; overscroll-behavior: contain; scroll-behavior: auto; }
.wk-body     { touch-action: manipulation; overscroll-behavior: contain; }
.wk-carousel { touch-action: pan-x; }
.modal-body  { touch-action: pan-y; overscroll-behavior: contain; }
.ex-list     { touch-action: pan-y; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.sync-log    { touch-action: pan-y; overscroll-behavior: contain; }
.reditor-pane { touch-action: pan-y; overscroll-behavior: contain; }

/* Lock page scroll when a modal is open */
body.modal-open { overflow: hidden; touch-action: none; }

/* ── Layout ────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar);
  min-width: var(--sidebar);
  height: 100vh;
  height: 100dvh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  position: fixed;
  left: 0; top: 0;
  z-index: 100;
}

#main {
  flex: 1;
  margin-left: var(--sidebar);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  position: relative;
}

/* ── Brand ─────────────────────────────────────────────── */
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.brand-icon {
  width: 36px; height: 36px;
  background: var(--accent);
  color: #000;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 13px; font-weight: 800;
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 800; letter-spacing: -0.3px; color: var(--text); }
.brand-sub  { font-size: 9px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }

/* ── Sidebar Navigation ───────────────────────────────── */
.nav-group { padding: 12px 0 4px; }
.nav-label {
  display: block;
  font-size: 9px; font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 18px 6px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 18px;
  color: var(--muted2);
  cursor: pointer;
  font-size: 12px;
  border-left: 2px solid transparent;
  transition: color 0.12s, background 0.12s, border-color 0.12s;
  user-select: none;
  position: relative;
}
.nav-item.active { color: var(--accent); border-left-color: var(--accent); background: rgba(var(--accent-rgb),0.06); }
.nav-icon { font-size: 14px; width: 16px; text-align: center; flex-shrink: 0; }
.nav-badge {
  margin-left: auto;
  font-size: 8px; font-weight: 700;
  background: var(--accent4); color: #fff;
  border-radius: 3px; padding: 2px 5px;
  letter-spacing: 0.5px;
  animation: pulse 1.5s ease-in-out infinite;
}
.nav-bottom { margin-top: auto; border-top: 1px solid var(--border); padding-top: 8px; }

/* ── Mobile Navigation ────────────────────────────────── */
#mobile-nav {
  display: none;
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 14px);
  left: 16px; right: 16px;
  height: 68px;
  background: rgba(11, 11, 11, 0.93);
  backdrop-filter: blur(24px) saturate(1.6);
  -webkit-backdrop-filter: blur(24px) saturate(1.6);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 22px;
  z-index: 200;
  padding: 0 6px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.55), inset 0 1px 0 rgba(255,255,255,0.05);
  align-items: center;
  justify-content: space-around;
  overflow: visible;
}
.mob-item {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--muted);
  transition: color 0.15s;
  flex: 1; height: 100%;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.mob-item.active { color: var(--accent); }
.mob-item:not(.mob-log):active { opacity: 0.6; }
.mob-icon-wrap {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 12px;
  transition: background 0.15s;
}
.mob-item.active .mob-icon-wrap { background: rgba(var(--accent-rgb),0.12); }
.mob-icon { width: 28px; height: 28px; display: block; flex-shrink: 0; }
.mob-log {
  position: relative;
  background: var(--accent);
  border-radius: 50%;
  width: 56px; height: 56px;
  margin-top: -22px;
  flex: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(var(--accent-rgb),0.55), 0 0 0 5px rgba(var(--accent-rgb),0.08);
  transition: transform 0.12s, box-shadow 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.mob-log:active { transform: scale(0.91); box-shadow: 0 2px 10px rgba(var(--accent-rgb),0.35); }
.mob-log-icon { display: block; color: #000; }
.mob-log.active { background: var(--accent); }

/* ── Panels ────────────────────────────────────────────── */
.panel {
  display: none;
  position: absolute;
  inset: 0;                 /* top:0 right:0 bottom:0 left:0 */
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px 40px;
  -webkit-overflow-scrolling: touch;
}
.panel.active { display: block; }

/* Loading state while async render fires */
.panel-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60vh;
}

/* ── Page Header ──────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.page-header-left { display: flex; flex-direction: column; gap: 4px; }
.page-title {
  font-family: 'Syne', sans-serif;
  font-size: 24px; font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
  line-height: 1.1;
}
.page-sub { font-size: 11px; color: var(--muted); }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ── Section Labels ───────────────────────────────────── */
.section-label {
  font-size: 9px; font-weight: 600;
  letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.section-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 20px 0;
}

/* ── Grid Layouts ─────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.grid-21 { display: grid; grid-template-columns: 2fr 1fr; gap: 12px; }
.grid-12 { display: grid; grid-template-columns: 1fr 2fr; gap: 12px; }
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; margin-bottom: 20px; }
.flex-row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 16px 18px;
  position: relative;
}
.card-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.card-title {
  font-family: 'Syne', sans-serif;
  font-size: 12px; font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
  text-transform: uppercase;
}
.card-meta { font-size: 10px; color: var(--muted); }
.card-actions { display: flex; gap: 6px; align-items: center; }

/* Stat cards */
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.stat-card-val {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text); line-height: 1;
}
.stat-card-lbl { font-size: 9px; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.stat-card-sub { font-size: 10px; color: var(--muted2); margin-top: 2px; }
.stat-card-accent { border-left: 3px solid var(--accent); }
.stat-card-up .stat-card-sub::before   { content: '↑ '; color: var(--accent); }
.stat-card-down .stat-card-sub::before { content: '↓ '; color: var(--accent4); }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 8px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 11px; font-weight: 500;
  letter-spacing: 0.3px;
  transition: color 0.12s, background 0.12s, border-color 0.12s, opacity 0.12s, transform 0.12s;
  cursor: pointer;
  white-space: nowrap; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.btn-accent  { background: var(--accent); color: #000; border-color: var(--accent); }
.btn-accent:hover { background: #d9ff4a; }
.btn-surface { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-surface:hover { background: var(--surface3); border-color: var(--muted); }
.btn-ghost   { background: transparent; color: var(--muted2); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted); background: var(--surface2); }
.btn-danger  { background: transparent; color: var(--accent4); border-color: var(--accent4); }
.btn-danger:hover { background: var(--accent4); color: #fff; }
.btn-icon    { padding: 7px; min-width: 32px; }
.btn-sm      { padding: 5px 10px; font-size: 10px; }
.btn-lg      { padding: 11px 22px; font-size: 13px; }
.btn-block   { width: 100%; }
.btn-accent-outline { background: transparent; color: var(--accent); border-color: var(--accent); }
.btn-accent-outline:hover { background: rgba(var(--accent-rgb),0.1); }

/* ── Inputs ───────────────────────────────────────────── */
.input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
  width: 100%;
  transition: border-color 0.12s;
  outline: none;
}
.input:focus { border-color: var(--accent); }
.input::placeholder { color: var(--muted); }
.input-sm { padding: 5px 8px; font-size: 11px; }
.input-lg { padding: 10px 14px; font-size: 13px; }
.input-group { display: flex; flex-direction: column; gap: 5px; }
.input-label { font-size: 10px; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }
.input-row { display: flex; gap: 8px; align-items: flex-end; }

select.input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23666'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 8px;
  padding-right: 28px;
  cursor: pointer;
}
textarea.input { resize: vertical; min-height: 72px; }

/* ── Filter Tabs ──────────────────────────────────────── */
.filter-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
/* Picker filter row — scrolls horizontally, never wraps */
#ex-picker-filters {
  flex-wrap: nowrap;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  padding-bottom: 2px;
  margin-bottom: 0;
}
#ex-picker-filters::-webkit-scrollbar { display: none; }
.ftab {
  background: transparent; color: var(--muted);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 4px 10px; font-size: 10px; font-family: inherit;
  cursor: pointer; transition: all 0.1s; white-space: nowrap;
  letter-spacing: 0.3px; text-transform: uppercase;
}
.ftab:hover { color: var(--text); border-color: var(--muted); }
.ftab.active { color: #000; background: var(--accent); border-color: var(--accent); }

/* ── Tags / Badges ────────────────────────────────────── */
.tag {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 3px; font-size: 9px;
  font-weight: 600; letter-spacing: 0.5px; text-transform: uppercase;
}
.tag-accent  { background: rgba(var(--accent-rgb),0.15); color: var(--accent); }
.tag-muted   { background: var(--surface3); color: var(--muted2); }
.tag-danger  { background: rgba(241,53,96,0.15); color: var(--accent4); }
.tag-cyan    { background: rgba(93,232,208,0.15); color: var(--accent2); }
.tag-orange  { background: rgba(241,164,53,0.15); color: var(--accent3); }
.tag-purple  { background: rgba(180,127,255,0.15); color: var(--purple); }
.muscle-dot  { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; }

/* ── Tables ───────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
  font-size: 9px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted);
  padding: 0 8px 8px; text-align: left;
  border-bottom: 1px solid var(--border);
}
td { padding: 8px 8px; border-bottom: 1px solid var(--border); font-size: 11px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

/* ── Chart Containers ─────────────────────────────────── */
.chart-wrap { min-height: 160px; position: relative; overflow: hidden; }
.chart-wrap-sm { min-height: 100px; position: relative; }
.chart-wrap-lg { min-height: 240px; position: relative; }
.chart-empty { display: flex; align-items: center; justify-content: center; height: 100%; color: var(--muted); font-size: 11px; flex-direction: column; gap: 6px; }

/* ── Empty States ─────────────────────────────────────── */
.empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 300px; gap: 10px; color: var(--muted);
  text-align: center;
}
.empty-icon { font-size: 36px; opacity: 0.4; }
.empty-title { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; color: var(--muted2); }
.empty-sub { font-size: 11px; max-width: 280px; line-height: 1.6; }

/* ══════════════════════════════════════════════════════════
   DASHBOARD
   ══════════════════════════════════════════════════════════ */
/* ── Dashboard week heatmap grid ─────────── */
.dash-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 4px;
}
.dash-hm-cell {
  border-radius: var(--radius);
  padding: 8px 6px 10px;
  display: flex; flex-direction: column;
  min-height: 80px; cursor: default;
  transition: background 0.1s;
}
@media (max-width: 600px) {
  .dash-heatmap-grid { gap: 4px; }
  .dash-hm-cell { padding: 5px 4px 6px; min-height: 64px; }
}

.streak-card {
  background: linear-gradient(135deg, rgba(var(--accent-rgb),0.08) 0%, transparent 60%);
  border: 1px solid rgba(var(--accent-rgb),0.2);
}
.streak-number {
  font-family: 'Syne', sans-serif;
  font-size: 52px; font-weight: 800;
  color: var(--accent); letter-spacing: -2px; line-height: 1;
}
.streak-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.streak-sub { font-size: 11px; color: var(--muted2); margin-top: 4px; }

.week-days { display: flex; gap: 6px; margin-top: 10px; }
.week-day {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.week-day-dot {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--surface3); border: 2px solid transparent;
  transition: all 0.15s;
}
.week-day-dot.done    { background: var(--accent); border-color: var(--accent); }
.week-day-dot.rest    { background: var(--surface3); border-color: var(--border2); }
.week-day-dot.today   { border-color: var(--accent); }
.week-day-lbl { font-size: 9px; color: var(--muted); letter-spacing: 0.5px; }

.recent-workout-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: opacity 0.1s;
}
.recent-workout-item:last-child { border-bottom: none; }
.recent-workout-item:hover { opacity: 0.8; }
.rw-color-bar { width: 3px; height: 36px; border-radius: 2px; flex-shrink: 0; }
.rw-info { flex: 1; min-width: 0; }
.rw-name { font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rw-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
.rw-stats { text-align: right; flex-shrink: 0; }
.rw-vol { font-size: 12px; font-weight: 500; color: var(--text); }
.rw-vol-lbl { font-size: 9px; color: var(--muted); }

.muscle-bar-row { display: flex; flex-direction: column; gap: 8px; }
.muscle-bar-item { display: flex; align-items: center; gap: 8px; }
.muscle-bar-lbl { font-size: 10px; color: var(--muted2); width: 80px; flex-shrink: 0; }
.muscle-bar-track { flex: 1; height: 6px; background: var(--surface3); border-radius: 3px; overflow: hidden; }
.muscle-bar-fill  { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.muscle-bar-val   { font-size: 10px; color: var(--muted); width: 24px; text-align: right; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   LOGGER — Active Workout
   ══════════════════════════════════════════════════════════ */
#panel-log { padding: 0; overflow: hidden; }
#panel-log.active { display: flex; flex-direction: column; overflow: hidden; }

/* ── Workout Header ──────────────────────────────────────── */
.wk-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 10px;
  position: sticky; top: 0; z-index: 50;
  flex-shrink: 0;
}

/* Single header row: ⋮ · timer · spacer · actions · FINISH */
.wk-title-row {
  display: flex; align-items: center; gap: 8px;
}
.wk-live-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #f13560; flex-shrink: 0;
  animation: pulse 1.1s ease-in-out infinite;
}
.wk-name-input {
  background: transparent; border: none; outline: none;
  font-family: 'Syne', sans-serif;
  font-size: 17px; font-weight: 800;
  color: var(--text); letter-spacing: -0.3px;
  flex: 1; min-width: 0; padding: 0;
}
.wk-name-input::placeholder { color: var(--muted); }
.wk-header-actions {
  display: flex; align-items: center; gap: 4px; flex-shrink: 0;
}
.wk-icon-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--muted2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: color 0.12s, border-color 0.12s;
  font-size: 16px;
}
.wk-icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.wk-icon-btn.active { color: var(--accent); border-color: var(--accent); background: rgba(var(--accent-rgb),0.1); }
.wk-finish-btn {
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius);
  padding: 8px 16px; font-size: 12px; font-weight: 800;
  font-family: 'Syne', sans-serif; cursor: pointer;
  letter-spacing: 0.5px; text-transform: uppercase;
  transition: background 0.12s; flex-shrink: 0;
  min-height: 36px;
}
.wk-finish-btn:hover { background: #d9ff4a; }

/* Row 2: ⋮ · timer · stats */
.wk-stats-row {
  display: flex; align-items: center; gap: 0;
}
.wk-menu-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: none; border: none;
  color: var(--muted2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; letter-spacing: 1px; line-height: 1;
  flex-shrink: 0; padding: 0;
  transition: color 0.12s;
}
.wk-menu-btn:hover { color: var(--text); }
.wk-timer {
  font-family: 'Syne', sans-serif;
  font-size: 17px; font-weight: 800;
  color: var(--accent); letter-spacing: 0.5px;
  white-space: nowrap; margin-right: 12px; flex-shrink: 0;
}
.wk-stats-group {
  flex: 1; display: flex; justify-content: space-between; gap: 4px;
}
.wk-stat { display: flex; flex-direction: column; gap: 2px; align-items: center; }
.wk-stat-val {
  font-family: 'Syne', sans-serif;
  font-size: 14px; font-weight: 700;
  color: var(--text); line-height: 1;
}
.wk-stat-lbl { font-size: 8px; color: var(--muted); letter-spacing: 0.5px; text-transform: uppercase; }

/* ── Exercise carousel ─────────────────────────────────── */
.wk-carousel-wrap {
  flex-shrink: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 8px 12px 10px;
}
.wk-carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.wk-carousel::-webkit-scrollbar { display: none; }
.wk-carousel-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  border-radius: 12px;
  cursor: pointer;
  scroll-snap-align: start;
  min-width: 56px;
  min-height: 56px;
  transition: border-color 0.15s, background 0.15s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
}
.wk-carousel-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.wk-carousel-abbrev {
  font-family: 'Syne', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
  line-height: 1;
  white-space: nowrap;
}
.wk-carousel-check {
  position: absolute;
  top: 5px; right: 5px;
}
.wk-carousel-cell.active .wk-carousel-abbrev { font-size: 12px; }
.wk-carousel-cell.done { opacity: 0.7; }
@media (hover: none) { .wk-carousel-cell:active { opacity: 0.7; } }
.wk-carousel-cell.drag-gap-left  { margin-left: 28px;  transition: margin .15s; }
.wk-carousel-cell.drag-gap-right { margin-right: 28px; transition: margin .15s; }

.wk-body { flex: 1; overflow-y: auto; padding: 8px 12px 24px; min-height: 0; }

/* ── Single-page exercise block ──────────────────────────── */
.ex-block-single {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
}

/* Clean set inputs (no stepper arrows) */
.set-input-clean {
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 6px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  font-family: 'Syne', sans-serif;
  width: 64px;
  outline: none;
  transition: border-color 0.12s;
}
.set-input-clean:focus { border-color: var(--accent); }
.set-input-clean::placeholder { color: var(--muted); font-weight: 400; }
@media (max-width: 900px) {
  .set-input-clean { font-size: 16px; width: 58px; padding: 9px 4px; }
}

/* Nav arrows */
.ex-nav-btn {
  background: none;
  border: none;
  color: var(--muted2);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  -webkit-tap-highlight-color: transparent;
  transition: color 0.12s, background 0.12s;
}
@media (hover: hover) { .ex-nav-btn:hover { color: var(--text); background: var(--surface2); } }
@media (hover: none)  { .ex-nav-btn:active { color: var(--text); background: var(--surface2); } }

/* ── Exercise Block ──────────────────────────────────────── */
.ex-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  margin-bottom: 12px;
  overflow: hidden;
}

/* Exercise header: name+badge left, nav+menu right */
.ex-block-header {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 12px 8px;
  min-width: 0;
}
.ex-header-info {
  flex: 1; min-width: 0;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.ex-name-btn {
  font-family: 'Syne', sans-serif;
  font-size: 16px; font-weight: 800;
  color: var(--text); background: none; border: none;
  cursor: pointer; padding: 0; text-align: left;
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  line-height: 1.25;
  -webkit-tap-highlight-color: transparent;
}
.ex-header-right {
  display: flex; align-items: center; gap: 2px; flex-shrink: 0;
}
.ex-menu-btn {
  width: 36px; height: 36px; border-radius: 8px;
  background: none; border: none;
  color: var(--muted2); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 700; letter-spacing: 1px;
  transition: color 0.12s; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.ex-menu-btn:hover { color: var(--text); }

/* Previous session bar */
.ex-prev-bar {
  padding: 5px 14px 6px;
  font-size: 11px; color: var(--muted);
  background: var(--surface2);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  font-style: italic;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Add row (notes + set) */
.ex-add-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px 12px;
}
.ex-notes-toggle {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 8px; padding: 6px 12px;
  font-size: 12px; color: var(--muted);
  cursor: pointer; font-family: inherit;
  transition: all 0.12s; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.ex-notes-toggle:hover { color: var(--text); border-color: var(--border); }

/* ── Sets table ──────────────────────────────────────────── */
.sets-table-wrap { padding: 6px 12px 4px; overflow-x: auto; }
.sets-table { width: 100%; border-collapse: collapse; }
.sets-table th {
  font-size: 9px; color: var(--muted); letter-spacing: 1px;
  text-transform: uppercase; padding: 0 4px 8px;
  text-align: center; border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.sets-table td {
  padding: 3px 3px; border-bottom: none;
  vertical-align: middle; text-align: center;
}

/* Set row states — left border colour signals state */
.set-row {
  transition: background 0.15s;
  touch-action: manipulation;
  position: relative;
}
.set-row td:first-child {
  border-left: 3px solid transparent;
  padding-left: 5px;
}

/* Next set — accent (orange) border, slightly prominent */
.set-row.next-set td:first-child { border-left-color: var(--accent3); }
.set-row.next-set { background: rgba(241,164,53,0.08); }
.set-row.next-set .set-input-clean {
  border-color: rgba(241,164,53,0.4);
  background: rgba(241,164,53,0.06);
}

/* Completed — green border, muted inputs */
.set-row.completed td:first-child { border-left-color: #4ade80; }
.set-row.completed { background: rgba(74,222,128,0.06); }
.set-row.completed .set-input-clean {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: rgba(74,222,128,0.5);
  opacity: 0.7;
}
.set-row.completed .set-type-badge { opacity: 0.4; }
.set-row.completed .set-rest-badge,
.set-row.completed .set-repcalc-btn,
.set-row.completed .set-effort-btn { opacity: 0.3; pointer-events: none; }

/* Warmup row — amber border */
.set-row[data-wu="1"] td:first-child { border-left-color: rgba(241,164,53,0.5); }

.set-num {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  border-radius: 4px; font-size: 10px; font-weight: 600;
  background: var(--surface3); color: var(--muted2);
  cursor: pointer; transition: all 0.1s; user-select: none;
}
.set-num:hover { background: var(--surface4); }
.set-num[data-type="warmup"]  { background: rgba(241,164,53,0.2); color: var(--accent3); }
.set-num[data-type="dropset"] { background: rgba(180,127,255,0.2); color: var(--purple); }
.set-num[data-type="failure"] { background: rgba(241,53,96,0.2); color: var(--accent4); }

.set-prev { font-size: 10px; color: var(--muted); font-style: italic; min-width: 64px; }

.set-input {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  padding: 5px 6px;
  font-size: 12px; font-family: inherit;
  text-align: center; outline: none;
  transition: border-color 0.1s;
}
.set-input:focus  { border-color: var(--accent); }
.set-input.weight { width: 68px; }
.set-input.reps   { width: 56px; }
.set-input.rpe    { width: 48px; }

.set-done-btn {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--surface3);
  border: 2px solid var(--border2);
  color: var(--muted); font-size: 18px; font-weight: 700;
  cursor: pointer; transition: all 0.12s;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.set-done-btn:hover { border-color: var(--accent); color: var(--accent); }
.set-done-btn.done  {
  background: #4ade80; border-color: #4ade80; color: #000;
  font-weight: 800;
}

.add-set-row { padding: 4px 14px 12px; }
.add-set-btn {
  background: transparent; border: 1px dashed var(--border2);
  border-radius: var(--radius); color: var(--muted);
  font-size: 11px; font-family: inherit;
  padding: 6px 12px; cursor: pointer; width: 100%;
  transition: all 0.12s;
}
.add-set-btn:hover { border-color: var(--accent); color: var(--accent); }

.ex-notes-input {
  margin: 0 14px 12px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--muted);
  font-size: 11px; font-family: inherit; font-style: italic;
  padding: 6px 10px; width: calc(100% - 28px);
  outline: none; resize: none; height: 32px;
  transition: all 0.12s;
}
.ex-notes-input:focus { border-color: var(--accent); color: var(--text); height: 56px; }

/* Rating tag chips */
.ex-rating-tags {
  display: flex; gap: 6px; padding: 4px 14px 6px;
  overflow-x: auto; flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ex-rating-tags::-webkit-scrollbar { display: none; }
.rating-tag-btn {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 20px; padding: 4px 10px; font-size: 10px;
  color: var(--muted2); cursor: pointer; white-space: nowrap;
  font-family: inherit; flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background .1s, color .1s, border-color .1s;
}

/* Sticky note display */
.ex-sticky-note {
  display: flex; align-items: flex-start; gap: 6px;
  padding: 6px 14px; background: rgba(241,163,53,0.07);
  border-bottom: 1px solid rgba(241,163,53,0.15);
}

/* Logger empty state / start prompt */
.log-start {
  display: flex; flex-direction: column; align-items: center;
  gap: 16px; text-align: center; padding: 20px;
  width: 100%; box-sizing: border-box;
}
.log-start-title {
  font-family: 'Syne', sans-serif;
  font-size: 22px; font-weight: 800; color: var(--text); letter-spacing: -0.3px;
}
.log-start-sub { font-size: 12px; color: var(--muted); max-width: 260px; line-height: 1.7; }
.log-routine-list { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.log-routine-btn {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; transition: all 0.12s; text-align: left;
  color: var(--text); font-family: inherit; font-size: 12px;
}
.log-routine-btn:hover { border-color: var(--accent); background: rgba(var(--accent-rgb),0.04); }
.log-routine-name { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; }
.log-routine-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
.log-routine-arrow { color: var(--muted); font-size: 16px; }

.wk-add-ex-bar {
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
  display: flex; gap: 8px;
  width: 100%; box-sizing: border-box;
}

/* Workout-specific bottom nav (replaces add-ex bar during active workout) */
.wk-workout-nav {
  display: flex; align-items: center; justify-content: space-around;
  padding: 8px 16px calc(8px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.wk-workout-nav-btn {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: none; border: none; cursor: pointer;
  padding: 6px 16px; border-radius: 10px; flex: 1;
  transition: background 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.wk-workout-nav-btn:active { background: var(--surface2); }
.wk-workout-nav-icon {
  font-size: 16px; font-weight: 800;
  font-family: 'DM Mono', monospace;
  color: var(--muted2); line-height: 1;
}
.wk-workout-nav-lbl {
  font-size: 9px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
}

/* Carousel add cell */
.wk-carousel-add {
  min-width: 52px; height: 52px;
  border-radius: 10px !important;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

/* ══════════════════════════════════════════════════════════
   REST TIMER
   ══════════════════════════════════════════════════════════ */
.overlay {
  position: fixed; inset: 0;
  background: rgba(10,10,10,0.88);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  will-change: opacity;
}
.overlay.show { opacity: 1; pointer-events: auto; }

/* Rest timer: floating widget — backdrop transparent, clicks pass through */
#rest-overlay {
  background: none !important;
  backdrop-filter: none !important;
  pointer-events: none;
  align-items: flex-end;
  justify-content: flex-end;
  padding: 24px;
  z-index: 1100;
}
#rest-overlay .rest-modal {
  pointer-events: auto;
  box-shadow: 0 24px 64px rgba(0,0,0,0.85), 0 0 0 1px var(--border2);
}
@media (max-width: 900px) {
  #rest-overlay {
    justify-content: center;
    padding: 16px;
    padding-bottom: calc(var(--mobnav) + env(safe-area-inset-bottom, 0px) + 16px);
  }

  /* All modals respect safe area */
  .modal { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .overlay { padding-bottom: 0; }
}

.rest-modal {
  display: flex; flex-direction: column; align-items: center; gap: 16px;
  padding: 32px 24px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 16px;
  min-width: 280px; position: relative;
}
.rest-label { font-size: 10px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
/* rest-time is rendered inline in HTML, inside ring container */
.rest-ring-container { position: relative; width: 160px; height: 160px; }
.rest-ring { width: 160px; height: 160px; position: relative; /* no CSS rotation — circle handles its own -90° */ }
.rest-ring-bg { fill: none; stroke: var(--surface3); stroke-width: 8; }
.rest-ring-progress {
  fill: none; stroke: var(--accent); stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 339.29;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset 0.9s linear;
}
.rest-ring-progress.urgent { stroke: var(--accent4); }
.rest-actions { display: flex; gap: 10px; }
.rest-next { font-size: 11px; color: var(--muted); text-align: center; min-height: 16px; }
.rest-mini {
  position: fixed;
  bottom: calc(var(--mobnav, 64px) + env(safe-area-inset-bottom, 0px) + 12px);
  right: 16px;
  z-index: 1100;
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: 24px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  pointer-events: auto;
}
.rest-mini.hidden { display: none; }
#rest-mini-display {
  font-family: 'DM Mono', monospace;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  min-width: 48px;
  text-align: center;
}
#rest-mini-skip {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
}
@media (min-width: 901px) {
  .rest-mini {
    bottom: 24px;
    right: 24px;
  }
}

.rest-close-btn {
  position: absolute; top: 12px; right: 12px;
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius); transition: all 0.1s; font-family: inherit;
}
.rest-close-btn:hover { color: var(--text); background: var(--surface2); }

/* ══════════════════════════════════════════════════════════
   MODALS
   ══════════════════════════════════════════════════════════ */
.modal {
  background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius2);
  width: 100%; max-width: 480px;
  max-height: 90vh; display: flex; flex-direction: column;
  overflow: hidden;
}
.modal-lg { max-width: 620px; }
.modal-xl { max-width: 800px; }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-header h2 { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 800; }
.modal-close {
  background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius); transition: all 0.1s; font-family: inherit;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-body { padding: 16px 18px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 12px; }
.modal-footer {
  padding: 14px 18px; border-top: 1px solid var(--border);
  display: flex; gap: 8px; justify-content: flex-end; flex-shrink: 0;
}

/* Exercise picker */
.ex-list { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; flex: 1; min-height: 0; margin-top: 4px; }
.ex-list-item {
  touch-action: manipulation;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius);
  cursor: pointer; transition: background 0.1s;
}
.ex-list-item:hover { background: var(--surface2); }
.ex-list-item * { pointer-events: none; user-select: none; }
.ex-list-item .muscle-dot { flex-shrink: 0; }
.ex-list-name { flex: 1; font-size: 12px; font-weight: 500; color: var(--text); }
.ex-list-cat { font-size: 10px; color: var(--muted); }
.ex-list-item.selected { background: rgba(var(--accent-rgb),0.08); }
.ex-list-item.selected .ex-list-name { color: var(--accent); }

/* Workout complete modal */
.complete-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.complete-stat { background: var(--surface2); border-radius: var(--radius); padding: 12px 10px; text-align: center; }
.complete-stat-val { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; color: var(--text); }
.complete-stat-lbl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.pr-announce { background: rgba(var(--accent-rgb),0.08); border: 1px solid rgba(var(--accent-rgb),0.2); border-radius: var(--radius); padding: 10px 12px; }
.pr-announce-title { font-size: 10px; color: var(--accent); font-weight: 600; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 6px; }
.pr-item { font-size: 11px; color: var(--text); padding: 2px 0; }

/* ══════════════════════════════════════════════════════════
   PLATE CALCULATOR
   ══════════════════════════════════════════════════════════ */
.plate-calc { display: flex; flex-direction: column; gap: 14px; }
.plate-total { font-family: 'Syne', sans-serif; font-size: 32px; font-weight: 800; color: var(--accent); text-align: center; }
.plate-visual { display: flex; align-items: center; justify-content: center; gap: 4px; flex-wrap: wrap; min-height: 60px; }
.plate {
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px; font-size: 9px; font-weight: 700;
  color: #000; border: 2px solid rgba(0,0,0,0.2);
  letter-spacing: 0.3px;
}
.plate-20 { width: 26px; height: 52px; background: #f13560; }
.plate-15 { width: 24px; height: 46px; background: #f1a435; }
.plate-10 { width: 22px; height: 38px; background: #5de8d0; }
.plate-5  { width: 20px; height: 30px; background: #b47fff; }
.plate-2  { width: 18px; height: 24px; background: #c8f135; }
.plate-1  { width: 16px; height: 20px; background: #888; color: #fff; }
.plate-bar { width: 8px; height: 64px; background: var(--muted); border-radius: 2px; }
.plate-list { display: flex; flex-direction: column; gap: 4px; }
.plate-list-row { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
.plate-list-name { color: var(--muted2); }
.plate-list-count { color: var(--text); font-weight: 600; }
.plate-input-row { display: flex; gap: 8px; align-items: center; }

/* ══════════════════════════════════════════════════════════
   HISTORY
   ══════════════════════════════════════════════════════════ */
.history-list { display: flex; flex-direction: column; gap: 10px; }
.history-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 14px 16px;
  cursor: pointer; transition: all 0.12s;
  display: flex; flex-direction: column; gap: 8px;
}
.history-item:hover { border-color: var(--border2); background: var(--surface2); }
.history-item-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.history-item-name { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; color: var(--text); }
.history-item-date { font-size: 10px; color: var(--muted); }
.history-item-stats { display: flex; gap: 16px; flex-wrap: wrap; }
.history-stat { display: flex; flex-direction: column; gap: 2px; }
.history-stat-val { font-size: 13px; font-weight: 600; color: var(--text); }
.history-stat-lbl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.history-exercises { display: flex; gap: 6px; flex-wrap: wrap; }
.history-ex-tag { font-size: 10px; color: var(--muted2); background: var(--surface3); border-radius: 3px; padding: 2px 6px; }

/* History detail */
.history-detail-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 20px;
}
.history-back-btn {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--muted); font-size: 14px;
  padding: 6px 10px; cursor: pointer; font-family: inherit;
  transition: all 0.1s;
}
.history-back-btn:hover { color: var(--text); }

/* ══════════════════════════════════════════════════════════
   EXERCISES
   ══════════════════════════════════════════════════════════ */
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.ex-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 14px;
  cursor: pointer; transition: all 0.12s;
  display: flex; flex-direction: column; gap: 6px;
}
.ex-card:hover { border-color: var(--border2); background: var(--surface2); transform: translateY(-1px); }
.ex-card-name { font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700; color: var(--text); }
.ex-card-muscle { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted2); }
.ex-card-cat { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.ex-card-pr { font-size: 10px; color: var(--accent); margin-top: auto; }

/* Exercise detail slide */
.ex-detail { display: flex; flex-direction: column; gap: 16px; }
.ex-detail-header { display: flex; align-items: flex-start; justify-content: space-between; }
.ex-detail-title { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; }
.ex-detail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.pr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pr-card {
  background: var(--surface2); border-radius: var(--radius);
  padding: 10px 12px; border: 1px solid var(--border);
}
.pr-card-val { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 800; color: var(--accent); }
.pr-card-lbl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px; }

/* ══════════════════════════════════════════════════════════
   ROUTINES
   ══════════════════════════════════════════════════════════ */
.routine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.routine-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); overflow: hidden; cursor: pointer;
  transition: all 0.12s;
}
.routine-card:hover { border-color: var(--border2); transform: translateY(-1px); }
.routine-card-header { padding: 14px 16px; background: var(--surface2); }
.routine-card-name { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; color: var(--text); }
.routine-card-desc { font-size: 10px; color: var(--muted); margin-top: 4px; }
.routine-card-body { padding: 12px 16px; }
.routine-day-list { display: flex; flex-direction: column; gap: 6px; }
.routine-day-item { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted2); }
.routine-day-name { color: var(--text); font-weight: 500; }
.routine-card-footer {
  padding: 10px 16px; border-top: 1px solid var(--border);
  display: flex; gap: 8px;
}

/* Routine builder */
.routine-builder { display: flex; flex-direction: column; gap: 16px; }
.routine-day-block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); overflow: hidden;
}
.routine-day-header {
  padding: 12px 14px; background: var(--surface2);
  display: flex; align-items: center; justify-content: space-between;
}
.routine-day-title { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; }
.routine-day-body { padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; }
.routine-ex-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.routine-ex-row:last-child { border-bottom: none; }
.routine-ex-name { flex: 1; font-size: 11px; font-weight: 500; }
.routine-ex-sets { font-size: 10px; color: var(--muted); }

/* ══════════════════════════════════════════════════════════
   PROGRESS
   ══════════════════════════════════════════════════════════ */
.progress-search-row { display: flex; gap: 8px; margin-bottom: 16px; }
.ex-select-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 12px 14px;
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; transition: all 0.12s; margin-bottom: 12px;
}
.ex-select-card:hover { border-color: var(--accent); }
.ex-select-name { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; flex: 1; }
.pr-timeline { display: flex; flex-direction: column; gap: 8px; }
.pr-entry { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.pr-entry:last-child { border-bottom: none; }
.pr-entry-date { font-size: 10px; color: var(--muted); width: 100px; flex-shrink: 0; }
.pr-entry-val { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; color: var(--accent); }
.pr-entry-reps { font-size: 10px; color: var(--muted2); }
.pr-entry-new { font-size: 9px; background: var(--accent); color: #000; border-radius: 3px; padding: 1px 5px; font-weight: 700; }

/* Volume tabs */
.vol-tabs { display: flex; gap: 4px; margin-bottom: 14px; }
.vol-tab {
  background: transparent; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--muted); font-size: 10px; padding: 4px 10px;
  cursor: pointer; font-family: inherit; letter-spacing: 0.5px; transition: all 0.1s;
}
.vol-tab.active { background: var(--surface3); color: var(--text); border-color: var(--border2); }

/* ══════════════════════════════════════════════════════════
   BODY METRICS
   ══════════════════════════════════════════════════════════ */
.body-chart-card { position: relative; }
.body-log-form { display: flex; flex-direction: column; gap: 12px; }
.measurements-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.measurement-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.measurement-row:last-child { border-bottom: none; }
.measurement-lbl { font-size: 11px; color: var(--muted2); }
.measurement-val { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; color: var(--text); }
.measurement-unit { font-size: 10px; color: var(--muted); margin-left: 3px; }
.measurement-delta { font-size: 10px; margin-left: 6px; }
.measurement-delta.up   { color: var(--accent4); }
.measurement-delta.down { color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   CONNECT (Health APIs)
   ══════════════════════════════════════════════════════════ */
.connect-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.api-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); overflow: hidden;
}
.api-card-header {
  padding: 16px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid var(--border);
}
.api-logo {
  width: 40px; height: 40px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.api-card-title { font-family: 'Syne', sans-serif; font-size: 14px; font-weight: 700; }
.api-card-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.api-status {
  margin-left: auto;
  font-size: 9px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase;
  padding: 3px 7px; border-radius: 3px;
}
.api-status.connected { background: rgba(var(--accent-rgb),0.15); color: var(--accent); }
.api-status.disconnected { background: var(--surface3); color: var(--muted); }
.api-status.pending { background: rgba(241,164,53,0.15); color: var(--accent3); }
.api-card-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.api-card-desc { font-size: 11px; color: var(--muted2); line-height: 1.6; }
.api-features { display: flex; flex-direction: column; gap: 6px; }
.api-feature { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--muted2); }
.api-feature-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); flex-shrink: 0; }
.api-card-footer { padding: 12px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }
.sync-log { display: flex; flex-direction: column; gap: 4px; max-height: 120px; overflow-y: auto; }
.sync-log-row { display: flex; justify-content: space-between; align-items: center; font-size: 10px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.sync-log-row:last-child { border-bottom: none; }
.sync-log-event { color: var(--muted2); }
.sync-log-time  { color: var(--muted); }
.sync-log-status.ok  { color: var(--accent); }
.sync-log-status.err { color: var(--accent4); }

/* ══════════════════════════════════════════════════════════
   SETTINGS
   ══════════════════════════════════════════════════════════ */
.settings-section { margin-bottom: 24px; }
.settings-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0; border-bottom: 1px solid var(--border); gap: 16px;
}
.settings-row:last-child { border-bottom: none; }
.settings-lbl { display: flex; flex-direction: column; gap: 3px; }
.settings-lbl-title { font-size: 12px; font-weight: 500; color: var(--text); }
.settings-lbl-sub { font-size: 10px; color: var(--muted); }
.settings-ctrl { flex-shrink: 0; }

/* ── Tiered settings menu ─────────────────────────────── */
.set-menu-section { margin-bottom: 28px; }
.set-menu-label {
  font-size: 11px; font-weight: 600; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted);
  padding: 0 4px 8px;
}
.set-menu-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  overflow: hidden;
}
.set-menu-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; gap: 12px;
  min-height: 52px;
}
.set-menu-row--tappable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) {
  .set-menu-row--tappable:hover { background: var(--surface2); }
}
@media (hover: none) {
  .set-menu-row--tappable:active { background: var(--surface2); }
}
.set-menu-row-left { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.set-menu-row-title { font-size: 15px; color: var(--text); font-weight: 400; }
.set-menu-row-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.set-menu-row-right { flex-shrink: 0; display: flex; align-items: center; gap: 8px; color: var(--muted); }
.set-menu-divider { height: 1px; background: var(--border); margin: 0 16px; }

/* Inline inputs inside menu rows */
.set-inline-input {
  background: transparent; border: none; outline: none;
  color: var(--muted); font-family: inherit; font-size: 15px;
  text-align: right; width: 80px; padding: 0;
}
.set-inline-input:focus { color: var(--text); }
.set-inline-select {
  background: var(--surface3);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 5px 28px 5px 8px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 8px;
}
.set-inline-select:focus { border-color: var(--accent); }
.set-inline-select option { background: var(--surface3); color: var(--text); }

/* Sub-screen slide-in */
.set-screen {
  position: absolute; inset: 0;
  background: var(--bg);
  overflow-y: auto; overflow-x: hidden;
  z-index: 50;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.32, 0.72, 0, 1);
  will-change: transform;
  padding: 0 0 60px;
}
.set-screen--in  { transform: translateX(0); }
.set-screen--out { transform: translateX(100%); }
.set-screen-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.set-back-btn {
  display: flex; align-items: center; gap: 6px;
  background: none; border: none; color: var(--accent);
  font-size: 15px; cursor: pointer; padding: 4px 0;
  -webkit-tap-highlight-color: transparent;
}
.set-back-btn span { font-size: 15px; }
.set-screen-title {
  font-family: 'Syne', sans-serif; font-size: 17px; font-weight: 700;
  color: var(--text); flex: 1; text-align: center; margin-right: 28px;
}
.set-screen-body { padding: 20px 16px; }

/* Toggle switch */
.toggle-wrap { display: flex; align-items: center; }
.toggle {
  position: relative; width: 40px; height: 22px;
  cursor: pointer; flex-shrink: 0;
}
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle-track {
  position: absolute; inset: 0;
  background: var(--surface3); border-radius: 11px;
  border: 1px solid var(--border2); transition: background 0.2s;
}
.toggle input:checked ~ .toggle-track { background: var(--accent); border-color: var(--accent); }
.toggle-thumb {
  position: absolute; left: 3px; top: 3px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--muted); transition: all 0.2s;
}
.toggle input:checked ~ .toggle-thumb { left: 21px; background: #000; }

/* Plate config */
.plate-config-row { display: flex; gap: 6px; flex-wrap: wrap; }
.plate-chip {
  background: var(--surface3); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 4px 10px; font-size: 11px;
  color: var(--muted2); cursor: pointer; transition: all 0.1s;
}
.plate-chip.active { background: rgba(var(--accent-rgb),0.12); border-color: var(--accent); color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 80px; right: 20px;
  display: flex; flex-direction: column; gap: 8px;
  z-index: 2000; pointer-events: none;
}
.toast {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: var(--radius); padding: 10px 14px;
  font-size: 12px; color: var(--text);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: flex; align-items: center; gap: 8px;
  pointer-events: none; min-width: 200px; max-width: 320px;
  animation: toastIn 0.2s ease;
  will-change: transform, opacity;
}
.toast.success { border-left: 3px solid var(--accent); }
.toast.error   { border-left: 3px solid var(--accent4); }
.toast.info    { border-left: 3px solid var(--accent2); }
.toast-out { animation: toastOut 0.2s ease forwards; }

/* ══════════════════════════════════════════════════════════
   PWA INSTALL BANNER
   ══════════════════════════════════════════════════════════ */
.install-banner {
  position: fixed; bottom: 70px; left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-width: 320px; max-width: 480px; width: calc(100% - 32px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4); z-index: 300;
}
.install-text { display: flex; flex-direction: column; gap: 3px; }
.install-text strong { font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700; }
.install-text span { font-size: 11px; color: var(--muted); }
.install-actions { display: flex; gap: 8px; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════
   ANIMATIONS
   ══════════════════════════════════════════════════════════ */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin { to { transform: rotate(360deg); } }
.fade-in { animation: fadeIn 0.2s ease; }
.spin { animation: spin 1s linear infinite; }

/* Progress bar */
.progress-bar-track { background: var(--surface3); border-radius: 3px; overflow: hidden; }
.progress-bar-fill  { height: 6px; border-radius: 3px; background: var(--accent); transition: width 0.4s ease; }
.progress-bar-fill.danger  { background: var(--accent4); }
.progress-bar-fill.warning { background: var(--accent3); }

/* Misc utilities */
.text-accent  { color: var(--accent);  }
.text-muted   { color: var(--muted);   }
.text-muted2  { color: var(--muted2);  }
.text-danger  { color: var(--accent4); }
.text-cyan    { color: var(--accent2); }
.text-orange  { color: var(--accent3); }
.text-purple  { color: var(--purple);  }
.fw-bold { font-weight: 700; }
.fw-800  { font-family: 'Syne', sans-serif; font-weight: 800; }
.text-sm { font-size: 10px; }
.text-xs { font-size: 9px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.d-none { display: none !important; }

/* Loading spinner */
.loading-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--surface3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 24px auto;
}

/* ══════════════════════════════════════════════════════════
   RESPONSIVE — Mobile
   ══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  :root { --sidebar: 0px; }
  #sidebar { display: none; }
  #mobile-nav { display: flex; }
  .history-back-btn, .set-back-btn, #prog-back-btn, #ex-back-btn,
  #hist-back, #routine-back, .reditor-back-l1, .reditor-back-l2 { display: none !important; }
  #main { margin-left: 0; width: 100%; height: 100vh; }
  .panel { padding: 16px 16px calc(var(--mobnav) + 24px); }
  #panel-log.active { padding: 0; overflow: hidden; }
  .wk-body { padding: 12px 12px 16px; }
  .wk-add-ex-bar { padding-bottom: calc(12px + var(--mobnav) + env(safe-area-inset-bottom, 0px)); }
  .wk-workout-nav { padding-bottom: calc(8px + var(--mobnav) + env(safe-area-inset-bottom, 0px)); }
  #rest-timer-btn { bottom: calc(var(--mobnav) + 12px); }
  .install-banner { bottom: calc(var(--mobnav) + 12px); }
  #toast-container { bottom: calc(var(--mobnav) + 12px); right: 12px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .grid-21, .grid-12 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; }
  .stat-card { padding: 8px 10px; }
  .stat-card .value, .stat-card-val { font-size: 16px; letter-spacing: -0.5px; }
  .stat-card .label, .stat-card-lbl { font-size: 8px; margin-bottom: 3px; }
  .stat-card .meta,  .stat-card-sub { font-size: 8px; margin-top: 2px; }
  .sets-table th.hide-mobile, .sets-table td.hide-mobile { display: none; }
  .page-title { font-size: 20px; }
  .ex-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .modal { max-width: 100%; border-radius: var(--radius2) var(--radius2) 0 0; }
  .overlay { align-items: flex-end; }
}

@media (max-width: 600px) {
  .connect-grid { grid-template-columns: 1fr; }
  .routine-grid { grid-template-columns: 1fr; }
  .complete-stats { grid-template-columns: 1fr 1fr 1fr; }
  .wk-stats-row { gap: 12px; }
}

/* Desktop grid fix at medium breakpoints */
@media (max-width: 1100px) and (min-width: 901px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
}

/* ══════════════════════════════════════════════════════════
   LOGGER — ADDITIONS (set delete, reorder, warm-up)
   ══════════════════════════════════════════════════════════ */
.set-del-btn {
  background: none; border: none; color: transparent;
  font-size: 10px; cursor: pointer; padding: 2px 4px;
  border-radius: 3px; transition: all 0.1s; font-family: inherit;
  width: 20px;
}
.set-row:hover .set-del-btn { color: var(--muted); }
.set-del-btn:hover { color: var(--accent4) !important; background: rgba(241,53,96,.1); }

.ex-reorder-btn {
  background: none; border: none; color: var(--muted);
  font-size: 13px; cursor: pointer; padding: 2px 5px;
  border-radius: var(--radius); transition: all 0.1s; font-family: inherit;
  line-height: 1;
}
.ex-reorder-btn:hover { color: var(--text); background: var(--surface3); }

.add-warmup-btn {
  background: transparent; border: 1px dashed rgba(241,164,53,.4);
  border-radius: var(--radius); color: var(--accent3);
  font-size: 10px; font-family: inherit;
  padding: 5px 10px; cursor: pointer; margin-left: 6px;
  transition: all 0.12s;
}
.add-warmup-btn:hover { border-color: var(--accent3); background: rgba(241,164,53,.08); }

/* Superset indicator */
.ex-block.superset::before {
  content: 'SUPERSET';
  display: block; font-size: 8px; font-weight: 700;
  letter-spacing: 1.5px; color: var(--purple);
  padding: 3px 14px; background: rgba(180,127,255,.1);
  border-bottom: 1px solid rgba(180,127,255,.2);
}
.ex-block + .ex-block.superset { margin-top: -4px; border-top-left-radius: 0; border-top-right-radius: 0; }

/* ══════════════════════════════════════════════════════════
   CALENDAR HEATMAP
   ══════════════════════════════════════════════════════════ */
.cal-cell { transition: opacity 0.1s, transform 0.1s; }
.cal-cell:hover { opacity: 0.75 !important; transform: scale(1.2); }
.cal-legend { display: flex; align-items: center; justify-content: flex-end; }

/* ══════════════════════════════════════════════════════════
   INSIGHTS PANEL
   ══════════════════════════════════════════════════════════ */
.ins-kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin-bottom: 16px; }
.ins-kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius2);
  padding: 14px; display: flex; flex-direction: column; gap: 4px;
}
.ins-kpi-val { font-family: 'Syne', sans-serif; font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.ins-kpi-lbl { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* ══════════════════════════════════════════════════════════
   BODY METRICS — MEASUREMENTS GRID
   ══════════════════════════════════════════════════════════ */
.measurements-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.measurements-grid .input-group { gap: 3px; }

/* ══════════════════════════════════════════════════════════
   MOBILE LOGGER POLISH
   ══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Set done button — large tap target */
  .set-done-btn     { width: 48px; height: 48px; font-size: 20px; min-width: 48px; border-radius: 10px; }

  /* Workout header */
  .wk-header        { padding: 10px 14px; }
  .wk-name-input    { font-size: 18px; }
  .wk-timer         { font-size: 18px; }
  .wk-finish-btn    { padding: 10px 16px; font-size: 13px; min-height: 44px; }

  /* Workout body — no extra bottom padding, the sticky bar handles spacing */
  .wk-body          { padding: 8px 10px 16px; scroll-padding-bottom: 80px; }

  /* wk-body fills remaining space, add bar sits below it */
  .wk-body          { padding: 8px 10px 16px; }

  /* Exercise blocks */
  .ex-block         { margin-bottom: 10px; }
  .ex-block-header  { padding: 12px 12px; min-height: 52px; }
  .ex-block-name    { font-size: 14px; }

  /* Sets table — bigger tap targets, more breathing room */
  .sets-table-wrap  { padding: 4px 8px 8px; overflow-x: auto; }
  .sets-table th    { padding: 0 4px 8px; font-size: 10px; }
  .sets-table td    { padding: 4px 3px; }

  /* Set inputs — large enough to tap comfortably, 16px prevents iOS zoom */
  .set-input        { min-height: 48px; font-size: 16px !important;
                      padding: 10px 6px; border-radius: 10px; }
  .set-input.weight { width: 72px; }
  .set-input.reps   { width: 60px; }

  /* Explicitly allow pointer events and touch on inputs */
  .set-input, .set-input-clean {
    pointer-events: auto !important;
    touch-action: auto !important;
    -webkit-user-select: text !important;
    user-select: text !important;
    cursor: text;
  }

  .set-input-clean  { width: 72px; padding: 10px 6px; font-size: 16px !important;
                      min-height: 48px; border-radius: 10px; }

  .add-set-row      { padding: 4px 10px 12px; }
  .add-set-btn      { min-height: 44px; font-size: 13px; }
  .ex-notes-input   { margin: 0 10px 10px; width: calc(100% - 20px); min-height: 44px; }
  .measurements-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════════
   BOTTOM SHEET — shared component
   ══════════════════════════════════════════════════════════ */
.bottom-sheet {
  background: var(--surface1);
  border-radius: 20px 20px 0 0;
  padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 28px);
  width: 100%; max-width: 600px; margin: 0 auto;
  box-sizing: border-box;
  position: relative;
}
.sheet-handle {
  width: 36px; height: 4px; background: rgba(255,255,255,0.15);
  border-radius: 2px; margin: 0 auto 16px;
}
.sheet-title {
  font-family: 'Syne', sans-serif;
  font-size: 13px; font-weight: 800;
  color: var(--text); margin-bottom: 16px;
  text-align: center; letter-spacing: -0.2px;
}
.sheet-tag-row {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-bottom: 14px;
}
.sheet-tag-btn {
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 20px; padding: 6px 12px;
  font-size: 12px; color: var(--muted2);
  cursor: pointer; font-family: inherit;
  transition: all 0.12s; white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.sheet-tag-btn:hover, .sheet-tag-btn--active {
  background: rgba(var(--accent-rgb),0.12);
  border-color: rgba(var(--accent-rgb),0.35);
  color: var(--accent);
}
.sheet-textarea {
  width: 100%; box-sizing: border-box;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  font-size: 14px; font-family: inherit;
  padding: 12px; outline: none; resize: none;
  height: 100px; margin-bottom: 12px;
  transition: border-color 0.12s;
}
.sheet-textarea:focus { border-color: var(--accent); }
.sheet-save-btn {
  width: 100%; padding: 14px;
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius);
  font-size: 14px; font-weight: 800;
  font-family: 'Syne', sans-serif; cursor: pointer;
  letter-spacing: 0.3px;
}

/* Exercise action sheet grid */
.ex-action-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.ex-action-btn {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 6px; padding: 14px 8px;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 12px; cursor: pointer;
  font-family: inherit; color: var(--text);
  font-size: 11px; font-weight: 600;
  transition: all 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.ex-action-btn:hover { background: var(--surface3); border-color: var(--border); }
.ex-action-btn:active { transform: scale(0.95); }
.ex-action-btn--danger { color: var(--accent4); }
.ex-action-icon {
  font-size: 18px; font-weight: 800;
  font-family: 'DM Mono', monospace;
  line-height: 1;
}

/* ══════════════════════════════════════════════════════════
   MOBILE LOGGER — larger inputs and overrides
   ══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  .wk-header { padding: 10px 12px 8px; }
  .wk-name-input { font-size: 16px; }
  .wk-timer { font-size: 16px; }
  .wk-stat-val { font-size: 13px; }
  .wk-finish-btn { padding: 8px 14px; font-size: 12px; min-height: 36px; }
  .wk-icon-btn { width: 34px; height: 34px; }

  .ex-block-header { padding: 12px 10px 10px; }
  .ex-name-btn { font-size: 15px; }
  .ex-add-row { padding: 8px 10px 12px; }

  .sets-table-wrap { padding: 4px 8px 4px; }
  .sets-table th { padding: 0 3px 8px; font-size: 9px; }
  .sets-table td { padding: 3px 2px; }

  .set-input-clean {
    width: 72px !important; padding: 10px 4px !important;
    font-size: 16px !important; min-height: 52px;
    border-radius: 10px;
  }
  .set-done-btn { width: 52px !important; height: 52px !important; font-size: 20px; border-radius: 12px; }

  .set-input, .set-input-clean {
    pointer-events: auto !important; touch-action: auto !important;
    -webkit-user-select: text !important; user-select: text !important;
    cursor: text;
  }

  .ex-action-grid { grid-template-columns: repeat(4, 1fr); gap: 6px; }
  .ex-action-btn { padding: 12px 6px; font-size: 10px; }
}

/* ══════════════════════════════════════════════════════════
   PROGRESS PANEL — radar + donut layout
   ══════════════════════════════════════════════════════════ */
.prog-radar-wrap { display: flex; align-items: center; justify-content: center; }

/* ══════════════════════════════════════════════════════════
   MISC POLISH
   ══════════════════════════════════════════════════════════ */
/* Smooth panel entrance */
.panel.active { animation: fadeIn 0.18s ease; }

/* Better card hover */
.card { transition: border-color 0.15s; }

/* Scrollable modal body */
.modal-body { scrollbar-width: thin; }

/* Better input number spinners on mobile */
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* Active panel log should flex column (already in panel def) */
#panel-log.active { display: flex; flex-direction: column; overflow: hidden; }

/* ══════════════════════════════════════════════════════════
   SET TYPE POPUP
   ══════════════════════════════════════════════════════════ */
/* ── Set type drawer ────────────────────────────────────── */
.stp-drawer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
@media (max-width: 400px) {
  .stp-drawer-grid { grid-template-columns: repeat(2, 1fr); }
}
.stp-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 6px 12px;
  border-radius: 14px;
  border: 2px solid var(--border2);
  background: var(--surface2);
  cursor: pointer;
  text-align: center;
  -webkit-tap-highlight-color: transparent;
  transition: border-color .1s, background .1s;
}
.stp-cell-active {
  border-color: var(--stpc, var(--accent));
  background: var(--surface3);
  box-shadow: inset 0 0 0 1px var(--stpc, var(--accent));
}
@media (hover: hover) { .stp-cell:not(.stp-cell-active):hover { background: var(--surface3); } }
@media (hover: none)  { .stp-cell:not(.stp-cell-active):active { background: var(--surface3); } }
.stp-cell-sym {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif;
  font-size: 13px; font-weight: 800;
  letter-spacing: -0.5px;
  background: rgba(128,128,128,0.12);
  border: 1px solid rgba(128,128,128,0.25);
  color: var(--stpc, var(--muted2));
  flex-shrink: 0;
}
.stp-cell-active .stp-cell-sym {
  background: rgba(128,128,128,0.22);
  border-color: var(--stpc, var(--accent));
}
.stp-cell-label {
  font-size: 11px; font-weight: 700;
  color: var(--text); line-height: 1.1;
}
.stp-cell-active .stp-cell-label { color: var(--stpc, var(--accent)); }
.stp-cell-desc {
  font-size: 9px; color: var(--muted);
  line-height: 1.3;
  display: none;
}
@media (min-width: 400px) { .stp-cell-desc { display: block; } }

/* ══════════════════════════════════════════════════════════
   ROUTINE BUILDER
   ══════════════════════════════════════════════════════════ */
.rbuilder-day {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); margin-bottom: 14px; overflow: hidden;
}
.rbuilder-day-header {
  background: var(--surface2); border-bottom: 1px solid var(--border);
  padding: 10px 14px; display: flex; align-items: center; gap: 8px;
}
.rbuilder-day-body { padding: 10px 0 4px; }

.rbuilder-ex {
  border-bottom: 1px solid var(--border);
}
.rbuilder-ex:last-child { border-bottom: none; }
.rbuilder-ex-header {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
}
.rth {
  font-size: 9px; font-weight: 700; letter-spacing: 1px;
  text-transform: uppercase; color: var(--muted);
  padding: 0 6px 5px; text-align: center;
  border-bottom: 1px solid var(--border);
}
.rset-row td { padding: 3px 4px; vertical-align: middle; text-align: center; }
.rset-row td:first-child { text-align: left; }
.rset-row:hover td { background: var(--surface2); }
.rset-input {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text);
  padding: 4px 6px; font-size: 11px; font-family: inherit;
  text-align: center; outline: none; transition: border-color 0.1s;
}
.rset-input:focus { border-color: var(--accent); }

.btn-icon-sm {
  background: none; border: none; color: var(--muted);
  font-size: 12px; cursor: pointer; padding: 3px 5px;
  border-radius: var(--radius); transition: all 0.1s; font-family: inherit;
  line-height: 1;
}
.btn-icon-sm:hover { color: var(--text); background: var(--surface3); }
.btn-ghost-inline {
  background: none; border: none; cursor: pointer; font-family: 'Syne', sans-serif;
}

/* ══════════════════════════════════════════════════════════
   LOGGER — EXERCISE NAME BUTTON (ellipsis + clickable)
   ══════════════════════════════════════════════════════════ */
.ex-name-btn {
  background: none; border: none; cursor: pointer;
  font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700;
  color: var(--text); letter-spacing: -0.2px;
  flex: 1; min-width: 0; text-align: left; padding: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color 0.1s;
}
.ex-name-btn:hover { color: var(--accent); }

/* ══════════════════════════════════════════════════════════
   PROGRAMS TAB — Mobile-native planner
   ══════════════════════════════════════════════════════════ */

/* Program card */
.prog-card { margin-bottom: 16px; padding: 0; overflow: hidden; }
.prog-card-header {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 16px 10px; flex-wrap: wrap;
}
.prog-name-input {
  font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700;
  color: var(--text); background: transparent; border: none; outline: none;
  flex: 1; min-width: 80px;
}
.prog-cycle-label {
  font-size: 10px; color: var(--muted2); white-space: nowrap; flex-shrink: 0;
}
.prog-card-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }
.prog-progress-wrap { padding: 0 16px 10px; }

/* Week strip */
.prog-week-strip {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 16px; border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border); background: var(--surface2);
  overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.prog-week-nav {
  background: var(--surface3); border: 1px solid var(--border2);
  color: var(--text); border-radius: 6px; width: 32px; height: 32px;
  font-size: 16px; cursor: pointer; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .1s;
}
.prog-week-nav:disabled { opacity: 0.35; cursor: default; }
.prog-week-nav:not(:disabled):active { background: var(--surface4); }
.prog-week-dots { display: flex; gap: 4px; flex: 1; overflow-x: auto; padding: 2px 0; }
.prog-week-dot {
  background: none; border: none; color: var(--muted); font-size: 11px;
  cursor: pointer; padding: 4px 3px; border-radius: 4px; flex-shrink: 0;
  min-width: 22px; min-height: 32px; transition: color .1s, background .1s;
}
.prog-week-dot.active { color: var(--text); background: var(--surface3); }
.prog-week-dot.current { color: var(--accent); }
.prog-week-dot.active.current { background: rgba(var(--accent-rgb),0.12); }

/* Week label */
.prog-week-label {
  font-size: 10px; color: var(--muted); letter-spacing: 1px;
  text-transform: uppercase; padding: 8px 16px 4px;
}

/* Day stack */
.prog-day-stack { padding: 4px 0 8px; }
.prog-day-row {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; min-height: 52px;
  border-bottom: 1px solid var(--border);
  transition: background .1s;
}
.prog-day-row:last-child { border-bottom: none; }
.prog-day-row.today { background: rgba(var(--accent-rgb),0.04); }
.prog-day-row.missed { background: rgba(241,53,96,0.05); }
.prog-day-label {
  width: 36px; flex-shrink: 0; display: flex; flex-direction: column;
  align-items: center; gap: 3px;
}
.prog-day-name {
  font-size: 11px; color: var(--muted); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.prog-day-name.active { color: var(--accent); }
.prog-today-dot {
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}
.prog-day-sessions {
  flex: 1; display: flex; flex-wrap: wrap; gap: 5px; align-items: center;
  min-height: 32px;
}
.prog-rest-label { font-size: 11px; color: var(--muted); }

/* Session chips */
.prog-session-chip {
  display: flex; align-items: center; gap: 5px;
  background: var(--surface2); border: 1px solid var(--chip-col, var(--border2));
  border-radius: 20px; padding: 4px 8px 4px 6px;
  cursor: pointer; transition: background .1s; min-height: 32px;
}
.prog-session-chip:active { background: var(--surface3); }
.prog-chip-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.prog-chip-name {
  font-size: 12px; font-weight: 600; color: var(--text);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.prog-chip-rem {
  background: none; border: none; color: var(--muted); font-size: 14px;
  cursor: pointer; padding: 0 0 0 2px; line-height: 1; flex-shrink: 0;
  min-width: 20px; min-height: 20px; display: flex; align-items: center; justify-content: center;
  transition: color .1s;
}
.prog-chip-rem:active { color: var(--accent4); }
.prog-chip-override {
  font-size: 9px; color: var(--accent2); margin-left: 2px;
  white-space: nowrap;
}

/* Day add / missed buttons */
.prog-day-add {
  min-width: 36px; min-height: 36px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: var(--muted); transition: color .1s;
}
.prog-day-add:active { color: var(--accent); }
.prog-missed-badge {
  min-width: 28px; min-height: 28px; flex-shrink: 0;
  background: rgba(241,53,96,0.15); border: 1px solid var(--accent4);
  color: var(--accent4); border-radius: 50%; font-size: 13px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background .1s;
}
.prog-missed-badge:active { background: rgba(241,53,96,0.3); }

/* Session picker sheet items */
.sess-pick-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 12px; border-radius: 10px; cursor: pointer;
  min-height: 56px; transition: background .1s;
}
.sess-pick-item:active { background: var(--surface2); }
.sess-pick-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.sess-pick-info { flex: 1; min-width: 0; }
.sess-pick-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sess-pick-ex { font-size: 11px; color: var(--muted); margin-top: 2px; }
.sess-pick-pref { color: var(--accent3); }

/* Copy week / missed action sheet pills */
.cw-pill {
  padding: 7px 12px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: var(--surface2); border: 1px solid var(--border2);
  color: var(--muted2); cursor: pointer; transition: all .12s;
  min-height: 36px;
}
.cw-pill.active {
  background: rgba(var(--accent-rgb),0.15); border-color: var(--accent);
  color: var(--accent);
}
.cw-pill:active { opacity: 0.8; }

/* Mobile overrides */
@media (max-width: 900px) {
  .prog-chip-name { max-width: 90px; }
  .prog-day-row { padding: 8px 12px; }
  .prog-week-strip { padding: 8px 12px; }
  .prog-card-header { padding: 12px 12px 8px; }
  .prog-progress-wrap { padding: 0 12px 10px; }
  .prog-week-label { padding: 8px 12px 4px; }
  .prog-name-input { font-size: 16px; }
}

/* ══════════════════════════════════════════════════════════
   ROUTINE EDITOR — Mobile two-level layout
   ══════════════════════════════════════════════════════════ */

/* Outer container — clips the two-pane slider */
.reditor-wrap {
  position: relative;
  overflow: hidden;
  /* Take full remaining height so L2 can scroll independently */
  min-height: 0;
}

/* Slider: two panes side by side, each 50% of double-width */
.reditor-slider {
  display: flex;
  width: 200%;
  transform: translateX(0);
  will-change: transform;
}

/* Each pane is half the slider = full viewport width */
.reditor-pane {
  width: 50%;
  min-width: 50%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Sticky header inside each pane */
.reditor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 10px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Large editable title inside header */
.reditor-title-in {
  font-family: 'Syne', sans-serif;
  font-size: 16px;
  font-weight: 800;
  background: transparent;
  border-color: transparent;
  padding-left: 0;
  width: 100%;
}
.reditor-title-in:focus { border-color: var(--accent); }

/* Day list cards (Level 1) */
.reditor-day-card {
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  margin-bottom: 10px;
  background: var(--surface);
  overflow: hidden;
  cursor: pointer;
  transition: background .1s, border-color .1s;
}
.reditor-day-card:active { background: var(--surface2); border-color: var(--border2); }
.reditor-day-card-body {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 12px 14px 16px;
  min-height: 64px;
}

/* DOW assignment buttons */
.dow-btn {
  flex: 1;
  min-height: 52px;
  background: var(--surface2);
  border: 1.5px solid var(--border2);
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  transition: all .12s;
}
.dow-btn.active {
  background: rgba(var(--accent-rgb),0.15);
  border-color: var(--accent);
}
.dow-btn:active { opacity: 0.75; }
.dow-btn-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.dow-btn.active .dow-btn-label { color: var(--accent); }

/* Mobile tap target boosts for routine editor buttons */
@media (max-width: 900px) {
  /* Set type button — bigger hit area */
  .rset-type-btn {
    min-height: 36px !important;
    min-width: 36px !important;
    padding: 4px 8px !important;
  }

  /* Del-set and add-set buttons */
  .del-set-btn { min-height: 36px !important; min-width: 36px !important; }
  .add-rset-btn, .add-wu-sets-btn { min-height: 44px !important; }

  /* Move / superset / delete exercise icon buttons */
  .btn-icon-sm {
    min-height: 36px !important;
    min-width: 36px !important;
    padding: 6px !important;
  }

  /* Set inputs — 16px prevents iOS zoom */
  .rset-input { font-size: 16px !important; }

  /* Exercise block header */
  .rbuilder-ex-header { padding: 12px; min-height: 52px; }
}

/* ══════════════════════════════════════════════════════════
/* ══════════════════════════════════════════════════════════
   PR BOARD
   ══════════════════════════════════════════════════════════ */
.pr-board-grid { display: flex; flex-direction: column; gap: 16px; }
.pr-board-grid-inner { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.pr-group-header {
  font-size: 9px; font-weight: 700; letter-spacing: 2px;
  text-transform: uppercase; color: var(--muted);
  padding: 8px 0 4px; border-bottom: 1px solid var(--border);
}
.pr-board-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 14px;
  cursor: pointer; transition: all 0.12s;
  border-left: 3px solid var(--pr-color, var(--accent));
  display: flex; flex-direction: column; gap: 4px;
}
.pr-board-card:hover { border-color: var(--pr-color, var(--accent)); transform: translateY(-1px); }
.pr-board-muscle  { display: flex; align-items: center; gap: 6px; font-size: 9px; color: var(--muted); }
.pr-board-name    { font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700; color: var(--text); line-height: 1.2; }
.pr-board-val     { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; color: var(--accent); line-height: 1; margin-top: 4px; }
.pr-board-sub     { font-size: 10px; color: var(--muted2); }
.pr-board-date    { font-size: 9px; color: var(--muted); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════
   NUTRITION
   ══════════════════════════════════════════════════════════ */
.nutr-avg-banner { margin-bottom: 16px; }

/*
   NAV — sidebar scrolls, version badge
   ══════════════════════════════════════════════════════════ */
#sidebar { overflow-y: auto; overflow-x: hidden; }
.brand-version {
  font-size: 8px; color: var(--muted); letter-spacing: 0.5px;
  margin-top: 1px;
}

/* ══════════════════════════════════════════════════════════
   HEAVYMETAL MATCH — card title caps + border accents
   ══════════════════════════════════════════════════════════ */
.card-header .card-title { text-transform: uppercase; letter-spacing: 0.8px; }
.nav-item.active .nav-icon { color: var(--accent); }
.nav-bottom { margin-top: auto; }

/* ══════════════════════════════════════════════════════════
   HEAVYMETAL EXACT MATCH ADDITIONS
   ══════════════════════════════════════════════════════════ */

/* Card h2 title (HM style) */
.card h2 {
  font-family: 'Syne', sans-serif;
  font-size: 13px; font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 12px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  color: var(--text);
}

/* Badges (HM exact) */
.badge { font-size: 9px; padding: 2px 6px; border-radius: 2px; font-family: 'DM Mono', monospace; font-weight: 400; letter-spacing: 1px; }
.badge-green  { background: rgba(var(--accent-rgb),.15);  color: var(--accent); }
.badge-blue   { background: rgba(93,232,208,.15);  color: var(--accent2); }
.badge-orange { background: rgba(241,164,53,.15);  color: var(--accent3); }
.badge-red    { background: rgba(241,53,96,.15);   color: var(--accent4); }

/* Stat-card inner styles (HM exact) */
.stat-card .label { font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; text-align: center; }
.stat-card .value { font-family: 'Syne', sans-serif; font-size: 18px; font-weight: 800; letter-spacing: -0.5px; line-height: 1; text-align: center; }
.stat-card .meta  { font-size: 10px; color: var(--muted2); margin-top: 4px; text-align: center; }
#dash-stats-row .stat-card { display: flex; flex-direction: column; align-items: center; }

/* HM-style 7-day week heatmap strip */
.hm-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-bottom: 16px; }
.hm-cell {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 8px 4px 6px;
  text-align: center;
  position: relative;
  cursor: default;
  min-height: 88px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
}
.hm-cell.hm-today { box-shadow: inset 0 0 0 2px var(--accent4) !important; }

/* Pinned exercise cards (HM exact) */
.pinned-card {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius2);
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.pinned-card:hover { border-color: var(--accent); }
.pinned-card-name { font-size: 13px; font-weight: 500; color: var(--text); }

/* Pin button (HM exact) */
.pin-btn {
  padding: 3px 10px; border-radius: 2px; font-size: 10px; cursor: pointer;
  border: 1px solid var(--border); color: var(--muted2);
  background: transparent; font-family: inherit; transition: all .1s;
}
.pin-btn:hover { border-color: var(--accent); color: var(--accent); }
.pin-btn.pinned { background: rgba(var(--accent-rgb),.15); border-color: var(--accent); color: var(--accent); }

/* Sort buttons (HM exact) */
.sort-btn {
  padding: 3px 10px; border-radius: 2px; font-size: 10px; cursor: pointer;
  border: 1px solid var(--border); color: var(--muted2);
  background: transparent; font-family: inherit; transition: all .1s;
}
.sort-btn.active { border-color: var(--accent2); color: var(--accent2); }

/* tfilter — same behaviour as .ftab, used in section headers (HM match) */
.tfilter {
  padding: 5px 12px; border-radius: var(--radius); font-size: 11px; cursor: pointer;
  border: 1px solid var(--border); color: var(--muted2); background: transparent;
  font-family: inherit; transition: all .15s;
}
.tfilter:hover { color: var(--text); border-color: var(--muted2); }
.tfilter.active { background: var(--accent); color: #000; border-color: var(--accent); font-weight: 500; }

/* Exercise tag list (HM exact) */
.ex-tag {
  padding: 4px 10px; border-radius: 2px; font-size: 11px; cursor: pointer;
  background: var(--surface2); border: 1px solid var(--border); color: var(--muted2);
  transition: all .1s; white-space: nowrap; display: inline-block;
}
.ex-tag:hover { border-color: var(--accent); color: var(--accent); }
.ex-tag.selected { background: rgba(var(--accent-rgb),.15); border-color: var(--accent); color: var(--accent); }
.ex-tag.pinned-tag { border-color: var(--accent3); color: var(--accent3); background: rgba(241,164,53,.1); }

/* Exercise search (HM exact) */
.ex-search {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px; color: var(--text);
  font-family: inherit; font-size: 12px; margin-bottom: 8px; outline: none;
}
.ex-search:focus { border-color: var(--accent); }

/* Plateau badge (HM exact) */
.plateau-badge {
  display: inline-block; font-size: 9px; padding: 2px 7px; border-radius: 2px;
  background: rgba(241,53,96,.15); color: var(--accent4); letter-spacing: 1px; text-transform: uppercase;
}

/* Accent colour helpers (HM exact) */
.accent  { color: var(--accent);  }
.accent2 { color: var(--accent2); }
.accent3 { color: var(--accent3); }
.accent4 { color: var(--accent4); }

@media (max-width: 900px) {
  .hm-week { gap: 3px; }
  .hm-cell { min-height: 68px; padding: 5px 2px 4px; }
}

/* HM api-card inner classes (used by nutrition + body panels) */
.api-name { font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700; }
.api-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }
.api-fields { display: flex; flex-direction: column; gap: 8px; }
.api-input {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px 12px; color: var(--text);
  font-family: inherit; font-size: 12px; outline: none;
}
.api-input:focus { border-color: var(--accent); }
.api-connect-btn {
  align-self: flex-start; padding: 7px 16px;
  background: var(--accent); color: #000;
  border: none; border-radius: var(--radius);
  font-family: inherit; font-size: 11px; font-weight: 500; cursor: pointer;
}
.api-connect-btn:hover { opacity: .85; }

/* Macro legend (HM exact) */
.macro-legend { display: flex; flex-direction: column; gap: 8px; flex: 1; }
.macro-item   { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.macro-dot    { width: 8px; height: 8px; border-radius: 1px; flex-shrink: 0; }
.macro-val    { font-family: 'Syne', sans-serif; font-weight: 700; margin-left: auto; }

/* PR board card styles (used in dashboard PR section) */
.pr-board-card  {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; cursor: pointer; transition: border-color .15s;
  border-left: 3px solid var(--pr-color, var(--accent));
  display: flex; flex-direction: column; gap: 4px;
}
.pr-board-card:hover { border-color: var(--pr-color, var(--accent)); }
.pr-board-muscle { display: flex; align-items: center; gap: 6px; font-size: 9px; color: var(--muted); }
.pr-board-name   { font-family: 'Syne', sans-serif; font-size: 12px; font-weight: 700; color: var(--text); line-height: 1.2; }
.pr-board-val    { font-family: 'Syne', sans-serif; font-size: 20px; font-weight: 800; color: var(--accent); line-height: 1; margin-top: 4px; }
.pr-board-sub    { font-size: 10px; color: var(--muted2); }
.pr-board-date   { font-size: 9px; color: var(--muted); margin-top: 2px; }

/* PR tag + rec-tag inline badges */
.pr-tag  { display:inline-block;font-size:8px;padding:1px 5px;border-radius:2px;background:rgba(var(--accent-rgb),.15);color:var(--accent);letter-spacing:1px;margin-left:4px; }
.rec-tag { display:inline-block;font-size:8px;padding:1px 5px;border-radius:2px;background:rgba(241,164,53,.15);color:var(--accent3);letter-spacing:1px;margin-left:4px; }

/* ══════════════════════════════════════════════════════════
   HISTORY — CALENDAR VIEW
   ══════════════════════════════════════════════════════════ */
.hist-cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.hist-cal-nav-label {
  font-family: 'Syne', sans-serif; font-size: 15px; font-weight: 700;
  color: var(--text); letter-spacing: -0.3px; text-align: center; flex: 1;
}
.hist-cal-nav-btn {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--muted2); font-size: 16px;
  width: 36px; height: 36px; cursor: pointer; font-family: inherit;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s; flex-shrink: 0;
}
.hist-cal-nav-btn:hover { color: var(--accent); border-color: var(--accent); }
.hist-cal-nav-btn:disabled { opacity: .3; pointer-events: none; }

/* Grid of months (1 mobile / 3 desktop) */
.hist-cal-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 14px;
}
@media (min-width: 900px) {
  .hist-cal-grid { grid-template-columns: repeat(3, 1fr); }
}

.hist-cal-month {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius2); padding: 14px;
}
.hist-cal-month-hdr {
  font-family: 'Syne', sans-serif; font-size: 13px; font-weight: 700;
  color: var(--text); margin-bottom: 10px; letter-spacing: -0.2px;
}
.hist-cal-dow-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 2px; margin-bottom: 4px;
}
.hist-cal-dow {
  font-size: 9px; text-align: center; color: var(--muted);
  padding: 2px 0; letter-spacing: 0.5px;
}
.hist-cal-weeks { display: flex; flex-direction: column; gap: 2px; }
.hist-cal-week  { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

.hist-cal-day {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  background: var(--surface2);
  cursor: default;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 4px 2px 4px;
  min-height: 42px;
  transition: opacity .15s, transform .1s;
  overflow: hidden;
}
.hist-cal-day.empty    { background: transparent; }
.hist-cal-day.has-workout { cursor: pointer; }
.hist-cal-day.has-workout:hover { transform: scale(1.1); z-index: 2; background: var(--surface3); }
.hist-cal-day.today    { box-shadow: 0 0 0 2px var(--accent); }
.hist-cal-day.today .hist-cal-day-num { color: var(--accent); font-weight: 700; }
.hist-cal-day-num {
  font-size: 13px; color: var(--muted); font-family: 'DM Mono', monospace;
  line-height: 1; z-index: 1; font-weight: 500;
}
.hist-cal-day.has-workout .hist-cal-day-num { color: var(--text); font-weight: 700; }
.hist-cal-dots {
  display: flex; gap: 3px; flex-wrap: wrap;
  justify-content: center; align-items: center; margin-top: 3px;
}
.hist-cal-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}

/* ── PR celebration ──────────────────────── */
@keyframes pr-trophy-pop {
  0%   { transform: scale(0) rotate(-20deg); opacity:0; }
  60%  { transform: scale(1.3) rotate(5deg);  opacity:1; }
  100% { transform: scale(1) rotate(0deg);   opacity:1; }
}
.pr-row { background: rgba(var(--accent-rgb),.04) !important; }
.pr-badge-overlay {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; border-radius: 4px;
  background: rgba(241,163,53,0.92);
  cursor: pointer; z-index: 1;
  animation: pr-trophy-pop .4s ease;
}

/* ── Set stepper (▲▼ around inputs) ─────── */
.set-stepper {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.set-stepper .set-input {
  width: 100%; text-align: center;
}
.step-btn {
  background: var(--surface3); border: none; color: var(--muted2);
  font-size: 8px; line-height: 1; padding: 2px 6px; cursor: pointer;
  border-radius: 3px; width: 100%; transition: background .1s, color .1s;
  -webkit-user-select: none; user-select: none;
}
.step-btn:active { background: var(--accent); color: #000; }

/* ── Manual timer preset buttons ─────────── */
.rest-preset-btn {
  background: var(--surface3); border: 1px solid var(--border2);
  border-radius: 10px; color: var(--text);
  font-family: inherit; font-size: 13px; font-weight: 600;
  padding: 12px 6px; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  text-align: center; min-height: 44px;
  -webkit-tap-highlight-color: transparent;
}
.rest-preset-btn:active { background: var(--accent); color: #000; border-color: var(--accent); }
@media (hover: hover) {
  .rest-preset-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }
}

/* ── Tooltip ─────────────────────────────── */
.il-tooltip-wrap {
  position: relative; display: inline-flex; flex-direction: column; align-items: center;
  cursor: default;
}
.il-tooltip-wrap .il-tooltip {
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--surface); border: 1px solid var(--border2);
  border-radius: 10px; padding: 10px 14px;
  font-size: 11px; line-height: 1.55; color: var(--muted2);
  font-family: 'DM Mono', monospace; letter-spacing: .3px;
  white-space: normal; width: 230px; text-align: left;
  box-shadow: 0 8px 24px rgba(0,0,0,.55);
  opacity: 0; pointer-events: none;
  transition: opacity .15s, transform .15s;
  transform: translateX(-50%) translateY(4px);
  z-index: 500;
}
.il-tooltip-wrap:hover .il-tooltip,
.il-tooltip-wrap:focus-within .il-tooltip {
  opacity: 1; transform: translateX(-50%) translateY(0);
}
.il-tooltip-wrap .il-tooltip::after {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--border2);
}
.il-tooltip-wrap .il-tooltip::before {
  content: ''; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--surface);
  margin-top: -1px; z-index: 1;
}

/* ── Bottom sheet drag pill ──────────────────────────────── */
@media (max-width: 900px) {
  .modal::before {
    content: '';
    display: block;
    width: 36px; height: 4px;
    background: rgba(255,255,255,0.15);
    border-radius: 2px;
    margin: 0 auto 12px;
  }
}

/* ══════════════════════════════════════════════════════════
   MOBILE NATIVE FEEL — hover guards, active states, sizing
   ══════════════════════════════════════════════════════════ */

/* Confine hover effects to devices that actually support hover.
   On mobile, :hover sticks after tap — this prevents that. */
@media (hover: hover) {
  .nav-item:hover { color: var(--text); background: var(--surface2); }
  .btn-accent:hover { background: #d9ff4a; }
  .btn-surface:hover { background: var(--surface3); border-color: var(--muted); }
  .btn-ghost:hover { color: var(--text); border-color: var(--muted); background: var(--surface2); }
  .btn-danger:hover { background: var(--accent4); color: #fff; }
  .btn-accent-outline:hover { background: rgba(var(--accent-rgb),0.1); }
  .card:hover { border-color: var(--border2); }
  .history-item:hover { border-color: var(--border2); background: var(--surface2); }
  .ex-card:hover { border-color: var(--border2); background: var(--surface2); transform: translateY(-1px); }
  .routine-card:hover { border-color: var(--border2); transform: translateY(-1px); }
  .ex-list-item:hover { background: var(--surface2); }
  .ex-select-card:hover { border-color: var(--accent); }
  .modal-close:hover { color: var(--text); background: var(--surface2); }
  .history-back-btn:hover { color: var(--text); }
  .ftab:hover { color: var(--text); border-color: var(--muted); }
  .cal-cell:hover { opacity: 0.75 !important; transform: scale(1.2); }
}

/* Instant :active tap feedback for touch devices */
@media (hover: none) {
  .btn:active    { opacity: 0.72; transform: scale(0.97); }
  .card:active   { opacity: 0.85; }
  .history-item:active { background: var(--surface3); }
  .ex-card:active      { background: var(--surface3); }
  .routine-card:active { background: var(--surface2); }
  .ex-list-item:active { background: var(--surface3); }
  .ex-list-item { padding: 14px 12px; min-height: 52px; }
  .ex-list-name { font-size: 14px; }
  .ex-list-cat  { font-size: 11px; }
  .ftab:active   { color: var(--text); border-color: var(--muted); }
  .nav-item:active { color: var(--text); background: var(--surface2); }
}

/* Minimum 44px touch targets on mobile */
@media (max-width: 900px) {
  .btn-sm   { padding: 10px 14px; min-height: 44px; font-size: 12px; }
  .ftab     { padding: 10px 14px; min-height: 44px; font-size: 11px; }
  .set-done-btn { width: 44px !important; height: 44px !important; font-size: 18px !important; }
  .set-del-btn  { width: 44px; height: 44px; display: flex !important; align-items: center; justify-content: center; }
  .modal-close  { width: 44px; height: 44px; }
  .history-back-btn { min-height: 44px; padding: 10px 14px; }
  .hist-filter-btn  { min-height: 44px !important; padding: 10px 14px !important; }
  .wk-carousel-cell { min-height: 44px; }
  .set-input        { min-height: 44px !important; }
  .sort-btn         { min-height: 44px; padding: 10px 14px; }
  /* History filter row — lock to horizontal axis so vertical scroll stays on the panel */
  #hist-filter-row  { touch-action: pan-x; overscroll-behavior-x: contain; }

  /* Larger readable font sizes — nothing below 11px on mobile */
  .nav-label, .section-label, .stat-card-lbl,
  .input-label, .card-meta { font-size: 11px; }
  .ex-list-cat, .history-stat-lbl, .card-title { font-size: 11px; }
  .tag, .pr-entry-new { font-size: 10px; }
  .stat-card-sub, .history-item-date { font-size: 11px; }

  /* Inputs must be 16px to prevent iOS zoom on focus */
  input, textarea, select, .input { font-size: 16px !important; }
  .set-input.weight, .set-input.reps { font-size: 16px !important; }
  .wk-name-input { font-size: 20px; }

  /* Panel bottom padding accounts for floating nav + safe area */
  .panel {
    padding-bottom: calc(var(--mobnav) + env(safe-area-inset-bottom, 0px) + 32px);
  }
}

/* ── Input focus always works — never block pointer or touch on inputs ── */
input, textarea, select {
  pointer-events: auto !important;
  touch-action: manipulation !important;
  -webkit-user-select: text !important;
  user-select: text !important;
}

/* ══════════════════════════════════════════════════════════
   PHASE 5 — POLISH
   ══════════════════════════════════════════════════════════ */

/* Staggered entrance for program cards */
@keyframes prog-card-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.prog-card-enter {
  animation: prog-card-in 0.28s cubic-bezier(0.32, 0.72, 0, 1) both;
}

/* Active scale micro-animation on all primary buttons in routines UI */
.btn-accent:active,
.btn-surface:active,
.btn-ghost:active {
  transform: scale(0.96);
  transition: transform 0.08s;
}
/* Restore on release */
.btn-accent,
.btn-surface,
.btn-ghost {
  transition: background 0.12s, border-color 0.12s, color 0.12s, transform 0.12s;
}

/* Dashboard missed session section */
.dash-missed-section {
  padding-top: 10px;
  margin-top: 10px;
  border-top: 1px solid rgba(241,53,96,0.2);
}
.dash-missed-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0 8px 10px;
  border-left: 3px solid var(--accent4);
  border-radius: 0 6px 6px 0;
  margin-bottom: 8px;
  background: rgba(241,53,96,0.05);
}
.dash-missed-row:last-child { margin-bottom: 0; }

/* Routine card staggered entrance */
@keyframes routine-card-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.routine-grid .routine-card {
  animation: routine-card-in 0.22s cubic-bezier(0.32,0.72,0,1) both;
}
.routine-grid .routine-card:nth-child(1) { animation-delay: 0ms; }
.routine-grid .routine-card:nth-child(2) { animation-delay: 40ms; }
.routine-grid .routine-card:nth-child(3) { animation-delay: 80ms; }
.routine-grid .routine-card:nth-child(4) { animation-delay: 120ms; }
.routine-grid .routine-card:nth-child(n+5) { animation-delay: 160ms; }

/* Session chip touch feedback (beyond CSS :active for pointer events) */
.prog-session-chip {
  touch-action: pan-y; /* allow vertical scroll but capture horizontal for swipe */
  user-select: none;
  -webkit-user-select: none;
}

/* ═══════════════════════════════════════════════════════════
   ROUTINE EDITOR — multi-session day blocks
   ═══════════════════════════════════════════════════════════ */

.rday-session-block {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--surface);
}
.rday-session-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  min-height: 32px;
}
.rday-session-block[data-stype="cardio"] {
  background: color-mix(in srgb, var(--accent3) 6%, var(--surface));
  border-color: color-mix(in srgb, var(--accent3) 25%, var(--border));
}

/* ═══════════════════════════════════════════════════════════
   CARDIO PANEL — overhaul
   ═══════════════════════════════════════════════════════════ */

/* Horizontal-scroll stats row */
.cardio-stats-scroll {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
  margin-bottom: 16px;
  scrollbar-width: none;
}
.cardio-stats-scroll::-webkit-scrollbar { display: none; }
.cardio-stats-scroll .stat-card {
  flex-shrink: 0;
  min-width: 110px;
}

/* Session history cards */
.cardio-session-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius2, 10px);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.12s;
}
@media (hover: hover) {
  .cardio-session-card:hover { border-color: var(--border2); }
}
@media (hover: none) {
  .cardio-session-card:active { background: var(--surface2); }
}

.cardio-session-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}

.cardio-session-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.cardio-session-stat > div:first-child {
  font-family: 'Syne', sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.cardio-session-stat > div:last-child {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 2px;
}

/* Zone badge on session card */
.cardio-zone-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}

/* Zone legend row below zone chart */
.cardio-zone-legend {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 0 2px;
}
.cardio-zone-pill {
  font-size: 9px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* Activity-type accordion */
.cardio-type-card {
  margin-bottom: 10px;
}
.cardio-type-header {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  padding: 14px 0 10px;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}
.cardio-type-chevron {
  font-size: 18px;
  color: var(--muted);
  transition: transform 0.2s;
  flex-shrink: 0;
}
.cardio-type-body {
  padding: 0 0 10px;
  border-top: 1px solid var(--border);
}
.cardio-type-record {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.cardio-type-record:last-child { border-bottom: none; }
.cardio-type-record span:first-child { color: var(--muted); }

/* Taller chart wrap for primary trend charts */
.chart-wrap-lg {
  min-height: 160px;
  position: relative;
}

/* ═══════════════════════════════════════════════════════════
   INSIGHTS PANEL — new components
   ═══════════════════════════════════════════════════════════ */

/* Readiness card — left border color set inline per status */
.ins-readiness-card {
  margin-bottom: 14px;
  padding: 14px 16px;
}
.ins-readiness-card .ins-readiness-bar {
  margin-top: 10px;
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
}
.ins-readiness-card .ins-readiness-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.32, 0.72, 0, 1);
}

/* Achievement feed entries */
.ins-achievement-entry {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.ins-achievement-entry:last-child { border-bottom: none; }

/* ═══════════════════════════════════════════════════════════
   PROGRESS PANEL — new components
   ═══════════════════════════════════════════════════════════ */

/* Session comparison two-column grid */
.prog-compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Near-PR progress bar */
.near-pr-bar {
  height: 4px;
  background: var(--surface3);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.near-pr-fill {
  height: 100%;
  background: var(--accent3);
  border-radius: 2px;
}

/* ═══════════════════════════════════════════════════════════
   STICKY SECTION LABELS
   ═══════════════════════════════════════════════════════════ */
.sticky-section-label {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 8px 0 10px;
  margin-bottom: 4px;
}

/* ═══════════════════════════════════════════════════════════
   MOBILE OVERRIDES — 900px breakpoint additions
   ═══════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
  /* Flatten all 2-col grids in analytics and cardio on mobile */
  #panel-analytics .grid-2,
  #panel-cardio .grid-2 {
    grid-template-columns: 1fr;
  }

  /* Comfortable stat chips on narrow screens */
  .cardio-session-stats {
    gap: 12px;
  }
  .cardio-session-stat > div:first-child {
    font-size: 15px;
  }

  /* Ensure edit/action buttons meet 44px touch target */
  .cardio-edit-btn {
    min-height: 44px;
    padding: 10px 16px;
  }
}
