/* ── Reset & Base ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-base:     #0D1117;
  --bg-surface:  #161B22;
  --bg-elevated: #1C2333;
  --border:      rgba(255,255,255,0.08);
  --border-med:  rgba(255,255,255,0.14);
  --accent:      #5B8AF0;
  --accent-dim:  rgba(91,138,240,0.15);
  --accent-glow: rgba(91,138,240,0.30);
  --green:       #4CAF50;
  --orange:      #FF9800;
  --red:         #EF5350;
  --purple:      #9C27B0;
  --teal:        #00BCD4;
  --text-1:      #E6EDF3;
  --text-2:      #8B949E;
  --text-3:      #484F58;
  --radius-sm:   8px;
  --radius-md:   14px;
  --radius-lg:   20px;
  --radius-pill: 999px;
  --nav-h:       72px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  background: var(--bg-base);
  color: var(--text-1);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', sans-serif;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

/* ── App Shell ───────────────────────────────────────────────────────── */
#app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* ── Screens ─────────────────────────────────────────────────────────── */
.screens {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.screen {
  position: absolute;
  inset: 0;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* ── Bottom Navigation ───────────────────────────────────────────────── */
.bottom-nav {
  position: relative;
  z-index: 100;
  height: calc(var(--nav-h) + var(--safe-bottom));
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding-bottom: var(--safe-bottom);
  flex-shrink: 0;
}

.nav-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: color 0.2s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
  padding: 10px 0 0;
}
.nav-btn.active { color: var(--accent); }
.nav-btn:active { transform: scale(0.9); }

.nav-icon { font-size: 22px; line-height: 1; }
.nav-label { font-size: 10px; font-weight: 600; letter-spacing: 0.3px; }

/* ── Header ──────────────────────────────────────────────────────────── */
.page-header {
  padding: 56px 20px 20px;
  background: linear-gradient(180deg, #0D1B2A 0%, var(--bg-base) 100%);
  position: sticky;
  top: 0;
  z-index: 10;
}
.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-1);
}
.page-header p {
  font-size: 13px;
  color: var(--text-2);
  margin-top: 3px;
}

/* ── Cards ───────────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.card + .card { margin-top: 0; }

/* ── Sections ────────────────────────────────────────────────────────── */
.section {
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.section + .section { margin-top: 10px; }

/* ── Pill / Badge ────────────────────────────────────────────────────── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 600;
}
.pill-accent  { background: var(--accent-dim); color: var(--accent); }
.pill-green   { background: rgba(76,175,80,.15); color: var(--green); }
.pill-orange  { background: rgba(255,152,0,.15); color: var(--orange); }
.pill-red     { background: rgba(239,83,80,.15); color: var(--red); }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer; font-weight: 600; border-radius: var(--radius-md);
  transition: opacity 0.15s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: 0.8; transform: scale(0.97); }
.btn-primary { background: var(--accent); color: #fff; padding: 14px 20px; font-size: 15px; width: 100%; }
.btn-outline {
  background: transparent;
  border: 1px solid var(--border-med);
  color: var(--text-1);
  padding: 12px 20px; font-size: 14px;
}
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: var(--radius-sm); }
.btn-icon {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-1);
  padding: 10px;
  border-radius: var(--radius-sm);
  font-size: 18px;
  line-height: 1;
}

/* ── Progress bar ────────────────────────────────────────────────────── */
.progress-track {
  height: 6px; border-radius: var(--radius-pill);
  background: var(--bg-elevated); overflow: hidden;
}
.progress-fill {
  height: 100%; border-radius: var(--radius-pill);
  background: var(--accent);
  transition: width 0.5s cubic-bezier(.4,0,.2,1);
}

/* ── Input ───────────────────────────────────────────────────────────── */
input, select, textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-md);
  color: var(--text-1);
  font-size: 15px;
  padding: 12px 14px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
}
input:focus, select:focus { border-color: var(--accent); }
::placeholder { color: var(--text-3); }

