/* NextRep — Direction artistique « Aurora Performance »
 * Verre dépoli, gradients chauds, hero tiles, pill nav flottante.
 */

/* ---------- Fonts —  Direction « Sport / Performance »
 * - Bebas Neue : titres condensés impactants (rang, count, headlines)
 * - Inter      : body UI, lisible partout
 * - JetBrains Mono : chiffres techniques (kg, kcal, dates)
 *
 * Fonts servies depuis Google Fonts (mis en cache par le SW au 1er load).
 */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- Design tokens ---------- */
:root {
  /* Bases sombres avec teinte chaude */
  --bg:           #0a0b12;
  --bg-glass:     rgba(255, 255, 255, 0.035);
  --bg-glass-2:   rgba(255, 255, 255, 0.06);
  --bg-card:      rgba(20, 22, 32, 0.65);
  --bg-elev:      rgba(28, 30, 42, 0.7);
  --bg-elev-2:    rgba(38, 40, 54, 0.75);
  --bg-deep:      #06070d;

  --hairline:        rgba(255, 255, 255, 0.08);
  --hairline-strong: rgba(255, 255, 255, 0.16);
  --border: var(--hairline);

  /* Texte */
  --text:      #f6f6fb;
  --text-dim:  #9ea3b5;
  --text-mute: #5a607a;

  /* Gradient signature : cyan → bleu → violet (électrique, glacé) */
  --grad-warm: linear-gradient(135deg, #22d3ee 0%, #3b82f6 50%, #8b5cf6 100%);
  --grad-warm-soft: linear-gradient(135deg, rgba(34, 211, 238, 0.18), rgba(139, 92, 246, 0.18));
  /* Gradient secondaire pour la data viz */
  --grad-cool: linear-gradient(135deg, #67e8f9 0%, #60a5fa 60%, #a78bfa 100%);
  /* Aurores posées en arrière-plan : cyan + indigo + violet */
  --aurora-1: rgba(34, 211, 238, 0.22);  /* cyan */
  --aurora-2: rgba(99, 102, 241, 0.20);  /* indigo */
  --aurora-3: rgba(139, 92, 246, 0.16);  /* violet */

  /* Accent solide */
  --accent:      #3b82f6;
  --accent-2:    #22d3ee;
  --accent-dim:  #1e40af;
  --accent-glow: rgba(59, 130, 246, 0.45);
  --gold:        #a78bfa;

  --success: #34d399;
  --danger:  #fb7185;
  --warning: #fbbf24;
  --info:    #818cf8;

  /* Géométrie */
  --radius-xl: 28px;
  --radius:    18px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --nav-h: 76px;
  --top-h: 56px;
  --safe-top:    env(safe-area-inset-top);
  --safe-bottom: env(safe-area-inset-bottom);

  --shadow-soft: 0 8px 32px rgba(0, 0, 0, 0.4);
  --shadow-glow: 0 12px 40px rgba(255, 120, 73, 0.25);

  --font-display: 'Bebas Neue', 'Oswald', Impact, sans-serif;
  --font-ui:      'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; }

/* Bebas Neue est condensée → on lui donne un peu d'air et on majore la
   taille typique (Bebas paraît visuellement plus petite à équivalent px) */
[style*="font-display"],
h1, h2, h3,
.hero-headline,
.rank-tile-name,
.streak-count,
.calorie-rem,
.auth-title {
  letter-spacing: 0.02em;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: contain;
}

/* Aurora background : grandes auras de couleur posées au lointain */
body {
  min-height: 100vh;
  padding-top: calc(var(--top-h) + var(--safe-top));
  padding-bottom: calc(var(--nav-h) + var(--safe-bottom) + 28px);
  position: relative;
  overflow-x: hidden;
}
body::before, body::after {
  content: '';
  position: fixed;
  pointer-events: none;
  z-index: -1;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.7;
}
body::before {
  /* aurora warm en haut à gauche */
  top: -180px; left: -120px;
  width: 480px; height: 480px;
  background: radial-gradient(circle, var(--aurora-1) 0%, transparent 70%);
}
body::after {
  /* aurora ambre/indigo en bas à droite */
  bottom: -200px; right: -160px;
  width: 520px; height: 520px;
  background:
    radial-gradient(circle at 70% 30%, var(--aurora-2) 0%, transparent 60%),
    radial-gradient(circle at 30% 70%, var(--aurora-3) 0%, transparent 60%);
}

button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 16px; color: var(--text); }

/* ---------- Topbar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--top-h) + var(--safe-top));
  padding: var(--safe-top) 20px 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(10, 11, 18, 0.6);
  backdrop-filter: blur(20px) saturate(160%);
  -webkit-backdrop-filter: blur(20px) saturate(160%);
  border-bottom: 1px solid var(--hairline);
  z-index: 50;
}
.topbar-actions { flex-shrink: 0; }
.topbar h1 {
  font-family: var(--font-ui);
  /* Réduit automatiquement la police selon la largeur de l'écran :
     - 17px sur grand écran (>425px de viewport)
     - jusqu'à 13px sur petit écran (320px) */
  font-size: clamp(13px, 4vw, 17px);
  line-height: 1.15;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--text);
  min-width: 0;
  flex: 1;
  /* Autorise 2 lignes max si vraiment besoin (ellipsis sur 3e+) */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* FAB : gradient warm, pill, soft float */
.fab {
  background: var(--grad-warm);
  color: #fff;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 8px 24px var(--accent-glow);
  transition: transform 0.15s ease;
}
.fab:active { transform: scale(0.92); }
.fab[hidden] { display: none; }
body.no-chrome .fab { display: none; }

/* Badge "non lu" sur le bouton actualités */
#notifs-btn { position: relative; }
.notifs-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--danger);
  box-shadow: 0 0 0 2px var(--bg);
}
.notifs-badge[hidden] { display: none; }

