/* ============================================
   FITNESS HQ — Shared Dark Theme
   ops.rakvia.com/fitness/
   ============================================ */

:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-card: #1c2128;
  --bg-hover: #252c35;
  --border: #30363d;
  --border-accent: #3b4252;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #6e7681;
  --accent: #58a6ff;
  --accent-glow: rgba(88, 166, 255, 0.15);
  --green: #3fb950;
  --green-dim: rgba(63, 185, 80, 0.15);
  --yellow: #d29922;
  --yellow-dim: rgba(210, 153, 34, 0.15);
  --red: #f85149;
  --red-dim: rgba(248, 81, 73, 0.15);
  --orange: #db6d28;
  --purple: #bc8cff;
  --pink: #f778ba;
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
  --radius: 8px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 1px 2px rgba(0,0,0,0.2);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

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

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Layout ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1rem; }

/* ---- Navigation ---- */
.nav {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.nav-links { display: flex; gap: 0.25rem; }

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  font-size: 0.87rem;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-links a:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-links a.active { color: var(--accent); background: var(--accent-glow); }

.nav-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 0.25rem;
}

.nav-meta {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* Hamburger Menu — always visible */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  padding: 0.5rem;
  margin-left: auto;
  background: none;
  border: none;
  z-index: 200;
}
.hamburger span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 2px;
  transition: all 0.2s;
}
.hamburger.open span:nth-child(1) { transform: rotate(45deg) translate(4px, 4px); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: rotate(-45deg) translate(4px, -4px); }

.nav-mobile-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 150;
}
.nav-mobile-overlay.open { display: block; }

.nav-drawer {
  display: none;
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 260px;
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  padding: 4rem 1.25rem 1.25rem;
  z-index: 175;
  flex-direction: column;
  gap: 0.25rem;
  box-shadow: var(--shadow-lg);
}
.nav-drawer.open { display: flex; }
.nav-drawer a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-drawer a:hover { color: var(--text-primary); background: var(--bg-hover); }
.nav-drawer a.active { color: var(--accent); background: var(--accent-glow); }
.nav-drawer .drawer-section {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 0.75rem 0.85rem 0.25rem;
  margin-top: 0.5rem;
}
.nav-drawer .drawer-section:first-child { margin-top: 0; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.card-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  font-family: var(--font-mono);
}

.card-subtitle {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ---- Section ---- */
.section { margin-bottom: 2rem; }

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-icon { font-size: 1.2rem; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.badge-green { background: var(--green-dim); color: var(--green); }
.badge-yellow { background: var(--yellow-dim); color: var(--yellow); }
.badge-red { background: var(--red-dim); color: var(--red); }
.badge-blue { background: var(--accent-glow); color: var(--accent); }

/* ---- Progress Bars ---- */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 0.5rem;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease;
}

.progress-green { background: var(--green); }
.progress-yellow { background: var(--yellow); }
.progress-red { background: var(--red); }
.progress-blue { background: var(--accent); }

/* ---- Tables ---- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.87rem;
}

thead th {
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  padding: 0.65rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--bg-hover); }

.you-marker {
  background: var(--accent-glow);
  font-weight: 600;
}

/* ---- Sparkline ---- */
.sparkline {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 28px;
  vertical-align: middle;
}

.sparkline-bar {
  width: 5px;
  border-radius: 2px;
  min-height: 3px;
  transition: height 0.3s;
}

/* ---- Profile Header ---- */
.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 2rem;
  box-shadow: var(--shadow-lg);
}

.profile-photo {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  box-shadow: 0 0 20px rgba(88, 166, 255, 0.2);
  flex-shrink: 0;
}

.profile-info { flex: 1; }
.profile-name { font-size: 1.5rem; font-weight: 700; line-height: 1.2; }
.profile-rank { color: var(--accent); font-weight: 600; font-size: 0.9rem; margin-top: 0.15rem; }

.profile-stats {
  display: flex;
  gap: 1.5rem;
  margin-top: 0.6rem;
}

.profile-stat {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.profile-stat strong {
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.9rem;
}

.xp-bar-wrap {
  margin-top: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.xp-bar {
  flex: 1;
  height: 10px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 999px;
  transition: width 0.8s ease;
}

.xp-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ---- Rings ---- */
.ring-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.ring-svg { width: 90px; height: 90px; }

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

.ring-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 0.8s ease;
}

.ring-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-align: center;
}

