/* =========================================================
   Fitness App - Feuille de style de base (mobile-first)
   Bootstrap 5 charge via CDN, ce fichier surcharge / complete.
   ========================================================= */

/* ---------- Coach : rendu texte riche + éditeur ---------- */
.rich-text { font-size: .92rem; color: var(--fa-text); line-height: 1.5; }
.rich-text > *:first-child { margin-top: 0; }
.rich-text > *:last-child { margin-bottom: 0; }
.rich-text p { margin: 0 0 8px; }
.rich-text h1, .rich-text h2, .rich-text h3, .rich-text h4 { margin: 12px 0 6px; line-height: 1.25; }
.rich-text h1 { font-size: 1.3rem; }
.rich-text h2 { font-size: 1.15rem; }
.rich-text h3 { font-size: 1.02rem; }
.rich-text ul, .rich-text ol { margin: 0 0 8px; padding-left: 22px; }
.rich-text li { margin-bottom: 4px; }
.rich-text a { color: var(--fa-primary); }
.rich-text blockquote {
  margin: 8px 0; padding: 6px 12px;
  border-left: 3px solid var(--fa-border); color: var(--fa-text-muted);
}
.rich-text table { border-collapse: collapse; max-width: 100%; }
.rich-text td, .rich-text th { border: 1px solid var(--fa-border); padding: 4px 8px; }

/* Barre d'outils de l'éditeur */
.rte-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
  padding: 6px; margin-bottom: 8px;
  border: 1px solid var(--fa-border); border-radius: var(--fa-radius-sm);
  background: var(--fa-bg);
}
.rte-btn {
  width: 34px; height: 32px;
  display: grid; place-items: center;
  border: 1px solid transparent; border-radius: 6px;
  background: transparent; color: var(--fa-text); cursor: pointer; font-size: 1rem;
}
.rte-btn:hover { background: var(--fa-surface); border-color: var(--fa-border); }
.rte-btn:active { background: var(--fa-primary); color: #fff; }
.rte-sep { width: 1px; height: 22px; background: var(--fa-border); margin: 0 3px; }

/* Boutons couleur : l'input color natif est superposé, invisible mais cliquable */
.rte-color { position: relative; overflow: hidden; flex-direction: column; gap: 0; }
.rte-color input[type="color"] {
  position: absolute; inset: 0;
  opacity: 0; width: 100%; height: 100%;
  border: 0; padding: 0; cursor: pointer;
}
.rte-color .rte-color__bar {
  position: absolute; left: 5px; right: 5px; bottom: 4px;
  height: 3px; border-radius: 2px; background: currentColor;
  pointer-events: none;
}
.rte-color i { margin-top: -2px; }

/* Sélecteur de couleur personnalisé (popover) */
.cp-pop {
  position: fixed; z-index: 2000;
  width: 232px;
  background: var(--fa-surface);
  border: 1px solid var(--fa-border);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.22);
  padding: 12px;
}
.cp-pop[hidden] { display: none; }
.cp-sat {
  position: relative;
  width: 100%; height: 140px;
  border-radius: 8px;
  cursor: crosshair;
  touch-action: none;
}
.cp-sat-thumb {
  position: absolute; width: 14px; height: 14px;
  border: 2px solid #fff; border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.4);
  transform: translate(-50%, -50%); pointer-events: none;
}
.cp-hue {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 14px; margin: 12px 0 10px;
  border-radius: 7px; outline: none;
  background: linear-gradient(to right, #f00 0%, #ff0 17%, #0f0 33%, #0ff 50%, #00f 67%, #f0f 83%, #f00 100%);
}
.cp-hue::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; border: 2px solid #888; cursor: pointer;
}
.cp-hue::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 2px solid #888; cursor: pointer; }
.cp-rgb { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.cp-swatch { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--fa-border); flex: 0 0 auto; }
.cp-rgb label, .cp-hexrow {
  display: flex; align-items: center; gap: 3px;
  font-size: .7rem; color: var(--fa-text-muted); font-weight: 600;
}
.cp-rgb input { width: 44px; }
.cp-rgb input, .cp-hexrow input {
  height: 30px; border: 1px solid var(--fa-border); border-radius: 6px;
  background: var(--fa-bg); color: var(--fa-text);
  font-size: .8rem; padding: 0 6px; text-align: center;
}
.cp-hexrow { margin-bottom: 12px; }
.cp-hexrow input { flex: 1; font-family: monospace; text-align: left; text-transform: lowercase; }
.cp-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* Sélecteur de taille de police */
.rte-select {
  height: 32px;
  border: 1px solid var(--fa-border);
  border-radius: 6px;
  background: var(--fa-surface);
  color: var(--fa-text);
  font-size: .82rem;
  padding: 0 6px;
  cursor: pointer;
}
.rte-select:hover { border-color: var(--fa-primary); }