/* Liste actualités dans la modal */
.news-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 2px;
}
.news-item {
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 14px;
}
.news-item.unread {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent-glow);
}
.news-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 6px;
}
.news-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.news-date {
  font-size: 11px;
  color: var(--text-mute);
  white-space: nowrap;
}
.news-body {
  margin: 0;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.55;
}

/* Scanner code-barres */
.scanner-backdrop { z-index: 10000; }
.scanner-modal { max-width: 440px; }
.scanner-title { margin-top: 0; }
.scanner-hint { margin: 4px 0 12px; font-size: 13px; }
.scanner-reader {
  width: 100%;
  min-height: 220px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: #000;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}
.scanner-reader video {
  width: 100% !important;
  height: auto !important;
  display: block;
}
.scanner-fallback {
  color: var(--text-dim);
  text-align: center;
  padding: 32px 18px;
  margin: 0;
  font-size: 13px;
}
.scanner-or {
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--text-mute);
  margin: 14px 0 8px;
  font-family: var(--font-mono);
}
.scanner-actions {
  display: flex;
  gap: 8px;
}
.scanner-input { flex: 1; }
.scanner-ok { flex-shrink: 0; }

/* Séparateur "ou saisis manuellement" dans la modal d'ajout d'aliment */
.food-or-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 10px;
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}
.food-or-divider::before,
.food-or-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

/* ===== Bouton Google (style Material) ===== */
.btn-google {
  background: #fff;
  color: #3c4043;
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 16px;
  font-size: 14px;
  transition: background 0.15s, box-shadow 0.15s;
}
.btn-google:hover {
  background: #f5f5f5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}
.btn-google:active { transform: scale(0.985); }
.btn-google .icon { margin-right: 0; }

/* Séparateur "ou" entre Google et le formulaire email */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  color: var(--text-mute);
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--hairline);
}

/* ===== Footer légal sur l'écran d'auth ===== */
.auth-legal-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 12px;
}
.link-btn {
  background: none;
  border: none;
  color: var(--accent-2);
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
  font-size: inherit;
  padding: 0;
}
.link-btn:hover { color: var(--text); }

/* Checkbox acceptation CGU à l'inscription */
.accept-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  margin: 8px 0 12px;
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}
.accept-row input[type="checkbox"] {
  margin-top: 2px;
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

/* Liens légaux dans le menu compte */
.account-legal-links {
  text-align: center;
  font-size: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

/* Labels de section dans le menu compte ("Mes données", "Gestion"...) */
.account-section-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-mute);
  margin: 18px 0 6px;
  padding: 0 4px;
}

/* ===== Sélecteur de langue (compact, drapeaux + code) ===== */
.lang-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.lang-btn {
  flex: 1;
  min-width: 64px;
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  color: var(--text-dim);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: all 0.15s;
}
.lang-btn:hover { border-color: var(--accent); color: var(--text); }
.lang-btn.active {
  background: var(--grad-warm);
  color: #fff;
  border-color: transparent;
}
.lang-flag { font-size: 18px; line-height: 1; }
.lang-code { font-family: var(--font-mono); letter-spacing: 0.04em; }

/* Affiche d'où vient le rang : "via Bench Press" sous le poids */
.rank-row-source {
  display: block;
  font-size: 10.5px;
  font-style: italic;
  margin-top: 2px;
  opacity: 0.75;
}

