/* ── Design tokens ─────────────────────────────────── */
:root {
  --bg:           #0f172a;
  --surface:      #1e293b;
  --surface-2:    #334155;
  --border:       #475569;
  --primary:      #3b82f6;
  --primary-dark: #2563eb;
  --accent:       #f59e0b;
  --success:      #10b981;
  --danger:       #ef4444;
  --text:         #f1f5f9;
  --text-muted:   #94a3b8;
  --text-dim:     #64748b;
  --radius:       12px;
  --radius-sm:    8px;
  --shadow:       0 4px 24px rgba(0,0,0,.4);
  --nav-h:        64px;
  --bottom-nav-h: 68px;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font: inherit; border: none; }
input, select, textarea { font: inherit; }

/* ── Layout ────────────────────────────────────────── */
.page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}
.container {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 0 16px;
}
.main-content { padding: 20px 0 32px; flex: 1; }

/* ── Top nav ───────────────────────────────────────── */
.top-nav {
  height: calc(var(--nav-h) + env(safe-area-inset-top, 0px));
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}
.top-nav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  letter-spacing: -.02em;
}
.nav-brand span { color: var(--text); }

/* ── Bottom nav (mobile) ───────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
}
.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: .625rem;
  color: var(--text-dim);
  transition: color .15s;
  padding-top: 4px;
  min-width: 0;
}
.bottom-nav a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.bottom-nav a svg { width: 20px; height: 20px; flex-shrink: 0; }
.bottom-nav a.active, .bottom-nav a:hover { color: var(--primary); }
.bottom-nav a.start-btn {
  color: var(--text);
}
.bottom-nav a.start-btn .nav-icon-wrap {
  background: var(--primary);
  border-radius: 50%;
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 2px;
}

/* Desktop nav links */
.desktop-nav-links {
  display: none;
  gap: 8px;
}
.desktop-nav-links a {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text-muted);
  transition: color .15s, background .15s;
}
.desktop-nav-links a:hover, .desktop-nav-links a.active {
  color: var(--text);
  background: var(--surface-2);
}

@media (min-width: 768px) {
  .bottom-nav { display: none; }
  .desktop-nav-links { display: flex; }
  .page { padding-bottom: 0; }
}

/* ── Cards ─────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: 12px; }
.card-title {
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

/* ── Stat cards ────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1;
  color: var(--primary);
}
.stat-label {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-weight: 600;
  transition: opacity .15s, transform .1s;
  white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-accent  { background: var(--accent); color: #0f172a; }
.btn-ghost   { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger  { background: var(--danger); color: #fff; }
.btn-danger:hover { opacity: .85; }
.btn-sm      { padding: 6px 14px; font-size: .82rem; }
.btn-lg      { padding: 14px 28px; font-size: 1rem; }
.btn-block   { width: 100%; }
.btn-icon    { padding: 8px; border-radius: 8px; }
.btn:disabled { opacity: .4; pointer-events: none; }

/* ── Section header ────────────────────────────────── */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 1rem;
  font-weight: 700;
}

/* ── Workout cards ─────────────────────────────────── */
.workout-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: border-color .15s;
}
.workout-card:hover { border-color: var(--primary); }
.workout-card + .workout-card { margin-top: 10px; }
.workout-card-info { flex: 1; min-width: 0; }
.workout-card-name {
  font-weight: 600;
  font-size: 1rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.workout-card-meta {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.workout-card-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── Badge / pill ──────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
}
.badge-strength { background: rgba(59,130,246,.2); color: #93c5fd; }
.badge-timed    { background: rgba(245,158,11,.2); color: #fcd34d; }
.badge-cardio   { background: rgba(16,185,129,.2); color: #6ee7b7; }
.badge-superset { background: rgba(168,85,247,.2);  color: #d8b4fe; }

/* ── Form elements ─────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  transition: border-color .15s;
  appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
}
.form-textarea { resize: vertical; min-height: 80px; }
.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

/* ── Exercise editor card ──────────────────────────── */
.exercise-editor {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 10px;
}
.exercise-editor-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
/* ── Superset editor ───────────────────────────────── */
.superset-editor-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 8px;
}
.superset-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
}
.superset-editor-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
}

/* ── Superset prep list ────────────────────────────── */
.prep-superset-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 360px;
  margin-top: 4px;
}
.prep-superset-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.prep-superset-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--text-muted);
}