.ring-count {
  font-size: 0.85rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

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

.heatmap-cell {
  aspect-ratio: 1;
  border-radius: 3px;
  min-width: 12px;
}

.heatmap-0 { background: var(--border); opacity: 0.4; }
.heatmap-1 { background: #0e4429; }
.heatmap-2 { background: #006d32; }
.heatmap-3 { background: #26a641; }
.heatmap-4 { background: #39d353; }

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
  justify-content: flex-end;
}

.heatmap-legend-cell {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

/* ---- Milestones ---- */
.milestone {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

.milestone:last-child { border-bottom: none; }

.milestone-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.milestone-unlocked .milestone-icon {
  background: var(--green-dim);
  border: 2px solid var(--green);
}

.milestone-locked .milestone-icon {
  background: var(--bg-hover);
  border: 2px solid var(--border);
  opacity: 0.5;
}

.milestone-name { font-weight: 600; font-size: 0.87rem; }
.milestone-date { font-size: 0.75rem; color: var(--text-muted); }
.milestone-locked .milestone-name { color: var(--text-muted); }

/* ---- Feed ---- */
.feed-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border);
}

.feed-item:last-child { border-bottom: none; }

.feed-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  background: var(--bg-hover);
}

.feed-details { flex: 1; }
.feed-name { font-weight: 600; font-size: 0.87rem; }
.feed-meta { font-size: 0.78rem; color: var(--text-muted); }
.feed-date { font-size: 0.78rem; color: var(--text-muted); text-align: right; white-space: nowrap; }

/* ---- Alert ---- */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  font-size: 0.87rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.alert-warning {
  background: var(--yellow-dim);
  border: 1px solid rgba(210, 153, 34, 0.3);
  color: var(--yellow);
}

.alert-danger {
  background: var(--red-dim);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: var(--red);
}

/* ---- Day Schedule (Playbook) ---- */
.day-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s;
}

.day-card:hover { border-color: var(--border-accent); }

.day-card.rest-day { opacity: 0.65; }
.day-card.today { border-color: var(--accent); box-shadow: 0 0 12px rgba(88, 166, 255, 0.12); }

.day-card.collapsed .day-body { display: none; }
.day-card.collapsed .day-header { border-bottom: none; }
.day-card .day-header::after {
  content: "\25B2";
  font-size: 0.7rem;
  color: var(--text-muted);
  transition: transform 0.2s;
}
.day-card.collapsed .day-header::after {
  content: "\25BC";
}

.day-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
}

.day-name {
  font-weight: 700;
  font-size: 0.9rem;
}

.day-date {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.day-body { padding: 1rem; }

.day-activity {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.day-activity:last-child { border-bottom: none; }

.day-activity-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
  background: var(--bg-hover);
}

.day-activity-info { flex: 1; }

.day-activity-name {
  font-weight: 600;
  font-size: 0.87rem;
}

.day-activity-detail {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.day-activity-time {
  font-size: 0.78rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.day-macros {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.macro-item { text-align: center; }

.macro-value {
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font-mono);
}

.macro-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.macro-why {
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-style: italic;
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: var(--bg-hover);
  border-radius: var(--radius);
}

/* ---- Mobility Prescription ---- */
.mobility-rx {
  margin-top: 0.75rem;
  padding: 0.75rem;
  background: rgba(188, 140, 255, 0.08);
  border: 1px solid rgba(188, 140, 255, 0.2);
  border-radius: var(--radius);
}

.mobility-rx-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--purple);
  margin-bottom: 0.35rem;
}

.mobility-rx-list {
  font-size: 0.78rem;
  color: var(--text-secondary);
  list-style: none;
}

.mobility-rx-list li {
  padding: 0.15rem 0;
}

.mobility-rx-list li::before {
  content: "\2192 ";
  color: var(--purple);
}

/* ---- Planned vs Actual Table ---- */
.status-hit { color: var(--green); }
.status-miss { color: var(--red); }
.status-partial { color: var(--yellow); }
.status-extra { color: var(--accent); }

/* ---- Coach Analysis ---- */
.coach-box {
  padding: 1rem 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.coach-box p {
  font-size: 0.87rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.coach-box p:last-child { margin-bottom: 0; }

.coach-box strong { color: var(--text-primary); }

.coach-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 0.5rem;
}

/* ---- Week Targets Summary ---- */
.target-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}

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

.target-name {
  font-weight: 600;
  font-size: 0.87rem;
}

.target-values {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.target-current {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.9rem;
}

.target-goal {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---- Exercise Library ---- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  align-items: center;
}

.filter-btn {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font-sans);
}

.filter-btn:hover {
  border-color: var(--border-accent);
  color: var(--text-primary);
  background: var(--bg-hover);
}

.filter-btn.active {
  background: var(--accent-glow);
  border-color: var(--accent);
  color: var(--accent);
}

.search-box {
  flex: 1;
  min-width: 200px;
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-primary);
  font-size: 0.87rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.15s;
}

.search-box::placeholder { color: var(--text-muted); }
.search-box:focus { border-color: var(--accent); }

.exercise-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.exercise-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s;
}