/* ===== Onboarding : 3 grandes cartes (Templates / IA / Manuel) ===== */
.onboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-top: 16px;
}
.onboard-card {
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.2s;
  font-family: inherit;
  color: var(--text);
}
.onboard-card:hover { border-color: var(--accent); }
.onboard-card:active { transform: scale(0.985); }
.onboard-card h3 {
  margin: 10px 0 4px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.onboard-card p {
  margin: 0;
  font-size: 13px;
  color: var(--text-dim);
}
.onboard-card-primary {
  background:
    radial-gradient(120% 90% at 0% 0%, rgba(59, 130, 246, 0.18), transparent 55%),
    var(--bg-card);
  border-color: rgba(59, 130, 246, 0.3);
}
.onboard-card-ai {
  background:
    radial-gradient(120% 90% at 100% 0%, rgba(139, 92, 246, 0.18), transparent 55%),
    var(--bg-card);
  border-color: rgba(139, 92, 246, 0.3);
}
.onboard-card .icon { color: var(--accent-2); }
.onboard-card-ai .icon { color: #a78bfa; }
.onboard-badge {
  display: inline-block;
  background: linear-gradient(135deg, #ff7a00, #ffb800);
  color: #1a1c25;
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* Row "quick start" (quand l'user a déjà des programmes) */
.quickstart-row {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}
.quickstart-row .btn { flex: 1; }

/* ===== Picker de templates ===== */
.template-picker-modal { max-width: 600px; }
.template-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 60vh;
  overflow-y: auto;
  padding: 4px 2px;
}
.template-card {
  position: relative;
  text-align: left;
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.2s;
}
.template-card:hover { border-color: var(--accent); }
.template-badge {
  position: absolute;
  top: 8px;
  right: 10px;
  background: var(--bg-elev);
  border: 1px solid var(--hairline-strong);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
}
.template-name { margin: 0 0 4px; font-size: 15px; }
.template-desc { margin: 0 0 6px; font-size: 12.5px; line-height: 1.4; }
.template-meta {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--text-mute);
  font-family: var(--font-mono);
}

/* Programmes affichés en preview avant import */
.template-programs {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 45vh;
  overflow-y: auto;
  margin: 12px 0;
}
.template-prog-card {
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.template-prog-card h4 { margin: 0 0 4px; font-size: 13px; }
.template-prog-exos {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.7;
}

/* ===== Générateur IA : rows de radio buttons ===== */
.gen-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.gen-radio {
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s;
}
.gen-radio.active {
  background: var(--grad-warm);
  color: #fff;
  border-color: transparent;
}

/* ===== Galerie photos progression ===== */
.photo-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.photo-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.photo-img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  display: block;
}
.photo-date {
  padding: 8px 10px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  text-align: center;
}
.photo-delete {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--danger);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.photo-delete:hover { background: rgba(251, 113, 133, 0.25); }

/* ===== Modal légale (CGU / Confidentialité) ===== */
.legal-modal { max-width: 640px; }
.legal-scroll {
  max-height: 70vh;
  overflow-y: auto;
  padding: 0 4px;
}
.legal-scroll h1 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 16px;
}
.legal-scroll h2 {
  font-size: 16px;
  margin: 18px 0 8px;
  color: var(--text);
}
.legal-scroll p,
.legal-scroll ul {
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.6;
  margin: 0 0 10px;
}
.legal-scroll ul { padding-left: 20px; }
.legal-scroll li { margin-bottom: 4px; }
.legal-scroll strong { color: var(--text); }

/* ===== Bibliothèque d'exercices ===== */
.exo-filter-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 0 12px;
  margin: 0 -20px 12px;
  padding-left: 20px;
  padding-right: 20px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}
.exo-filter-strip::-webkit-scrollbar { display: none; }
.exo-chip {
  flex-shrink: 0;
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  font-family: var(--font-ui);
  white-space: nowrap;
  transition: all 0.2s ease;
  scroll-snap-align: start;
}
.exo-chip.active {
  background: var(--grad-warm);
  color: #fff;
  border-color: transparent;
}
.exo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}
.exo-card {
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  text-align: left;
  font-family: inherit;
  transition: transform 0.15s ease, border-color 0.2s;
}
.exo-card:hover { border-color: var(--accent); }
.exo-card:active { transform: scale(0.98); }
.exo-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: #1a1c25;
  display: block;
}
.exo-thumb-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  opacity: 0.4;
}
.exo-info {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.exo-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.exo-muscles {
  font-size: 11px;
  text-transform: capitalize;
}

/* ===== Détail exercice (modal) ===== */
.exo-detail-modal { max-width: 560px; }
.exo-detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 6px 0 12px;
}
.exo-tag {
  background: var(--bg-glass-2);
  border: 1px solid var(--hairline);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--text-dim);
}
.exo-detail-images {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 12px 0;
}
.exo-detail-img {
  width: 100%;
  border-radius: var(--radius-sm);
  background: #1a1c25;
}
.exo-detail-section { margin-top: 18px; }
.exo-detail-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-mute);
  margin: 0 0 8px;
}
.exo-instructions {
  padding-left: 20px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.6;
}
.exo-instructions li { margin-bottom: 8px; }

/* Statut de traduction au-dessus des instructions */
.exo-translate-status {
  font-size: 11px;
  font-style: italic;
  margin-bottom: 8px;
}

/* Bouton "voir détails" sur une carte d'exo (modal picker) */
.exo-card { position: relative; }
.exo-card-info {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(8px);
}
.exo-card-info:hover { background: var(--accent); }

/* Modal picker plus grande pour bien afficher la grille */
.exo-picker-modal { max-width: 720px; max-height: 90vh; display: flex; flex-direction: column; }
.exo-picker-modal .exo-grid {
  max-height: 50vh;
  overflow-y: auto;
  padding-right: 4px;
}

/* ===== Icônes SVG inline (style Lucide) =====
   Alignées avec le texte voisin, prennent la couleur du parent (currentColor). */
.icon {
  display: inline-block;
  vertical-align: -0.18em; /* baseline visuel */
  flex-shrink: 0;
}
/* Petit espace après une icône suivie de texte dans un bouton */
button .icon,
.exo-tag .icon { margin-right: 6px; }

/* ===== Records personnels (PR) ===== */
.pr-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pr-card {
  background: var(--bg-card);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: 4px 12px;
  align-items: center;
}
.pr-name {
  grid-column: 1;
  grid-row: 1;
  font-weight: 700;
  color: var(--text);
  font-size: 14px;
  line-height: 1.2;
}
.pr-stats {
  grid-column: 2;
  grid-row: 1 / span 2;
  text-align: right;
}
.pr-stat-main {
  display: flex;
  align-items: baseline;
  gap: 4px;
  justify-content: flex-end;
}
.pr-weight {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}
.pr-unit {
  font-size: 12px;
  color: var(--text-mute);
}
.pr-reps {
  margin-left: 6px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-dim);
}
.pr-e1rm {
  font-size: 11px;
  color: var(--accent-2);
  margin-top: 2px;
}
.pr-date {
  grid-column: 1;
  grid-row: 2;
  font-size: 11px;
  font-family: var(--font-mono);
}