/* ── Superset session list ─────────────────────────── */
.superset-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.superset-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-radius: var(--radius);
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color .15s;
}
.superset-item.done {
  opacity: .55;
}
.superset-item.current {
  border-color: var(--primary);
  background: rgba(59,130,246,.06);
}
.superset-item.upcoming {
  opacity: .7;
}
.superset-item-ind {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-dim);
  margin-top: 2px;
}
.superset-item-ind.current {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.superset-item.done .superset-item-ind {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
}
.superset-item-name {
  font-weight: 600;
  font-size: .95rem;
}
.superset-item-meta {
  font-size: .8rem;
  color: var(--text-muted);
  margin-top: 2px;
}
.superset-item-log {
  font-size: .8rem;
  color: var(--success);
  margin-top: 2px;
}
.superset-sub-inputs {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}
.superset-sub-inputs > div { flex: 1; }
.superset-timed-wrap {
  margin-top: 10px;
  text-align: center;
}
.superset-timer-display {
  font-size: 2.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  color: var(--primary);
}

.exercise-drag-handle {
  color: var(--text-dim);
  cursor: grab;
  flex-shrink: 0;
}
.exercise-fields { display: none; }
.exercise-fields.active { display: block; }
.type-fields { display: none; }
.type-fields.active { display: block; }

/* ── Active session ────────────────────────────────── */
.session-page {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: var(--bg);
}
.session-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: calc(14px + env(safe-area-inset-top, 0px)) 16px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.session-progress-text {
  font-size: .8rem;
  color: var(--text-muted);
  flex: 1;
  text-align: right;
}
.session-workout-name {
  font-weight: 700;
  flex: 1;
  font-size: .95rem;
}

.session-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 16px;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

.exercise-header {
  text-align: center;
  margin-bottom: 24px;
}
.exercise-name {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.exercise-subtitle {
  color: var(--text-muted);
  font-size: .9rem;
  margin-top: 4px;
}
.exercise-notes {
  font-size: .82rem;
  color: var(--text-dim);
  font-style: italic;
  margin-top: 6px;
  line-height: 1.4;
}

/* Timer ring */
.timer-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto 28px;
}
.timer-ring-svg {
  width: min(240px, 60vw);
  height: min(240px, 60vw);
  transform: rotate(-90deg);
}
.timer-ring-bg { fill: none; stroke: var(--surface-2); stroke-width: 10; }
.timer-ring-progress {
  fill: none;
  stroke: var(--primary);
  stroke-width: 10;
  stroke-linecap: round;
  transition: stroke .3s;
}
.timer-ring-progress.warning { stroke: var(--accent); }
.timer-ring-progress.danger  { stroke: var(--danger); }
.timer-display {
  position: absolute;
  font-size: clamp(2.5rem, 10vw, 3.5rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
}
.timer-wrap-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.timer-controls { display: flex; gap: 12px; justify-content: center; }

/* Strength set logger */
.set-logger { width: 100%; }
.set-row {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 40px;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: none; }
.set-num {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-dim);
  text-align: center;
}
.set-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--text);
  text-align: center;
  font-size: .95rem;
  width: 100%;
}
.set-input:focus { outline: none; border-color: var(--primary); }
.set-check {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.set-check.done {
  background: var(--success);
  border-color: var(--success);
}
.set-headers {
  display: grid;
  grid-template-columns: 28px 1fr 1fr 40px;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}
.set-header-label {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-dim);
  text-align: center;
}

