/* Health page — TheLab */

.health-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.health-grid-2.no-gap { margin-bottom: 0; gap: 12px; }

.health-widget {
  padding: 20px;
  display: flex;
  flex-direction: column;
}

/* Top area — big number + chips */
.hw-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.hw-big {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hw-big .big-num {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.hw-big .big-unit {
  font-size: 14px;
  color: var(--muted);
  font-weight: 400;
}
.hw-big .big-label {
  font-size: 12px;
  color: var(--dim);
  margin-top: 2px;
}
.hw-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: flex-start;
}
.hw-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.hw-chip .chip-val {
  font-weight: 700;
  color: var(--text);
}
.hw-chip.chip-green  { border-color: rgba(16,185,129,.4); }
.hw-chip.chip-green .chip-val { color: var(--green); }
.hw-chip.chip-red    { border-color: rgba(239,68,68,.4); }
.hw-chip.chip-red .chip-val { color: var(--red); }
.hw-chip.chip-purple { border-color: rgba(124,58,237,.4); }
.hw-chip.chip-purple .chip-val { color: var(--purple); }
.hw-chip.chip-blue   { border-color: rgba(59,130,246,.4); }
.hw-chip.chip-blue .chip-val { color: var(--blue); }
.hw-chip.chip-teal   { border-color: rgba(6,182,212,.4); }
.hw-chip.chip-teal .chip-val { color: var(--teal); }
.hw-chip.chip-gold   { border-color: rgba(245,158,11,.4); }
.hw-chip.chip-gold .chip-val { color: var(--gold); }

/* Chart wrappers */
.hw-chart-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
}
.hw-chart-wrap canvas {
  max-height: 240px;
  width: 100% !important;
}
.hw-chart-sm canvas {
  max-height: 200px;
}