/* Toast PR celebratory */
.pr-toast {
  position: fixed;
  top: calc(var(--safe-top) + var(--top-h) + 12px);
  left: 50%;
  transform: translate(-50%, -20px);
  opacity: 0;
  pointer-events: none;
  z-index: 5000;
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pr-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
.pr-toast-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  background:
    radial-gradient(120% 90% at 0% 50%, rgba(255, 184, 0, 0.25), transparent 60%),
    rgba(20, 22, 32, 0.95);
  border: 1px solid rgba(255, 184, 0, 0.45);
  box-shadow: 0 16px 50px rgba(255, 122, 0, 0.35);
  border-radius: var(--radius);
  padding: 14px 18px;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text);
  min-width: 280px;
}
.pr-toast-inner > .icon {
  color: #ffb800;
  filter: drop-shadow(0 0 12px rgba(255, 184, 0, 0.6));
}
.pr-toast-title {
  font-weight: 700;
  font-size: 14px;
  background: linear-gradient(135deg, #ff7a00 0%, #ffb800 60%, #ffe066 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.pr-toast-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}
.pr-toast-delta {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  background: rgba(255, 184, 0, 0.15);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: #ffd060;
}

/* Prévisualisation d'un programme importé */
.import-program-preview {
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 10px 0 14px;
}
.import-program-preview h3 {
  margin: 0 0 6px;
  font-size: 16px;
}
.import-exo-list {
  list-style: disc;
  padding-left: 20px;
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--text-dim);
  line-height: 1.7;
  max-height: 200px;
  overflow-y: auto;
}

/* ===== Row d'actions secondaires sur la page édition programme ===== */
.program-edit-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}
.btn-icon-text {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  font-size: 13px;
  flex: 1;
  justify-content: center;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.icon-btn {
  background: var(--bg-glass);
  color: var(--text);
  border: 1px solid var(--hairline);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}
.icon-btn:hover { background: var(--bg-glass-2); border-color: var(--hairline-strong); }
.icon-btn:active { transform: scale(0.94); }
.icon-btn svg { width: 16px; height: 16px; }

.sync-indicator {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: transparent;
  transition: background 0.2s ease;
  flex-shrink: 0;
}
.sync-indicator[data-status="pending"],
.sync-indicator[data-status="saving"] {
  background: var(--warning);
  animation: pulse 1.4s ease-in-out infinite;
}
.sync-indicator[data-status="saved"] { background: var(--success); }
.sync-indicator[data-status="error"] { background: var(--danger); }
@keyframes pulse { 0%, 100% { opacity: 0.35 } 50% { opacity: 1 } }

body.no-chrome .bottom-nav { display: none; }
body.no-chrome { padding-bottom: var(--safe-bottom); }
body.no-chrome .topbar-actions .icon-btn,
body.no-chrome .topbar-actions .sync-indicator { visibility: hidden; }

/* ---------- Bottom nav : pill flottante ---------- */
.bottom-nav {
  position: fixed;
  bottom: calc(14px + var(--safe-bottom));
  left: 14px; right: 14px;
  margin: 0 auto;
  max-width: 540px;
  height: var(--nav-h);
  background: rgba(14, 16, 24, 0.72);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 12px 48px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  padding: 8px;
  z-index: 50;
}
.nav-btn {
  flex: 1;
  min-width: 0; /* permet à flex de rétrécir vraiment */
  background: none;
  border: none;
  color: var(--text-mute);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.2s ease;
  padding: 8px 4px;
  height: 100%;
  border-radius: 999px;
  position: relative;
  overflow: hidden;
}
.nav-btn span {
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
}
/* L'actif a un fond pill et un label TOUJOURS visible : on l'élargit pour
   accueillir des mots longs comme "Programmes" / "Historique" sans tronquer */
.nav-btn.active { flex: 1.7; }
.nav-btn.active span { text-overflow: clip; }
/* Sur les inactifs, on garde un ellipsis discret au cas où */
.nav-btn:not(.active) span { text-overflow: ellipsis; }
@media (max-width: 360px) {
  .nav-btn { font-size: 9.5px; }
}
.nav-btn svg {
  width: 22px;
  height: 22px;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.nav-btn.active {
  color: #fff;
  background: var(--grad-warm);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 6px 18px var(--accent-glow);
}
.nav-btn.active svg { transform: scale(1.08); }
.nav-btn:not(.active):active { background: rgba(255, 255, 255, 0.04); }

/* ---------- Layout ---------- */
.view {
  padding: 20px 18px 8px;
  max-width: 720px;
  margin: 0 auto;
}

/* ---------- Cards : verre dépoli ---------- */
.card {
  position: relative;
  background: var(--bg-card);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: transform 0.15s ease, border-color 0.2s ease;
  box-shadow: var(--shadow-soft);
}
.card.clickable { cursor: pointer; }
.card.clickable:hover { border-color: var(--hairline-strong); }
.card.clickable:active { transform: scale(0.99); }

.card-title {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  word-break: break-word;
}
.card-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.card-row > div:first-child { min-width: 0; flex: 1; }
.card-row .chip { flex-shrink: 0; }
.card-meta {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.card-meta span { display: inline-flex; align-items: center; gap: 5px; }
.card-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* ---------- Hero tiles (dashboard) ---------- */
.hero-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  grid-template-areas:
    "rank nutrition"
    "streak streak";
  gap: 12px;
  margin-bottom: 18px;
}
/* Sur petit écran (mobile portrait), on empile en 1 colonne pour avoir
   plus de place au texte (rang "Grand Maître" / "À débloquer" sans coupure) */
@media (max-width: 520px) {
  .hero-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "rank"
      "nutrition"
      "streak";
  }
  .hero-tile.hero-tile-streak {
    min-height: 80px;
  }
}
.hero-tile-rank { grid-area: rank; }
.hero-tile-glass:not(.hero-tile-streak) { grid-area: nutrition; }
.hero-tile.hero-tile-streak {
  grid-area: streak;
  min-height: 96px;
  padding: 14px 24px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 20px;
  background:
    radial-gradient(120% 90% at 0% 50%, rgba(255, 122, 0, 0.18), transparent 60%),
    var(--bg-card);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  border: 1px solid rgba(255, 122, 0, 0.22);
}
.hero-tile-streak.empty {
  background: var(--bg-card);
  border-color: var(--hairline);
}
.streak-flame-wrap {
  width: 56px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 6px 18px rgba(255, 122, 0, 0.55));
  animation: streak-flicker 2.6s ease-in-out infinite;
}
.hero-tile-streak.empty .streak-flame-wrap {
  filter: grayscale(1) opacity(0.35);
  animation: none;
}
.streak-flame { width: 100%; height: 100%; }
.streak-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.streak-eyebrow {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
}
.streak-count {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1;
  font-weight: 700;
  background: linear-gradient(135deg, #ff7a00 0%, #ffb800 60%, #ffe066 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  letter-spacing: -0.02em;
}
.hero-tile-streak.empty .streak-count {
  background: none;
  color: var(--text-mute);
}
.streak-sub {
  font-size: 12px;
  color: var(--text-dim);
}
@keyframes streak-flicker {
  0%, 100% { transform: scale(1) rotate(-1deg); }
  25%      { transform: scale(1.04) rotate(1deg); }
  50%      { transform: scale(0.98) rotate(-0.5deg); }
  75%      { transform: scale(1.02) rotate(1.5deg); }
}
.hero-tile {
  position: relative;
  border-radius: var(--radius);
  padding: 18px;
  overflow: hidden;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  transition: transform 0.18s ease;
  border: 1px solid var(--hairline);
}
.hero-tile:active { transform: scale(0.985); }
.hero-tile-glass {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* Tuile rang : glass, logo prominent à droite, glow de la couleur du rang */
.hero-tile-rank {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--rank-color, var(--hairline));
  box-shadow: 0 0 40px var(--rank-glow, transparent);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 14px;
  gap: 10px;
  padding: 16px 14px 16px 18px;
}
.hero-tile-rank::before {
  /* halo de couleur du rang depuis la droite */
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 100% 50%, var(--rank-glow, transparent) 0%, transparent 65%);
  opacity: 0.5;
  pointer-events: none;
}
.hero-tile-rank.empty {
  border-color: var(--hairline);
  box-shadow: none;
}
.rank-tile-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  z-index: 1;
  min-width: 0;
}
.rank-tile-name {
  color: var(--rank-color, var(--text)) !important;
  text-shadow: 0 0 18px var(--rank-glow, transparent);
  font-size: clamp(18px, 5vw, 26px) !important;
  line-height: 1.1;
  /* On laisse le navigateur wrap entre les mots mais on évite la coupure
     de mots qui donnait "débloquer" sur 2 lignes */
  word-break: normal;
  overflow-wrap: break-word;
  hyphens: none;
}
.hero-tile-rank.empty .rank-tile-name {
  color: var(--text-dim) !important;
  text-shadow: none;
}
.rank-tile-logo {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  object-fit: contain;
  filter: drop-shadow(0 0 18px var(--rank-glow, transparent));
  z-index: 1;
  flex-shrink: 0;
}
.rank-tile-logo-placeholder {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  color: var(--text-mute);
  background: var(--bg-glass);
  border: 1px dashed var(--hairline-strong);
  flex-shrink: 0;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.hero-headline {
  font-family: var(--font-ui);
  font-size: 28px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  position: relative;
  z-index: 1;
}
.hero-sub {
  font-size: 12.5px;
  color: var(--text-dim);
  position: relative;
  z-index: 1;
}

/* ---------- Buttons ---------- */
.btn {
  background: var(--bg-glass);
  color: var(--text);
  border: 1px solid var(--hairline);
  padding: 12px 18px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  transition: all 0.18s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.btn:hover { border-color: var(--hairline-strong); background: var(--bg-glass-2); }
.btn:active { transform: scale(0.97); }
.btn-primary {
  background: var(--grad-warm);
  color: #fff;
  border: none;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.22) inset,
    0 6px 22px var(--accent-glow);
}
.btn-primary:hover { box-shadow: 0 1px 0 rgba(255, 255, 255, 0.3) inset, 0 8px 28px var(--accent-glow); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--bg-glass); }
.btn-danger { color: var(--danger); border-color: rgba(251, 113, 133, 0.3); background: transparent; }
.btn-danger:hover { background: rgba(251, 113, 133, 0.08); }
.btn-block { width: 100%; }
.btn-sm { padding: 8px 14px; font-size: 12.5px; }