/* Boutons taille de police (A + chevron) */
.rte-size { gap: 1px; }
.rte-size .rte-az { font-weight: 700; font-size: .95rem; line-height: 1; }
.rte-size .rte-az--sm { font-size: .72rem; }
.rte-size i { font-size: .6rem; }

/* Cellules éditables : largeur minimale pour la saisie */
.rte-editor td, .rte-editor th { min-width: 44px; }
.rte-editor {
  min-height: 220px; max-height: 55vh; overflow-y: auto;
  border: 1px solid var(--fa-border); border-radius: var(--fa-radius-sm);
  padding: 12px; background: var(--fa-surface);
}
.rte-editor:focus { outline: 2px solid var(--fa-primary); outline-offset: -1px; }

/* ---------- 1. Variables de theme ---------- */
:root {
  /* Couleurs principales (a ajuster selon ta charte) */
  --fa-primary:      #ff5722;   /* orange energie */
  --fa-primary-dark: #e64a19;
  --fa-secondary:    #2962ff;   /* bleu accent */
  --fa-success:      #2e7d32;
  --fa-danger:       #d32f2f;
  --fa-warning:      #f9a825;

  /* Neutres */
  --fa-bg:        #f5f6f8;      /* fond app */
  --fa-surface:   #ffffff;      /* cartes */
  --fa-text:      #1a1d21;
  --fa-text-muted:#6b7280;
  --fa-border:    #e5e7eb;

  /* Layout */
  --fa-radius:      16px;
  --fa-radius-sm:   10px;
  --fa-shadow:      0 2px 12px rgba(0,0,0,.06);
  --fa-shadow-lg:   0 8px 28px rgba(0,0,0,.12);
  --fa-navbar-h:    64px;       /* hauteur bottom nav */
  --fa-maxw:        480px;      /* largeur conteneur mobile */

  /* Typo */
  --fa-font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ---------- 2. Mode sombre (optionnel, active via [data-theme="dark"]) ---------- */
[data-theme="dark"] {
  --fa-bg:        #0e1116;
  --fa-surface:   #181c23;
  --fa-text:      #f3f4f6;
  --fa-text-muted:#9aa3b2;
  --fa-border:    #2a2f3a;
  --fa-shadow:    0 2px 12px rgba(0,0,0,.4);
}

/* ---------- 3. Reset / base ---------- */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--fa-font);
  background: var(--fa-bg);
  color: var(--fa-text);
  -webkit-font-smoothing: antialiased;
  /* espace pour la bottom nav en mobile */
  padding-bottom: calc(var(--fa-navbar-h) + env(safe-area-inset-bottom, 0px));
}

a { color: var(--fa-primary); text-decoration: none; }
a:hover { color: var(--fa-primary-dark); }

img { max-width: 100%; display: block; }

/* ---------- 4. Conteneur application ---------- */
.app-shell {
  width: 100%;
  max-width: var(--fa-maxw);
  margin: 0 auto;
  min-height: 100vh;
  background: var(--fa-bg);
  position: relative;
}

/* ---------- 5. Header app ---------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
  padding: 0 16px;
  background: var(--fa-surface);
  border-bottom: 1px solid var(--fa-border);
}
.app-header__title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0;
}

/* ---------- 6. Zone de contenu ---------- */
.app-content {
  padding: 16px;
}