/* Cardio input */
.cardio-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-bottom: 28px;
}
.cardio-timer-display {
  font-size: clamp(3rem, 14vw, 5rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  color: var(--success);
}
.cardio-input-group {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cardio-dist-input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 700;
  width: 120px;
  text-align: center;
}
.cardio-dist-input:focus { outline: none; border-color: var(--success); }

/* Rest overlay */
.rest-overlay {
  position: fixed;
  inset: 0;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  background: rgba(15, 23, 42, .95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.rest-overlay.visible {
  opacity: 1;
  pointer-events: all;
}
.rest-label {
  font-size: .9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
}
.rest-timer {
  font-size: clamp(4rem, 20vw, 7rem);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
  color: var(--accent);
}
.rest-next {
  font-size: .85rem;
  color: var(--text-muted);
}

/* Session footer */
.session-footer {
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  display: flex;
  gap: 10px;
  background: var(--surface);
  position: sticky;
  bottom: 0;
}
.sets-progress {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.set-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 2px solid var(--border);
  transition: background .2s, border-color .2s;
}
.set-dot.done { background: var(--success); border-color: var(--success); }
.set-dot.current { background: var(--primary); border-color: var(--primary); }

/* ── Preparation screen ────────────────────────────── */
.prep-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  gap: 16px;
  padding: 32px 8px;
}
.prep-number {
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--text-dim);
}
.prep-name {
  font-size: clamp(1.8rem, 7vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
}
.prep-badge {
  font-size: .85rem;
  padding: 4px 14px;
}
.prep-details {
  font-size: .95rem;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 24px;
  line-height: 1.7;
}
.prep-notes {
  font-size: .9rem;
  color: var(--text-dim);
  font-style: italic;
  max-width: 300px;
  line-height: 1.5;
}

/* ── Completion screen ─────────────────────────────── */
.completion-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  text-align: center;
  gap: 16px;
  flex: 1;
}
.completion-icon { font-size: 4rem; }
.completion-title { font-size: 2rem; font-weight: 800; }
.completion-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
  max-width: 360px;
}

/* ── History ───────────────────────────────────────── */
.session-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  cursor: pointer;
  transition: border-color .15s;
}
.session-item:hover { border-color: var(--primary); }
.session-item + .session-item { margin-top: 10px; }
.session-date-badge {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  text-align: center;
  min-width: 46px;
  flex-shrink: 0;
}
.session-day  { font-size: 1.3rem; font-weight: 800; line-height: 1; }
.session-mon  { font-size: .65rem; text-transform: uppercase; color: var(--text-muted); }
.session-info { flex: 1; min-width: 0; }
.session-name { font-weight: 600; font-size: .95rem; }
.session-meta { font-size: .8rem; color: var(--text-muted); margin-top: 3px; }

.session-detail {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 10px;
  display: none;
}
.session-detail.open { display: block; }
.session-exercise-row {
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
  display: flex;
  justify-content: space-between;
}
.session-exercise-row:last-child { border-bottom: none; }

/* ── Weekly chart ──────────────────────────────────── */
.week-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 80px;
  padding: 0 4px;
}
.week-bar-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}
.week-bar {
  width: 100%;
  background: var(--primary);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height .4s;
  opacity: .7;
}
.week-bar.today { opacity: 1; }
.week-label { font-size: .65rem; color: var(--text-dim); }