/* ---------- Forms ---------- */
.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 14px;
}
.field label {
  font-family: var(--font-ui);
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--text-dim);
  font-weight: 600;
}
.input, .textarea, .select {
  background: var(--bg-glass);
  border: 1.5px solid var(--hairline);
  color: var(--text);
  padding: 13px 16px;
  border-radius: 14px;
  outline: none;
  transition: all 0.18s ease;
  width: 100%;
  font-family: var(--font-ui);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  background: var(--bg-glass-2);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.18);
}
.select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-dim) 50%),
    linear-gradient(135deg, var(--text-dim) 50%, transparent 50%);
  background-position:
    calc(100% - 20px) 50%,
    calc(100% - 14px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}
.select option {
  background-color: #181b24;
  color: #f6f6fb;
  font-family: var(--font-ui);
  padding: 8px;
}

/* ---------- Segmented control (genre, etc.) ---------- */
.segmented {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 4px;
}
.segmented-item {
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 10px 12px;
  border-radius: 11px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}
.segmented-item:hover { color: var(--text); }
.segmented-item.active {
  background: var(--grad-warm);
  color: #fff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

/* ---------- Option list (niveau d'activité, etc.) ---------- */
.option-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: left;
  font-family: var(--font-ui);
}
.option-row:hover { border-color: var(--hairline-strong); background: var(--bg-glass-2); }
.option-row.active {
  border-color: var(--accent);
  background: rgba(59, 130, 246, 0.10);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.10);
}
.option-row-text { min-width: 0; }
.option-row-label {
  font-size: 14px;
  font-weight: 600;
}
.option-row-hint {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  margin-top: 2px;
}
.option-row-tick {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-mute);
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  flex-shrink: 0;
  transition: all 0.18s ease;
}
.option-row.active .option-row-tick {
  background: var(--grad-warm);
  border: none;
  color: #fff;
  box-shadow: 0 0 12px var(--accent-glow);
}
.textarea { resize: vertical; min-height: 80px; }
.input-num {
  text-align: center;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
  -moz-appearance: textfield;
}
.input-num::-webkit-outer-spin-button,
.input-num::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ---------- Section title ---------- */
.section-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--text);
  margin: 28px 0 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title:first-child { margin-top: 4px; }