label { font-size: 13px; color: var(--text-2); font-weight: 500; display: block; margin-bottom: 6px; }

/* ── Divider ─────────────────────────────────────────────────────────── */
hr { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ── Modal / Sheet ───────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.7);
  display: flex; align-items: flex-end;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s;
}
.overlay.open { opacity: 1; pointer-events: auto; }

.sheet {
  background: var(--bg-surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 12px 20px 32px;
  width: 100%;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(.4,0,.2,1);
}
.overlay.open .sheet { transform: translateY(0); }

.sheet-handle {
  width: 40px; height: 4px;
  background: var(--border-med);
  border-radius: var(--radius-pill);
  margin: 0 auto 16px;
}
.sheet-title { font-size: 17px; font-weight: 700; margin-bottom: 16px; }

/* ── Toast ───────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: calc(var(--nav-h) + var(--safe-bottom) + 12px);
  left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-elevated);
  border: 1px solid var(--border-med);
  color: var(--text-1);
  border-radius: var(--radius-pill);
  padding: 10px 20px;
  font-size: 14px; font-weight: 500;
  white-space: nowrap;
  z-index: 300;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ══════════════════════════════════════════════════════════════════════ */
/*  DASHBOARD                                                             */
/* ══════════════════════════════════════════════════════════════════════ */
.hero {
  padding: 56px 20px 24px;
  background: linear-gradient(160deg, #0D1B2A 0%, #1A1F3C 100%);
}
.hero-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,0.12);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700; color: #fff;
  cursor: pointer;
}
.hero-greeting { font-size: 24px; font-weight: 700; color: #fff; }
.hero-sub { font-size: 13px; color: rgba(255,255,255,0.55); margin-top: 3px; }

.stat-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 12px; border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.18);
  font-size: 13px; font-weight: 600; color: #fff;
}

.hero-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 18px; }
.hero-row { display: flex; gap: 8px; }
.btn-hero-sec {
  flex: 1; background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff; border-radius: var(--radius-md);
  padding: 12px 10px; font-size: 13px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: opacity 0.15s; -webkit-tap-highlight-color: transparent;
}
.btn-hero-sec:active { opacity: 0.7; }

/* Quick stats row */
.quick-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.qs-card {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer;
}
.qs-icon { font-size: 20px; }
.qs-val { font-size: 17px; font-weight: 700; color: var(--text-1); }
.qs-lbl { font-size: 11px; color: var(--text-2); }

/* Today card */
.today-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px 16px;
}
.today-info h3 { font-size: 15px; font-weight: 600; color: var(--text-1); }
.today-info p  { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.week-dots { display: flex; gap: 5px; align-items: center; }
.dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--border-med);
  transition: background 0.3s;
}
.dot.done { background: var(--accent); }

/* Insight card */
.insight-card {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  background: rgba(91,138,240,0.07);
  border: 1px solid rgba(91,138,240,0.2);
}
.insight-icon { font-size: 22px; }
.insight-text { font-size: 13px; color: var(--text-2); line-height: 1.5; flex: 1; }

/* Recent workout */
.recent-card {
  display: flex; align-items: center; gap: 12px;
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 12px 14px; cursor: pointer;
}
.recent-icon {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--accent-dim); display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.recent-info { flex: 1; }
.recent-info strong { font-size: 14px; font-weight: 600; }
.recent-info span { font-size: 12px; color: var(--text-2); display: block; margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════════════ */
/*  QUICK LOG                                                             */
/* ══════════════════════════════════════════════════════════════════════ */
.exercise-picker-area {
  display: flex; flex-direction: column; gap: 8px;
}
.ex-search { position: relative; }
.ex-search input { padding-left: 38px; }
.ex-search::before {
  content: '🔍'; position: absolute; left: 12px; top: 50%;
  transform: translateY(-50%); font-size: 14px;
}

.ex-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.ex-chip {
  padding: 6px 12px; border-radius: var(--radius-pill);
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 13px; color: var(--text-2); cursor: pointer;
  transition: all 0.15s; white-space: nowrap;
}
.ex-chip.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.exercise-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.ex-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: var(--radius-md);
  background: var(--bg-elevated); border: 1px solid var(--border);
  cursor: pointer; transition: border-color 0.15s;
}
.ex-item:active { border-color: var(--accent); }
.ex-item-icon {
  width: 32px; height: 32px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
}
.ex-item-name { font-size: 14px; font-weight: 500; }
.ex-item-cat  { font-size: 11px; color: var(--text-2); }
.ex-cat-badge { display:inline-block; font-size:10px; font-weight:600; padding:1px 7px; border-radius:20px; margin-top:3px; letter-spacing:.2px; }