/* ── Toast ─────────────────────────────────────────── */
.toast-container {
  position: fixed;
  bottom: calc(var(--bottom-nav-h) + 12px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}
@media (min-width: 768px) {
  .toast-container { bottom: 24px; }
}
.toast {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  font-size: .88rem;
  font-weight: 500;
  color: var(--text);
  box-shadow: var(--shadow);
  animation: toast-in .25s ease forwards;
  max-width: 90vw;
}
.toast.success { border-color: var(--success); color: #6ee7b7; }
.toast.error   { border-color: var(--danger);  color: #fca5a5; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Empty state ───────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-dim);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state-title { font-size: 1rem; font-weight: 600; color: var(--text-muted); }
.empty-state-sub { font-size: .85rem; margin-top: 4px; }

/* ── Spinner ───────────────────────────────────────── */
.spinner {
  width: 28px; height: 28px;
  border: 3px solid var(--surface-2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Workout detail page ───────────────────────────── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .85rem;
  color: var(--text-muted);
  transition: color .15s;
}
.back-link:hover { color: var(--text); }

.detail-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
@media (min-width: 540px) {
  .detail-hero {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
  }
}
.detail-hero-body { flex: 1; min-width: 0; }
.detail-title {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.2;
}
.detail-desc {
  font-size: .9rem;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
}
.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  font-size: .82rem;
  color: var(--text-muted);
}
.meta-dot { color: var(--text-dim); }
.detail-hero-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: flex-start;
}

.detail-exercise-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.detail-exercise-header {
  display: flex;
  align-items: center;
  gap: 10px;
}
.detail-exercise-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  flex-shrink: 0;
  color: var(--text-muted);
}
.detail-exercise-name {
  font-weight: 600;
  font-size: .95rem;
  flex: 1;
}
.detail-spec-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.detail-spec {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: .78rem;
  color: var(--text-muted);
}
.detail-exercise-notes {
  margin-top: 8px;
  font-size: .8rem;
  color: var(--text-dim);
  font-style: italic;
}
.detail-sub-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-left: 4px;
  border-left: 2px solid var(--border);
  margin-left: 12px;
}
.detail-sub-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}
.detail-sub-row svg { flex-shrink: 0; color: var(--text-dim); }

/* ── Misc utilities ────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}
.text-muted { color: var(--text-muted); }
.text-dim   { color: var(--text-dim); }
.text-sm    { font-size: .85rem; }
.fw-700     { font-weight: 700; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-20 { margin-top: 20px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.flex  { display: flex; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
.text-muted { color: var(--text-muted); font-size: .85em; }

/* ── Auth pages ─────────────────────────────────────── */
.auth-page {
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  padding: calc(24px + env(safe-area-inset-top, 0px)) 16px calc(24px + env(safe-area-inset-bottom, 0px));
  box-sizing: border-box;
  overflow-y: auto;
}
.auth-container {
  width: 100%;
  max-width: 400px;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 36px 32px;
  box-shadow: var(--shadow);
}
.auth-brand {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -.5px;
  margin-bottom: 24px;
  color: var(--text);
}
.auth-brand span { color: var(--primary); }
.auth-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 24px;
}
.auth-form .form-group {
  margin-bottom: 16px;
}
.auth-form label {
  display: block;
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.auth-form input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  font-size: 1rem;
  transition: border-color .15s;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--primary);
}
.auth-form input::placeholder { color: var(--text-dim); }
.auth-error {
  background: rgba(239,68,68,.12);
  border: 1px solid rgba(239,68,68,.3);
  color: #fca5a5;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: .875rem;
  margin-bottom: 16px;
}
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-dim);
  font-size: .8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}
.auth-footer {
  text-align: center;
  font-size: .875rem;
  color: var(--text-muted);
  margin-top: 20px;
}
.auth-footer a { color: var(--primary); }
.auth-footer a:hover { text-decoration: underline; }

/* Google OAuth button */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 16px;
  font-size: .9375rem;
  font-weight: 500;
  transition: background .15s, border-color .15s;
  width: 100%;
  text-decoration: none;
}
.btn-google:hover { background: var(--border); }
.btn-full { width: 100%; }