.row {
  display: flex;
  gap: 10px;
  align-items: center;
}
.row > * { flex: 1; }
.row-tight { gap: 6px; }
.spacer { flex: 1; }

/* ---------- Exercise (program editor) ---------- */
.exercise-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}
.exercise-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
}
.exercise-head .exercise-name {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 700;
  padding: 4px 0;
  border-bottom: 1.5px dashed var(--hairline);
}
.exercise-head .exercise-name:focus {
  outline: none;
  border-bottom-color: var(--accent);
}
.exercise-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}
.exercise-grid .field { margin-bottom: 0; }
.exercise-grid label { font-size: 11px; }

/* ---------- Set rows ---------- */
.set-row {
  display: grid;
  grid-template-columns: 36px 1fr 1fr 48px;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
}
.set-row:last-child { border-bottom: none; }
.set-idx {
  background: var(--bg-glass);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  width: 36px; height: 36px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline);
}
.set-row.done .set-idx {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--success);
}
.set-target {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-top: 3px;
  text-align: center;
}
.set-check {
  background: var(--bg-glass);
  border: 1.5px solid var(--hairline);
  border-radius: 14px;
  width: 48px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  color: var(--text-mute);
  transition: all 0.18s ease;
}
.set-check.done {
  background: var(--grad-warm);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-glow);
}
.set-check svg { width: 20px; height: 20px; }

/* ---------- Empty state ---------- */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-dim);
}
.empty-icon {
  font-size: 48px;
  margin-bottom: 14px;
  opacity: 0.7;
}
.empty-title {
  font-family: var(--font-ui);
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 8px;
  letter-spacing: -0.015em;
}
.empty-hint {
  font-size: 13.5px;
  margin: 0 0 22px;
  line-height: 1.5;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 24px);
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--bg-elev);
  color: var(--text);
  padding: 11px 18px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--hairline-strong);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  max-width: 90%;
  text-align: center;
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Modal : sheet avec grab handle ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: rgba(20, 22, 32, 0.92);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border: 1px solid var(--hairline);
  border-bottom: none;
  border-top-left-radius: var(--radius-xl);
  border-top-right-radius: var(--radius-xl);
  width: 100%;
  max-width: 600px;
  padding: 26px 20px calc(22px + var(--safe-bottom));
  animation: slideUp 0.32s cubic-bezier(0.22, 0.61, 0.36, 1);
  position: relative;
}
.modal::before {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 4px;
  background: var(--hairline-strong);
  border-radius: 4px;
}
.modal h2 {
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.015em;
  margin: 8px 0 18px;
  font-size: 22px;
}

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { transform: translateY(100%) } to { transform: translateY(0) } }

/* ---------- Chips ---------- */
.chip {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--bg-glass);
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--hairline);
}
.chip-accent {
  background: var(--grad-warm-soft);
  color: var(--accent-2);
  border-color: rgba(59, 130, 246, 0.4);
}

/* ---------- Rest timer ---------- */
.rest-timer {
  position: fixed;
  bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px);
  left: 16px;
  right: 16px;
  max-width: 540px;
  margin: 0 auto;
  background: var(--grad-warm);
  color: #fff;
  padding: 14px 20px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.2) inset,
    0 16px 40px var(--accent-glow);
  z-index: 80;
  animation: slideUp 0.28s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.rest-timer-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  opacity: 0.92;
}
.rest-timer-time {
  font-family: var(--font-ui);
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.rest-timer-actions { display: flex; gap: 8px; }
.rest-timer-actions button {
  background: rgba(255, 255, 255, 0.20);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  width: 40px; height: 40px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: background 0.18s ease;
}
.rest-timer-actions button:hover { background: rgba(255, 255, 255, 0.28); }

/* ---------- Chart canvas ---------- */
.chart-wrap {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 8px 8px;
  margin-bottom: 12px;
}
.chart-wrap canvas {
  width: 100%;
  height: 220px;
  display: block;
}
.chart-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.stat-box {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
}
.stat-val {
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 700;
  background: var(--grad-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.10em;
  margin-top: 6px;
}

/* ---------- Utility ---------- */
.muted { color: var(--text-dim); }
.tabular { font-variant-numeric: tabular-nums; }
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 16px; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }
.hidden { display: none !important; }

/* ---------- Écran d'authentification ---------- */
.auth-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  max-width: 420px;
  margin: 40px auto 0;
  text-align: center;
}
.auth-logo {
  margin-bottom: 8px;
  filter: drop-shadow(0 0 32px var(--accent-glow));
  display: flex;
  justify-content: center;
}
.auth-logo-img {
  width: 260px;
  height: 260px;
  object-fit: contain;
}
.auth-title {
  font-family: var(--font-ui);
  font-size: 42px;
  font-weight: 700;
  /* margin-top négatif pour remonter le titre vers le logo (qui a beaucoup
     de padding visuel à cause du drop-shadow / contenu transparent) */
  margin: -56px 0 8px;
  letter-spacing: -0.025em;
  background: var(--grad-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.auth-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px;
  margin: 24px 0 20px;
  width: 100%;
  max-width: 300px;
}
.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-dim);
  padding: 10px 18px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.auth-tab.active {
  background: var(--grad-warm);
  color: #fff;
  box-shadow: 0 6px 18px var(--accent-glow);
}
.auth-form { width: 100%; text-align: left; }
.auth-form .field { margin-bottom: 14px; }