/* Sets table */
.sets-header {
  display: grid; grid-template-columns: 32px 1fr 1fr 1fr 36px;
  gap: 6px; align-items: center;
  padding: 0 4px;
  font-size: 11px; font-weight: 600; color: var(--text-2); text-align: center;
  margin-bottom: 6px;
}
.set-row {
  display: grid; grid-template-columns: 32px 1fr 1fr 1fr 36px;
  gap: 6px; align-items: center; margin-bottom: 6px;
}
.set-num {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--bg-elevated); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-2); flex-shrink: 0;
}
.set-num.done { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }
.set-input {
  padding: 9px 8px; font-size: 15px; text-align: center;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}
.set-input:focus { border-color: var(--accent); }
.btn-del { background: none; border: none; font-size: 18px; cursor: pointer; opacity: 0.5; }
.btn-del:active { opacity: 1; }

.current-exercise-name {
  font-size: 18px; font-weight: 700; color: var(--text-1);
  margin-bottom: 4px;
}
.current-exercise-meta { font-size: 12px; color: var(--text-2); }

/* Rest timer in log */
.rest-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(0,188,212,.10); border: 1px solid rgba(0,188,212,.25);
  border-radius: var(--radius-md); padding: 10px 14px;
}
.rest-banner span { font-size: 14px; font-weight: 600; color: var(--teal); }

/* ══════════════════════════════════════════════════════════════════════ */
/*  PROGRESS                                                              */
/* ══════════════════════════════════════════════════════════════════════ */
.period-tabs {
  display: flex; gap: 6px;
}
.period-tab {
  flex: 1; padding: 8px; border-radius: var(--radius-sm);
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-2);
  cursor: pointer; text-align: center; transition: all 0.15s;
}
.period-tab.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.stat-tile {
  background: var(--bg-surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 14px;
}
.stat-tile .val { font-size: 24px; font-weight: 800; color: var(--text-1); }
.stat-tile .lbl { font-size: 12px; color: var(--text-2); margin-top: 3px; }
.stat-tile .sub { font-size: 11px; color: var(--text-3); margin-top: 6px; }

/* Mini bar chart */
.mini-chart {
  display: flex; align-items: flex-end; gap: 4px;
  height: 60px;
}
.mini-bar {
  flex: 1; background: var(--accent); opacity: 0.4;
  border-radius: 3px 3px 0 0; min-height: 3px;
  transition: height 0.4s ease;
}
.mini-bar.today { opacity: 1; }

/* Record rows */
.record-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.record-row:last-child { border-bottom: none; }
.record-rank { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.record-info { flex: 1; }
.record-info strong { font-size: 14px; }
.record-info span { font-size: 12px; color: var(--text-2); display: block; }
.record-val { font-size: 16px; font-weight: 700; color: var(--accent); }

/* Weight chart canvas */
#weightChart { width: 100%; height: 140px; display: block; }

/* ══════════════════════════════════════════════════════════════════════ */
/*  WATER / NUTRITION                                                     */
/* ══════════════════════════════════════════════════════════════════════ */
.water-glass-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 12px 0 8px;
}
.water-glass-svg {
  width: 160px; height: 220px;
}
.water-ml {
  font-size: 40px; font-weight: 800; color: var(--text-1);
  margin-top: -8px;
}
.water-goal { font-size: 14px; color: var(--text-2); }

.add-water-row {
  display: flex; gap: 6px; flex-wrap: wrap; justify-content: center;
}
.add-water-btn {
  padding: 9px 14px; border-radius: var(--radius-pill);
  background: var(--bg-elevated); border: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--teal);
  cursor: pointer; transition: all 0.15s; -webkit-tap-highlight-color: transparent;
}
.add-water-btn:active { transform: scale(0.93); }