/* Sleep top row */
.sleep-top-row {
  display: flex;
  gap: 24px;
  margin-bottom: 16px;
  align-items: flex-start;
  flex-wrap: wrap;
}
.sleep-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sleep-summary .big-num {
  font-size: 36px;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
}
.sleep-summary .big-label {
  font-size: 12px;
  color: var(--dim);
}
.sleep-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Rating badges */
.rating-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.rating-excellent { background: rgba(16,185,129,.15); color: #34d399; }
.rating-good      { background: rgba(59,130,246,.15); color: #60a5fa; }
.rating-fair      { background: rgba(245,158,11,.15); color: #fbbf24; }
.rating-poor      { background: rgba(239,68,68,.15);  color: #f87171; }

/* Status pill for training */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.status-productive   { background: rgba(16,185,129,.15); color: #34d399; }
.status-maintaining  { background: rgba(59,130,246,.15); color: #60a5fa; }
.status-recovery     { background: rgba(245,158,11,.15); color: #fbbf24; }
.status-detraining   { background: rgba(239,68,68,.15);  color: #f87171; }
.status-unproductive { background: rgba(239,68,68,.15);  color: #f87171; }
.status-no-status    { background: rgba(100,116,139,.15); color: #94a3b8; }

/* Mini stat blocks */
.mini-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}
.mini-stat {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  min-width: 100px;
  flex: 1;
}
.mini-stat .ms-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.mini-stat .ms-val {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
}
.mini-stat .ms-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

/* Responsive */
@media (max-width: 900px) {
  .health-grid-2 { grid-template-columns: 1fr; }
  .sleep-top-row { flex-direction: column; }
}
@media (max-width: 600px) {
  .hw-top { flex-direction: column; }
  .hw-big .big-num { font-size: 28px; }
  .mini-stats { flex-direction: column; }
}

/* ── Body tab v2 (Job 3) ─────────────────────────────────────────── */
.body-v2 { padding-top: 12px; padding-bottom: var(--content-pad-bottom); }
.body-v2 .section-tabs { margin-bottom: 18px; }

.body-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 12px;
  position: relative;
}
.body-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.body-card-title {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: var(--w-semi);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0;
}
.body-card-eyebrow {
  font-size: 11px;
  font-weight: var(--w-semi);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.body-card-eyebrow.is-up   { color: var(--success); }
.body-card-eyebrow.is-down { color: var(--danger); }

/* Bodyweight card */
.bw-hero {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr);
  gap: 16px;
  align-items: center;
}
.bw-current {
  font-family: var(--font-display);
  font-size: 40px;
  font-weight: var(--w-semi);
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1;
}
.bw-current-num { font-variant-numeric: tabular-nums; }
.bw-current-unit {
  font-size: 14px; color: var(--text-2); margin-left: 6px;
  font-weight: var(--w-medium); letter-spacing: 0.02em;
}
.bw-sparkline-wrap { height: 60px; position: relative; }
.bw-sparkline-wrap canvas { max-height: 60px; }
.bw-fab {
  position: absolute;
  right: 16px; bottom: 16px;
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  border: none;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4), 0 0 0 1px rgba(255,255,255,0.06);
  transition: background var(--d-fast), transform var(--d-fast);
}
.bw-fab:hover  { background: var(--accent-strong); }
.bw-fab:active { transform: translateY(1px); }
.bw-fab i { line-height: 1; }

/* Bottom sheets */
.bw-sheet, .muscle-drill-sheet {
  display: none; position: fixed; inset: 0; z-index: 5200;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  align-items: flex-end; justify-content: center;
}
.bw-sheet.open, .muscle-drill-sheet.open { display: flex; animation: fadeIn var(--dur-2) var(--ease); }
.bw-sheet-box, .muscle-drill-box {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-radius: 20px 20px 0 0;
  width: 100%; max-width: 560px;
  padding: 16px 18px calc(28px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 36px rgba(0,0,0,0.6);
  animation: slideUp var(--d-base) var(--ease);
}
.bw-sheet-handle {
  width: 40px; height: 4px;
  margin: 0 auto 14px;
  background: var(--text-3);
  border-radius: 2px;
  opacity: 0.4;
}
.bw-sheet h3, .muscle-drill-box h3 {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: var(--w-semi);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
  margin: 0 0 14px;
}
.bw-form { display: flex; flex-direction: column; gap: 10px; }
.bw-form-row { display: flex; flex-direction: column; gap: 4px; }
.bw-form-lbl {
  font-size: 11px;
  font-weight: var(--w-semi);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-3);
}
.bw-form input {
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 15px;
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
}
.bw-form input:focus { outline: none; border-color: var(--accent); }
.bw-form-save {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  margin-top: 6px;
  padding: 14px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: var(--w-semi);
}
.bw-form-status {
  text-align: center;
  font-size: 12px;
  color: var(--text-2);
  min-height: 1em;
}

/* Heatmap card */
.body-flip-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-2);
  font-size: 11px;
  font-weight: var(--w-semi);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color var(--d-fast), color var(--d-fast);
}
.body-flip-btn:hover { border-color: var(--accent); color: var(--accent); }
.body-flip-btn i { font-size: 13px; }
.body-heatmap-figure {
  display: flex; justify-content: center;
  margin: 8px 0 14px;
  min-height: 320px;
}
.body-heatmap-figure .muscle-svg {
  width: 100%; max-width: 280px; height: auto;
}
.body-heatmap-help {
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
  margin: 0;
  letter-spacing: 0.02em;
}

/* Muscle drill-down */
.muscle-drill-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.drill-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--d-fast);
}
.drill-row:hover { border-color: var(--accent); }
.drill-row-left { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.drill-row-name { font-size: 14px; font-weight: var(--w-semi); }
.drill-row-sub { font-size: 11px; color: var(--text-3); }
.drill-row-right { text-align: right; display: flex; flex-direction: column; gap: 4px; align-items: flex-end; }
.drill-row-rm {
  font-size: 14px; font-weight: var(--w-semi); color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.drill-empty {
  padding: 16px; text-align: center; color: var(--text-2); font-size: 13px;
}

/* Rank chip */
.rank-chip {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: var(--w-semi);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
}

/* Lifts table */
.lifts-table { display: flex; flex-direction: column; gap: 2px; }
.lifts-head, .lifts-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) 64px minmax(72px, auto) 44px 88px;
  gap: 8px;
  align-items: center;
  padding: 12px 4px;
  border-bottom: 1px solid var(--border);
}
.lifts-head { padding-top: 6px; padding-bottom: 8px; }
.lifts-head-cell {
  font-size: 10px;
  font-weight: var(--w-semi);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-3);
}
.lifts-row {
  text-decoration: none;
  color: var(--text);
  transition: background var(--d-fast);
}
.lifts-row:hover { background: rgba(255,255,255,0.02); }
.lifts-row:last-child { border-bottom: none; }
.lifts-cell { font-size: 13px; font-variant-numeric: tabular-nums; }
.lifts-cell-name {
  font-weight: var(--w-semi);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lifts-cell-rm { color: var(--accent); font-weight: var(--w-semi); }
.lifts-cell-last, .lifts-cell-pr { color: var(--text-3); font-size: 11px; }
.lifts-empty { padding: 20px; text-align: center; color: var(--text-2); font-size: 13px; }

/* Coach */
.body-coach-body { font-size: 14px; color: var(--text); line-height: 1.55; }
.body-coach-body p { margin: 0 0 12px; }
.body-coach-body h1, .body-coach-body h2, .body-coach-body h3 {
  font-family: var(--font-display);
  font-weight: var(--w-semi);
  letter-spacing: -0.01em;
  margin: 16px 0 8px;
  color: var(--text);
}
.body-coach-body h1 { font-size: 18px; }
.body-coach-body h2 { font-size: 16px; }
.body-coach-body h3 { font-size: 14px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.06em; }
.body-coach-body ul, .body-coach-body ol { margin: 0 0 12px 18px; }
.body-coach-body li { margin-bottom: 4px; }
.body-coach-body code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
}
.body-coach-body pre {
  background: var(--surface-2);
  padding: 12px;
  border-radius: 8px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 12px;
}
.body-coach-body a { color: var(--accent); }
.coach-article + .coach-article {
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.coach-article-title {
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: var(--w-semi);
  color: var(--text);
  margin: 0 0 10px;
  letter-spacing: -0.01em;
}
.coach-empty { padding: 12px 0; }
.coach-empty-headline {
  font-size: 14px; font-weight: var(--w-semi); color: var(--text); margin-bottom: 6px;
}
.coach-empty-hint {
  font-size: 12px; color: var(--text-2); line-height: 1.5;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