.auth-spinner {
  width: 38px;
  height: 38px;
  border: 3px solid var(--hairline);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
  margin: 18px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Muscle chips ---------- */
.muscle-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.muscle-chip {
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.18s ease;
}
.muscle-chip:hover { border-color: var(--hairline-strong); color: var(--text); }
.muscle-chip.selected {
  background: var(--grad-warm);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 14px var(--accent-glow);
}
.muscle-chip.auto:not(.selected) {
  border-color: rgba(59, 130, 246, 0.5);
  border-style: dashed;
  color: var(--accent-2);
}

/* ---------- Section rang ---------- */
.rank-section {
  margin-bottom: 20px;
}
.overall-rank {
  position: relative;
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--rank-color, var(--hairline-strong));
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  box-shadow: 0 0 60px var(--rank-glow, transparent);
  overflow: hidden;
}
.overall-rank::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 80% 50%, var(--rank-glow, transparent) 0%, transparent 65%);
  opacity: 0.5;
  pointer-events: none;
}
.overall-rank-icon {
  font-size: 36px;
  filter: drop-shadow(0 0 8px var(--rank-glow, transparent));
  z-index: 1;
}
.overall-rank-logo {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  filter: drop-shadow(0 0 20px var(--rank-glow, transparent));
  z-index: 1;
  flex-shrink: 0;
  object-fit: contain;
}
.overall-rank-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
}
.overall-rank-name {
  font-family: var(--font-ui);
  font-size: 30px;
  font-weight: 700;
  color: var(--rank-color, var(--text));
  text-shadow: 0 0 24px var(--rank-glow, transparent);
  letter-spacing: -0.02em;
  margin-top: 2px;
  position: relative;
  z-index: 1;
}

.body-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 18px 0;
}
.body-toggle {
  display: inline-flex;
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px;
  margin-bottom: 14px;
  gap: 4px;
}
.body-toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 18px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.25s ease;
}
.body-toggle-btn.active {
  background: var(--grad-warm);
  color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}
.body-stage {
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.4));
}
.body-diagram {
  width: 220px;
  max-width: 75%;
  height: auto;
}
.body-diagram { display: block; margin: 0 auto; }
.body-diagram [data-g] {
  transition: fill 0.3s ease;
}

.rank-list {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  overflow: hidden;
}
.rank-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--hairline);
}
.rank-row:last-child { border-bottom: none; }
.rank-row.empty { opacity: 0.55; }
.rank-row-name {
  font-size: 13.5px;
  font-weight: 600;
}
.rank-row-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}
.rank-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.35);
  color: var(--rank-color, var(--text));
  border: 1px solid var(--rank-color, var(--hairline));
  padding: 4px 11px 4px 4px;
  border-radius: 999px;
  font-family: var(--font-ui);
  font-size: 11.5px;
  font-weight: 600;
  text-shadow: 0 0 10px var(--rank-glow, transparent);
  box-shadow: 0 0 18px var(--rank-glow, transparent);
}
.rank-badge-logo {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: contain;
}
.rank-row-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

/* ---------- Nutrition : Calorie Hero ---------- */
.calorie-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 22px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 22px 22px 22px 18px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.10);
}
.calorie-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 50%, rgba(34, 211, 238, 0.10), transparent 60%);
  pointer-events: none;
}
.calorie-ring {
  position: relative;
  width: 150px;
  height: 150px;
  flex-shrink: 0;
}
.calorie-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
  filter: drop-shadow(0 0 18px rgba(59, 130, 246, 0.4));
}
.kcal-ring-bg { fill: none; stroke: rgba(255, 255, 255, 0.06); stroke-width: 11; }
.kcal-ring-fg {
  fill: none;
  stroke: url(#kcalGrad);
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.5s ease;
}
.calorie-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.calorie-val {
  font-family: var(--font-ui);
  font-size: 38px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
  background: var(--grad-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.calorie-unit {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-dim);
  margin-top: 4px;
}
.calorie-meta {
  position: relative;
  z-index: 1;
  min-width: 0;
}
.calorie-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.calorie-rem {
  font-family: var(--font-ui);
  font-size: 36px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--text);
}
.calorie-target {
  font-family: var(--font-ui);
  font-size: 12.5px;
  color: var(--text-dim);
  margin-top: 4px;
}

@media (max-width: 380px) {
  .calorie-hero { gap: 16px; padding: 18px 16px; }
  .calorie-ring { width: 130px; height: 130px; }
  .calorie-val { font-size: 32px; }
  .calorie-rem { font-size: 30px; }
}

/* ---------- Nutrition : Macro bars ---------- */
.macro-bars {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
}
.macro-bar { display: flex; flex-direction: column; gap: 7px; }
.macro-bar-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.macro-bar-label {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.macro-bar-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
  white-space: nowrap;
}
.macro-bar-val strong {
  color: var(--text);
  font-weight: 500;
  font-size: 13.5px;
}
.macro-bar-sep { margin: 0 4px; opacity: 0.5; }
.macro-bar-unit { margin-left: 2px; opacity: 0.7; }
.macro-bar-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.macro-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.4s ease;
}
.macro-bar-fill.over {
  background: var(--danger) !important;
  box-shadow: 0 0 12px rgba(251, 113, 133, 0.4) !important;
}

/* ---------- Nutrition : date / cibles ---------- */
.date-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 4px;
}
.date-nav .btn-sm {
  border-radius: 999px;
  width: 36px;
  height: 36px;
  padding: 0;
}
.date-label {
  flex: 1;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-transform: capitalize;
}
.targets-edit {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 14px;
}
.targets-edit summary {
  cursor: pointer;
  color: var(--text-dim);
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  user-select: none;
}
.macro-targets-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.macro-targets-grid .field { margin-bottom: 0; }
.input-suffix {
  position: relative;
  display: flex;
  align-items: center;
}
.input-suffix .input { padding-right: 46px; }
.input-suffix .suffix {
  position: absolute;
  right: 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  pointer-events: none;
}
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  cursor: pointer;
}
.switch input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ============================================================
   Séance picker (hero + cards programme)
   ============================================================ */
