:root {
  --bg: #0f1115;
  --surface: #181c24;
  --surface-2: #1f242e;
  --border: #2a3140;
  --text: #e6e9ef;
  --muted: #8a93a4;
  --accent: #5ac8fa;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --shadow: 0 4px 16px rgba(0,0,0,0.35);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
  /* Prevent any element from causing horizontal page scroll/zoom */
  overflow-x: hidden;
  /* Lock iOS Safari font scaling */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

/* Disable iOS double-tap zoom on buttons / links / inputs (still allows
   normal taps; just kills the 300ms zoom-on-double-tap). */
button, a, input, select, textarea, [role="button"] {
  touch-action: manipulation;
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: max(env(safe-area-inset-top), 16px) 16px max(env(safe-area-inset-bottom), 16px);
}

.hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.hero > div:first-child { min-width: 0; flex: 1 1 auto; }
.hero h1 {
  margin: 0 0 4px;
  font-size: 20px;
  letter-spacing: -0.01em;
  line-height: 1.2;
  white-space: normal;
  word-break: keep-all;
  overflow-wrap: break-word;
}
.muted { color: var(--muted); font-size: 13px; margin: 0; }

.hero-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  max-width: 100%;
  padding: 2px 0;
}
.hero-actions::-webkit-scrollbar { display: none; }
.hero-actions button {
  flex-shrink: 0;
}

button { font-family: inherit; }
.ghost {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
}
.ghost:active { transform: translateY(1px); }

.primary {
  background: linear-gradient(135deg, var(--accent), #3aa6d0);
  color: #001827;
  border: 1px solid rgba(90,200,250,0.5);
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity 0.15s;
}
.primary:disabled { opacity: 0.55; cursor: not-allowed; }
.primary:active:not(:disabled) { transform: translateY(1px); }
.primary .btn-icon { font-size: 15px; line-height: 1; }

.status-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.status-pill.hidden { display: none; }
.status-pill.good { border-color: rgba(52,211,153,0.4); color: var(--good); }
.status-pill.bad { border-color: rgba(248,113,113,0.4); color: var(--bad); }
.status-pill .spin {
  display: inline-block;
  width: 12px; height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-msg { color: var(--muted); padding: 32px 16px; text-align: center; }
.error-msg {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.35);
  color: var(--bad);
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 14px;
}

/* ====== Today card ====== */
.today {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}
.today-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 14px;
}
.today-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.01em; }
.today-date { color: var(--muted); font-size: 13px; }