/* Meal list */
.meal-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.meal-row:last-child { border-bottom: none; }
.meal-name { font-size: 14px; font-weight: 500; }
.meal-kcal { font-size: 14px; font-weight: 700; color: var(--accent); }
.meal-macros { font-size: 11px; color: var(--text-2); margin-top: 2px; }

.macro-row {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 8px;
  margin-top: 4px;
}
.macro-chip {
  text-align: center; padding: 8px 4px;
  background: var(--bg-elevated); border-radius: var(--radius-sm);
}
.macro-chip .mv { font-size: 16px; font-weight: 700; }
.macro-chip .ml { font-size: 10px; color: var(--text-2); margin-top: 2px; }

/* ══════════════════════════════════════════════════════════════════════ */
/*  PROFILE                                                               */
/* ══════════════════════════════════════════════════════════════════════ */
.profile-hero {
  padding: 56px 20px 24px;
  background: linear-gradient(160deg,#0D1B2A 0%,var(--bg-base) 100%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.profile-avatar {
  width: 80px; height: 80px; border-radius: 50%;
  background: var(--accent-dim); border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 700; color: var(--accent);
}
.profile-name { font-size: 20px; font-weight: 700; }
.profile-meta { font-size: 13px; color: var(--text-2); }

.settings-list { display: flex; flex-direction: column; }
.settings-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  cursor: pointer; -webkit-tap-highlight-color: transparent;
  transition: background 0.15s;
}
.settings-row:active { background: var(--bg-elevated); }
.settings-row:last-child { border-bottom: none; }
.settings-row-icon { font-size: 20px; width: 28px; text-align: center; }
.settings-row-info { flex: 1; }
.settings-row-info strong { font-size: 15px; display: block; }
.settings-row-info span { font-size: 12px; color: var(--text-2); margin-top: 1px; display: block; }
.settings-row-arrow { color: var(--text-3); font-size: 16px; }

/* Toggle switch */
.toggle {
  width: 44px; height: 26px; border-radius: 13px;
  background: var(--border-med); position: relative; cursor: pointer;
  transition: background 0.2s; flex-shrink: 0;
}
.toggle.on { background: var(--accent); }
.toggle::after {
  content: ''; position: absolute;
  width: 20px; height: 20px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px;
  transition: transform 0.2s;
}
.toggle.on::after { transform: translateX(18px); }

/* ══════════════════════════════════════════════════════════════════════ */
/*  INSTALL BANNER                                                        */
/* ══════════════════════════════════════════════════════════════════════ */
#install-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 400;
  background: var(--accent); color: #fff;
  padding: 14px 20px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; font-size: 13px; font-weight: 600;
  transform: translateY(-100%); transition: transform 0.3s;
}
#install-banner.show { transform: translateY(0); }
#install-banner button {
  background: rgba(255,255,255,0.25); border: none; color: #fff;
  padding: 6px 14px; border-radius: var(--radius-pill);
  font-weight: 700; cursor: pointer; font-size: 13px;
}

/* ── Utilities ───────────────────────────────────────────────────────── */
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.gap-8 { gap: 8px; }
.flex  { display: flex; }
.flex-1 { flex: 1; }
.col   { flex-direction: column; }
.row   { flex-direction: row; }
.center { align-items: center; justify-content: center; }
.between { justify-content: space-between; }
.items-center { align-items: center; }
.font-bold { font-weight: 700; }
.text-sm { font-size: 13px; }
.text-xs { font-size: 11px; }
.text-2 { color: var(--text-2); }
.text-accent { color: var(--accent); }
.w-full { width: 100%; }