.pick-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  background: var(--grad-warm);
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 22px;
  margin-bottom: 14px;
  cursor: pointer;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 12px 36px var(--accent-glow);
  transition: transform 0.15s ease;
}
.pick-hero:active { transform: scale(0.985); }
.pick-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 100% 0%, rgba(255, 255, 255, 0.18), transparent 55%),
    radial-gradient(circle at 0% 100%, rgba(0, 0, 0, 0.18), transparent 50%);
  pointer-events: none;
}
.pick-hero-text { position: relative; z-index: 1; min-width: 0; flex: 1; }
.pick-hero .hero-eyebrow { color: rgba(255, 255, 255, 0.85); }
.pick-hero-name {
  font-family: var(--font-ui);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-top: 4px;
  word-break: break-word;
}
.pick-hero-meta {
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 6px;
  opacity: 0.9;
  display: flex; gap: 6px;
}
.pick-hero-cta {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(255, 255, 255, 0.30);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  backdrop-filter: blur(8px);
}

.pick-card .pick-card-cta {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ============================================================
   Séance active : hero progress + cards exercice
   ============================================================ */
.session-hero {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 16px;
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.10);
}
.session-hero-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 14px;
  gap: 12px;
}
.session-hero-progress {
  font-family: var(--font-ui);
  font-size: 44px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.session-hero-total {
  font-size: 22px;
  color: var(--text-dim);
  font-weight: 500;
  margin-left: 2px;
}
.session-hero-pct {
  font-family: var(--font-ui);
  font-size: 32px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
}
.session-hero-pct span { font-size: 14px; opacity: 0.7; margin-left: 2px; }
.session-progress-track {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  overflow: hidden;
}
.session-progress-fill {
  height: 100%;
  background: var(--grad-warm);
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
  box-shadow: 0 0 14px var(--accent-glow);
}

.exercise-live {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  transition: opacity 0.3s ease, border-color 0.3s ease;
}
.exercise-live.done {
  border-color: rgba(52, 211, 153, 0.35);
  box-shadow: 0 0 24px rgba(52, 211, 153, 0.08);
}
.exercise-live-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.exercise-live-num {
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  flex-shrink: 0;
}
.exercise-live.done .exercise-live-num {
  background: rgba(52, 211, 153, 0.15);
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--success);
}
.exercise-live-meta { flex: 1; min-width: 0; }
.exercise-live-name {
  font-family: var(--font-ui);
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.exercise-live-target {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  margin-top: 2px;
}
.exercise-live-progress {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}
.exercise-live.done .exercise-live-progress {
  background: rgba(52, 211, 153, 0.12);
  border-color: rgba(52, 211, 153, 0.4);
  color: var(--success);
}

/* ============================================================
   Historique
   ============================================================ */
.history-hero {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: center;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 18px 14px;
  margin-bottom: 16px;
  box-shadow: 0 0 40px rgba(59, 130, 246, 0.08);
}
.history-stat { text-align: center; min-width: 0; }
.history-stat-val {
  font-family: var(--font-ui);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.history-stat-label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  margin-top: 6px;
}
.history-stat-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  margin-top: 2px;
}
.history-stat-sep {
  width: 1px;
  height: 38px;
  background: var(--hairline);
  margin: 0 4px;
}

.history-card {
  display: grid;
  grid-template-columns: 56px 1fr auto;
  align-items: center;
  gap: 14px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: all 0.18s ease;
  cursor: pointer;
}
.history-card:hover { border-color: var(--hairline-strong); }
.history-card:active { transform: scale(0.99); }
.history-date {
  text-align: center;
  background: var(--bg-glass);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 8px 0;
}
.history-date-num {
  font-family: var(--font-ui);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  background: var(--grad-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.history-date-day {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 3px;
}
.history-card-body { min-width: 0; }
.history-card-body .card-title { margin: 0 0 4px; font-size: 15px; }
.history-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.history-card-meta .dot { opacity: 0.4; }
.history-card-cta {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-glass);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text-dim);
  flex-shrink: 0;
}

/* ============================================================
   Session detail
   ============================================================ */
.detail-hero {
  margin-bottom: 14px;
  padding: 4px 4px 0;
}
.detail-hero-name {
  font-family: var(--font-ui);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin-top: 4px;
}
.detail-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.detail-stat {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hairline);
  border-radius: 14px;
  padding: 14px 8px;
  text-align: center;
}
.detail-stat-val {
  font-family: var(--font-ui);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--grad-warm);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.detail-stat-val span {
  font-size: 12px;
  font-weight: 500;
  margin-left: 2px;
  opacity: 0.8;
}
.detail-stat-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-top: 5px;
}

.detail-top {
  background:
    radial-gradient(circle at 0% 50%, rgba(59, 130, 246, 0.12), transparent 60%),
    var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 0 30px rgba(59, 130, 246, 0.10);
}
.detail-top-line {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 4px;
  margin-bottom: 4px;
  font-family: var(--font-ui);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.detail-top-w { font-size: 32px; color: var(--text); }
.detail-top-x { font-size: 18px; color: var(--text-dim); }
.detail-top-r { font-size: 22px; color: var(--text); }

/* ============================================================
   Aliments sauvegardés : scroll horizontal pill
   ============================================================ */
.saved-foods {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
  margin: 0 -18px;
  padding-left: 18px;
  padding-right: 18px;
  scrollbar-width: none;
}
.saved-foods::-webkit-scrollbar { display: none; }
.saved-foods .saved-food {
  flex: 0 0 140px;
  scroll-snap-align: start;
}
.saved-food {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--hairline);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  transition: all 0.18s ease;
  font-family: var(--font-ui);
}
.saved-food:hover { border-color: var(--hairline-strong); }
.saved-food:active { transform: scale(0.98); }
.saved-food-name {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 3px;
}
.saved-food-meta {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-dim);
}