/* ====== Hero scores (Recovery / Strain / Sleep) ====== */
.hero-scores {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.hero-score {
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 12px;
  text-align: center;
}
.hero-score::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(255,255,255,0.02), transparent 60%);
  pointer-events: none;
}
.hero-score.good { border-color: rgba(52,211,153,0.5); }
.hero-score.warn { border-color: rgba(251,191,36,0.5); }
.hero-score.bad  { border-color: rgba(248,113,113,0.5); }
.hero-score-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}
.hero-score-value {
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.hero-score.good .hero-score-value { color: var(--good); }
.hero-score.warn .hero-score-value { color: var(--warn); }
.hero-score.bad  .hero-score-value { color: var(--bad); }
.hero-score-unit { font-size: 16px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.hero-score-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hero-score .info-btn { position: absolute; top: 6px; right: 6px; }
.hero-info-btn.open {
  background: var(--accent) !important;
  color: #001827 !important;
  border-color: var(--accent) !important;
}

/* Shared info panel under the 3 hero scores */
.hero-info-panel {
  margin: -4px 0 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: slidedown 0.2s ease;
}
.hero-info-panel[hidden] { display: none; }
.hero-info-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
  letter-spacing: -0.01em;
}
@keyframes slidedown {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Info panel internal layout (used by both hero panel and metric inline) */
.info-section { margin-bottom: 10px; }
.info-section:last-of-type { margin-bottom: 0; }
.info-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 3px;
}
.info-text {
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.info-text.pre { white-space: pre-wrap; }
.info-whoop {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* Day navigation header */
.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}
.day-nav-label {
  flex: 1;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.nav-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 18px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Make recent rows act like buttons */
.recent button.recent-row {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s;
}
.recent button.recent-row:hover {
  background: var(--surface-2);
}
.recent button.recent-row.selected {
  background: rgba(90,200,250,0.08);
  box-shadow: inset 3px 0 0 var(--accent);
}

/* ====== Metric grid ====== */
.metrics {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.metric {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
}
.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}
.metric .label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.metric .value { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.metric .unit  { color: var(--muted); font-size: 13px; font-weight: 500; margin-left: 4px; }
.metric .sub   { color: var(--muted); font-size: 12px; }

.metric.good .value { color: var(--good); }
.metric.warn .value { color: var(--warn); }
.metric.bad  .value { color: var(--bad); }

@media (min-width: 480px) {
  .metrics { grid-template-columns: repeat(3, 1fr); }
}

/* ====== Info button (the small "i" on each metric) ====== */
.info-btn {
  width: 18px; height: 18px;
  min-width: 18px;
  border-radius: 50%;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--border);
  font-size: 10px;
  font-weight: 700;
  font-style: italic;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: all 0.15s;
}
.info-btn:hover { color: var(--accent); border-color: var(--accent); }
.info-btn.open { background: var(--accent); color: #001827; border-color: var(--accent); }

.metric-info {
  margin-top: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text);
}

/* ====== AI Coach Notes ====== */
.coach {
  margin-top: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(90,200,250,0.08), rgba(90,200,250,0.02));
  border: 1px solid rgba(90,200,250,0.25);
  border-radius: 12px;
}
.coach h3 {
  margin: 0 0 8px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
}
.coach .body { white-space: pre-wrap; font-size: 15px; line-height: 1.55; }

/* AI Coach v2 — section cards with colored accents */
.coach.coach-v2 {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 14px 14px 8px;
}
.coach-v2 .coach-head { margin-bottom: 6px; }
.coach-sections {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 4px;
}
.coach-section {
  border: 1px solid var(--border);
  border-left-width: 3px;
  border-radius: 8px;
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.coach-section-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  padding: 10px 12px;
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  letter-spacing: 0.01em;
  font-family: inherit;
}
.coach-section-head:hover { background: rgba(255,255,255,0.03); }
.coach-section-title { flex: 1; min-width: 0; }
.coach-section-chevron {
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.2s ease;
  margin-left: 8px;
}
.coach-section.collapsed .coach-section-chevron { transform: rotate(-90deg); }
.coach-section.collapsed .coach-section-body { display: none; }
.coach-section-body {
  padding: 0 14px 12px 14px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text);
}
.coach-section-body p { margin: 0 0 8px; }
.coach-section-body p:last-child { margin-bottom: 0; }
.coach-section-body ul { margin: 4px 0 8px; padding-left: 18px; }
.coach-section-body li { margin: 3px 0; }
.coach-section-body li::marker { color: var(--muted); }
.coach-section-body strong { color: var(--text); font-weight: 700; }

/* Themed accents per section type */
.coach-section-read    { border-left-color: #5ac8fa; }
.coach-section-pattern { border-left-color: #a855f7; }
.coach-section-plan    { border-left-color: #fbbf24; background: linear-gradient(135deg, rgba(251,191,36,0.05), var(--surface-2)); }
.coach-section-lifting { border-left-color: #34d399; }
.coach-section-nutrition { border-left-color: #fb923c; }
.coach-section-supplement { border-left-color: #c084fc; }
.coach-section-swap    { border-left-color: #f472b6; }
.coach-section-default { border-left-color: var(--accent); }
.coach-section-plan .coach-section-title { color: #fbbf24; }
.coach-section-plan .coach-section-body strong { color: #fcd34d; }

.workout-summary {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--surface-2);
  border-radius: 10px;
  font-size: 14px;
}
.workout-summary .label {
  color: var(--muted); font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 4px;
}

/* ====== Recent list ====== */
.section-title {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 22px 4px 10px;
}
.section-title h2 { margin: 0; font-size: 16px; letter-spacing: -0.01em; }
.section-title .muted { font-size: 12px; }

.recent {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.recent-row {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
.recent-row:last-child { border-bottom: none; }
.recent-row .date { font-weight: 600; font-size: 14px; }
.recent-row .date .dow { display: block; color: var(--muted); font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; }
.recent-row .pills {
  display: flex; flex-wrap: wrap; gap: 6px;
  font-size: 12px; color: var(--muted);
}
.recent-row .pill {
  background: var(--surface-2);
  border-radius: 6px;
  padding: 2px 6px;
}
.recent-row .pill strong { color: var(--text); font-weight: 600; }
.recent-row .score {
  font-size: 13px; font-weight: 600;
  padding: 4px 8px; border-radius: 6px;
  background: var(--surface-2);
  color: var(--muted);
  min-width: 36px; text-align: center;
}
.recent-row .score.good { color: var(--good); }
.recent-row .score.warn { color: var(--warn); }
.recent-row .score.bad  { color: var(--bad); }

/* ====== Trends ====== */
.trends {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 18px;
}
.trends h2 { margin: 0 0 10px; font-size: 16px; letter-spacing: -0.01em; }
.trend-row {
  display: grid; grid-template-columns: 1fr auto auto;
  align-items: baseline; gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.trend-row:last-child { border-bottom: none; }
.trend-row .label { color: var(--muted); font-size: 13px; }
.trend-row .value { font-weight: 600; }
.trend-row .delta { font-size: 12px; }
.trend-row .delta.up { color: var(--good); }
.trend-row .delta.down { color: var(--bad); }
.trend-row .delta.flat { color: var(--muted); }

.footnote { margin-top: 22px; padding: 14px; text-align: center; }

/* ====== Glossary modal ====== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}
.modal.hidden { display: none; }
.modal-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body {
  overflow-y: auto;
  padding: 16px;
}
.help-entry {
  padding-bottom: 14px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--border);
}
.help-entry:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.help-entry h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: var(--accent);
}
.help-entry p {
  margin: 4px 0;
  font-size: 13px;
  line-height: 1.55;
}
.help-entry p strong { color: var(--text); }
.help-entry .whoop { font-size: 12px; }

/* ====== Workout plan card ====== */
.workout-plan {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
}
.workout-plan.good { border-left-color: var(--good); }
.workout-plan.warn { border-left-color: var(--warn); }
.workout-plan.bad  { border-left-color: var(--bad); }
.workout-plan h3 {
  margin: 0 0 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.workout-plan .plan-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}
.workout-plan ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.6; }
.workout-plan li { margin: 4px 0; }

/* ====== Workout Readiness card ====== */
.readiness-card {
  margin-bottom: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-left: 4px solid var(--accent);
  border-radius: 12px;
}
.readiness-good { border-left-color: var(--good); background: linear-gradient(180deg, rgba(70,200,120,0.06), var(--surface-2)); }
.readiness-warn { border-left-color: var(--warn); background: linear-gradient(180deg, rgba(240,180,60,0.06), var(--surface-2)); }
.readiness-bad  { border-left-color: var(--bad);  background: linear-gradient(180deg, rgba(255,80,80,0.06), var(--surface-2)); }
.readiness-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.readiness-headline { display: flex; align-items: center; gap: 12px; min-width: 0; }
.readiness-emoji { font-size: 28px; line-height: 1; }
.readiness-label {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
}
.readiness-good .readiness-label { color: #6ce69b; }
.readiness-warn .readiness-label { color: #ffcc66; }
.readiness-bad  .readiness-label { color: #ff7a7a; }
.readiness-sub {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}
.readiness-score {
  display: flex;
  align-items: baseline;
  gap: 2px;
  flex-shrink: 0;
}
.readiness-score-num {
  font-size: 32px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.readiness-good .readiness-score-num { color: #6ce69b; }
.readiness-warn .readiness-score-num { color: #ffcc66; }
.readiness-bad  .readiness-score-num { color: #ff7a7a; }
.readiness-score-out { font-size: 13px; color: var(--muted); font-weight: 600; }
.readiness-block-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
  margin: 10px 0 6px;
}
.rdy-reasons, .rdy-advice {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.rdy-reason {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  padding-left: 0;
}
.rdy-reason-icon {
  font-weight: 800;
  flex-shrink: 0;
  width: 14px;
}
.rdy-tone-good .rdy-reason-icon { color: #6ce69b; }
.rdy-tone-warn .rdy-reason-icon { color: #ffcc66; }
.rdy-tone-bad  .rdy-reason-icon { color: #ff7a7a; }
.rdy-advice li {
  font-size: 13px;
  line-height: 1.45;
  padding-left: 14px;
  position: relative;
}
.rdy-advice li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
}
.readiness-eta {
  margin-top: 12px;
  padding: 8px 10px;
  background: rgba(91, 134, 229, 0.10);
  border: 1px solid rgba(91, 134, 229, 0.30);
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--text);
}

/* ====== Log strip ====== */
.log-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-radius: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.log-strip-pills {
  display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px;
}
.log-pill {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 4px 10px;
}
.log-open-btn { font-size: 13px; padding: 6px 10px; }

/* ====== Log modal form ====== */
.log-form {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.log-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--muted);
}
.log-form input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.log-form input:focus {
  outline: none;
  border-color: var(--accent);
}
.log-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
}
.log-status { font-size: 13px; }

/* ====== Coach card with chat button ====== */
.coach-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.coach-head h3 { margin: 0; }
.coach.coach-empty {
  border-style: dashed;
  border-color: rgba(90, 200, 250, 0.35);
  background: linear-gradient(135deg, rgba(90,200,250,0.06), rgba(90,200,250,0.01));
}
.chat-open-btn { font-size: 12px; padding: 5px 10px; }

/* ====== Charts ====== */
.charts {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-top: 18px;
}
.charts h2 { margin: 0 0 12px; font-size: 16px; }
.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 600px) {
  .chart-grid { grid-template-columns: repeat(3, 1fr); }
}
.chart-card {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 12px;
}
.chart-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 4px;
}
.chart-title { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.chart-now { font-size: 14px; font-weight: 700; }
.chart-card canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 50px;
  margin: 4px 0;
  /* Canvas's intrinsic width attribute is overridden in JS to match rendered size */
}
.chart-card { min-width: 0; overflow: hidden; }
.chart-grid { min-width: 0; }
.chart-foot {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
}
.chart-foot .up   { color: var(--good); }
.chart-foot .down { color: var(--bad); }
.chart-foot .up.inv  { color: var(--bad); }
.chart-foot .down.inv { color: var(--good); }
.chart-empty { font-size: 12px; color: var(--muted); padding: 10px 0; }

/* Latest workout card */
.latest-workout {
  margin-top: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(251,191,36,0.06), rgba(251,191,36,0.02));
  border: 1px solid rgba(251,191,36,0.25);
  border-radius: 12px;
}
.lw-head { margin-bottom: 12px; }
.lw-head h3 { margin: 0 0 4px; font-size: 16px; }
.lw-head p { margin: 0; }
.lift-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lift-row {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 2px 12px;
  padding: 8px 0;
  border-top: 1px solid var(--border);
  align-items: baseline;
}
.lift-row:first-child { border-top: none; padding-top: 0; }
.lift-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.lift-top {
  font-size: 14px;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}
.lift-sets {
  grid-column: 1 / -1;
  font-size: 11px;
  color: var(--muted);
}
.lift-muscle {
  display: inline-block;
  background: var(--surface-2);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 10px;
  font-weight: 600;
  color: var(--muted);
  text-transform: lowercase;
  margin-left: 6px;
}
.lift-up   { color: var(--good); font-size: 12px; font-weight: 600; margin-left: 6px; }
.lift-down { color: var(--bad); font-size: 12px; font-weight: 600; margin-left: 6px; }
.lift-same { color: var(--muted); font-size: 12px; margin-left: 6px; }
.lift-new  { color: var(--accent); font-size: 12px; font-weight: 600; margin-left: 6px; }

.lift-row.clickable, .chart-card.clickable { cursor: pointer; }
.lift-row.clickable:hover { background: var(--surface-2); border-radius: 6px; }
.chart-card.clickable:hover { border: 1px solid var(--accent); background: var(--surface); }

/* Weekly volume per muscle group */
.weekly-volume {
  margin-top: 16px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.wv-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.wv-head h3 { margin: 0; font-size: 16px; }
.wv-head .muted { font-size: 11px; }
.vol-rows { display: flex; flex-direction: column; gap: 6px; }
.vol-row {
  display: grid;
  grid-template-columns: 90px 1fr 60px 80px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  padding: 4px 0;
}
.vol-label { font-weight: 600; }
.vol-bar-wrap { position: relative; }
.vol-bar-track {
  position: relative;
  height: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  overflow: hidden;
}
.vol-bar-zone {
  position: absolute;
  top: 0; bottom: 0;
  background: rgba(52, 211, 153, 0.18);
  pointer-events: none;
}
.vol-bar-fill {
  position: absolute;
  top: 0; bottom: 0; left: 0;
  border-radius: 4px;
}
.vol-bar-fill.good { background: var(--good); }
.vol-bar-fill.warn { background: var(--warn); }
.vol-bar-fill.bad  { background: var(--bad); }
.vol-sets { text-align: right; font-size: 13px; }
.vol-sets strong { color: var(--text); font-weight: 700; }
.vol-status { font-size: 11px; text-align: right; text-transform: lowercase; }
.vol-row.good .vol-status { color: var(--good); }
.vol-row.warn .vol-status { color: var(--warn); }
.vol-row.bad  .vol-status { color: var(--bad); }

@media (max-width: 480px) {
  .vol-row { grid-template-columns: 75px 1fr 50px 60px; gap: 6px; font-size: 11px; }
  .vol-label { font-size: 12px; }

  /* Profile modal: stack the form pairs on narrow screens so labels and
     inputs always fit edge-to-edge without overlap */
  .profile-grid { grid-template-columns: 1fr; }
  .profile-grid label.span-2 { grid-column: auto; }
  .profile-modal-card { width: calc(100vw - 16px); }
  .profile-modal-card .modal-body { padding: 14px 12px; }
  .profile-section { padding: 12px 10px; }

  /* Header: keep title + actions on the same logical row; stack actions
     below on really narrow screens so nothing overflows */
  .hero { flex-direction: column; align-items: stretch; gap: 8px; }
  .hero h1 { font-size: 18px; }
  .hero h1, .muted { white-space: normal; }
  #lastUpdated { font-size: 12px; }
  .hero-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 6px;
  }
  .hero-actions .primary {
    padding: 8px 10px;
    font-size: 14px;
  }
  .hero-actions .ghost {
    padding: 8px 10px;
    font-size: 15px;
  }
  /* On very narrow screens, hide the "Fetch new" text so the ⚡ icon alone
     fits the row alongside the 5 other action buttons. */
  .hero-actions .btn-label { display: none; }
  .hero-actions .primary { padding: 8px 11px; font-size: 16px; }
  /* App padding — give content breathing room without horizontal overflow */
  #app { padding-left: 12px; padding-right: 12px; }
}

/* Per-lift history modal */
.lift-modal-card {
  max-width: 600px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
}
.lift-history-body { padding: 16px; }
.lift-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.lift-stat {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}
.lift-stat .muted { font-size: 11px; }
.lift-stat-val { font-size: 18px; font-weight: 700; color: var(--text); }
.lift-chart {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 14px;
}
.lift-chart-row {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  margin-bottom: 6px;
}
.lift-chart-row .muted { color: var(--muted); }
.lift-chart-now { font-weight: 700; color: var(--text); }
.lift-chart canvas { width: 100%; height: 80px; display: block; }

.lift-sessions { display: flex; flex-direction: column; gap: 10px; }
.lift-session {
  background: var(--surface-2);
  border-radius: 8px;
  padding: 12px;
}
.lift-session.is-pr {
  border: 1px solid rgba(251, 191, 36, 0.4);
}
.lift-session-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}
.lift-session-date {
  font-weight: 700;
  font-size: 14px;
}
.lift-session-top {
  font-weight: 700;
  font-size: 14px;
  color: var(--accent);
}
.lift-session-title { font-size: 11px; margin-bottom: 8px; }
.pr-badge {
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(251, 191, 36, 0.15);
  border-radius: 4px;
  color: var(--warn);
}

.set-list { display: flex; flex-direction: column; gap: 4px; }
.set-row {
  display: grid;
  grid-template-columns: 24px 1fr auto auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  padding: 4px 8px;
  background: var(--surface);
  border-radius: 4px;
}
.set-row.warmup { opacity: 0.5; }
.set-num {
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}
.set-vals { font-weight: 600; }
.set-rpe { font-size: 11px; color: var(--muted); }
.set-tag { font-size: 10px; }

/* Post-workout debrief card */
.workout-debrief {
  margin-top: 16px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(251,191,36,0.10), rgba(251,191,36,0.02));
  border: 1px solid rgba(251,191,36,0.35);
  border-radius: 12px;
}
.debrief-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.debrief-head h3 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -0.01em;
}
.debrief-head .muted { font-size: 11px; }
.debrief-body {
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
}
.debrief-body strong {
  color: var(--warn);
  display: inline-block;
  margin-top: 6px;
}

/* PRs card */
.prs-card {
  margin-top: 12px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(251,191,36,0.04));
  border: 1px solid rgba(251,191,36,0.4);
  border-radius: 10px;
}
.prs-head h3 { margin: 0 0 6px; font-size: 15px; color: var(--warn); }
.prs-body { font-size: 13px; line-height: 1.55; }

/* HR Zones card */
.hr-zones-card {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.hr-zones-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 12px;
}
.hr-zones-head h3 { margin: 0; font-size: 16px; }
.hr-zones-head .muted { font-size: 11px; }
.zone-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.zone-row {
  display: grid;
  grid-template-columns: 90px 1fr 70px;
  gap: 10px;
  align-items: center;
  font-size: 12px;
}
.zone-label { white-space: nowrap; }
.zone-label strong { display: inline-block; min-width: 24px; }
.zone-bar {
  background: var(--surface-2);
  height: 10px;
  border-radius: 5px;
  overflow: hidden;
}
.zone-fill { height: 100%; }
.zone-min { text-align: right; font-weight: 600; font-size: 13px; }

.vigorous-progress {
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.vigorous-progress .muted { font-size: 11px; margin-bottom: 6px; }
.vig-bar {
  background: var(--surface-2);
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 6px;
}
.vig-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--good));
}
.vig-text { font-size: 12px; color: var(--muted); }
.vig-text strong { color: var(--text); }

/* Coach Memory modal */
.memory-intro {
  margin: 0 0 14px;
  font-size: 13px;
  line-height: 1.5;
}
.memory-add-form {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  align-items: stretch;
}
.memory-add-form input {
  flex: 1;
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.memory-add-form select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 8px;
  color: var(--text);
  font-size: 16px;
}
.memory-add-form button { font-size: 12px; padding: 6px 12px; }
.memory-list {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 50vh;
  overflow-y: auto;
}
.memory-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  background: var(--surface-2);
  border-radius: 8px;
}
.memory-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 600;
  white-space: nowrap;
}
.memory-tag.tag-training  { color: var(--accent); border: 1px solid rgba(90,200,250,0.3); }
.memory-tag.tag-health    { color: var(--bad);    border: 1px solid rgba(248,113,113,0.3); }
.memory-tag.tag-nutrition { color: var(--good);   border: 1px solid rgba(52,211,153,0.3); }
.memory-tag.tag-goals     { color: #c084fc;        border: 1px solid rgba(192,132,252,0.3); }
.memory-tag.tag-lifestyle { color: var(--muted);   border: 1px solid var(--border); }
.memory-fact {
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
}
.memory-archive {
  font-size: 12px;
  padding: 4px 8px;
  opacity: 0.7;
}
.memory-archive:hover { opacity: 1; color: var(--bad); }

/* Workout logger modal */
.log-workout-card {
  max-width: 600px;
  width: calc(100vw - 24px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.log-workout-card .modal-body {
  overflow-y: auto;
  padding: 14px 12px;
  box-sizing: border-box;
}
.log-workout-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.log-workout-foot .primary { padding: 10px 18px; font-size: 14px; }
.log-workout-status { font-size: 12px; }
.log-ex {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 12px 10px;
  margin-bottom: 12px;
  box-sizing: border-box;
}
.log-ex-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.log-ex-name {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
}
.log-ex-rest {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
}
.log-ex-rest button {
  padding: 2px 6px;
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  cursor: pointer;
}
.log-ex-rest button:hover { border-color: var(--accent); }
.log-ex-rest-val { font-weight: 700; color: var(--text); min-width: 30px; text-align: center; }
.log-sets-table {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.log-sets-header,
.log-set-row {
  display: grid;
  grid-template-columns: 20px 60px minmax(0, 1fr) minmax(0, 1fr) 40px 28px 20px;
  gap: 3px;
  align-items: center;
}
.log-set-prev {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  padding: 6px 2px;
  border-radius: 5px;
  background: rgba(255,255,255,0.03);
  border: 1px dashed rgba(255,255,255,0.08);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.log-set-prev:hover { background: rgba(91,134,229,0.12); border-color: var(--accent); color: var(--text); }
.log-set-prev.empty { opacity: 0.35; cursor: default; }
.log-set-prev.empty:hover { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.08); color: var(--muted); }
.log-sets-header {
  font-size: 9px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0 2px;
  margin-bottom: 4px;
  text-align: center;
}
.log-set-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-align: center;
}
.log-input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 4px;
  /* 16px prevents iOS Safari from auto-zooming on focus */
  font-size: 16px;
  color: var(--text);
  text-align: center;
  font-family: inherit;
  -moz-appearance: textfield;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.log-input::-webkit-outer-spin-button,
.log-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.log-input:focus { outline: none; border-color: var(--accent); }
.log-set-done {
  padding: 6px 0;
  font-size: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.log-set-done:hover { border-color: var(--accent); }
.log-set-done.done {
  background: rgba(46, 204, 113, 0.15);
  border-color: rgba(46, 204, 113, 0.5);
  color: var(--good);
}
.log-set-remove {
  padding: 4px 2px;
  font-size: 12px;
  opacity: 0.4;
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  width: 100%;
  min-width: 0;
}
.log-set-remove:hover { opacity: 1; color: var(--bad); }
.log-add-set { width: 100%; font-size: 12px; padding: 6px 10px; }
.log-set-row.warmup { opacity: 0.6; }
.log-set-row.done .log-input {
  opacity: 0.6;
  background: var(--surface-2);
}

/* Sticky rest timer at top of log-workout modal body */
.rest-timer {
  position: sticky;
  top: -14px;
  z-index: 5;
  margin: -14px -12px 12px;
  padding: 10px 14px;
  background: linear-gradient(135deg, rgba(91, 134, 229, 0.25), rgba(91, 134, 229, 0.12));
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rest-timer.hidden { display: none; }
.rest-timer.expiring { background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(245, 158, 11, 0.15)); }
.rest-timer.done { background: linear-gradient(135deg, rgba(46, 204, 113, 0.35), rgba(46, 204, 113, 0.18)); }
.rest-timer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rest-time {
  font-size: 28px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--text);
}
.rest-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.rest-actions { display: flex; gap: 6px; }
.rest-btn {
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
.rest-btn:hover { background: rgba(255, 255, 255, 0.15); }
.rest-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
}
.rest-progress-fill {
  height: 100%;
  background: var(--accent);
  width: 100%;
  transition: width 0.9s linear, background 0.3s ease;
}
.rest-timer.expiring .rest-progress-fill { background: #f59e0b; }
.rest-timer.done .rest-progress-fill { background: var(--good); }

/* Exercise header substitute button */
.log-ex-sub {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
.log-ex-sub:hover { border-color: var(--accent); color: var(--accent); }
.log-ex-swap {
  display: inline-block;
  margin-left: 8px;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 600;
  background: rgba(91, 134, 229, 0.18);
  border: 1px solid rgba(91, 134, 229, 0.35);
  border-radius: 4px;
  color: var(--accent);
  vertical-align: middle;
}
.log-ex-video {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
.log-ex-video:hover { border-color: var(--accent); color: var(--accent); }
.log-ex-savedef {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(46, 204, 113, 0.15);
  border: 1px solid rgba(46, 204, 113, 0.4);
  border-radius: 6px;
  color: var(--good);
  cursor: pointer;
}
.log-ex-savedef:hover { background: rgba(46, 204, 113, 0.25); border-color: var(--good); }
.log-ex-savedef:disabled { opacity: 0.6; cursor: default; }
.log-ex-saved {
  display: inline-block;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(46, 204, 113, 0.18);
  color: var(--good);
  border-radius: 6px;
}

/* Workout duration timer badge in modal header */
.log-workout-head { display: flex; align-items: center; gap: 10px; }
.log-workout-head h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workout-timer-badge {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
  padding: 6px 10px;
  background: rgba(91, 134, 229, 0.18);
  border: 1px solid rgba(91, 134, 229, 0.4);
  border-radius: 8px;
  color: var(--accent);
  letter-spacing: 0.02em;
  flex-shrink: 0;
}
.workout-timer-badge.hidden { display: none; }

/* Per-exercise notes */
.log-ex-notes-btn {
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  cursor: pointer;
}
.log-ex-notes-btn:hover { border-color: var(--accent); color: var(--accent); }
.log-ex-notes-btn.active {
  background: rgba(91, 134, 229, 0.2);
  border-color: var(--accent);
  color: var(--accent);
}
.log-ex-notes-wrap {
  margin-top: 8px;
  margin-bottom: 8px;
}
.log-ex-notes-wrap.hidden { display: none; }
.log-ex-notes-input {
  width: 100%;
  min-height: 60px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  resize: vertical;
  box-sizing: border-box;
}
.log-ex-notes-input:focus { outline: none; border-color: var(--accent); }
.log-ex-notes-input::placeholder { color: var(--muted); }

/* Substitute exercise modal */
.sub-modal-card {
  max-width: 560px;
  width: calc(100vw - 24px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.sub-search-row {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.sub-search-row input {
  width: 100%;
  padding: 10px 12px;
  font-size: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  box-sizing: border-box;
}
.sub-search-row input:focus { outline: none; border-color: var(--accent); }
#subModalBody {
  overflow-y: auto;
  padding: 12px 14px;
  flex: 1;
}
.sub-section-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 10px 0 6px;
  font-weight: 700;
}
.sub-section-head:first-child { margin-top: 0; }
.sub-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  margin-bottom: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.sub-item:hover { background: rgba(91, 134, 229, 0.1); border-color: var(--accent); }
.sub-item-name { font-size: 14px; font-weight: 600; color: var(--text); }
.sub-item-meta {
  font-size: 11px;
  color: var(--muted);
  text-transform: capitalize;
  white-space: nowrap;
}
.sub-item.current {
  border-color: var(--good);
  background: rgba(46, 204, 113, 0.08);
}
.sub-item.current::after { content: "current"; font-size: 10px; color: var(--good); margin-left: 6px; }
.sub-empty { padding: 30px 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* Form video modal */
.video-modal-card {
  max-width: 720px;
  width: calc(100vw - 24px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
#videoModalBody {
  overflow-y: auto;
  padding: 12px 14px;
  box-sizing: border-box;
}
.video-embed-wrap {
  position: relative;
  width: 100%;
  padding-top: 56.25%; /* 16:9 */
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 14px;
}
.video-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.video-alts {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.video-alt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
}
.video-alt:hover { border-color: var(--accent); background: rgba(91, 134, 229, 0.08); }
.video-alt img { width: 96px; height: 54px; border-radius: 5px; object-fit: cover; flex-shrink: 0; }
.video-alt-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.video-alt-title {
  font-size: 13px; font-weight: 600; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.video-alt-channel { font-size: 11px; color: var(--muted); }
.video-yt-link {
  display: inline-block;
  margin-top: 10px;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--bg);
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

/* Instant debrief view (replaces logger body after Save to Hevy) */
.debrief-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  padding: 60px 20px;
  gap: 14px;
  color: var(--text);
}
.debrief-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.debrief-body {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  padding: 6px 4px 20px;
}
.debrief-body p { margin: 0 0 10px; }
.debrief-body p strong {
  display: block;
  margin-top: 14px;
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.debrief-body p:first-child strong { margin-top: 0; }
.debrief-body ul { margin: 4px 0 12px; padding-left: 20px; }
.debrief-body li { margin: 4px 0; }
.debrief-error {
  padding: 30px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* 🍽️ Meal logger modal */
.meal-modal-card {
  max-width: 560px;
  width: calc(100vw - 24px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.meal-modal-card .modal-body {
  overflow-y: auto;
  padding: 14px 16px;
}
.meal-section-label {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  margin: 4px 0 6px;
}
.meal-text-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
  margin-bottom: 14px;
}
#mealText {
  flex: 1;
  min-height: 70px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  resize: vertical;
  box-sizing: border-box;
}
#mealText:focus { outline: none; border-color: var(--accent); }
#mealText::placeholder { color: var(--muted); }
.meal-photo-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.meal-photo-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.meal-photo-btn:hover { border-color: var(--accent); color: var(--accent); }
.meal-photo-preview-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}
.meal-photo-preview-wrap.hidden { display: none; }
.meal-photo-preview-wrap img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
}
.meal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}
.meal-parse-status {
  font-size: 12px;
}
.meal-review-summary {
  padding: 10px 12px;
  background: rgba(91, 134, 229, 0.08);
  border: 1px solid rgba(91, 134, 229, 0.25);
  border-radius: 8px;
  margin-bottom: 14px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
}
.meal-review-summary .summary-tag {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.meal-macro-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.meal-macro-cell {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 6px;
  text-align: center;
}
.meal-macro-cell label {
  display: block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 700;
}
.meal-macro-cell input {
  width: 100%;
  border: none;
  background: transparent;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  font-family: inherit;
  -moz-appearance: textfield;
  min-width: 0;
  box-sizing: border-box;
}
.meal-macro-cell input::-webkit-outer-spin-button,
.meal-macro-cell input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.meal-macro-cell input:focus { outline: none; color: var(--accent); }
.meal-review-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.meal-review-actions button { flex: 1; }
.meal-confidence {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-bottom: 8px;
}
.meal-confidence.confidence-high { color: var(--good); }
.meal-confidence.confidence-low { color: #f59e0b; }
.meal-notes-warn {
  font-size: 12px;
  padding: 8px 10px;
  background: rgba(245, 158, 11, 0.08);
  border-left: 3px solid #f59e0b;
  border-radius: 4px;
  color: var(--text);
  margin-bottom: 10px;
}

/* 👤 Profile modal */
.profile-modal-card {
  max-width: 560px;
  width: calc(100vw - 24px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.profile-modal-card .modal-body {
  overflow-y: auto;
  padding: 14px 16px;
}
.profile-intro { font-size: 12px; margin-bottom: 16px; }
.profile-section {
  margin-bottom: 18px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}
.profile-section-head {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 10px;
}
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.profile-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}
.profile-grid label.span-2 { grid-column: 1 / -1; }
.profile-grid input,
.profile-grid select {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  /* 16px so iOS Safari doesn't zoom on focus */
  font-size: 16px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  max-width: 100%;
  /* Strip native browser chrome (number spinners, date picker chevron position) */
  -webkit-appearance: none;
  -moz-appearance: textfield;
  appearance: none;
  /* Allow text inside to truncate cleanly instead of overflowing */
  text-overflow: ellipsis;
  overflow: hidden;
}
/* Custom chevron for select (since we removed native) */
.profile-grid select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' stroke='%238a93a4' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  padding-right: 32px;
}
.profile-grid input::-webkit-outer-spin-button,
.profile-grid input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.profile-grid input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(55%);
  cursor: pointer;
}
.profile-grid input:focus, .profile-grid select:focus { outline: none; border-color: var(--accent); }
.profile-grid input::placeholder { color: var(--muted); font-size: 12px; }

.profile-targets {
  background: linear-gradient(135deg, rgba(91, 134, 229, 0.12), rgba(91, 134, 229, 0.04));
  border-color: rgba(91, 134, 229, 0.35);
}
.prof-targets-content { font-size: 13px; line-height: 1.6; }
.prof-targets-content .prof-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.06);
}
.prof-targets-content .prof-row:last-of-type { border-bottom: none; }
.prof-targets-content .prof-row .label { color: var(--muted); }
.prof-targets-content .prof-row .value { color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.prof-targets-content .prof-row.headline { padding-top: 8px; margin-top: 4px; border-top: 1px solid rgba(255,255,255,0.1); border-bottom: none; }
.prof-targets-content .prof-row.headline .label { color: var(--text); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; }
.prof-targets-content .prof-row.headline .value { color: var(--accent); font-size: 16px; }
.prof-targets-content .prof-macro-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.prof-macro-tile {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px;
  text-align: center;
}
.prof-macro-tile .name { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 700; }
.prof-macro-tile .qty { font-size: 18px; font-weight: 800; color: var(--text); margin-top: 2px; }
.prof-macro-tile .cal { font-size: 10px; color: var(--muted); margin-top: 2px; }

.profile-actions { display: flex; align-items: center; gap: 10px; padding-top: 4px; }
.profile-actions .primary { font-size: 14px; }
.profile-save-status { font-size: 12px; }
.profile-preset-blurb { font-size: 12px; margin: 4px 0 0; text-transform: none; letter-spacing: normal; font-weight: 400; }

/* 📊 DEXA modal */
.dexa-modal-card {
  max-width: 640px;
  width: calc(100vw - 24px);
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}
.dexa-modal-card .modal-body {
  overflow-y: auto;
  padding: 14px 16px;
}
.dexa-intro { font-size: 12px; margin-bottom: 14px; }
.dexa-actions-row {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 10px 0 14px;
  flex-wrap: wrap;
}
.dexa-actions-row .primary { font-size: 14px; padding: 9px 16px; }
.dexa-actions-row .ghost { font-size: 13px; padding: 8px 12px; }
.dexa-section-head { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; color: var(--muted); margin: 16px 0 8px; }
.dexa-empty { padding: 30px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.dexa-list { display: flex; flex-direction: column; gap: 6px; }
.dexa-row {
  display: grid;
  grid-template-columns: 90px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.dexa-row-date { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.dexa-row-name { font-size: 14px; font-weight: 600; color: var(--text); }
.dexa-row-stats { font-size: 11px; margin-top: 2px; }
.dexa-row-actions { display: flex; gap: 2px; }
.dexa-row-actions button { padding: 6px 8px; font-size: 14px; background: transparent; border: 1px solid transparent; }
.dexa-row-actions button:hover { background: rgba(255,255,255,0.06); border-color: var(--border); }
.dexa-back-row { margin-bottom: 8px; }
.dexa-back-row button { font-size: 12px; padding: 5px 10px; }

.dexa-upload-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.dexa-file-name { font-size: 12px; }
.dexa-parse-status { font-size: 12px; margin-top: 6px; display: block; }
.dexa-file-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.dexa-file-list:empty { display: none; }
.dexa-file-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.dexa-file-item-num {
  font-size: 10px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  padding: 2px 8px;
  flex-shrink: 0;
}
.dexa-file-item-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.dexa-file-item-size { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.dexa-file-remove {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 14px;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
}
.dexa-file-remove:hover { background: rgba(255,80,80,0.12); color: var(--bad); border-color: rgba(255,80,80,0.3); }
.dexa-doc-links { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }

.dexa-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.dexa-form-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 700;
}
.dexa-form-grid label.span-2 { grid-column: 1 / -1; }
.dexa-form-grid input {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 500;
  box-sizing: border-box;
  min-width: 0;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
.dexa-form-grid input:focus { outline: none; border-color: var(--accent); }
.dexa-raw { margin-bottom: 12px; }
.dexa-raw summary { cursor: pointer; font-size: 12px; padding: 6px 0; }
.dexa-raw pre {
  background: var(--surface-2);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 11px;
  line-height: 1.4;
  overflow-x: auto;
  white-space: pre-wrap;
  color: var(--text);
}

.dexa-detail-head { margin: 4px 0 12px; font-size: 16px; }
.dexa-detail-head .muted { font-size: 12px; font-weight: 500; margin-left: 6px; }
.dexa-doc-link {
  display: inline-block;
  margin: 0 0 12px;
  padding: 8px 12px;
  background: rgba(91, 134, 229, 0.12);
  border: 1px solid rgba(91, 134, 229, 0.35);
  border-radius: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.dexa-doc-link:hover { background: rgba(91, 134, 229, 0.2); }
.dexa-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.dexa-stat {
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.dexa-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.dexa-stat-value { font-size: 16px; font-weight: 700; color: var(--text); margin-top: 2px; font-variant-numeric: tabular-nums; }
.dexa-stat.tone-good { border-color: rgba(70, 200, 120, 0.35); background: linear-gradient(180deg, rgba(70,200,120,0.10), rgba(70,200,120,0.04)); }
.dexa-stat.tone-good .dexa-stat-value { color: #6ce69b; }
.dexa-stat.tone-warn { border-color: rgba(240, 180, 60, 0.35); background: linear-gradient(180deg, rgba(240,180,60,0.10), rgba(240,180,60,0.04)); }
.dexa-stat.tone-warn .dexa-stat-value { color: #ffcc66; }
.dexa-stat.tone-bad { border-color: rgba(255, 80, 80, 0.40); background: linear-gradient(180deg, rgba(255,80,80,0.12), rgba(255,80,80,0.04)); }
.dexa-stat.tone-bad .dexa-stat-value { color: #ff7a7a; }

.dexa-delta-strip { margin: 10px 0 16px; }
.dexa-delta-head { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; margin-bottom: 6px; }
.dexa-delta-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(82px, 1fr));
  gap: 6px;
}
.dexa-delta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  min-width: 0;
}
.dexa-delta-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.dexa-delta-val { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.dexa-delta-good { border-color: rgba(70, 200, 120, 0.35); background: linear-gradient(180deg, rgba(70,200,120,0.10), rgba(70,200,120,0.03)); }
.dexa-delta-good .dexa-delta-val { color: #6ce69b; }
.dexa-delta-bad  { border-color: rgba(255, 80, 80, 0.35); background: linear-gradient(180deg, rgba(255,80,80,0.10), rgba(255,80,80,0.03)); }
.dexa-delta-bad  .dexa-delta-val { color: #ff7a7a; }
.dexa-delta-flat .dexa-delta-val { color: var(--muted); font-weight: 600; }

.dexa-chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-bottom: 14px; }
.dexa-chart-grid .chart-card { padding: 8px 10px; background: rgba(255,255,255,0.03); border-radius: 8px; border: 1px solid var(--border); }
.dexa-chart-grid .chart-card .chart-title { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 700; }
.dexa-chart-grid .chart-card .chart-now { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dexa-chart-grid .chart-card canvas { width: 100%; max-width: 100%; }
.dexa-chart-grid .chart-foot { display: flex; justify-content: space-between; font-size: 10px; margin-top: 2px; }
.dexa-chart-grid .chart-foot .up,
.dexa-chart-grid .chart-foot .down { font-weight: 700; font-variant-numeric: tabular-nums; }
.dexa-chart-grid .chart-foot .up { color: #6ce69b; }
.dexa-chart-grid .chart-foot .down { color: #ff7a7a; }
/* When lower is better (BF, VAT), invert the colors */
.dexa-chart-grid .chart-foot .up.inv { color: #ff7a7a; }
.dexa-chart-grid .chart-foot .down.inv { color: #6ce69b; }
.dexa-chart-grid .chart-empty { font-size: 12px; color: var(--muted); padding: 6px 0; }

.dexa-compare-pickers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.dexa-compare-pickers label { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dexa-compare-pickers label span { font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700; }
.dexa-compare-pickers select {
  width: 100%;
  font-size: 13px;
  padding: 8px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
}
.dexa-cmp-wrap { overflow-x: auto; }
.dexa-cmp-table { width: 100%; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.dexa-cmp-table thead th {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--muted); font-weight: 700; padding: 6px 8px; text-align: left;
  border-bottom: 1px solid var(--border);
}
.dexa-cmp-table thead th:not(:first-child) { text-align: right; }
.dexa-cmp-table tbody th { font-weight: 600; color: var(--muted); padding: 6px 8px; text-align: left; font-size: 11px; }
.dexa-cmp-table tbody td { padding: 6px 8px; text-align: right; color: var(--text); font-weight: 600; }
.dexa-cmp-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.04); }
.dexa-cmp-good { color: #6ce69b !important; }
.dexa-cmp-bad  { color: #ff7a7a !important; }

.dexa-tips {
  margin: 4px 0 14px;
  padding: 10px 12px;
  background: linear-gradient(180deg, rgba(91, 134, 229, 0.08), rgba(91, 134, 229, 0.03));
  border-left: 3px solid rgba(91, 134, 229, 0.6);
  border-radius: 8px;
}
.dexa-tips-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: #8db4ff;
  margin-bottom: 6px;
}
.dexa-tips-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.dexa-tips-list li {
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  padding-left: 14px;
  position: relative;
}
.dexa-tips-list li::before {
  content: "→";
  position: absolute;
  left: 0;
  top: 0;
  color: #8db4ff;
  font-weight: 700;
}
.dexa-tips-list li b { color: #ffd884; }
.dexa-analysis {
  margin-top: 8px;
  padding: 14px;
  background: rgba(91, 134, 229, 0.06);
  border: 1px solid rgba(91, 134, 229, 0.25);
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.55;
}
.dexa-analysis p { margin: 0 0 10px; }
.dexa-analysis p:last-child { margin-bottom: 0; }
.dexa-analysis strong { color: var(--accent); }
.dexa-analysis ul { margin: 4px 0 10px; padding-left: 20px; }
.dexa-analysis li { margin: 3px 0; }

/* Educational targets card content */
.prof-plan-summary {
  padding: 12px 14px;
  background: rgba(91, 134, 229, 0.08);
  border: 1px solid rgba(91, 134, 229, 0.3);
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 10px;
}
.prof-plan-summary strong { color: var(--accent); }
.prof-goal-line {
  padding: 8px 12px;
  margin-bottom: 10px;
  background: rgba(168, 85, 247, 0.07);
  border-left: 3px solid #a855f7;
  border-radius: 5px;
  font-size: 12px;
  color: var(--text);
}
.prof-goal-line strong { color: #c084fc; }
.prof-warning {
  padding: 10px 12px;
  margin-bottom: 12px;
  background: rgba(248, 113, 113, 0.08);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.5;
  color: #fca5a5;
}
.prof-section-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--muted);
  margin: 14px 0 8px;
}
.prof-path {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 4px;
}
.prof-path-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 6px;
}
.prof-path-row.deficit { background: rgba(248, 113, 113, 0.06); }
.prof-path-row.surplus { background: rgba(52, 211, 153, 0.06); }
.prof-path-row.target {
  background: linear-gradient(135deg, rgba(91, 134, 229, 0.15), rgba(91, 134, 229, 0.05));
  border: 1px solid rgba(91, 134, 229, 0.35);
}
.prof-path-step { min-width: 0; flex: 1; }
.prof-path-label { font-size: 13px; font-weight: 600; color: var(--text); }
.prof-path-row.target .prof-path-label { color: var(--accent); font-weight: 700; }
.prof-path-sub { font-size: 11px; margin-top: 2px; }
.prof-path-value {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  margin-left: 10px;
}
.prof-path-row.deficit .prof-path-value { color: #f87171; }
.prof-path-row.surplus .prof-path-value { color: #34d399; }
.prof-path-row.target .prof-path-value { color: var(--accent); font-size: 17px; }

.prof-tips {
  margin-top: 14px;
  padding: 12px 14px;
  background: rgba(251, 191, 36, 0.06);
  border: 1px solid rgba(251, 191, 36, 0.25);
  border-radius: 10px;
}
.prof-tips-head {
  font-size: 12px;
  font-weight: 700;
  color: #fbbf24;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.prof-tips ul {
  margin: 0;
  padding-left: 20px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text);
}
.prof-tips li { margin: 4px 0; }
.prof-tips li strong { color: #fbbf24; }

/* Today's nutrition card on the dashboard */
.nutrition-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 14px 0;
}
.nutrition-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.nutrition-card-head h3 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text);
}
.nutrition-card-head button {
  font-size: 12px;
  padding: 6px 12px;
}
.nutrition-totals {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.nutrition-totals .nt-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nutrition-totals .nt-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.nutrition-totals .nt-value .nt-unit {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.nutrition-totals .nt-label {
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

/* Macro tracker on the dashboard (Phase 2) */
.macro-tracker {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 14px 0;
}
.macro-tracker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.macro-tracker-head h3 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text);
}
.macro-tracker-head .macro-log-btn {
  font-size: 12px;
  padding: 6px 12px;
}
.macro-tracker-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}
.macro-weight-btn {
  font-size: 14px;
  padding: 6px 9px;
}
.macro-reset-btn {
  font-size: 13px;
  padding: 6px 8px;
  opacity: 0.6;
}
.macro-reset-btn:hover { opacity: 1; }
.macro-rows { display: flex; flex-direction: column; gap: 10px; }
.macro-row {
  display: grid;
  grid-template-columns: 56px 1fr 80px;
  align-items: center;
  gap: 10px;
}
.macro-row .macro-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--muted);
}
.macro-row .macro-bar {
  height: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 5px;
  overflow: hidden;
  position: relative;
}
.macro-row .macro-fill {
  height: 100%;
  border-radius: 5px;
  background: var(--accent);
  transition: width 0.4s ease;
}
.macro-row .macro-fill.over { background: #f59e0b; }
.macro-row .macro-fill.way-over { background: var(--bad); }
.macro-row .macro-fill.perfect { background: var(--good); }
.macro-row .macro-numbers {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: right;
  font-weight: 700;
}
.macro-row .macro-numbers .target { color: var(--muted); font-weight: 500; }
.macro-tracker-footer {
  margin-top: 12px;
  font-size: 12px;
  color: var(--muted);
}

/* ====== Macro tracker v2 (Apple-Activity-style rings + pace + actions) ====== */
.macro-tracker-v2 {
  background: linear-gradient(135deg, rgba(255, 67, 101, 0.06), rgba(91, 134, 229, 0.05));
  border: 1px solid rgba(255, 67, 101, 0.18);
  border-radius: 14px;
  padding: 14px 16px 12px;
  margin-bottom: 14px;
}
.macro-tracker-v2 .macro-tracker-head { margin-bottom: 10px; }
.macro-pace {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.macro-pace.pace-good {
  color: #6ce69b; background: rgba(70, 200, 120, 0.12);
  border: 1px solid rgba(70, 200, 120, 0.35);
}
.macro-pace.pace-warn {
  color: #ffcc66; background: rgba(240, 180, 60, 0.12);
  border: 1px solid rgba(240, 180, 60, 0.35);
}
.macro-pace.pace-bad {
  color: #ff7a7a; background: rgba(255, 80, 80, 0.12);
  border: 1px solid rgba(255, 80, 80, 0.40);
}
.macro-pace.pace-neutral {
  color: var(--muted); background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}

.macro-visual-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 6px;
}
.macro-svg {
  width: 180px;
  height: 180px;
  filter: drop-shadow(0 4px 14px rgba(91, 134, 229, 0.20));
}

.macro-detail {
  font-size: 12.5px;
  color: #e2e8f0;
  text-align: center;
  margin: 0 0 12px;
  padding: 8px 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  line-height: 1.45;
}

.macro-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}
.macro-legend-row {
  display: grid;
  grid-template-columns: 14px 60px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
.macro-leg-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.macro-leg-p .macro-leg-dot { background: #ff4365; box-shadow: 0 0 8px rgba(255,67,101,0.5); }
.macro-leg-c .macro-leg-dot { background: #5b86e5; box-shadow: 0 0 8px rgba(91,134,229,0.5); }
.macro-leg-f .macro-leg-dot { background: #f0b43c; box-shadow: 0 0 8px rgba(240,180,60,0.5); }
.macro-leg-label { font-weight: 700; color: var(--text); }
.macro-leg-val { font-weight: 700; color: var(--text); text-align: right; }
.macro-leg-pct { font-weight: 800; min-width: 42px; text-align: right; color: var(--muted); }
.macro-legend-row.perfect { border-color: rgba(70, 200, 120, 0.40); background: linear-gradient(180deg, rgba(70,200,120,0.07), rgba(70,200,120,0.02)); }
.macro-legend-row.perfect .macro-leg-pct { color: #6ce69b; }
.macro-legend-row.over { border-color: rgba(240, 180, 60, 0.40); background: linear-gradient(180deg, rgba(240,180,60,0.07), rgba(240,180,60,0.02)); }
.macro-legend-row.over .macro-leg-pct { color: #ffcc66; }

.macro-actions {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 6px;
  margin-bottom: 0;
}
.macro-act-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 9px 6px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  color: var(--text);
}
.macro-act-btn:hover { background: rgba(255,255,255,0.07); border-color: rgba(91,134,229,0.40); }
.macro-act-btn:active { transform: scale(0.97); }
.macro-act-emoji { font-size: 18px; line-height: 1; }
.macro-act-label { font-size: 11px; font-weight: 700; }
.macro-act-primary {
  background: linear-gradient(135deg, rgba(91,134,229,0.18), rgba(255,67,101,0.14));
  border-color: rgba(91,134,229,0.50);
}
.macro-act-primary:hover { background: linear-gradient(135deg, rgba(91,134,229,0.28), rgba(255,67,101,0.20)); }
.macro-act-primary .macro-act-label { color: #ffffff; }

/* Today's meals list */
.meal-log-list {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.meal-log-list-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 8px;
}
.meal-log-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 6px;
  border-radius: 8px;
  margin-bottom: 4px;
}
.meal-log-row:hover { background: rgba(255,255,255,0.03); }
.meal-log-time {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--muted);
}
.meal-log-desc { min-width: 0; }
.meal-log-summary {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.meal-log-macros {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.meal-log-actions { display: flex; gap: 4px; }
.meal-log-actions button {
  padding: 6px 8px;
  font-size: 14px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
}
.meal-log-actions button:hover { background: rgba(255,255,255,0.06); border-color: var(--border); }
.meal-log-actions .meal-delete-btn:hover { border-color: var(--bad); color: var(--bad); }
.macro-no-profile {
  padding: 18px 8px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.macro-no-profile button {
  margin-top: 10px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

/* 💧 Hydration card */
.hydration-card {
  background: linear-gradient(135deg, rgba(90, 200, 250, 0.10), rgba(15, 76, 110, 0.06));
  border: 1px solid rgba(125, 211, 252, 0.30);
  border-radius: 14px;
  padding: 14px 16px 12px;
  margin-bottom: 14px;
}
.hydration-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 8px;
}
.hydration-head h3 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text);
}
.hydration-pace {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}
.hydration-pace.pace-good {
  color: #6ce69b;
  background: rgba(70, 200, 120, 0.12);
  border: 1px solid rgba(70, 200, 120, 0.35);
}
.hydration-pace.pace-warn {
  color: #ffcc66;
  background: rgba(240, 180, 60, 0.12);
  border: 1px solid rgba(240, 180, 60, 0.35);
}
.hydration-pace.pace-bad {
  color: #ff7a7a;
  background: rgba(255, 80, 80, 0.12);
  border: 1px solid rgba(255, 80, 80, 0.40);
}
.hydration-pace.pace-neutral {
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
}

/* Water-glass SVG */
.hyd-visual-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}
.hyd-svg {
  width: 160px;
  height: 160px;
  filter: drop-shadow(0 4px 12px rgba(91, 134, 229, 0.20));
}

.hyd-detail {
  font-size: 12px;
  color: #cbd5e1;
  text-align: center;
  margin: 0 0 12px;
  padding: 7px 10px;
  background: rgba(125,211,252,0.06);
  border-radius: 8px;
  line-height: 1.4;
}

/* 5-button quick-add row */
.hyd-actions {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}
.hyd-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 8px 4px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.05s;
  min-width: 0;
}
.hyd-btn:hover { background: rgba(125,211,252,0.10); border-color: rgba(125,211,252,0.40); }
.hyd-btn:active { transform: scale(0.96); background: rgba(125,211,252,0.18); }
.hyd-btn-emoji { font-size: 20px; line-height: 1; }
.hyd-btn-ml { font-size: 11px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.hyd-btn-custom .hyd-btn-emoji { font-size: 16px; }

.hyd-undo {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
}
.hyd-undo:hover { color: var(--text); border-color: rgba(125,211,252,0.40); background: rgba(125,211,252,0.06); }

.hyd-footer {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
}
.hyd-link {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 4px 8px;
  cursor: pointer;
  font-size: 11.5px;
  font-weight: 600;
  border-radius: 6px;
}
.hyd-link:hover { color: var(--text); background: rgba(125,211,252,0.08); }
.hyd-link-warn { color: var(--muted); }
.hyd-link-warn:hover { color: #ff7a7a; background: rgba(255,80,80,0.08); }
.hyd-link-sep { color: var(--muted); opacity: 0.5; }

/* Hevy delete button on workout card */
.lw-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.lw-delete-btn {
  font-size: 16px;
  padding: 6px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  color: var(--muted);
  transition: all 0.15s;
  flex-shrink: 0;
}
.lw-delete-btn:hover { background: rgba(255,80,80,0.10); border-color: rgba(255,80,80,0.40); color: #ff7a7a; }

/* Duplicate notice */
.dup-notice {
  margin-bottom: 10px;
  padding: 8px 12px;
  background: rgba(240, 180, 60, 0.08);
  border: 1px solid rgba(240, 180, 60, 0.30);
  border-radius: 8px;
  font-size: 12px;
  color: #ffcc66;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.dup-notice button { font-size: 11px; padding: 4px 10px; }

/* Garmin activities card */
.garmin-activities {
  margin-bottom: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.06), rgba(0, 212, 255, 0.02));
  border: 1px solid rgba(0, 212, 255, 0.20);
  border-radius: 12px;
}
.ga-head h3 { margin: 0 0 2px; font-size: 14px; font-weight: 700; }
.ga-head p { font-size: 11px; margin: 0 0 10px; }
.garmin-act-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.garmin-act-chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  background: rgba(0, 212, 255, 0.10);
  border: 1px solid rgba(0, 212, 255, 0.30);
  border-radius: 999px;
  color: #7ee0ff;
}
.ga-foot { font-size: 11px; margin: 0; line-height: 1.4; }

/* 💊 Supplements card */
.supps-card {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.07), rgba(168, 85, 247, 0.02));
  border: 1px solid rgba(168, 85, 247, 0.25);
  border-radius: 12px;
  padding: 12px 16px;
  margin-bottom: 14px;
}
.supps-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.supps-head h3 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text);
}
.supps-count {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #a855f7;
  font-variant-numeric: tabular-nums;
  text-transform: none;
  letter-spacing: normal;
}
.supps-manage-btn {
  font-size: 12px;
  padding: 5px 12px;
}
.supps-list { display: flex; flex-direction: column; gap: 4px; }
.supp-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 6px 4px;
  border-radius: 6px;
  cursor: pointer;
}
.supp-row:hover { background: rgba(255,255,255,0.03); }
.supp-row input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: #a855f7;
  cursor: pointer;
}
.supp-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}
.supp-row input[type="checkbox"]:checked + .supp-name {
  text-decoration: line-through;
  color: var(--muted);
}
.supp-remove {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 12px;
  padding: 4px 6px;
  cursor: pointer;
  opacity: 0.5;
}
.supp-remove:hover { opacity: 1; color: var(--bad); }
.supps-empty {
  padding: 16px 4px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.supps-head-actions { display: flex; gap: 4px; }
.supps-history-btn { padding: 5px 10px; font-size: 13px; }

/* 14-day adherence grid */
.supps-history { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(168, 85, 247, 0.25); }
.supps-history.hidden { display: none; }
.supps-history-table-wrap { overflow-x: auto; }
.supps-history-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.supps-history-table th, .supps-history-table td {
  padding: 4px 6px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.supps-history-table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 10px;
}
.supps-history-table td.taken { color: var(--good); font-weight: 700; }
.supps-history-table td.missed { color: rgba(255,255,255,0.15); }
.supps-history-table td.supp-name-cell {
  text-align: left;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  max-width: 110px;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12px;
}
.supps-history-table td.supp-adh {
  font-size: 11px;
  font-weight: 700;
  color: #a855f7;
  white-space: nowrap;
}
.supps-history-foot { font-size: 11px; margin-top: 6px; text-align: right; }

/* Mic / voice button */
.mic-btn {
  padding: 8px 12px;
  font-size: 15px;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  flex-shrink: 0;
}
.mic-btn.listening {
  background: var(--bad);
  border-color: var(--bad);
  animation: pulse-mic 1s ease-in-out infinite;
}
@keyframes pulse-mic {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.lift-charts-title {
  margin: 18px 0 10px;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* Routine picker */
.routine-picker {
  margin-bottom: 16px;
}
.rp-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  padding: 0 2px;
}
.rp-head h3 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.01em;
}
.rp-head .muted { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 700; }
.routine-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.routine-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.routine-card-body { padding: 10px 12px; }
.routine-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.routine-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.routine-status {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.routine-status.done {
  color: var(--good);
  border-color: rgba(52, 211, 153, 0.4);
  background: rgba(52, 211, 153, 0.06);
}
.routine-status.todo {
  color: var(--warn);
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.05);
}
.routine-status.stale {
  color: var(--bad);
  border-color: rgba(248, 113, 113, 0.4);
  background: rgba(248, 113, 113, 0.05);
}
.routine-status.new {
  color: var(--accent);
  border-color: rgba(90, 200, 250, 0.4);
  background: rgba(90, 200, 250, 0.05);
}
.routine-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
  flex-wrap: wrap;
}
.routine-exs {
  color: var(--text);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
}
.routine-meta-sep { color: var(--border); }
.routine-count { white-space: nowrap; font-variant-numeric: tabular-nums; }
.routine-card-actions {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 6px;
}
.routine-brief-btn {
  padding: 9px 0;
  font-size: 16px;
}
.routine-log-btn {
  padding: 9px 12px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}
.routine-card.has-inprogress {
  border-color: rgba(91, 134, 229, 0.55);
  box-shadow: 0 0 0 1px rgba(91, 134, 229, 0.2) inset;
}
.routine-inprogress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(91, 134, 229, 0.14);
  border-bottom: 1px solid rgba(91, 134, 229, 0.25);
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.02em;
}
.routine-discard {
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 700;
  background: transparent;
  border: 1px solid rgba(255, 99, 99, 0.4);
  border-radius: 4px;
  color: #ff6b6b;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.routine-discard:hover { background: rgba(255, 99, 99, 0.12); border-color: #ff6b6b; }

/* Swipe carousel — horizontal scroll with snap, dot pagination below */
.routine-carousel { position: relative; }
.routine-track {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding: 2px 2px 4px;
  margin: 0 -2px;
  scroll-padding-left: 2px;
  scroll-padding-right: 2px;
}
.routine-track::-webkit-scrollbar { display: none; }
.routine-slide {
  flex: 0 0 calc(100% - 4px);
  scroll-snap-align: center;
  scroll-snap-stop: always;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-sizing: border-box;
}
.routine-slide .slide-body { padding: 12px 14px; }
.routine-slide.has-inprogress {
  border-color: rgba(91, 134, 229, 0.55);
  box-shadow: 0 0 0 1px rgba(91, 134, 229, 0.2) inset;
}

/* The AI's pick gets a warm gold accent */
.routine-slide.ai-pick {
  border-color: rgba(251, 191, 36, 0.55);
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.10), rgba(251, 191, 36, 0.02) 60%, var(--surface-2));
  box-shadow: 0 0 18px rgba(251, 191, 36, 0.12);
}
.ai-pick-badge {
  display: inline-block;
  padding: 4px 9px;
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 6px;
  margin-bottom: 10px;
  border: 1px solid rgba(251, 191, 36, 0.4);
}
.ai-pick-reason {
  font-size: 12px;
  color: #fcd34d;
  margin: -4px 0 10px;
  font-weight: 600;
  line-height: 1.4;
}

/* Pagination dots */
.routine-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.rp-dot {
  width: 7px;
  height: 7px;
  padding: 0;
  background: var(--border);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease, width 0.2s ease;
}
.rp-dot.active {
  background: var(--accent);
  width: 22px;
  border-radius: 4px;
}
.rp-dot:hover { background: var(--text); }
.rp-dot.active:hover { background: var(--accent); }
.routine-briefing {
  margin-top: 10px;
  padding: 12px 14px;
  background: linear-gradient(135deg, rgba(90, 200, 250, 0.08), rgba(90, 200, 250, 0.02));
  border: 1px solid rgba(90, 200, 250, 0.25);
  border-radius: 10px;
}
.briefing-body {
  font-size: 13px;
  line-height: 1.6;
}
.briefing-body strong {
  color: var(--accent);
  display: inline-block;
  margin-top: 6px;
}

/* Inline chat below each briefing */
.briefing-chat {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(90, 200, 250, 0.2);
}
.briefing-chat-msgs {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
  max-height: 400px;
  overflow-y: auto;
}
.briefing-chat-msgs:empty { display: none; }
.br-msg {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.55;
  max-width: 90%;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.br-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #3aa6d0);
  color: #001827;
  border-bottom-right-radius: 3px;
}
.br-msg.coach {
  align-self: flex-start;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
}
.br-msg.coach strong { color: var(--accent); }
.br-msg.typing { font-style: italic; color: var(--muted); }
.briefing-chat-form {
  display: flex;
  gap: 8px;
}
.briefing-chat-form input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.briefing-chat-form input:focus { outline: none; border-color: var(--accent); }
.briefing-chat-form button {
  font-size: 13px;
  padding: 8px 14px;
}

/* Sync modal */
.sync-body { padding: 16px; }
.sync-explain {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.55;
  color: var(--muted);
}
.sync-steps {
  margin: 0 0 16px;
  padding-left: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text);
}
.sync-steps li { margin: 4px 0; }
.sync-steps strong {
  color: var(--accent);
}
.sync-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sync-actions .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  padding: 12px 16px;
  font-size: 15px;
  width: 100%;
}
.sync-armed-msg {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px;
  margin-bottom: 14px;
  background: rgba(90,200,250,0.08);
  border: 1px solid rgba(90,200,250,0.3);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
}

/* ====== Floating chat button ====== */
.chat-fab {
  position: fixed;
  bottom: max(env(safe-area-inset-bottom), 20px);
  right: 20px;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #3aa6d0);
  border: none;
  font-size: 24px;
  color: #001827;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(90,200,250,0.4);
  z-index: 50;
}
.chat-fab.hidden { display: none; }
.chat-fab:active { transform: translateY(1px); }

/* ====== Chat modal ====== */
.chat-card {
  max-width: 600px;
  height: 80vh;
  display: flex;
  flex-direction: column;
}
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg {
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
  max-width: 85%;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.chat-msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #3aa6d0);
  color: #001827;
  border-bottom-right-radius: 4px;
}
.chat-msg.coach {
  align-self: flex-start;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}
.chat-msg.typing { font-style: italic; color: var(--muted); }
.chat-form {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.chat-form input {
  flex: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
}
.chat-form input:focus { outline: none; border-color: var(--accent); }