/* User nav in top bar */
.user-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.user-nav-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.user-nav-avatar-initial {
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.user-nav-name {
  font-size: .875rem;
  color: var(--text-muted);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Profile page ───────────────────────────────── */
.profile-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
/* Avatar upload wrapper */
.profile-avatar-wrap {
  position: relative;
  flex-shrink: 0;
  cursor: pointer;
  display: block;
}
.profile-avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  opacity: 0;
  transition: opacity .2s;
}
.profile-avatar-wrap:hover .profile-avatar-overlay { opacity: 1; }

.profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 22px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background-size: cover;
  background-position: center;
}
.profile-info-name  { font-size: 18px; font-weight: 600; color: var(--text); }
.profile-info-email { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.profile-section { margin-bottom: 28px; }
.profile-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.profile-section-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: -8px;
  margin-bottom: 12px;
}

/* Fitness level cards */
.level-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.level-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 8px;
  text-align: center;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  transition: border-color .15s, color .15s, background .15s;
}
.level-card:hover  { border-color: var(--surface-2); color: var(--text); }
.level-card.active { border-color: var(--primary); color: var(--primary); background: rgba(59,130,246,.1); }

/* Goal / limitation chips */
.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color .15s, color .15s, background .15s;
  line-height: 1;
}
.chip:hover  { border-color: var(--surface-2); color: var(--text); }
.chip.active { border-color: var(--primary); color: var(--primary); background: rgba(59,130,246,.1); }
.chip.limit.active { border-color: var(--accent); color: var(--accent); background: rgba(245,158,11,.1); }

/* Notes textarea */
.profile-notes {
  width: 100%;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 12px;
  resize: vertical;
  min-height: 80px;
  transition: border-color .15s;
}
.profile-notes:focus         { outline: none; border-color: var(--primary); }
.profile-notes::placeholder  { color: var(--text-dim); }

/* ── Language toggle ────────────────────────────── */
.lang-toggle {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 4px 8px;
  cursor: pointer;
  transition: color .15s, border-color .15s;
}
.lang-toggle:hover { color: var(--text); border-color: var(--primary); }