/* ── History rows ────────────────────────────────────────────────────── */
.history-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s; -webkit-tap-highlight-color: transparent;
}
.history-row:last-child { border-bottom: none; }
.history-row:active { background: var(--bg-elevated); }
.history-icon {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  background: var(--accent-dim); display: flex; align-items: center;
  justify-content: center; font-size: 16px; flex-shrink: 0;
}
.history-info { flex: 1; }
.history-info strong { font-size: 14px; font-weight: 600; display: block; }
.history-info span { font-size: 12px; color: var(--text-2); }

/* ── Set prev hint ───────────────────────────────────────────────────── */
.set-prev-hint {
  position: absolute; top: 2px; right: 6px;
  font-size: 9px; color: var(--text-3); font-weight: 600;
  pointer-events: none;
}

/* ── Scrollbar ───────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 0; height: 0; }

/* ── Animations ──────────────────────────────────────────────────────── */
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-in { animation: fadeSlideUp 0.3s ease forwards; }

@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
.pulse { animation: pulse 2s infinite; }

/* ── TDEE result ─────────────────────────────────────────────────────── */
.tdee-result-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-med);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 0;
}
.tdee-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--border);
}
.tdee-row:last-child { border-bottom: none; }
.tdee-label { font-size: 13px; color: var(--text-2); }
.tdee-value { font-size: 16px; font-weight: 700; color: var(--text-1); }

/* ── Achievements grid ───────────────────────────────────────────────── */
.ach-grid {
  display: grid; grid-template-columns: repeat(3,1fr); gap: 10px;
}
.ach-card {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 8px;
  text-align: center; transition: border-color .2s;
}
.ach-card.unlocked { border-color: rgba(91,138,240,.4); background: rgba(91,138,240,.07); }
.ach-card.locked { opacity: 0.45; }
.ach-icon { font-size: 28px; margin-bottom: 6px; }
.ach-name { font-size: 11px; font-weight: 600; color: var(--text-1); line-height: 1.3; }
.ach-hint { font-size: 10px; color: var(--text-3); margin-top: 3px; }

/* ── Measurements ────────────────────────────────────────────────────── */
.meas-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.meas-row:last-child { border-bottom: none; }
.meas-label { font-size: 14px; color: var(--text-2); }
.meas-val { font-size: 16px; font-weight: 700; color: var(--text-1); }
.meas-diff-up { color: var(--green); font-size: 11px; margin-left: 4px; }
.meas-diff-down { color: var(--red); font-size: 11px; margin-left: 4px; }

/* ── Sleep chart ─────────────────────────────────────────────────────── */
.mini-chart {
  display: flex; align-items: flex-end; gap: 6px; height: 60px;
}
.mini-bar {
  flex: 1; border-radius: 4px 4px 0 0; min-height: 4px;
  background: var(--accent-dim); transition: height .3s;
}
.mini-bar.today { background: var(--accent); }
.mini-bar.warn   { background: var(--orange); }
.mini-bar.bad    { background: var(--red); }

/* Rest timer preset buttons */
.rest-preset-btn { background: var(--elevated); color: var(--text-dim); border: 1px solid var(--border); border-radius: 8px; padding: 3px 9px; font-size: 11px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s; }
.rest-preset-active { background: rgba(79,195,247,0.18) !important; color: var(--teal) !important; border-color: var(--teal) !important; }

/* ── Filter chips ────────────────────────────────────────────────────── */
.chip {
  flex-shrink: 0; padding: 6px 14px; border-radius: 20px; font-size: 12px;
  font-weight: 600; border: 1px solid var(--border); background: var(--bg-elevated);
  color: var(--text-2); cursor: pointer; transition: background .18s, color .18s, border-color .18s;
  white-space: nowrap;
}
.chip-active {
  background: rgba(79,195,247,0.15); color: var(--teal); border-color: var(--teal);
}