.exercise-card:hover { border-color: var(--border-accent); }

.exercise-card[data-category] { } /* JS filtering hook */

.ex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}

.ex-header:hover { background: var(--bg-hover); }

.ex-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.ex-tags {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.ex-tag {
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.ex-tag-muscle { background: rgba(63, 185, 80, 0.12); color: var(--green); }
.ex-tag-split { background: rgba(88, 166, 255, 0.12); color: var(--accent); }
.ex-tag-type { background: rgba(188, 140, 255, 0.12); color: var(--purple); }

.ex-toggle {
  font-size: 1.1rem;
  color: var(--text-muted);
  transition: transform 0.2s;
  user-select: none;
}

.exercise-card.open .ex-toggle { transform: rotate(180deg); }

.ex-body {
  display: none;
  padding: 1rem;
}

.exercise-card.open .ex-body { display: block; }

.ex-section {
  margin-bottom: 0.85rem;
}

.ex-section:last-child { margin-bottom: 0; }

.ex-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.ex-prescription {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}

.ex-rx-item { text-align: center; }

.ex-rx-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
}

.ex-rx-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  text-transform: uppercase;
}

.ex-cue-list {
  list-style: none;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.ex-cue-list li {
  padding: 0.2rem 0;
  padding-left: 1rem;
  position: relative;
}

.ex-cue-list li::before {
  content: "\2022";
  position: absolute;
  left: 0;
  color: var(--text-muted);
}

.ex-cue-list.mistakes li::before {
  content: "\2716";
  color: var(--red);
}

.ex-breathing {
  padding: 0.65rem 0.85rem;
  background: rgba(63, 185, 80, 0.06);
  border: 1px solid rgba(63, 185, 80, 0.15);
  border-radius: var(--radius);
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.ex-breathing strong { color: var(--green); }

.ex-tempo {
  padding: 0.65rem 0.85rem;
  background: rgba(88, 166, 255, 0.06);
  border: 1px solid rgba(88, 166, 255, 0.15);
  border-radius: var(--radius);
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-family: var(--font-mono);
}

.ex-video {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.75rem;
  border-radius: var(--radius);
  background: var(--red-dim);
  color: var(--red);
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: none;
  transition: opacity 0.15s;
}

.ex-video:hover { opacity: 0.8; }

.ex-why {
  padding: 0.65rem 0.85rem;
  background: var(--bg-hover);
  border-radius: var(--radius);
  font-size: 0.84rem;
  color: var(--text-secondary);
  font-style: italic;
  border-left: 3px solid var(--accent);
}

/* ---- Section Divider ---- */
.section-divider {
  font-size: 1rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 0.75rem 0;
  margin: 1.5rem 0 1rem;
  border-bottom: 2px solid var(--border);
}

/* ---- Collapsible routine ---- */
.routine-group {
  margin-bottom: 1.5rem;
}

.routine-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.alert-info {
  background: var(--accent-glow);
  border: 1px solid rgba(88, 166, 255, 0.3);
  color: var(--accent);
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ---- Body Map ---- */
.bodymap-layout {
  display: grid;
  grid-template-columns: 1fr 1.4fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.bodymap-figure {
  text-align: center;
}

.bodymap-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.bodymap-svg {
  width: 100%;
  max-width: 260px;
  height: auto;
}

/* Split-day color coding for muscle regions */
.muscle-region {
  cursor: pointer;
  stroke-width: 1;
  transition: fill 0.2s, stroke 0.2s, filter 0.2s;
}

/* Default fills by split — always visible */
.muscle-region[data-split="legs"] {
  fill: rgba(88, 166, 255, 0.18);
  stroke: rgba(88, 166, 255, 0.35);
}
.muscle-region[data-split="back-biceps"] {
  fill: rgba(63, 185, 80, 0.18);
  stroke: rgba(63, 185, 80, 0.35);
}
.muscle-region[data-split="chest-triceps"] {
  fill: rgba(188, 140, 255, 0.18);
  stroke: rgba(188, 140, 255, 0.35);
}
.muscle-region[data-split="shoulders-abs"] {
  fill: rgba(210, 153, 34, 0.18);
  stroke: rgba(210, 153, 34, 0.35);
}

/* Hover — brighter fill */
.muscle-region[data-split="legs"]:hover {
  fill: rgba(88, 166, 255, 0.4);
  stroke: var(--accent);
  stroke-width: 1.5;
}
.muscle-region[data-split="back-biceps"]:hover {
  fill: rgba(63, 185, 80, 0.4);
  stroke: var(--green);
  stroke-width: 1.5;
}
.muscle-region[data-split="chest-triceps"]:hover {
  fill: rgba(188, 140, 255, 0.4);
  stroke: var(--purple);
  stroke-width: 1.5;
}
.muscle-region[data-split="shoulders-abs"]:hover {
  fill: rgba(210, 153, 34, 0.4);
  stroke: var(--yellow);
  stroke-width: 1.5;
}

/* Active — strong fill + glow */
.muscle-region.active[data-split="legs"] {
  fill: rgba(88, 166, 255, 0.55);
  stroke: var(--accent);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(88, 166, 255, 0.5));
}
.muscle-region.active[data-split="back-biceps"] {
  fill: rgba(63, 185, 80, 0.55);
  stroke: var(--green);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(63, 185, 80, 0.5));
}
.muscle-region.active[data-split="chest-triceps"] {
  fill: rgba(188, 140, 255, 0.55);
  stroke: var(--purple);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(188, 140, 255, 0.5));
}
.muscle-region.active[data-split="shoulders-abs"] {
  fill: rgba(210, 153, 34, 0.55);
  stroke: var(--yellow);
  stroke-width: 2;
  filter: drop-shadow(0 0 8px rgba(210, 153, 34, 0.5));
}

.muscle-label {
  font-size: 7px;
  font-weight: 700;
  fill: var(--text-secondary);
  text-anchor: middle;
  pointer-events: none;
  font-family: var(--font-sans);
  letter-spacing: 0.04em;
  opacity: 0.85;
}

/* Split legend inline with SVGs */
.bodymap-legend {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.bodymap-legend-item {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.bodymap-legend-swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.bodymap-legend-swatch.swatch-legs { background: rgba(88, 166, 255, 0.5); }
.bodymap-legend-swatch.swatch-back { background: rgba(63, 185, 80, 0.5); }
.bodymap-legend-swatch.swatch-chest { background: rgba(188, 140, 255, 0.5); }
.bodymap-legend-swatch.swatch-shoulders { background: rgba(210, 153, 34, 0.5); }

.bodymap-info {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  min-height: 200px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 60px;
}

.bodymap-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 180px;
  text-align: center;
  color: var(--text-secondary);
}

.bodymap-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.bodymap-muscle-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.bodymap-detail-section {
  margin-bottom: 1rem;
}

.bodymap-detail-section:last-child {
  margin-bottom: 0;
}

.bodymap-exercise-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.bodymap-exercise-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.65rem;
  background: var(--bg-hover);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text-primary);
  transition: background 0.15s, border-color 0.15s;
  border: 1px solid transparent;
}