/* ── AI generate sheet ──────────────────────────── */
.ai-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 200;
  display: flex;
  align-items: flex-end;
}
@media (min-width: 640px) {
  .ai-backdrop { align-items: center; justify-content: center; }
}
.ai-sheet {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@media (min-width: 640px) {
  .ai-sheet { border-radius: var(--radius); max-width: 480px; max-height: 82vh; }
}
.ai-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 16px 14px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}
.ai-sheet-title { font-size: 17px; font-weight: 600; }
.ai-sheet-body  { padding: 16px; }
.ai-sheet-footer {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--border);
  position: sticky;
  bottom: 0;
  background: var(--surface);
}
.ai-sheet-footer .btn { flex: 1; }
.ai-section { margin-bottom: 20px; }
.ai-section:last-child { margin-bottom: 0; }
.ai-section-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.ai-profile-note {
  font-size: 12px;
  color: var(--text-dim);
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin-bottom: 18px;
}
.ai-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 24px;
  gap: 16px;
}
.ai-loading-text { font-size: 14px; color: var(--text-muted); }
.ai-workout-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 16px;
}
.ai-exercise-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.ai-exercise-item:last-child { border-bottom: none; }
.ai-exercise-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}
.ai-exercise-info { min-width: 0; }
.ai-exercise-name { font-size: 14px; font-weight: 500; color: var(--text); }
.ai-exercise-meta { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.ai-exercise-note { font-size: 11px; color: var(--text-dim); margin-top: 3px; font-style: italic; }

/* ── Tab row ────────────────────────────────────── */
.tab-row {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 3px;
}
.tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  border-radius: calc(var(--radius-sm) - 2px);
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.tab-btn.active { background: var(--surface-2); color: var(--text); }
.tab-btn:hover:not(.active) { color: var(--text); }

/* ── Diet module ────────────────────────────────── */

/* Macro progress bars */
.macro-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.macro-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.macro-card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.macro-card-label { font-size: 11px; color: var(--text-muted); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.macro-card-value { font-size: 13px; font-weight: 600; color: var(--text); }
.macro-card-goal  { font-size: 11px; color: var(--text-dim); }
.macro-bar {
  height: 5px;
  border-radius: 3px;
  background: var(--surface-2);
  overflow: hidden;
}
.macro-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width .3s ease;
}
.macro-bar-fill.cal   { background: var(--primary); }
.macro-bar-fill.prot  { background: var(--success); }
.macro-bar-fill.carb  { background: var(--accent); }
.macro-bar-fill.fat   { background: #a78bfa; }
.macro-bar-fill.over  { background: var(--danger); }

/* Meal sections */
.meal-section { margin-bottom: 16px; }
.meal-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0 8px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 8px;
}
.meal-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.meal-section-kcal {
  font-size: 12px;
  color: var(--text-dim);
}
.meal-entry {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.meal-entry:last-child { border-bottom: none; }
.meal-entry-name { flex: 1; font-size: 14px; color: var(--text); }
.meal-entry-kcal { font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.meal-entry-del  { color: var(--text-dim); flex-shrink: 0; cursor: pointer; padding: 2px; }
.meal-entry-del:hover { color: var(--danger); }
.meal-add-btn {
  width: 100%;
  margin-top: 6px;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.meal-add-btn:hover { border-color: var(--primary); color: var(--primary); }

/* Week planner grid */
.week-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 20px;
}
.week-day-col {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition: background .15s;
  min-height: 72px;
}
.week-day-col:hover  { background: var(--surface-2); }
.week-day-col.today  { border: 1.5px solid var(--primary); }
.week-day-col.active { background: rgba(59,130,246,.12); }
.week-day-name { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.week-day-num  { font-size: 15px; font-weight: 600; color: var(--text); margin: 2px 0; }
.week-day-kcal { font-size: 10px; color: var(--text-dim); }
.week-day-dot  { width: 4px; height: 4px; border-radius: 50%; background: var(--primary); margin: 4px auto 0; }

/* Recipe cards */
.recipe-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: background .15s;
  text-decoration: none;
  color: inherit;
}
.recipe-card:hover { background: var(--surface-2); }
.recipe-cat-badge {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.recipe-cat-badge.breakfast { background: rgba(245,158,11,.15); }
.recipe-cat-badge.lunch     { background: rgba(16,185,129,.15); }
.recipe-cat-badge.dinner    { background: rgba(59,130,246,.15); }
.recipe-cat-badge.snack     { background: rgba(167,139,250,.15); }
.recipe-cat-badge.other     { background: var(--surface-2); }
.recipe-card-info    { flex: 1; min-width: 0; }
.recipe-card-name    { font-size: 14px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recipe-card-meta    { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.recipe-card-actions { display: flex; gap: 4px; flex-shrink: 0; }

/* Recipe detail */
.recipe-hero { margin-bottom: 20px; }
.recipe-title { font-size: 22px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.recipe-desc  { font-size: 14px; color: var(--text-muted); line-height: 1.6; margin-bottom: 12px; }
.recipe-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.recipe-meta-item { display: flex; align-items: center; gap: 4px; font-size: 13px; color: var(--text-muted); }
.nutrition-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 24px;
}
.nutrition-cell {
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 10px 8px;
  text-align: center;
}
.nutrition-cell-val   { font-size: 16px; font-weight: 700; color: var(--text); }
.nutrition-cell-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }
.ingredients-list { list-style: none; }
.ingredients-list li {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.ingredients-list li:last-child { border-bottom: none; }
.ingredient-amount { color: var(--text-muted); white-space: nowrap; margin-left: 8px; }
.instructions-list { list-style: none; }
.instructions-list li {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  line-height: 1.6;
}
.instructions-list li:last-child { border-bottom: none; }
.step-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* Recipe editor ingredient rows */
.ingredient-row {
  display: grid;
  grid-template-columns: 1fr 80px 70px auto;
  gap: 6px;
  margin-bottom: 6px;
  align-items: center;
}
.instruction-row {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
  align-items: flex-start;
}
.instruction-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 8px;
}

/* Diet settings */
.diet-goal-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

/* Macro shorthand pills */
.macro-pill {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}
.macro-pill.cal  { background: rgba(59,130,246,.15);  color: var(--primary); }
.macro-pill.prot { background: rgba(16,185,129,.15);  color: var(--success); }
.macro-pill.carb { background: rgba(245,158,11,.15);  color: var(--accent);  }
.macro-pill.fat  { background: rgba(167,139,250,.15); color: #a78bfa; }

/* Add-to-diary sheet (reuses ai-backdrop/ai-sheet) */
.serving-select {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 16px 0;
}
.serving-select label { font-size: 14px; color: var(--text-muted); flex: 1; }
.serving-input { width: 70px; text-align: center; }

/* ── Recipe search bar ──────────────────────────── */
.search-bar input[type="search"] {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 10px 14px;
  width: 100%;
  transition: border-color .15s;
}
.search-bar input[type="search"]:focus { outline: none; border-color: var(--primary); }
.search-bar input[type="search"]::placeholder { color: var(--text-dim); }

/* ── Diet history ───────────────────────────────── */
.history-week-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 12px;
}
.history-week-stat { text-align: center; }
.history-week-stat-val   { font-size: 16px; font-weight: 700; color: var(--text); }
.history-week-stat-label { font-size: 10px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: 2px; }

.history-day-card {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 10px;
  overflow: hidden;
  transition: background .15s;
}
.history-day-card.today   { border: 1.5px solid var(--primary); }
.history-day-card.empty   { opacity: .55; }

.history-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}
.history-day-left    { min-width: 0; }
.history-day-name    { font-size: 14px; font-weight: 600; color: var(--text); }
.history-day-kcal    { font-size: 13px; color: var(--text-muted); margin-top: 2px; }
.history-day-empty   { font-size: 12px; color: var(--text-dim); margin-top: 2px; }
.history-day-macros  { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.history-chevron     { color: var(--text-dim); transition: transform .2s; }
.history-chevron.flipped { transform: rotate(180deg); }

.history-day-detail {
  display: none;
  padding: 0 16px 14px;
  border-top: 1px solid var(--border);
}
.history-day-detail.open { display: block; }

.history-meal-group  { margin-top: 10px; }
.history-meal-type   { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }

/* Exercise video link */
.ex-video-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--primary);
  text-decoration: none;
}
.ex-video-link:hover { text-decoration: underline; }
.prep-video-link {
  margin-top: 12px;
  font-size: 15px;
  padding: 8px 18px;
  background: rgba(59,130,246,.12);
  border-radius: var(--radius-sm);
}

/* ── AI-generated images ────────────────────────── */

/* Recipe hero image */
.recipe-hero-img {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 16px;
  background: var(--surface);
}
/* Placeholder shown while image is generating */
.recipe-hero-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: var(--radius);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}
/* Recipe card thumbnail */
.recipe-thumb {
  width: 52px;
  height: 52px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

/* Exercise image in prep / detail */
.exercise-img-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 12px;
  background: var(--surface);
  position: relative;
}
.exercise-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* Gradient placeholder per exercise type */
.ex-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 40px;
}
.ex-placeholder.strength { background: linear-gradient(135deg,#1e3a5f,#1e293b); }
.ex-placeholder.timed    { background: linear-gradient(135deg,#3b2a1a,#1e293b); }
.ex-placeholder.cardio   { background: linear-gradient(135deg,#1a3d2a,#1e293b); }
.ex-placeholder.superset { background: linear-gradient(135deg,#2d1a3d,#1e293b); }
.ex-placeholder-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255,255,255,.7);
  text-align: center;
  padding: 0 16px;
  line-height: 1.3;
}