/* ---------- 7. Cartes ---------- */
.fa-card {
  background: var(--fa-surface);
  border: 1px solid var(--fa-border);
  border-radius: var(--fa-radius);
  box-shadow: var(--fa-shadow);
  padding: 16px;
}

/* ---------- 8. Bottom navigation (mobile) ---------- */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--fa-maxw);
  height: calc(var(--fa-navbar-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: var(--fa-surface);
  border-top: 1px solid var(--fa-border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.05);
  z-index: 1030;
}
.bottom-nav__item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--fa-text-muted);
  font-size: .7rem;
  font-weight: 500;
  border: none;
  background: none;
  transition: color .15s ease;
}
.bottom-nav__item .icon { font-size: 1.35rem; line-height: 1; }
.bottom-nav__item.active { color: var(--fa-primary); }

/* ---------- 9. Boutons utilitaires ---------- */
.btn-fa-primary {
  background: var(--fa-primary);
  border-color: var(--fa-primary);
  color: #fff;
  font-weight: 600;
  border-radius: var(--fa-radius-sm);
}
.btn-fa-primary:hover { background: var(--fa-primary-dark); border-color: var(--fa-primary-dark); color:#fff; }

/* ---------- 10. Titres de section ---------- */
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 12px;
}
.section-title h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
}
.section-title a { font-size: .8rem; font-weight: 600; }

/* ---------- 11. CTA principale (commencer une seance) ---------- */
.cta-start {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px;
  border: none;
  border-radius: var(--fa-radius);
  background: linear-gradient(135deg, var(--fa-primary), var(--fa-primary-dark));
  color: #fff;
  box-shadow: var(--fa-shadow-lg);
  text-align: left;
}
.cta-start .cta-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.cta-start .cta-text { line-height: 1.2; }
.cta-start .cta-text strong { font-size: 1.1rem; }
.cta-start .cta-text span { font-size: .82rem; opacity: .9; }
.cta-start i.bi-chevron-right { margin-left: auto; font-size: 1.2rem; }

/* ---------- 12. Anneau de completion ---------- */
.ring {
  --val: 0;
  --size: 72px;
  width: var(--size); height: var(--size);
  border-radius: 50%;
  display: grid; place-items: center;
  background:
    radial-gradient(closest-side, var(--fa-surface) 78%, transparent 79% 100%),
    conic-gradient(var(--fa-primary) calc(var(--val) * 1%), var(--fa-border) 0);
  flex-shrink: 0;
}
.ring__label { font-size: .95rem; font-weight: 700; }

/* ---------- 13. Stat mini-cartes ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stat-tile {
  background: var(--fa-surface);
  border: 1px solid var(--fa-border);
  border-radius: var(--fa-radius-sm);
  padding: 12px 14px;
}
.stat-tile .stat-value { font-size: 1.25rem; font-weight: 700; }
.stat-tile .stat-label { font-size: .72rem; color: var(--fa-text-muted); }

/* ---------- 14. Badge type d'exercice ---------- */
.badge-type {
  font-size: .65rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.badge-type.weighted   { background: #fff0eb; color: var(--fa-primary-dark); }
.badge-type.bodyweight { background: #e8f0ff; color: var(--fa-secondary); }
.badge-type.timed      { background: #fff8e1; color: #b27d00; }

/* ---------- 15. Lignes progression / volume ---------- */
.metric-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--fa-border);
}
.metric-row:last-child { border-bottom: none; }
.metric-row .metric-name { font-weight: 600; font-size: .9rem; }
.metric-row .metric-sub  { font-size: .75rem; color: var(--fa-text-muted); }
.metric-row .metric-val  { margin-left: auto; text-align: right; font-weight: 700; }

.trend-up   { color: var(--fa-success); }
.trend-down { color: var(--fa-danger); }
.trend-flat { color: var(--fa-text-muted); }

/* Barre de volume horizontale */
.volume-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--fa-border);
  overflow: hidden;
  margin-top: 6px;
}
.volume-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--fa-secondary);
}