.bodymap-exercise-item:hover {
  background: var(--accent-glow);
  border-color: rgba(88, 166, 255, 0.2);
}

.bodymap-ex-name {
  font-weight: 600;
  font-size: 0.87rem;
}

.bodymap-ex-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-align: right;
}

.bodymap-stretch-item {
  font-size: 0.84rem;
  color: var(--text-secondary);
  padding: 0.2rem 0;
}

.bodymap-notes {
  font-size: 0.84rem;
  color: var(--text-secondary);
  line-height: 1.55;
  padding: 0.65rem 0.85rem;
  background: var(--bg-hover);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

/* Collapsible reference table */
.collapsible-toggle {
  cursor: pointer;
  user-select: none;
}

.collapsible-toggle .toggle-icon {
  transition: transform 0.2s;
  display: inline-block;
  font-size: 0.85rem;
  margin-left: 0.35rem;
  color: var(--text-muted);
}

.collapsible-toggle.open .toggle-icon {
  transform: rotate(180deg);
}

.collapsible-content {
  display: none;
}

.collapsible-content.open {
  display: block;
}

/* ---- HR Zone Bars ---- */
.zone-bar { display: flex; height: 20px; border-radius: 4px; overflow: hidden; }
.zone-segment { transition: width 0.3s; min-width: 1px; }
.zone-z1 { background: var(--text-muted); }
.zone-z2 { background: var(--green); }
.zone-z3 { background: var(--yellow); }
.zone-z4 { background: var(--orange); }
.zone-z5 { background: var(--red); }
.zone-legend { display: flex; gap: 0.75rem; flex-wrap: wrap; margin-top: 0.35rem; }
.zone-legend-item { display: flex; align-items: center; gap: 0.25rem; font-size: 0.72rem; font-family: var(--font-mono); color: var(--text-muted); }
.zone-legend-swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* ---- Expandable Feed Detail ---- */
.feed-item-expandable { cursor: pointer; border-radius: var(--radius); transition: background 0.15s; }
.feed-item-expandable:hover { background: var(--bg-hover); }
.feed-detail-panel { display: none; padding: 0.75rem 0 0.75rem 2.75rem; border-bottom: 1px solid var(--border); }
.feed-detail-panel.open { display: block; }
.feed-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* ---- Effort Badge ---- */
.badge-effort { background: rgba(188, 140, 255, 0.15); color: var(--purple); font-family: var(--font-mono); }

/* ---- Run/Walk Ratio ---- */
.rw-bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; margin-top: 0.35rem; }
.rw-run { background: var(--green); }
.rw-walk { background: var(--yellow); }
.rw-label { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); margin-top: 0.2rem; }

/* ---- Pace Splits ---- */
.pace-splits { width: 100%; }
.pace-splits td { padding: 0.2rem 0.5rem; font-size: 0.78rem; font-family: var(--font-mono); border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.pace-splits .pace-bar-cell { width: 50%; }
.pace-bar { height: 16px; border-radius: 3px; background: var(--accent); opacity: 0.7; transition: width 0.3s; }

/* ---- Weekly Trends ---- */
.trends-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.trends-chart { display: flex; align-items: flex-end; gap: 3px; height: 100px; position: relative; }
.trend-col { flex: 1; display: flex; flex-direction: column; align-items: center; position: relative; }
.trend-bar { width: 100%; border-radius: 3px 3px 0 0; transition: height 0.3s; min-height: 2px; }
.trend-bar.accent { background: var(--accent); }
.trend-bar.green { background: var(--green); }
.trend-bar.orange { background: var(--orange); }
.trend-label { font-size: 0.58rem; color: var(--text-muted); font-family: var(--font-mono); margin-top: 0.25rem; white-space: nowrap; }
.trend-value { font-size: 0.62rem; color: var(--text-secondary); font-family: var(--font-mono); margin-bottom: 0.15rem; }
.trends-title { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-secondary); margin-bottom: 0.5rem; }

/* ---- Route Map (routes.html) ---- */
.route-map { height: 350px; border-radius: var(--radius-lg); overflow: hidden; border: 1px solid var(--border); }
.route-map-sm { height: 200px; }
.route-list-item { display: flex; align-items: center; gap: 1rem; padding: 0.75rem; border-bottom: 1px solid var(--border); cursor: pointer; border-radius: var(--radius); transition: background 0.15s; }
.route-list-item:hover { background: var(--bg-hover); }
.route-list-item.active { background: var(--accent-glow); border-color: var(--accent); }
.route-stats { display: flex; gap: 1rem; font-size: 0.78rem; font-family: var(--font-mono); color: var(--text-muted); }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; text-align: center; }
  .profile-stats { justify-content: center; flex-wrap: wrap; }
  .nav { flex-wrap: nowrap; gap: 0.5rem; }
  .nav-links { display: none; }
  .nav-meta { display: none; }
  .day-macros { grid-template-columns: repeat(2, 1fr); }
  .ex-prescription { grid-template-columns: 1fr; }
  .filter-bar { gap: 0.35rem; }
  .bodymap-layout {
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
  }
  .bodymap-layout .bodymap-info {
    grid-column: 1 / -1;
    order: 3;
    position: static;
  }
  .bodymap-svg { max-width: 200px; }
  .bodymap-legend { gap: 0.5rem; }
  .bodymap-ex-detail { display: none; }
  .feed-detail-grid { grid-template-columns: 1fr; }
  .trends-grid { grid-template-columns: 1fr; }
  .trends-chart { height: 70px; }
  .route-map { height: 250px; }
}

@media (max-width: 480px) {
  html { font-size: 14px; }
  .container { padding: 1rem; }
  .heatmap { gap: 2px; }
}