/* ---------- 16. Liste historique ---------- */
.history-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  background: var(--fa-surface);
  border: 1px solid var(--fa-border);
  border-radius: var(--fa-radius-sm);
  margin-bottom: 10px;
}
.history-item .h-date { font-weight: 600; font-size: .9rem; }
.history-item .h-meta { font-size: .75rem; color: var(--fa-text-muted); }
.history-item .h-comp { margin-left: auto; font-weight: 700; }

/* Badges de comparaison à la séance précédente (améliorés / égaux / en baisse) */
.cmp-badges { display: flex; gap: 5px; flex-shrink: 0; }
.cmp-badge {
  display: inline-flex; align-items: center; gap: 1px;
  min-width: 32px; justify-content: center;
  padding: 4px 7px; border-radius: 8px;
  font-size: .8rem; font-weight: 700;
}
.cmp-badge.up   { background: #ff00fa; border: 1px solid #e300a3db; color: #ffffff; }  /* magenta : plus de reps */
.cmp-badge.eq   { background: #ffffff; border: 1px solid var(--fa-border); color: #111; }
.cmp-badge.down { background: #e43737; border: 1px solid #f62b2b; color: #000000; }    /* rouge : moins de reps */

/* ---------- Accueil : calendrier des dernières séances ---------- */
.cal-strip {
  display: flex;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  cursor: grab;
  padding-bottom: 2px;
}
.cal-strip:active { cursor: grabbing; }
.cal-strip::-webkit-scrollbar { display: none; }
.cal-day {
  position: relative;
  flex: 0 0 auto;
  width: 27px;
  text-align: center;
  border: 1px solid var(--fa-border);   /* bordure autour de chaque cellule */
  border-radius: 6px;
  padding: 2px 0;
  background: var(--fa-surface);
}
/* séparation entre semaines : espace + trait avant chaque lundi
   (marges gauche/droite du trait identiques : ~5px de chaque côté) */
.cal-day.wk-start { margin-left: 10px; }
.cal-day.wk-start::before {
  content: "";
  position: absolute;
  left: -7px; top: 1px; bottom: 1px;
  width: 2px; border-radius: 2px;
  background: #6b7280;                   /* gris plus foncé, séparation plus visible */
}
.cal-day .cal-month {
  font-size: .52rem; font-weight: 700; color: var(--fa-text-muted);
  height: 11px; white-space: nowrap; overflow: visible;
}
.cal-day .cal-wd {
  font-size: .56rem; color: var(--fa-text-muted);
  display: inline-block; min-width: 13px; border-radius: 4px; line-height: 1.35;
}
.cal-day .cal-num {
  font-size: .76rem; font-weight: 600;
  width: 22px; height: 22px; margin: 2px auto 0;
  display: grid; place-items: center; border-radius: 50%;
  color: var(--fa-text);
}
/* Aujourd'hui : fond mis en évidence sur la cellule */
.cal-day.today { background: #fff3bf; border-color: #f4b400; }
/* week-end plus visible : fond coloré derrière la lettre S / D */
.cal-day.we .cal-wd { background: #ffdccb; color: #c0392b; font-weight: 700; }
.cal-day.trained .cal-num { background: var(--fa-primary); color: #fff; }
/* Cardio (bleu foncé) ; jour avec les deux -> rond coupé en diagonale
   (haut-gauche orange, bas-droite bleu, séparés par une barre oblique) */
.cal-day.cardio:not(.trained) .cal-num { background: #1d45b4; color: #fff; }
.cal-day.trained.cardio .cal-num {
  color: #fff;
  background: linear-gradient(135deg,
    var(--fa-primary) 0 calc(50% - 1px),
    #fff             calc(50% - 1px) calc(50% + 1px),
    #1d45b4          calc(50% + 1px) 100%);
}

/* Légende du calendrier */
.cal-legend {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  padding-left: 2px;
  font-size: .74rem;
  color: var(--fa-text-muted);
}
.cal-dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 5px;
}
.cal-dot.workout { background: var(--fa-primary); }
.cal-dot.cardio  { background: #1d45b4; }

/* ---------- Connexion (login) ---------- */
.auth-wrap {
  max-width: 380px;
  margin: 0 auto;
  padding-top: 8vh;
}
.auth-logo {
  text-align: center;
  margin-bottom: 20px;
}
.auth-logo img {
  border-radius: 20px;
  box-shadow: var(--fa-shadow);
}
.auth-logo h1 {
  font-size: 1.35rem;
  font-weight: 700;
  margin: 12px 0 2px;
}

/* ---------- Accueil : graphique de progression ---------- */
.chart-wrap { position: relative; height: 260px; }

/* ---------- 17. Carte exercice (séance + config) ---------- */
.exercise-card {
  background: var(--fa-surface);
  border: 1px solid var(--fa-border);
  border-radius: var(--fa-radius);
  box-shadow: var(--fa-shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.exercise-card__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.exercise-card__head .ex-name { font-weight: 700; }
.exercise-card__head .ex-target { font-size: .75rem; color: var(--fa-text-muted); }

/* Vignette image d'exercice */
.ex-thumb {
  width: 52px; height: 52px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--fa-bg);
  border: 1px solid var(--fa-border);
  flex-shrink: 0;
  padding: 6px;
}
.ex-thumb.sm { width: 126px; height: 126px; padding: 4px; }  /* 3× plus grand */

/* Tableau de séries */
.set-row {
  display: grid;
  grid-template-columns: 34px 1fr 1fr 40px;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
}
.set-row.timed { grid-template-columns: 34px 1fr 40px; }
.set-row .set-no {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--fa-bg);
  font-size: .8rem; font-weight: 700;
}
.set-row .field-label { font-size: .65rem; color: var(--fa-text-muted); display: block; }
.set-row input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--fa-border);
  border-radius: 8px;
  font-size: .9rem;
  text-align: center;
}
.set-check {
  width: 32px; height: 32px;
  border: 2px solid var(--fa-border);
  border-radius: 50%;
  background: none;
  display: grid; place-items: center;
  color: transparent;
}
.set-check.done {
  background: var(--fa-success);
  border-color: var(--fa-success);
  color: #fff;
}

/* En-tête de colonnes séries */
.set-head {
  display: grid;
  grid-template-columns: 34px 1fr 1fr 40px;
  gap: 8px;
  font-size: .65rem;
  color: var(--fa-text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  margin-bottom: 4px;
}
.set-head.timed { grid-template-columns: 34px 1fr 40px; }

/* ---------- 17a. Séance : "Focus technique du jour" DANS la carte ---------- */
.tips-inline {
  background: #fff8e9;
  border: 1px solid #f3e0b8;
  border-radius: var(--fa-radius-sm);
  padding: 10px 12px;
  margin-bottom: 12px;
}
.tips-inline__title {
  font-weight: 700;
  color: #9a6b00;
  font-size: .9rem;
  margin-bottom: 6px;
}
.tips-inline__list {
  margin: 0;
  padding-left: 18px;
  font-size: .85rem;
  color: var(--fa-text);
}
.tips-inline__list li { margin-bottom: 4px; }

/* ---------- 17b. Séance : grande photo + séries en blocs + steppers ---------- */
/* Cartes de séance un peu plus proches des bords de l'écran */
#session-list {
  margin-left: -6px;
  margin-right: -6px;
}
/* Espacement resserré entre exercices (page séance uniquement) */
#session-list .exercise-card {
  padding: 10px;
  margin-bottom: 8px;
}
.ex-photo {
  display: block;
  width: 100%;
  height: auto;
  background: var(--fa-bg);
  border-radius: var(--fa-radius-sm);
  margin-bottom: 8px;
}
.ex-info { margin-bottom: 8px; }
.ex-info .ex-name { font-size: 1.15rem; font-weight: 700; }
.ex-info .ex-target { font-size: .82rem; color: var(--fa-text-muted); }

/* Titre + point de départ + bouton d'aide rond "?" à droite */
.ex-head { display: flex; align-items: flex-start; gap: 10px; }
.ex-head .ex-info { flex: 1 1 auto; }
.help-btn {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--fa-border);
  background: var(--fa-surface);
  color: var(--fa-primary);
  font-size: 1rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.help-btn:hover { background: var(--fa-bg); }
.help-btn.active,
.help-btn[aria-expanded="true"] { background: var(--fa-primary); color: #fff; border-color: var(--fa-primary); }

/* Bouton flamme "exercice très difficile" (même taille que le "?") */
.hard-btn {
  flex: 0 0 auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--fa-border);
  background: var(--fa-surface);
  color: var(--fa-text-muted);
  font-size: 1rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.hard-btn:hover { background: var(--fa-bg); }
/* Actif : fond du rond rouge, icône blanche */
.hard-btn.active { background: #e43737; border-color: #e43737; color: #fff; }

/* Panneau d'aide (sous les répétitions) : rien quand fermé, tout le bloc quand ouvert */
.help-panel {
  background: #fff8e9;
  border: 1px solid #f3e0b8;
  border-radius: var(--fa-radius-sm);
  padding: 10px 12px;
  margin-top: 10px;
}
.help-panel[hidden] { display: none; }
.help-panel__title {
  font-weight: 700; color: #9a6b00; font-size: .9rem; margin-bottom: 6px;
}
.help-panel__list {
  margin: 0;
  padding-left: 18px;
  font-size: .85rem;
  color: var(--fa-text);
}
.help-panel__list li { margin-bottom: 5px; }

/* Barre repliée (exercice terminé) */
.ex-collapsed {
  display: none;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.ex-collapsed .ex-collapsed__name { font-weight: 700; }
.ex-collapsed .ex-collapsed__vals {
  margin-left: auto;
  font-weight: 600;
  color: var(--fa-text-muted);
  font-size: .9rem;
  white-space: nowrap;
}

/* État replié : on masque photo / infos / séries, on réduit la hauteur */
.exercise-card.collapsed {
  padding: 12px 16px;
  border-color: var(--fa-success);
}
.exercise-card.collapsed .ex-photo,
.exercise-card.collapsed .ex-head,
.exercise-card.collapsed .help-panel,
.exercise-card.collapsed .set-block { display: none; }
.exercise-card.collapsed .ex-collapsed { display: flex; }

.set-block {
  display: flex;
  align-items: stretch;          /* les zones de semaine remplissent la hauteur */
  gap: 10px;
  background: var(--fa-bg);
  border: 1px solid var(--fa-border);
  border-left: none;
  border-right: none;
  border-radius: 0;              /* pas de coins arrondis */
  padding: 0 9px;                /* pas de padding vertical -> bandeaux pleine hauteur */
  margin: 0 -10px 6px;           /* annule le padding (10px) de la carte -> pleine largeur */
}
.set-block.done {
  border-color: var(--fa-success);
  background: #f1f8f2;
}
[data-theme="dark"] .set-block.done { background: rgba(46,125,50,.15); }

/* Champs de la série : colonne (1 ou 2 steppers) qui occupe l'espace */
.set-fields {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.stepper-field .field-label { margin-bottom: 4px; }

/* Poids figé (lecture seule en séance) */
.weight-fixed {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.weight-fixed .weight-val {
  font-size: 1.2rem;
  font-weight: 700;
}

/* Bouton de validation : même aspect que le bouton "-", avec un "v" dedans.
   Devient vert une fois la série validée. */
.set-block .set-check {
  flex-shrink: 0;
  width: 34px;
  height: 43px;
  border: 1px solid var(--fa-border);
  border-radius: 11px;
  background: var(--fa-surface);
  color: var(--fa-text);     /* le "v" est visible en neutre */
  font-size: 1.2rem;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.set-block .set-check.done {
  background: var(--fa-success);
  border-color: var(--fa-success);
  color: #fff;
}

/* Stepper : toute la ligne (historique + séparateur + nombre + - + + ✓)
   forme un seul ruban qui défile horizontalement d'un bloc. */
.stepper {
  display: flex;
  align-items: stretch;        /* zones de semaine pleine hauteur */
  justify-content: flex-end;   /* historique + contrôles collés à droite */
  gap: 6px;
}
/* éléments qui ne sont PAS des zones de semaine : hauteur naturelle, centrés */
.stepper > .sep-thick,
.stepper > .stepper-ctrl { align-self: center; }
.stepper::-webkit-scrollbar { display: none; }  /* WebKit */
.stepper:active { cursor: grabbing; }
/* tous les segments gardent leur largeur naturelle (font partie du défilement) */
.stepper > * { flex: 0 0 auto; }
.stepper-ctrl {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Nombre de reps de la séance en cours : même design que l'historique,
   mais texte noir en neutre (blanc/noir). Aucune action au clic. */
.stepper .current-rep {
  flex-shrink: 0;
  color: #111;            /* noir en neutre (au lieu du gris de l'historique) */
}
/* en cmp-red / cmp-mag, la couleur de texte vient de ces classes (hist-cell) */

/* Séparateur épais noir entre l'historique et le nombre courant */
.sep-thick {
  flex-shrink: 0;
  width: 2px;
  height: 36px;
  border-radius: 2px;
  background: #111;
  margin: 0 3px;
}

/* Historique des séances précédentes. Fait partie du ruban défilant du stepper.
   margin-left:auto pousse tout le groupe à droite quand il y a de la place. */
.set-history {
  display: flex;
  align-items: stretch;   /* bandeaux de semaine pleine hauteur */
  gap: 0;                  /* les semaines se touchent (le changement de gris délimite) */
  flex: 0 1 auto;
  min-width: 0;
  overflow-x: auto;        /* SEUL l'historique défile (à gauche du trait noir) */
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  cursor: grab;
}
.set-history::-webkit-scrollbar { display: none; }
.set-history:active { cursor: grabbing; }
.hist-cell {
  position: relative;      /* pour le tag flamme "très difficile" */
  flex: 0 0 auto;
  width: 30px;
  height: 34px;            /* plus petit que la ligne -> la couleur de semaine encadre */
  display: grid;
  place-items: center;
  border: 1px solid var(--fa-border);
  border-radius: 8px;
  background: var(--fa-surface);
  font-size: 1.08rem;     /* même taille que le champ éditable */
  font-weight: 700;
  color: var(--fa-text-muted);
}
/* Tag flamme (exercice marqué "très difficile" cette séance-là) : en haut à droite */
.hist-flame {
  position: absolute;
  top: -6px; right: -5px;
  font-size: .93rem;                         /* taille précédente (.62rem) + 50% */
  color: #e8590c;
  text-shadow: 0 0 2px #fff, 0 0 2px #fff;   /* lisible par-dessus toute couleur de case */
  pointer-events: none;
}
.hist-cell.empty {
  background: var(--fa-bg);
  border-style: dashed;
}
/* Bandeau de semaine : fond gris DERRIÈRE le groupe de cases (délimite les
   semaines ISO, lundi). Le gris est sur le conteneur, pas sur les cases. */
.wk-band {
  flex: 0 0 auto;
  align-self: stretch;       /* remplit toute la hauteur de la ligne */
  display: flex;
  align-items: center;       /* cases centrées verticalement dans la zone */
  gap: 3px;
  padding: 0 3px;            /* pas de padding vertical : la couleur va bord à bord */
}
.wk-band.wk-a { background: #d4d8e0; }   /* plus grise */
.wk-band.wk-b { background: #ebedf1; }   /* moins grise */
/* Comparaison avec la case de gauche (séance précédente) */
.hist-cell.cmp-red {           /* valeur EN BAISSE -> rouge */
  background: #e43737;
  border-color: #f62b2b;
  color: #000000;
}
.hist-cell.cmp-mag {           /* valeur EN HAUSSE -> magenta (flashy) */
  background: #ff00fa;
  border-color: #e300a3db;
  color: #ffffff;
}
.stepper .step {
  width: 34px;          /* largeur réduite de 20% (43 -> 34) */
  height: 43px;
  flex-shrink: 0;
  border-radius: 11px;
  font-size: 1.45rem;
  font-weight: 700;
  line-height: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--fa-border);
  background: var(--fa-surface);
  color: var(--fa-text);
}
.stepper .step.plus {
  background: var(--fa-primary);
  border-color: var(--fa-primary);
  color: #fff;
}
.stepper .step:active { transform: scale(.94); }
.stepper .step-val {
  flex: 0 0 auto;
  width: 48px;          /* largeur minimale pour 2 chiffres */
  min-width: 0;
  height: 43px;
  padding: 0 4px;
  text-align: center;
  font-size: 1.08rem;
  font-weight: 700;
  border: 1px solid var(--fa-border);
  border-radius: 10px;
  background: var(--fa-surface);
  color: var(--fa-text);
}

/* ---------- 18. Barre de progression de séance (sticky bas) ---------- */
.session-footer {
  position: fixed;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: var(--fa-maxw);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--fa-surface);
  border-top: 1px solid var(--fa-border);
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  z-index: 1035;
}
/* Barre de progression segmentée : 1 tronçon par exercice, subdivisé par série */
.session-progress {
  display: flex;
  gap: 4px;            /* écart entre tronçons d'exercice */
  height: 8px;
  margin-bottom: 10px;
}
.session-progress .pbar-seg {
  flex: 1;             /* chaque exercice = un tronçon de largeur égale */
  display: flex;
  gap: 0;              /* pas d'écart entre cellules d'un même tronçon */
  min-width: 0;
  background: none;    /* neutralise un éventuel style .seg hérité */
  padding: 0;
  border-radius: 2px;  /* coins arrondis sur le tronçon entier */
  overflow: hidden;
}
.session-progress .pbar-cell {
  flex: 1;             /* une cellule par série */
  background: var(--fa-border);
  border-radius: 0;    /* contiguës à l'intérieur du tronçon */
  transition: background .15s ease;
}
.session-progress .pbar-cell.done { background: var(--fa-primary); }

/* Quand la session-footer est presente, plus de bottom-nav -> padding bas */
body.has-session-footer { padding-bottom: 96px; }

/* ---------- 19. Boutons utilitaires divers ---------- */
.btn-ghost {
  background: none;
  border: 1px dashed var(--fa-border);
  border-radius: var(--fa-radius-sm);
  color: var(--fa-text-muted);
  padding: 12px;
  width: 100%;
  font-weight: 600;
}
.icon-btn {
  border: none; background: none;
  color: var(--fa-text-muted);
  font-size: 1.1rem;
  padding: 4px 8px;
}
.icon-btn.danger { color: var(--fa-danger); }
.icon-btn:active { transform: scale(.9); }

/* Poignée de glisser-déposer */
.drag-handle {
  color: var(--fa-text-muted);
  cursor: grab;
  font-size: 1.2rem;
  touch-action: none;
  padding: 0 2px;
}
.drag-handle:active { cursor: grabbing; }

/* Groupe d'actions d'un exercice (monter / descendre / supprimer) */
.ex-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}
.ex-actions .icon-btn { padding: 4px 6px; }

/* Carte en cours de déplacement */
.exercise-card[draggable="true"] { cursor: default; }
.exercise-card.dragging { opacity: .4; }

/* Sélecteur de type (segmented) */
.seg {
  display: flex;
  gap: 6px;
  background: var(--fa-bg);
  padding: 4px;
  border-radius: 10px;
}
.seg input { display: none; }
.seg label {
  flex: 1;
  text-align: center;
  font-size: .75rem;
  font-weight: 600;
  padding: 7px 4px;
  border-radius: 7px;
  color: var(--fa-text-muted);
  cursor: pointer;
}
.seg input:checked + label {
  background: var(--fa-surface);
  color: var(--fa-primary);
  box-shadow: var(--fa-shadow);
}

/* ---------- 20. Responsive : desktop ---------- */
@media (min-width: 992px) {
  body { padding-bottom: 0; }
  .app-shell { max-width: 720px; }
  .bottom-nav { max-width: 720px; }
  .session-footer { max-width: 720px; }
}
