/* ─── View Transitions API (Safari 18+, Chrome 126+) ──────────────
   Active un cross-fade natif entre navigations same-origin. Élimine
   la sensation "blink" entre 2 pages tap, sans changer le routing.
*/
@view-transition { navigation: auto; }
::view-transition-old(root) {
  animation: vt-fade-out 180ms cubic-bezier(0.4, 0, 1, 1) forwards;
}
::view-transition-new(root) {
  animation: vt-fade-in 220ms cubic-bezier(0, 0, 0.2, 1) forwards;
}
@keyframes vt-fade-out { to { opacity: 0; } }
@keyframes vt-fade-in  { from { opacity: 0; } }

/* ─── Fade-in body au load (fallback universel, marche iOS 17 et avant) ──
   Sans View Transitions API, on adoucit AU MOINS l'arrivée de la nouvelle
   page : le body part en opacity 0 (avec background noir déjà inline) et
   monte à 1 en 180ms. Combiné au prefetch touchstart, le flash blanc du
   WebView devient quasi imperceptible.
*/
@keyframes body-fade-in { from { opacity: 0; } to { opacity: 1; } }
body { animation: body-fade-in 180ms ease-out; }
/* Skip l'anim si l'user préfère reduced-motion */
@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none; }
}

/* ─── Reset + base ─── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Background noir forcé partout (bounce iOS, overscroll, safe-area) */
  background: #000 !important;
  color-scheme: dark;
  min-height: 100%;
  /* Bloque le bounce iOS WKWebView qui exposait une bande blanche
     (underPageBackgroundColor par défaut) au scroll up extrême.
     PTR custom JS continue de fonctionner via touchstart/move. */
  overscroll-behavior: none;
}
body {
  overscroll-behavior: none;
}
/* iOS Safari/WebKit zoome auto sur input/select avec font-size < 16px.
   Le zoom n'est pas réversible (viewport laissé scalé). On force 16px partout
   pour bloquer ce comportement à la source. */
input, select, textarea { font-size: 16px; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  background: #000;  /* forcé : sans var() pour éviter tout fallback light */
  color: var(--text);
  min-height: 100vh;
  line-height: 1.4;
  /* padding-bottom retiré : créait une zone visible en dessous du tab bar.
     Le tab bar gère lui-même sa safe-area, et le main a déjà son padding. */
}

/* ─── iOS HealthKit-inspired tokens ─── */
:root {
  --bg: #000000;
  --bg-elevated: #1c1c1e;
  --bg-card: #1c1c1e;
  --bg-card-hover: #2c2c2e;
  --bg-tertiary: #2c2c2e;
  --separator: rgba(84,84,88,0.65);
  --border: rgba(255,255,255,0.06);

  --text: #ffffff;
  --text-secondary: rgba(235,235,245,0.6);
  --text-tertiary: rgba(235,235,245,0.55);  /* WCAG AA ≥ 4.5:1 sur fond #000 */

  --red: #ff3b30;
  --orange: #ff9f0a;
  --yellow: #ffd60a;
  --green: #34c759;
  --mint: #66d4cf;
  --teal: #5ac8fa;
  --cyan: #64d2ff;
  --blue: #0a84ff;
  --indigo: #5e5ce6;
  --purple: #bf5af2;
  --pink: #ff375f;
  --brown: #ac8e68;

  /* Échelle border-radius unifiée (5 tokens) — bannir les valeurs nues
     dispersées (audit UX : 9 variantes 2/3/4/5/6/7/8/10/12/14/16). */
  --radius-xs: 4px;        /* badges décoratifs, tags */
  --radius-sm: 8px;        /* boutons compacts, inputs */
  --radius: 14px;          /* cards Apple Premium (par défaut) */
  --radius-sheet: 16px;    /* bottom sheets, modals */
  --radius-pill: 999px;    /* pills, intensity badges, circles */
  --radius-lg: 14px;       /* alias historique → --radius */
  --radius-md: 14px;       /* alias historique → --radius */

  /* Échelle padding cards unifiée. 2 variantes :
     - --card-padding : dense (info-cards workout, cards générique) 12px 14px
     - --card-padding-lg : aéré (sleep-score-bar, sleep-period, hr-summary) 0.85rem 1rem
     Bannir les valeurs nues 0.7rem/0.6rem qui cassent l'alignement vertical. */
  --card-padding: 12px 14px;
  --card-padding-lg: 0.85rem 1rem;

  /* Échelle typo unifiée (8 niveaux Apple SF Pro inspired).
     Audit UX a relevé 30+ tailles dispersées (0.5→2.6rem) — anarchie.
     Bannir les valeurs nues sur les nouveaux composants : utiliser ces tokens. */
  --ts-2xs:  0.65rem;   /* Caption micro : hint, legend tertiaire */
  --ts-xs:   0.7rem;    /* Caption : meta, badges, footnote */
  --ts-sm:   0.78rem;   /* Texte secondaire : sous-titre, helper */
  --ts-md:   0.85rem;   /* Body courant : paragraphes, descriptions */
  --ts-base: 1rem;      /* Body emphasis, ancrage iOS 16px */
  --ts-lg:   1.15rem;   /* Card titles importants, h3 */
  --ts-xl:   1.5rem;    /* Page header h1 (.ap-page-header__title) */
  --ts-2xl:  2.6rem;    /* Hero number (.ap-home-hero__num) */

  --shadow: 0 1px 0 rgba(255,255,255,0.04) inset;

  /* === Apple Premium v2 tokens (redesign UI) === */
  /* Sport-encoded colors (Apple-soft palette).
     Note : 4 paires partagent volontairement leur valeur — sémantique distincte
     malgré la couleur identique (les 2 contextes ne s'affichent jamais ensemble
     sur une même page). On peut diverger plus tard sans renommer. */
  --c-cycling: #ff375f;     /* alias visuel : --c-reward */
  --c-hr: #ff453a;          /* alias visuel : --c-strength */
  --c-sleep: #bf5af2;
  --c-recovery: #30d158;
  --c-nutrition: #ffd60a;
  --c-running: #ff9f0a;     /* alias visuel : --c-walking */
  --c-walking: #ff9f0a;
  --c-body: #5e5ce6;        /* alias visuel : --c-ai */
  --c-strength: #ff453a;
  --c-mobility: #5ac8fa;    /* alias visuel : --c-weather */
  --c-rest: #8e8e93;
  --c-reward: #ff375f;
  --c-weather: #5ac8fa;
  --c-ai: #5e5ce6;
  --c-phase: #0a84ff;
  --c-arrow: #0a84ff;       /* CTA arrow Apple-blue */

  /* Motion */
  --motion-fast: 200ms ease;
  --motion-spring: 300ms cubic-bezier(0.34, 1.56, 0.64, 1);
  --motion-feedback: 80ms ease-out;  /* utilisé Phase 1+ (tap feedback scale 0.97) */

  /* Card backgrounds (utilisés Phase 1+ pour le mode édition home) */
  --bg-edit-toolbar: rgba(255,255,255,0.05);
  --bg-catalog: #0e0e0e;
}

/* App dark-only : on désactive complètement le mode clair pour éviter
   les bandes blanches qui apparaissaient sur iOS quand le système était
   en mode clair (les variables --bg étaient écrasées en #f2f2f7).
   Si on veut un jour supporter le light mode, le rétablir via une classe
   <html class="theme-light"> plutôt que le media query système. */

/* ─── Header ─── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 1rem 1.25rem 0.5rem;
  /* Fallback iOS PWA legacy + moderne pour la status bar overlay */
  padding-top: max(1rem, constant(safe-area-inset-top));
  padding-top: max(1rem, env(safe-area-inset-top));
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  position: sticky;
  top: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  z-index: 100;
  border-bottom: 0.5px solid var(--separator);
}
/* En mode PWA standalone : status bar overlay → on force un offset suffisant
   pour ne pas passer dessous. 3.4rem (~54px) couvre tous les iPhones (le notch
   peut atteindre 47-50px). La détection se fait à la fois via classe JS
   (body.standalone) ET via media query — l'un ou l'autre suffit. */
body.standalone header {
  padding-top: max(3.4rem, env(safe-area-inset-top)) !important;
}
@media all and (display-mode: standalone) {
  header { padding-top: max(3.4rem, env(safe-area-inset-top)) !important; }
}
/* App dark-only — light mode désactivé (cf. note plus haut) */

header .brand a {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

header nav {
  display: flex;
  gap: 0.25rem;
}
header nav a {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-pill);
  font-weight: 500;
  transition: background 0.15s;
}
header nav a:hover { background: var(--bg-tertiary); }
header nav a.active { background: var(--bg-tertiary); }

/* Bouton retour iOS-style — chevron SVG dans une zone tactile 44×44.
   Apparait sur toutes les pages sauf la home (logique JS dans _layout.html).
   Couleur iOS-blue (Apple HIG : back chevron = primary tint). */
.header-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin-left: -10px;
  background: none;
  border: none;
  color: var(--blue);
  text-decoration: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  transition: background var(--motion-fast, 200ms ease), transform 80ms ease-out;
}
.header-back svg {
  width: 24px;
  height: 24px;
}
.header-back:active { transform: scale(0.88); }
.header-back:hover { background: var(--bg-tertiary); }

/* Hamburger button — caché desktop, montré mobile */
.burger {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: var(--ts-xl);
  line-height: 1;
  padding: 0.4rem 0.6rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
}
.burger:hover { background: var(--bg-tertiary); }

@media (max-width: 700px) {
  .burger { display: block; }
  header nav {
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.1rem;
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 0.5px solid var(--separator);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.25s ease, opacity 0.2s ease, margin-top 0.2s ease, padding-top 0.2s ease;
    -webkit-overflow-scrolling: touch;
  }
  body.menu-open header nav {
    max-height: calc(100vh - 80px);  /* assez pour 9+ items, scroll si plus */
    overflow-y: auto;                 /* scroll dans le menu si overflow */
    opacity: 1;
  }
  body:not(.menu-open) header nav {
    margin-top: 0;
    padding-top: 0;
    border-top-color: transparent;
  }
  header nav a {
    padding: 0.75rem 0.8rem;
    border-radius: var(--radius-sm);
    font-size: var(--ts-base);
  }
}

/* ─── Layout ─── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem 1.25rem 4rem;
  padding-left: max(1.25rem, env(safe-area-inset-left));
  padding-right: max(1.25rem, env(safe-area-inset-right));
  /* Espace pour la bottom tab bar (~72px) + marge respiration → 90px total
     + safe-area. Le FAB Coach IA (56px à bottom 76px) ne recouvre plus le
     contenu grâce au scroll-aware FAB (cf. coach-chat.js setupScrollAwareFab) :
     dès que l'user scrolle vers le bas le FAB sort de l'écran, donc pas
     besoin d'espace blanc dédié qui paraîtrait vide sur les pages courtes. */
  padding-bottom: calc(90px + env(safe-area-inset-bottom));
}

/* ─── Bottom tab bar (Apple Premium navigation) ─────────────── */
#bottom-tabs {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  display: flex;
  align-items: stretch;
  justify-content: space-around;
  background: rgba(0, 0, 0, .82);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-top: .5px solid var(--separator, rgba(255,255,255,.1));
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  padding-left: max(8px, env(safe-area-inset-left));
  padding-right: max(8px, env(safe-area-inset-right));
}
.tab-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 6px 4px;
  text-decoration: none;
  color: var(--text-secondary, rgba(235,235,245,.6));
  background: none;
  border: none;
  font-family: inherit;
  font-size: .62rem;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s ease, transform .15s ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 50px;
  position: relative;
}
.tab-item:active { transform: scale(.94); }
.tab-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
}
.tab-label {
  letter-spacing: -.005em;
  line-height: 1;
}
.tab-item.tab-active {
  color: var(--tab-color, var(--blue));
}
.tab-item.tab-active::before {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 5px;
  height: 5px;
  border-radius: var(--radius-pill);
  background: var(--tab-color, var(--blue));
  /* Halo glow soft autour de la pastille — signature Apple Fitness */
  box-shadow:
    0 0 8px var(--tab-color, var(--blue)),
    0 0 16px color-mix(in srgb, var(--tab-color, var(--blue)) 40%, transparent);
  animation: tab-halo-pulse 2.4s ease-in-out infinite;
}
@keyframes tab-halo-pulse {
  0%, 100% {
    box-shadow:
      0 0 8px var(--tab-color, var(--blue)),
      0 0 16px color-mix(in srgb, var(--tab-color, var(--blue)) 40%, transparent);
  }
  50% {
    box-shadow:
      0 0 12px var(--tab-color, var(--blue)),
      0 0 22px color-mix(in srgb, var(--tab-color, var(--blue)) 55%, transparent);
  }
}
/* Glow subtil sur l'icône active aussi */
.tab-item.tab-active .tab-icon {
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--tab-color, var(--blue)) 45%, transparent));
}
@media (prefers-reduced-motion: reduce) {
  .tab-item.tab-active::before { animation: none; }
}
/* App dark-only — light mode désactivé (cf. note plus haut) */

/* ─── Bottom sheet "Plus" ─── */
#more-sheet {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: none;
  pointer-events: none;
}
#more-sheet.open { display: block; pointer-events: auto; }
.more-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity .22s ease;
}
#more-sheet.open .more-sheet-backdrop { opacity: 1; }
.more-sheet-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-elevated, #1c1c1e);
  border-radius: var(--radius-sheet) 16px 0 0;
  padding: 12px 16px calc(20px + env(safe-area-inset-bottom));
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  transform: translateY(100%);
  transition: transform .28s cubic-bezier(.32,.72,0,1);
  max-height: 70vh;
  overflow-y: auto;
  box-shadow: 0 -8px 24px rgba(0,0,0,.45);
}
#more-sheet.open .more-sheet-content { transform: translateY(0); }
.more-sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,.2);
  margin: 0 auto 12px;
}
#more-sheet h3 {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: -.005em;
  color: var(--text-secondary);
  margin: 0 0 10px;
  padding: 0 4px;
}
#more-sheet-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.more-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--text);
  background: rgba(255,255,255,.04);
  transition: background .15s ease;
}
.more-item:hover, .more-item:active { background: rgba(255,255,255,.08); }
.more-item-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.more-item-icon svg { width: 22px; height: 22px; }
.more-item-label {
  flex: 1;
  font-size: .95rem;
  font-weight: 500;
}
.more-item-chev {
  width: 14px;
  height: 14px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.section-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 1.25rem 0 0.75rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.section-title small {
  font-size: var(--ts-md);
  font-weight: 500;
  color: var(--text-secondary);
  letter-spacing: 0;
}

/* ─── Hero (Activity rings + recovery) ─── */
.hero {
  background: linear-gradient(135deg, var(--bg-card) 0%, #2c2c2e 100%);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.85rem;
  align-items: center;
  box-shadow: var(--shadow);
}

.hero .rings {
  width: 100px;
  height: 100px;
}

.hero .stats {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}
.hero .stats h2 {
  font-size: var(--ts-sm);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 0 0 0.2rem;
}
.hero .stat-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
}
.hero .stat-row .label {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--ts-sm);
  min-width: 62px;
}
.hero .stat-row .value {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}
.hero .stat-row .value strong { font-size: 1.05rem; }
.hero .stat-row .unit { color: var(--text-secondary); font-weight: 500; font-size: 0.72rem; }
@media (max-width: 380px) {
  .hero { grid-template-columns: 86px 1fr; padding: 0.7rem 0.85rem; gap: 0.7rem; }
  .hero .rings { width: 86px; height: 86px; }
  .hero .stat-row .label { min-width: 56px; }
}

/* ─── Activity rings SVG ─── */
.ring {
  fill: none;
  stroke-width: 12;
  stroke-linecap: round;
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dasharray 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.ring-bg { stroke: rgba(255,255,255,0.1); }
.ring-move { stroke: var(--red); }
.ring-exercise { stroke: var(--green); }
.ring-stand { stroke: var(--cyan); }

/* ─── Insights texte (Bevel-inspired) ─── */
.insights-card {
  background: linear-gradient(135deg, rgba(10,132,255,0.12) 0%, rgba(94,92,230,0.08) 100%);
  border: 0.5px solid rgba(10,132,255,0.3);
  border-radius: var(--radius-lg);
  padding: var(--card-padding-lg);
  margin-bottom: 0.75rem;
}
.insights-greeting {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.insights-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.insights-list li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.28rem 0;
  border-bottom: 0.5px solid rgba(255,255,255,0.05);
  font-weight: 500;
}
.insights-list li:last-child { border-bottom: 0; }

/* Bloc legacy supprimé (~155 lignes) :
   .tiles, .tile, .tile-icon, .tile-label, .feed, .feed-item, .feed-icon,
   .feed-date, .feed-stats, .feed-meta, .workout-name, .workout-card, .wc-*,
   .intensity, .chip, .wc-map, .route-mini — classes utilisées uniquement
   par home.html.legacy (l'ancienne home pré-bento, plus servie). Le sprite
   SVG remplace les emojis Unicode (font-size:2rem) qui violaient la règle
   "icônes sprite SVG obligatoires" (cf. mémoire feedback_coach_icons_sprite). */

/* ─── Workout detail page (REDESIGN fun) ─── */
.muted { color: var(--text-secondary); font-size: 0.9rem; font-weight: 500; }

.wo-hero {
  position: relative;
  border-radius: var(--radius-lg);
  margin: .6rem 0 .8rem;
  overflow: hidden;
  isolation: isolate;
  min-height: 130px;
  display: flex;
  align-items: flex-end;
}
.wo-hero-bg {
  position: absolute; inset: 0; z-index: -1;
  opacity: 0.85;
}
.wo-hero::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(to top, var(--bg) 0%, transparent 55%);
}
.wo-hero-content {
  padding: 1.1rem 1.1rem 1rem;
  width: 100%;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.45);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: .8rem;
  row-gap: .4rem;
  align-items: center;
}
.wo-hero-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  width: 44px;
  height: 44px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.3));
}
.wo-hero-icon svg { width: 44px !important; height: 44px !important; }
.wo-hero-content h1 {
  grid-column: 2;
  grid-row: 1;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0;
}
.wo-hero-meta {
  grid-column: 2;
  grid-row: 2;
  font-size: 0.76rem;
  font-weight: 500;
  opacity: 0.88;
  text-transform: capitalize;
  margin: 0;
  line-height: 1.3;
}

/* Effort badge + big-stats : sur la ligne full-width sous le header titre */
.wo-effort-row {
  grid-column: 1 / -1;
  grid-row: 3;
  margin: .4rem 0 0;
}
.effort-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.25rem 0.65rem 0.25rem 0.3rem;
  background: rgba(0,0,0,0.4);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255,255,255,0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.effort-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: var(--radius-pill);
  background: var(--effort-color, #888);
  color: #fff;
  font-weight: 800;
  font-size: var(--ts-sm);
  box-shadow: 0 0 10px var(--effort-color, transparent);
}
.effort-label {
  font-weight: 700;
  font-size: 0.82rem;
  letter-spacing: -0.01em;
  color: var(--effort-color, #fff);
  text-shadow: 0 0 14px var(--effort-color, transparent);
}

.wo-hero-big-stats {
  grid-column: 1 / -1;
  grid-row: 4;
  display: flex;
  gap: 1.1rem;
  flex-wrap: wrap;
  margin-top: .35rem;
}

/* ─── Pills verdict / indoor (hero) ─── */
.wo-pills {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-top: .35rem;
}
.wo-pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .2rem .55rem;
  border-radius: var(--radius-pill);
  font-size: .72rem;
  font-weight: 500;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  letter-spacing: 0;
  text-transform: none;
}
.wo-pill strong { font-weight: 700; }

/* Pills "mots-clés" pour le summary collapsed de la card Contexte */
.wo-ctx-pill {
  display: inline-flex;
  align-items: center;
  padding: .15rem .5rem;
  border-radius: var(--radius-pill);
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ─── Désactive le menu contextuel iOS (Copier/Traduire) sur les tuiles
   pour éviter le conflit avec le long-press TileManager. Re-autorise la
   sélection sur les valeurs numériques + headings (utile pour copier
   un kcal, une distance, un nom de séance). ─── */
[data-tile-id],
.ap-widget {
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  user-select: none;
}
/* Désactive le menu "Ouvrir dans un nouvel onglet" iOS sur les liens
   internes aux widgets/tuiles (long-press = edit mode, pas menu Safari) */
[data-tile-id] a,
.ap-widget a {
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}
[data-tile-id] .ap-val,
[data-tile-id] .ap-val-sm,
[data-tile-id] .big-num,
[data-tile-id] .big-stat,
[data-tile-id] .sv,
[data-tile-id] .hr-val,
[data-tile-id] .pace-val,
[data-tile-id] .time-val,
[data-tile-id] .info-val,
[data-tile-id] h1,
[data-tile-id] h3,
[data-tile-id] p,
[data-tile-id] input,
[data-tile-id] textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

/* ─── TileManager : edit mode style iOS app icons ─── */
@keyframes tile-jiggle {
  0%, 100% { transform: rotate(-.6deg); }
  50%      { transform: rotate(.6deg); }
}
body.tile-edit-mode [data-tile-id] {
  position: relative;
  animation: tile-jiggle .25s infinite alternate ease-in-out;
  transform-origin: center;
  overflow: visible !important;  /* sinon le badge "−" en top:-8px gets clipped */
}
/* En mode édition : neutralise les boutons/liens INTERNES aux tuiles pour
   ne pas bloquer le drag SortableJS. Le badge de suppression + la toolbar
   restent cliquables. */
body.tile-edit-mode [data-tile-id] a,
body.tile-edit-mode [data-tile-id] button,
body.tile-edit-mode [data-tile-id] input,
body.tile-edit-mode [data-tile-id] select,
body.tile-edit-mode [data-tile-id] textarea,
body.tile-edit-mode [data-tile-id] [role="button"] {
  pointer-events: none !important;
}
body.tile-edit-mode .tile-remove-badge,
body.tile-edit-mode .tile-edit-toolbar-btn,
body.tile-edit-mode #tile-add-sheet,
body.tile-edit-mode #tile-add-sheet * {
  pointer-events: auto !important;
}
body.tile-edit-mode [data-tile-id]:nth-child(even) {
  animation-delay: -.125s;  /* déphasage pour effet désynchronisé naturel */
}
/* Hide la tuile mais garde l'élément (pour pouvoir le réafficher au toggle) */
[data-tile-id].tile-hidden { display: none !important; }

/* SortableJS visuals pendant le drag pour feedback clair user */
/* Ghost = placeholder visible où la tuile va atterrir */
.tile-ghost {
  opacity: 1 !important;
  background: rgba(10, 132, 255, .15) !important;
  border: 2px dashed var(--blue, #0a84ff) !important;
  border-radius: var(--radius, 10px);
  animation: none !important;
  transform: none !important;
}
.tile-ghost > * { visibility: hidden; }
/* Chosen = tuile en cours de drag (effacée car remplacée par dragClass clone) */
.tile-chosen {
  opacity: .35;
  animation: none !important;
}
/* Dragging = clone qui suit le doigt — élevé + tilt léger */
.tile-dragging {
  opacity: 1 !important;
  transform: rotate(2deg) scale(1.04) !important;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .55), 0 0 0 2px var(--blue, #0a84ff);
  animation: none !important;
  z-index: 9999;
  cursor: grabbing;
}

/* Badge de suppression "−" en haut à gauche (style iOS app icon remove) */
.tile-remove-badge {
  position: absolute;
  top: -8px;
  left: -8px;
  z-index: 10;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  color: #000;
  border: 1.5px solid rgba(0,0,0,.15);
  font-size: 1.1rem;
  font-weight: 700;
  font-family: inherit;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,.4);
  padding: 0;
}
.tile-remove-badge.tile-required {
  background: rgba(255,255,255,.4);
  color: rgba(0,0,0,.5);
  cursor: not-allowed;
  font-size: .75rem;
}

/* ─── Toolbar édition mode iOS-style : OK gauche + plus droite ─── */
.tile-edit-toolbar-btn {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 14px);
  z-index: 360;
  background: rgba(28, 28, 30, .92);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  color: #fff;
  border: .5px solid rgba(255,255,255,.15);
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.5);
}
body.standalone .tile-edit-toolbar-btn,
@media all and (display-mode: standalone) {
  .tile-edit-toolbar-btn { top: calc(env(safe-area-inset-top) + 52px); }
}
.tile-edit-ok {
  left: max(14px, env(safe-area-inset-left));
  padding: .5rem 1rem .5rem .85rem;
  border-radius: var(--radius-pill);
  font-size: .9rem;
  font-weight: 700;
  color: var(--c-recovery, #30d158);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.tile-edit-btn-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--c-recovery, #30d158);
  color: #000;
  font-size: .85rem;
  font-weight: 800;
  line-height: 1;
}
.tile-edit-add {
  right: max(14px, env(safe-area-inset-right));
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: var(--ts-xl);
  font-weight: 600;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--blue, #0a84ff);
  transition: opacity .15s ease, color .15s ease;
}
.tile-edit-add.tile-add-disabled {
  opacity: .35;
  color: rgba(255,255,255,.4);
  cursor: not-allowed;
}

/* Bouton "↻ Réinitialiser" — centré bottom (au-dessus tab bar) */
.tile-edit-reset {
  position: fixed;
  bottom: calc(80px + env(safe-area-inset-bottom));
  left: 50%;
  top: auto;
  transform: translateX(-50%);
  z-index: 350;
  background: rgba(255,69,58,.18);
  border: 1px solid rgba(255,69,58,.4);
  color: var(--red, #ff3b30);
  padding: .5rem 1.1rem;
  border-radius: var(--radius-pill);
  font-size: .82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  white-space: nowrap;
}

/* Sheet "Ajouter une tuile" sous le bouton + (dropdown style iOS) */
#tile-add-sheet {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 62px);
  right: max(14px, env(safe-area-inset-right));
  z-index: 355;
  background: rgba(28, 28, 30, .92);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: .5px solid rgba(255,255,255,.15);
  border-radius: 12px;
  padding: 8px;
  min-width: 200px;
  max-width: 80vw;
  max-height: 50vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: tile-add-sheet-in .18s ease-out;
}
body.standalone #tile-add-sheet,
@media all and (display-mode: standalone) {
  #tile-add-sheet { top: calc(env(safe-area-inset-top) + 100px); }
}
@keyframes tile-add-sheet-in {
  from { opacity: 0; transform: translateY(-6px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.tile-add-title {
  font-size: .62rem;
  color: rgba(255,255,255,.55);
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 700;
  padding: 4px 8px;
}
.tile-add-empty {
  font-size: .82rem;
  color: rgba(255,255,255,.55);
  padding: 12px;
  text-align: center;
  font-style: italic;
}
.tile-add-item {
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
  color: #fff;
  font-family: inherit;
  font-size: .85rem;
  font-weight: 500;
  text-align: left;
  padding: .55rem .7rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.tile-add-item:hover { background: rgba(255,255,255,.14); }

/* Reduced motion : désactive le jiggle */
@media (prefers-reduced-motion: reduce) {
  body.tile-edit-mode [data-tile-id] { animation: none; }
}

/* ─── Barre effort par zones FC (sous le hero) ─── */
.wo-effort-bar {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 10px 14px 12px;
  margin: 0 0 7px;
  border: .5px solid var(--border);
}
.wo-effort-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: .5rem;
  margin-bottom: .5rem;
}
.wo-effort-label {
  font-size: .78rem;
  font-weight: 700;
  color: var(--c-hr, #ff453a);
  letter-spacing: -.005em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.wo-effort-label svg { width: 14px; height: 14px; }
.wo-effort-sub {
  font-size: .72rem;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.wo-effort-track {
  display: flex;
  height: 10px;
  border-radius: var(--radius-pill);
  overflow: hidden;
  background: rgba(255,255,255,.04);
  margin-bottom: .5rem;
}
.wo-effort-seg { transition: flex .3s ease; }
.wo-effort-legend {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem .75rem;
  font-size: .68rem;
  color: var(--text-secondary);
}
.wo-effort-legend-item {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
}
.wo-effort-legend-item em {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--text);
}
.wo-effort-dot {
  width: 8px;
  height: 8px;
  border-radius: var(--radius-pill);
  display: inline-block;
  flex-shrink: 0;
}
.big-stat { display: flex; flex-direction: column; line-height: 1; }
.big-num {
  font-size: var(--ts-xl);
  font-weight: 800;
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
}
.big-unit { font-size: 0.72rem; opacity: 0.88; font-weight: 600; margin-top: 0.15rem; }
.big-label { font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.08em; opacity: 0.7; font-weight: 700; margin-top: 0.25rem; }

.wo-map-wrap {
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 1rem;
  border: 0.5px solid var(--border);
  background: var(--bg-card);
}
.wo-map-detail {
  height: 420px;
  background: var(--bg-card);
}

/* ─── Map toggle (Vitesse / FC) ─── */
.map-toggle {
  display: flex;
  gap: 0.25rem;
  padding: 0.5rem;
  background: var(--bg-card);
  border-bottom: 0.5px solid var(--border);
}
.map-toggle button {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: inherit;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.map-toggle button:hover { background: rgba(255,255,255,0.04); color: var(--text); }
.map-toggle button.active {
  background: var(--bg-tertiary);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255,255,255,0.06) inset;
}
.map-toggle button:not([data-mode]) { flex: 0 0 auto; }
#wo-map-fullscreen:hover { background: rgba(255,255,255,0.06); color: var(--text); }

/* Map fullscreen mode — immersif, 1 doigt pour pan/zoom */
.wo-map-wrap.map-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  margin: 0;
  border-radius: 0;
  border: none;
  display: flex;
  flex-direction: column;
}
.wo-map-wrap.map-fullscreen .wo-map-detail {
  flex: 1;
  height: auto;
}
.wo-map-wrap.map-fullscreen .map-toggle {
  padding-top: max(.5rem, env(safe-area-inset-top));
}
.wo-map-wrap.map-fullscreen .map-legend {
  padding-bottom: max(.85rem, env(safe-area-inset-bottom));
}
body.map-fullscreen-active {
  overflow: hidden;
}
/* Style "actif" du bouton fullscreen quand activé */
.wo-map-wrap.map-fullscreen #wo-map-fullscreen {
  color: var(--blue, #0a84ff);
  background: rgba(10,132,255,.15);
}

/* ─── Map legend (gradient ou zones) ─── */
.map-legend {
  padding: 0.7rem 0.85rem 0.85rem;
  border-top: 0.5px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  font-size: var(--ts-sm);
  color: var(--text-secondary);
}
.legend-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: var(--ts-xs);
  color: var(--text-tertiary);
  margin-right: 0.25rem;
}
.legend-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-pill);
  font-weight: 600;
  color: var(--text);
}
.legend-pill em { font-style: normal; opacity: 0.6; font-weight: 500; }
.legend-dot { width: 10px; height: 10px; border-radius: var(--radius-pill); display: inline-block; }
.legend-gradient {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 200px;
}
.legend-gradient span { font-feature-settings: "tnum"; font-weight: 600; color: var(--text); }
.legend-bar {
  flex: 1;
  height: 8px;
  border-radius: var(--radius-pill);
}
.legend-empty { color: var(--text-tertiary); font-style: italic; }
.leaflet-container { background: var(--bg-tertiary); font-family: inherit; }
.leaflet-control-attribution { font-size: 9px !important; background: rgba(0,0,0,0.5) !important; color: #fff !important; }
.leaflet-control-attribution a { color: #fff !important; }

.wo-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.stat-chip {
  background: var(--bg-card);
  padding: var(--card-padding-lg);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  border: 0.5px solid var(--border);
}
.sk { font-size: var(--ts-sm); color: var(--text-secondary); font-weight: 600; }
.sv { font-size: 1.1rem; font-weight: 700; font-feature-settings: "tnum"; }

.wo-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1rem;
}
@media (max-width: 700px) {
  .wo-row { grid-template-columns: 1fr; }
  .wo-hero-content h1 { font-size: var(--ts-lg); }
  .big-num { font-size: 1.35rem; }
  .wo-map-detail { height: 320px; }
  .wo-hero-icon, .wo-hero-icon svg { width: 38px !important; height: 38px !important; }
}
.chart-large.half { margin-top: 0; }
.chart-large.half canvas { max-height: 220px; }

/* ─── Pace / Speed / Time cards — alignées sur .ap-card pattern ─── */
.wo-pace-card, .wo-time-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: var(--card-padding);
  margin-bottom: 7px;
  border: .5px solid var(--border);
}
.pace-title, .time-title {
  font-size: var(--ts-sm);
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--c-running, var(--orange));
  margin-bottom: 0.6rem;
}
.time-title { color: var(--text-secondary); }
.pace-grid, .time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}
.time-grid { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
.pace-item, .time-grid > div { display: flex; flex-direction: column; gap: 0.3rem; }
.pace-label, .time-label {
  font-size: var(--ts-sm);
  font-weight: 600;
  color: var(--text-secondary);
}
.pace-val, .time-val {
  font-size: 1.6rem;
  font-weight: 700;
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
  color: var(--text);
}
.pace-chart {
  margin-top: 1rem;
  max-height: 180px !important;
  width: 100%;
}

/* ─── Photos de séance (galerie + lightbox) ─── */
.wo-photos-card {
  padding: var(--card-padding);
  margin-bottom: 7px;
}
.wo-photos__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.wo-photos__title {
  font-size: var(--ts-md);
  font-weight: 700;
  color: var(--c-recovery);
}
.wo-photos__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.wo-photos__thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--bg-card-hover);
  border: 0.5px solid var(--border);
  border-radius: 8px;
  padding: 0;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--motion-feedback);
}
.wo-photos__thumb:active { transform: scale(0.97); }
.wo-photos__thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.wo-photos__date {
  position: absolute;
  bottom: 4px; left: 4px; right: 4px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: var(--ts-2xs);
  padding: 2px 4px;
  border-radius: 4px;
  font-feature-settings: "tnum";
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.wo-photos__empty {
  font-size: var(--ts-sm);
  color: var(--text-tertiary);
  text-align: center;
  padding: 14px 8px;
}
.wo-photos__status {
  margin-top: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  font-size: var(--ts-xs);
  color: var(--text-tertiary);
}
.wo-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) 16px env(safe-area-inset-bottom);
}
.wo-lightbox img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}
.wo-lightbox__close,
.wo-lightbox__del {
  position: absolute;
  top: max(20px, env(safe-area-inset-top));
  background: rgba(255,255,255,0.15);
  border: 0.5px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: var(--ts-sm);
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-height: 44px;
}
.wo-lightbox__close { right: 16px; width: 44px; padding: 0; font-size: 1.2rem; }
.wo-lightbox__del { left: 16px; color: #ff453a; }

/* ─── Rythme cardiaque card (style Apple Premium) ─── */
.wo-hr-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: var(--card-padding);
  margin-bottom: 7px;
  border: .5px solid var(--border);
}
.hr-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.6rem;
}
.hr-title {
  font-size: var(--ts-sm);
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--c-hr, var(--red));
}
.hr-stats {
  display: flex;
  gap: 2.5rem;
  margin-bottom: 0.6rem;
}
.hr-stat { display: flex; align-items: baseline; flex-direction: row; gap: 0.3rem; flex-wrap: wrap; }
.hr-val {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--red);
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
  line-height: 1;
}
.hr-unit { font-size: var(--ts-md); color: var(--text-secondary); font-weight: 600; }
.hr-lbl { font-size: var(--ts-md); color: var(--text-secondary); margin-left: 0.4rem; }
.hr-chart-wrap {
  position: relative;
  height: 220px;
  margin-top: 0.4rem;
}

/* ─── Info cards (Splits / Puissance / Météo) — style Apple Premium ─── */
.wo-info-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: var(--card-padding);
  margin-bottom: 7px;
  border: .5px solid var(--border);
}
.info-title {
  font-size: var(--ts-sm);
  font-weight: 700;
  letter-spacing: -0.005em;
  margin-bottom: 1rem;
}
.info-title.vitesse  { color: var(--blue); }
.info-title.puissance { color: var(--purple); }
.info-title.meteo    { color: var(--orange); }
.info-title.recovery { color: var(--red); }
.info-grid {
  display: grid;
  gap: 1.25rem;
}
.info-grid-2 { grid-template-columns: 1fr 1fr; }
.info-grid-3 { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.info-grid-4 { grid-template-columns: repeat(auto-fit, minmax(95px, 1fr)); }
.info-grid > div { display: flex; flex-direction: column; gap: 0.3rem; }
.info-lbl {
  font-size: var(--ts-sm);
  font-weight: 600;
  color: var(--text-secondary);
}
.info-val {
  font-size: var(--ts-xl);
  font-weight: 700;
  font-feature-settings: "tnum";
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
}
.info-note {
  margin-top: 0.9rem;
  font-size: var(--ts-md);
  color: var(--text-secondary);
  line-height: 1.4;
}
.info-note.positive { color: var(--green); }

.info-source {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 0.5px solid var(--border);
  font-size: var(--ts-md);
}
.info-source-lbl { color: var(--text-secondary); font-weight: 600; }
.info-source-val { color: var(--text); font-weight: 600; }

/* ─── Calendar — Programme (style TrainingPeaks) ─── */
.cal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.5rem 0 1rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.cal-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.cal-nav button {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  color: var(--text);
  font-size: var(--ts-base);
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.cal-nav button:hover { background: var(--bg-tertiary); }
.cal-nav h1 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  text-transform: capitalize;
  margin: 0;
  min-width: 180px;
  text-align: center;
}
.cal-today-btn {
  background: var(--bg-tertiary);
  border: 0.5px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: var(--ts-md);
  font-weight: 600;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-pill);
  cursor: pointer;
}
.cal-today-btn:hover { background: var(--bg-card-hover); }

.cal-week-headers {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  margin-bottom: 0.4rem;
  font-size: var(--ts-xs);
  text-transform: uppercase;
  color: var(--text-secondary);
  font-weight: 700;
  letter-spacing: 0.06em;
}
.cal-week-headers > div {
  text-align: center;
  padding: 0.4rem 0;
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0.25rem;
  margin-bottom: 1rem;
}
.cal-cell {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.4rem;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.cal-cell:hover {
  border-color: var(--blue);
  transform: translateY(-1px);
}
.cal-cell-empty {
  background: transparent;
  border: none;
  cursor: default;
}
.cal-cell-empty:hover { transform: none; }
.cal-cell-today {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
}
.cal-day-num {
  font-size: var(--ts-md);
  font-weight: 700;
  color: var(--text-secondary);
  line-height: 1;
  margin-bottom: 0.1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem;
}
.cal-weather {
  font-size: var(--ts-xs);
  font-weight: 600;
  font-feature-settings: "tnum";
  color: var(--text-tertiary);
  white-space: nowrap;
}
.cal-weather.has-warning {
  color: var(--orange);
}
.cal-cell-today .cal-day-num {
  color: var(--blue);
}
.cal-planned {
  background: rgba(255,255,255,0.04);
  border-left: 3px solid var(--blue);
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-xs);
  font-size: var(--ts-xs);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow: hidden;
  line-height: 1.2;
}
.cal-planned .cal-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.cal-actual {
  border: 1px solid;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-xs);
  font-size: var(--ts-xs);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-feature-settings: "tnum";
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: rgba(48,209,88,0.25);
  touch-action: manipulation;
}
a.cal-actual:active { transform: scale(0.97); }
.cal-actual.cal-matched { color: var(--green, #30d158); }
.cal-icon { font-size: 0.8em; flex-shrink: 0; }

@media (max-width: 700px) {
  .cal-cell { min-height: 70px; padding: 0.3rem; }
  .cal-planned, .cal-actual { font-size: 0.6rem; padding: 0.15rem 0.3rem; }
  .cal-day-num { font-size: 0.72rem; }
  .cal-nav h1 { font-size: var(--ts-lg); min-width: 150px; }
  .cal-week-headers { font-size: 0.6rem; }
}

/* ─── Modal détail jour ─── */
.cal-modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.cal-modal.open { display: flex; }
.cal-modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 500px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  border: 0.5px solid var(--border);
  position: relative;
}
.cal-modal-content h3 {
  margin: 0 0 1rem;
  font-size: 1.2rem;
  text-transform: capitalize;
  padding-right: 2rem;
}
.cal-modal-content h4 {
  margin: 1rem 0 0.5rem;
  font-size: var(--ts-md);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.cal-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: inherit;
}
.modal-item {
  background: var(--bg-tertiary);
  padding: var(--card-padding-lg);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.modal-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}
.modal-item-header strong { font-size: var(--ts-base); }
.modal-stats {
  display: flex;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
  margin-top: 0.5rem;
  font-size: var(--ts-md);
  color: var(--text-secondary);
  font-feature-settings: "tnum";
}
.modal-link {
  display: inline-block;
  margin-top: 0.6rem;
  color: var(--blue);
  text-decoration: none;
  font-weight: 600;
  font-size: var(--ts-md);
}
.modal-meta {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.3rem;
}
.badge {
  background: var(--blue);
  color: #fff;
  padding: 0.15rem 0.55rem;
  border-radius: var(--radius-xs);
  font-size: var(--ts-xs);
  font-weight: 700;
}
.muted { color: var(--text-tertiary); font-style: italic; font-size: 0.9rem; }

/* ─── Météo (modal calendar + reco card home) ─── */
.modal-weather {
  background: rgba(10,132,255,0.06);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
  padding: var(--card-padding-lg);
  margin-bottom: 1rem;
}
.weather-row {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.weather-icon-big {
  font-size: 2.2rem;
  line-height: 1;
  flex-shrink: 0;
}
.weather-info { flex: 1; min-width: 0; }
.weather-summary {
  font-size: var(--ts-base);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.25rem;
}
.weather-stats {
  display: flex;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--text-secondary);
  font-feature-settings: "tnum";
}
.weather-warning {
  margin-top: 0.6rem;
  padding: 0.5rem 0.7rem;
  background: rgba(255,159,10,0.1);
  border-left: 2px solid var(--orange);
  border-radius: 6px;
  font-size: var(--ts-md);
  color: var(--text);
  line-height: 1.4;
}

.reco-weather {
  margin-top: 0.85rem;
  padding: var(--card-padding-lg);
  background: rgba(10,132,255,0.06);
  border-left: 3px solid var(--blue);
  border-radius: var(--radius);
}
.reco-weather-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.6rem;
}
.reco-weather-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text);
}
.reco-weather-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-top: 0.2rem;
  font-feature-settings: "tnum";
}
.reco-weather-warnings {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.reco-weather-warnings li {
  background: rgba(255,159,10,0.1);
  border-left: 2px solid var(--orange);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  font-size: var(--ts-md);
  line-height: 1.4;
  color: var(--text);
}

/* États planned : skipped, moved, drag */
.cal-planned-list {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-height: 1.5rem;
}
.cal-planned.cal-skipped {
  opacity: 0.45;
  text-decoration: line-through;
  text-decoration-color: var(--red);
  text-decoration-thickness: 1.5px;
}
.cal-planned.cal-moved {
  border-left-style: dashed;
}
.cal-planned.cal-done {
  background: rgba(255, 215, 0, 0.10);
  border-left-color: #ffc83d !important;
  border-left-width: 4px;
}
.cal-planned.cal-past-unconfirmed {
  opacity: 0.55;
  border-left-style: dotted;
}
.cal-planned.cal-past-unconfirmed::after {
  content: "⚠";
  margin-left: auto;
  font-size: 0.75em;
  color: var(--orange);
  flex-shrink: 0;
}
.cal-medal {
  margin-left: auto;
  font-size: 0.85em;
  flex-shrink: 0;
  filter: drop-shadow(0 0 2px rgba(255, 200, 60, 0.6));
}
.cal-actual.cal-bonus {
  border-style: dashed;
  font-style: italic;
}
.cal-planned {
  cursor: grab;
}
.cal-planned:active { cursor: grabbing; }
.cal-drag-ghost {
  opacity: 0.4;
  background: var(--blue) !important;
}

/* Modal — boutons actions, badges */
.modal-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 0.5px solid var(--border);
}
.btn-action {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  color: var(--text);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-action:hover { background: var(--bg-card-hover); }
.btn-skip { color: var(--red); border-color: var(--red); }
.btn-skip:hover { background: rgba(255,59,48,0.1); }
.btn-move { color: var(--orange); border-color: var(--orange); }
.btn-move:hover { background: rgba(255,159,10,0.1); }
.btn-done { color: #ffc83d; border-color: #ffc83d; }
.btn-done:hover { background: rgba(255, 200, 61, 0.12); }
.btn-undo { color: var(--text-secondary); }
.modal-actions-note {
  font-size: var(--ts-sm);
  color: var(--text-secondary);
  font-style: italic;
  align-self: center;
}

.modal-desc {
  font-size: var(--ts-md);
  color: var(--text);
  margin-top: 0.5rem;
  line-height: 1.4;
  padding: 0.5rem 0.75rem;
  background: rgba(255,255,255,0.04);
  border-radius: 6px;
  border-left: 2px solid var(--blue);
}
.modal-item-skipped {
  opacity: 0.6;
}
.modal-item-done {
  border-left: 3px solid #ffc83d;
  padding-left: 0.5rem;
}
.badges { display: flex; gap: 0.3rem; }
.badge-red { background: var(--red) !important; }
.badge-orange { background: var(--orange) !important; }
.badge-gold {
  background: linear-gradient(135deg, #ffd700, #ffa500) !important;
  color: #1a1a1a !important;
  font-weight: 700;
}

/* ─── Structure de séance (style TrainingPeaks) ─── */
.workout-structure {
  margin-top: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.phase-block {
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius);
  padding: 0.75rem 0.85rem;
}
.phase-title {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
}
.phase-steps {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}
.step {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.7rem;
  border-left: 2px solid var(--blue);
}
.step-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-size: var(--ts-md);
  font-feature-settings: "tnum";
}
.step-dur {
  font-weight: 700;
  color: var(--text);
  min-width: 3.5rem;
}
.step-intensity {
  display: inline-block;
  background: var(--blue);
  color: #fff;
  padding: 0.1rem 0.5rem;
  border-radius: var(--radius-xs);
  font-size: var(--ts-xs);
  font-weight: 700;
}
.step-hr, .step-rpe, .step-rest {
  font-size: var(--ts-sm);
  color: var(--text-secondary);
  font-weight: 600;
}
.step-hr { color: var(--red); }
.step-rpe { color: var(--orange); }
.step-note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-top: 0.3rem;
  line-height: 1.4;
}

.step-repeat {
  background: rgba(10,132,255,0.08);
  border-left: 2px solid var(--blue);
  padding: 0.6rem 0.7rem;
  border-radius: var(--radius-sm);
}
.step-repeat-label {
  font-size: var(--ts-md);
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 0.5rem;
}
.step-repeat-inner {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding-left: 0.5rem;
}
.step-repeat-inner .step {
  background: var(--bg-card);
}

.coach-notes {
  margin-top: 0.85rem;
  background: rgba(255,159,10,0.08);
  border-left: 3px solid var(--orange);
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: var(--ts-md);
  line-height: 1.45;
  color: var(--text);
}
.equipment {
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-tertiary);
  line-height: 1.4;
}

/* ─── Bouton info exercice + popup détail ─── */
.ex-info-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--ts-base);
  padding: 0 0.3rem 0 0;
  line-height: 1;
  vertical-align: middle;
  opacity: 0.55;
  transition: opacity 0.15s;
}
.ex-info-btn:hover { opacity: 1; }

.ex-detail-popup {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.ex-detail-popup.open { display: flex; }
.ex-detail-content {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  border: 0.5px solid var(--border);
  position: relative;
}
.ex-detail-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: var(--bg-tertiary);
  border: none;
  color: var(--text);
  font-size: 1.4rem;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.ex-detail-content h3 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  padding-right: 2rem;
}
.ex-detail-content h4 {
  margin: 1rem 0 0.5rem;
  font-size: var(--ts-md);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.ex-photos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin: 0.5rem 0 1rem;
}
.ex-photos img {
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  background: #fff;
}
.ex-video-links {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
  flex-wrap: wrap;
}
.ex-video-link {
  display: inline-block;
  padding: 0.55rem 0.9rem;
  text-decoration: none;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: var(--ts-md);
}
.ex-video-link.primary {
  background: var(--red);
  color: #fff !important;
}
.ex-video-link.search {
  background: var(--bg-tertiary);
  color: var(--text) !important;
  border: 0.5px solid var(--border);
}
.ex-channels {
  margin-top: 0.6rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.ex-channels-label { font-weight: 700; color: var(--text); }
.ex-section {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 0.5px solid var(--border);
}
.ex-section ul, .ex-section ol {
  margin: 0;
  padding-left: 1.4rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text);
}
.ex-section ul li, .ex-section ol li { margin-bottom: 0.35rem; }
.ex-section p { margin: 0.3rem 0; line-height: 1.5; }
.ex-loading, .ex-error {
  padding: 2rem;
  text-align: center;
  color: var(--text-secondary);
  font-style: italic;
}
.ex-error { color: var(--orange); }

/* ─── Rendu X Core (3 sections échauffement / main / auxiliaires) ─── */
.xcore-structure {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.xcore-section {
  background: rgba(255,255,255,0.03);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  border-left: 3px solid var(--xcore-color, var(--blue));
}
.xcore-section-title {
  font-size: var(--ts-md);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--xcore-color, var(--text-secondary));
  margin-bottom: 0.55rem;
}
.xcore-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--ts-md);
}
.xcore-table td {
  padding: 0.35rem 0.4rem;
  vertical-align: top;
  border-bottom: 0.5px solid var(--border);
}
.xcore-table tr:last-child td { border-bottom: none; }
.xcore-table tr.xcore-row-focus td {
  background: rgba(255, 200, 61, 0.06);
}
.xcore-star {
  display: inline-block;
  margin-right: 0.25rem;
  filter: drop-shadow(0 0 2px rgba(255, 200, 60, 0.6));
}
.xcore-name {
  font-weight: 600;
  color: var(--text);
  width: 50%;
}
.xcore-sets {
  font-feature-settings: "tnum";
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  text-align: right;
  width: 25%;
}
.xcore-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
  text-align: right;
}
@media (max-width: 600px) {
  .xcore-table td { padding: 0.3rem 0.3rem; font-size: 0.8rem; }
  .xcore-name { width: auto; }
  .xcore-sets { width: auto; }
  .xcore-note { display: none; }
}

.zones-legend {
  margin-top: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.z-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  font-size: var(--ts-md);
  padding: 0.25rem 0;
}
.z-dot { width: 10px; height: 10px; border-radius: 50%; }
.z-name { color: var(--text); font-weight: 600; }
.z-pct { color: var(--text-secondary); font-weight: 700; font-feature-settings: "tnum"; }

/* ─── Recovery Score (Bevel-inspired) ─── */
.recovery-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 0.9rem;
  align-items: center;
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow);
}
.recovery-score .score-circle {
  position: relative;
  width: 100px;
  height: 100px;
  margin: 0 auto;
}
.recovery-score .score-circle svg { width: 100%; height: 100%; transition: stroke-dasharray 0.8s cubic-bezier(0.4,0,0.2,1); }
.recovery-score .score-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.recovery-score .score-num {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  font-feature-settings: "tnum";
  line-height: 1;
}
.recovery-score .score-label {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin-top: 0.18rem;
}

/* Explication sous le score (Bevel-style pédagogique) */
.score-explain {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 0.5px solid var(--border);
  text-align: center;
  max-width: 280px;
}
.explain-phrase {
  font-size: 0.88rem;
  color: var(--text);
  line-height: 1.4;
  margin-bottom: 0.5rem;
}
.explain-method {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  line-height: 1.4;
  font-style: italic;
}

/* Baseline 14j (déviation HRV / RHR) */
.recovery-baseline {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 0.5px solid var(--border);
}
.baseline-title {
  font-size: var(--ts-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  margin-bottom: 0.4rem;
}
.baseline-row {
  display: grid;
  grid-template-columns: 80px 60px 1fr;
  gap: 0.5rem;
  align-items: center;
  padding: 0.2rem 0;
  font-size: 0.82rem;
  font-feature-settings: "tnum";
}
.baseline-row > span:first-child { color: var(--text-secondary); font-weight: 500; }
.baseline-row > span:nth-child(2) { font-weight: 700; }
.baseline-row .muted { font-size: 0.75rem; }
.baseline-info {
  text-align: center;
  font-size: 0.8rem;
  padding: 0.5rem;
}

/* ─── Recommandation entraînement (verdict du jour) ─── */
.reco-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  margin-bottom: 0.75rem;
  border-left: 4px solid var(--green);
  position: relative;
  overflow: hidden;
}
.reco-card[data-color="green"]  { border-left-color: var(--green); }
.reco-card[data-color="yellow"] { border-left-color: var(--yellow); }
.reco-card[data-color="orange"] { border-left-color: var(--orange); }
.reco-card[data-color="red"]    { border-left-color: var(--red); }

.reco-header {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  margin-bottom: 0.55rem;
}
.reco-icon {
  font-size: 1.6rem;
  line-height: 1;
  flex-shrink: 0;
  filter: drop-shadow(0 0 10px currentColor);
}
.reco-card[data-color="green"]  .reco-icon { color: var(--green); }
.reco-card[data-color="yellow"] .reco-icon { color: var(--yellow); }
.reco-card[data-color="orange"] .reco-icon { color: var(--orange); }
.reco-card[data-color="red"]    .reco-icon { color: var(--red); }

.reco-title-block { flex: 1; min-width: 0; }
.reco-title {
  font-size: 1.05rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.15rem;
  line-height: 1.2;
}
.reco-card[data-color="green"]  .reco-title { color: var(--green); }
.reco-card[data-color="yellow"] .reco-title { color: var(--yellow); }
.reco-card[data-color="orange"] .reco-title { color: var(--orange); }
.reco-card[data-color="red"]    .reco-title { color: var(--red); }

.reco-summary {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.4;
}

.reco-details {
  list-style: none;
  padding: 0;
  margin: 0 0 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.reco-details li {
  font-size: 0.88rem;
  color: var(--text-secondary);
  padding-left: 1.2rem;
  position: relative;
  line-height: 1.4;
}
.reco-details li::before {
  content: "•";
  position: absolute;
  left: 0.4rem;
  color: var(--text-tertiary);
  font-weight: 700;
}

.reco-reprise {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 0.5px solid var(--border);
}
.reco-reprise-when {
  font-size: var(--ts-md);
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}
.reco-reprise-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.reco-reprise-list li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding-left: 1.4rem;
  position: relative;
  line-height: 1.4;
}
.reco-reprise-list li::before {
  content: "✓";
  position: absolute;
  left: 0.2rem;
  color: var(--green);
  font-weight: 800;
}

.reco-plan-match {
  margin-top: 0.85rem;
  padding: var(--card-padding-lg);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.04);
  border-left: 3px solid var(--text-tertiary);
}
.reco-plan-match[data-alignment="aligned"]      { border-left-color: var(--green); }
.reco-plan-match[data-alignment="rest_planned"] { border-left-color: var(--blue); }
.reco-plan-match[data-alignment="too_intense"]  { border-left-color: var(--orange); background: rgba(255,159,10,0.08); }
.reco-plan-match[data-alignment="lighter_than_plan"] { border-left-color: var(--green); }
.reco-plan-match[data-alignment="skipped"]      { border-left-color: var(--text-tertiary); }
.plan-match-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}
.plan-match-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
.plan-match-text { flex: 1; min-width: 0; }
.plan-match-title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  margin-bottom: 0.3rem;
}
.plan-match-plan {
  font-size: var(--ts-md);
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
}
.plan-match-plan strong { color: var(--text); }
.plan-match-suggestion {
  font-size: var(--ts-md);
  color: var(--text-secondary);
  line-height: 1.4;
}

.reco-meta {
  margin-top: 0.85rem;
  padding-top: 0.6rem;
  border-top: 0.5px solid var(--border);
  font-size: var(--ts-xs);
  color: var(--text-tertiary);
  font-style: italic;
  text-align: center;
}

.recovery-breakdown { width: 100%; }
.recovery-breakdown h3 {
  font-size: var(--ts-md);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
}
.breakdown-row {
  display: grid;
  grid-template-columns: 80px 1fr 70px;
  gap: 0.75rem;
  align-items: center;
  padding: 0.4rem 0;
  font-size: var(--ts-md);
}
.breakdown-row > span:first-child { color: var(--text-secondary); font-weight: 500; }
.breakdown-row strong {
  text-align: right;
  font-feature-settings: "tnum";
  font-weight: 600;
  font-size: 0.95rem;
}
.bar {
  height: 6px;
  background: rgba(255,255,255,0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
  display: block;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--green);
  border-radius: var(--radius-pill);
  width: 0;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

/* ─── Metric cards grid ─── */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.75rem;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem 1.1rem 1.1rem;
  border: 0.5px solid var(--border);
  box-shadow: var(--shadow);
  transition: transform 0.15s, background 0.15s;
  cursor: default;
  position: relative;
  overflow: hidden;
  /* Écart uniforme entre tuiles (7px, identique au gap home) */
  margin-bottom: 7px;
}
.card:hover { background: var(--bg-card-hover); transform: translateY(-1px); }

.card .card-head {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.card .card-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.card .card-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--accent, var(--text-secondary));
}

.card .card-value {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.4rem;
}
.card .card-value .num {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text);
}
.card .card-value .unit {
  font-size: var(--ts-md);
  color: var(--text-secondary);
  font-weight: 500;
}

.card .card-meta {
  font-size: var(--ts-sm);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-weight: 500;
}
.card .trend-up { color: var(--green); }
.card .trend-down { color: var(--red); }
.card .trend-neutral { color: var(--text-tertiary); }

.card .sparkline {
  width: 100%;
  height: 36px;
  margin-top: 0.6rem;
  opacity: 0.85;
}

/* Color accents per category */
.card[data-cat="heart"] { --accent: var(--red); }
.card[data-cat="activity"] { --accent: var(--green); }
.card[data-cat="sleep"] { --accent: var(--purple); }
.card[data-cat="body"] { --accent: var(--mint); }
.card[data-cat="nutrition"] { --accent: var(--orange); }
.card[data-cat="breath"] { --accent: var(--cyan); }
.card[data-cat="mind"] { --accent: var(--indigo); }

/* ─── Trends chart (large) ─── */
.chart-large {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-top: 1rem;
  border: 0.5px solid var(--border);
}
.chart-large h3 {
  font-size: .78rem;
  font-weight: 700;
  color: var(--c-hr, #ff453a);
  margin-bottom: 0.8rem;
  letter-spacing: -.005em;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.chart-large h3 svg { width: 16px; height: 16px; }
.chart-large canvas {
  max-height: 280px;
  width: 100%;
}

/* ─── Range selector ─── */
.range-selector {
  display: inline-flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-pill);
  padding: 3px;
  gap: 2px;
}
.range-selector button {
  background: transparent;
  border: 0;
  color: var(--text-secondary);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius-pill);
  font-weight: 600;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  font-family: inherit;
}
.range-selector button.active {
  background: var(--bg-card);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

/* ─── Markdown body (for dashboards) ─── */
.markdown-body { padding: 0.5rem 0; }
.markdown-body h1, .markdown-body h2, .markdown-body h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 1.5rem 0 0.5rem;
}
.markdown-body h1 { font-size: 1.6rem; }
.markdown-body h2 {
  font-size: 1.2rem;
  border-bottom: 0.5px solid var(--separator);
  padding-bottom: 0.4rem;
  color: var(--text);
}
.markdown-body h3 { font-size: 1.05rem; }
.markdown-body p { margin: 0.7rem 0; color: var(--text-secondary); }
.markdown-body ul, .markdown-body ol { margin: 0.7rem 0 0.7rem 1.5rem; }
.markdown-body table {
  border-collapse: collapse;
  margin: 1rem 0;
  width: 100%;
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 0.9rem;
}
.markdown-body th, .markdown-body td {
  padding: 0.55rem 0.85rem;
  text-align: left;
  border-bottom: 0.5px solid var(--separator);
}
.markdown-body th { background: rgba(10,132,255,0.15); font-weight: 600; color: var(--text); }
.markdown-body code {
  background: var(--bg-tertiary);
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  font-size: 0.85em;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
.markdown-body blockquote {
  border-left: 3px solid var(--blue);
  margin: 1rem 0;
  padding: 0.5rem 0 0.5rem 1rem;
  color: var(--text-secondary);
  background: rgba(10,132,255,0.06);
  border-radius: 0 var(--radius) var(--radius) 0;
}

/* ─── Dashboards list ─── */
.dashboards-list {
  display: grid;
  gap: 0.5rem;
}
.dashboards-list a {
  display: block;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  color: var(--text);
  text-decoration: none;
  border: 0.5px solid var(--border);
  transition: background 0.15s;
}
.dashboards-list a:hover { background: var(--bg-card-hover); }

/* ─── Footer ─── */
footer {
  text-align: center;
  color: var(--text-tertiary);
  padding: 2rem 1rem 1rem;
  padding-bottom: max(1rem, env(safe-area-inset-bottom));
  font-size: 0.75rem;
}

.error {
  background: rgba(255,59,48,0.15);
  border: 0.5px solid var(--red);
  color: var(--red);
  padding: 1rem 1.2rem;
  border-radius: var(--radius);
  margin: 1rem 0;
}

/* ─── Bevel-style Hero (pills + 3 rings séparés) ─── */
.bevel-hero {
  margin: 0.5rem 0 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.bevel-pills {
  display: flex;
  gap: 0.5rem;
}
.bevel-pill {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-card, #1c1c1e);
  border: 0.5px solid var(--separator, #333);
  border-radius: var(--radius-pill);
  flex: 1 1 auto;
  min-width: 0;
  color: var(--text);
  text-align: left;
  cursor: default;
}
.bevel-pill:disabled { cursor: default; }
.bevel-pill .bp-icon {
  font-size: 1.05rem;
  line-height: 1;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(48, 209, 88, 0.18);
}
.bevel-pill-weather .bp-icon { background: rgba(120, 130, 145, 0.2); }
.bevel-pill .bp-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.15;
}
.bevel-pill .bp-text strong {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bevel-pill .bp-text small {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bevel-rings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  background: var(--bg-card, #1c1c1e);
  border-radius: var(--radius-lg);
  padding: 0.85rem 0.6rem 0.95rem;
  border: 0.5px solid var(--separator, #333);
}
.bevel-ring-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.bevel-ring-svg {
  width: 100%;
  max-width: 86px;
  aspect-ratio: 1;
}
.bevel-ring-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -75%);
  font-size: var(--ts-base);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  font-feature-settings: "tnum";
}
.bevel-ring-label {
  margin-top: 0.3rem;
  font-size: var(--ts-sm);
  font-weight: 600;
  color: var(--text);
}
.bevel-ring-card + .bevel-ring-card {
  border-left: 0.5px solid rgba(255,255,255,0.08);
}
@media (max-width: 380px) {
  .bevel-rings { padding: 0.7rem 0.3rem 0.85rem; }
  .bevel-ring-svg { max-width: 76px; }
  .bevel-ring-value { font-size: 0.92rem; }
  .bevel-ring-label { font-size: var(--ts-xs); }
}

/* ─── Insight du jour (carte narrative sous les rings) ─── */
.daily-insight-card {
  background: var(--bg-card, #1c1c1e);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem 1.05rem;
  margin: 0.5rem 0 1rem;
  border: 0.5px solid var(--separator, #333);
}
.di-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 0.4rem;
}
.di-emoji {
  font-size: var(--ts-lg);
  line-height: 1;
}
.di-title {
  font-size: var(--ts-base);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.di-narrative {
  color: var(--text-secondary, #aeaeb2);
  font-size: 0.92rem;
  line-height: 1.5;
}

/* ─── Bottom sheet "Ajouter un aliment" ─── */
.add-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: none;
  pointer-events: none;
}
.add-modal.open { display: block; pointer-events: auto; }
.add-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.25s ease;
}
.add-modal.open .add-modal-backdrop { opacity: 1; }

/* Popup centré (mobile + desktop, jamais bottom-sheet) */
.add-modal-sheet {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%) scale(0.96);
  opacity: 0;
  background: var(--bg-elevated, #1c1c1e);
  border-radius: var(--radius-sheet);
  display: flex;
  flex-direction: column;
  width: 94%;
  max-width: 540px;
  max-height: 85vh;
  transition: transform 0.22s cubic-bezier(0.32, 0.72, 0, 1), opacity 0.18s ease;
  box-shadow: 0 24px 60px rgba(0,0,0,0.55);
  padding-bottom: max(0px, env(safe-area-inset-bottom));
}
.add-modal.open .add-modal-sheet {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
}

.add-modal-handle { display: none; }
.add-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1rem 0.7rem;
  border-bottom: 0.5px solid var(--separator, #333);
  flex-shrink: 0;
}
.add-modal-body {
  padding: 0.9rem 1rem 1.2rem;
  overflow-y: auto;
  flex: 1;
  -webkit-overflow-scrolling: touch;
}

/* Tabs méthode d'ajout (Code-barres / Recherche / Photo / Favoris)
   Style Yazio-inspired : pill ovale + label EN DESSOUS (extérieur).
   Actif = fond plein violet clair avec icône colorée ; inactif = bordure fine. */
.add-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 6px;
}
.add-tab {
  flex-shrink: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: transparent;
  color: var(--text);
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: var(--ts-sm);
  font-weight: 600;
  min-width: 76px;
  -webkit-tap-highlight-color: transparent;
}
.add-tab-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 76px;
  height: 48px;
  border-radius: var(--radius-pill);
  border: 1.5px solid rgba(94,92,230,0.35);
  background: transparent;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.add-tab:hover .add-tab-pill { background: rgba(94,92,230,0.08); }
.add-tab.active .add-tab-pill {
  background: var(--c-ai, #5e5ce6);
  border-color: var(--c-ai, #5e5ce6);
}
.add-tab-icon { width: 22px; height: 22px; color: var(--c-ai, #5e5ce6); pointer-events: none; }
.add-tab.active .add-tab-icon { color: #fff; }
.add-tab-label { color: var(--text); font-weight: 600; opacity: 0.65; transition: opacity 0.15s; }
.add-tab.active .add-tab-label { opacity: 1; }

/* Pills meal type segmented control */
.meal-pill {
  flex: 1;
  background: none;
  color: var(--text);
  border: none;
  padding: 0.5rem 0.4rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--ts-md);
  font-weight: 500;
  transition: background 0.15s;
}
.meal-pill.active {
  background: var(--blue, #0a84ff);
  color: #fff;
  font-weight: 600;
}

/* Lignes "Récents" et "Favoris" dans le modal */
.quick-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary, #1c1c1e);
  margin-bottom: 0.35rem;
  -webkit-tap-highlight-color: rgba(10,132,255,0.25);
  touch-action: manipulation;
}
.quick-row .qr-main {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.quick-row .qr-main .qr-name {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.quick-row .qr-main .qr-meta {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin-top: 0.1rem;
}
.quick-row button.qr-action {
  flex-shrink: 0;
  background: none;
  border: none;
  font-size: 1.2rem;
  line-height: 1;
  padding: 0.3rem 0.5rem;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
}
.quick-row button.qr-action.qr-add {
  background: var(--green, #30d158);
  color: #000;
  font-weight: 700;
}
.quick-row button.qr-action.qr-fav.active {
  color: var(--yellow, #ffd60a);
}

.quick-section-title {
  font-size: var(--ts-xs);
  font-weight: 700;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0.6rem 0 0.4rem;
}

/* Boutons rapides eau/café/alcool */
.drink-quick {
  flex: 1 1 auto;
  min-width: 0;
  background: rgba(255,255,255,0.05);
  border: none;
  color: var(--text);
  padding: 7px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: var(--ts-sm);
  font-weight: 600;
  line-height: 1;
  text-align: center;
  -webkit-tap-highlight-color: rgba(10,132,255,0.3);
  touch-action: manipulation;
  transition: background 0.15s;
}
.drink-quick:hover { background: rgba(255,255,255,0.08); }
.drink-quick small {
  display: none;
  color: var(--text-tertiary);
}
.drink-quick:active { background: var(--blue, #0a84ff); color: #fff; }

.pellet {
  font-size: 1.1rem;
  color: var(--text-tertiary);
  line-height: 1;
}
.pellet.filled { color: #8b5a2b; }

.back {
  color: var(--blue);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}
.back::before { content: "‹ "; }

/* ─── Body composition (page /body + widget home) ─── */
.body-kpis { grid-template-columns: repeat(5, 1fr); }
.body-kpi {
  position: relative;
  padding: 0.85rem 0.95rem 1.6rem;
  border-left: 3px solid var(--accent, var(--blue));
  min-height: 5.5rem;
}
.body-kpi .card-label {
  font-size: var(--ts-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 0.25rem;
}
.body-kpi .card-value {
  display: flex; align-items: baseline; gap: 0.25rem;
}
.body-kpi .num { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; }
.body-kpi .unit { font-size: 0.8rem; color: var(--text-tertiary); }
.body-kpi .card-delta { font-size: var(--ts-xs); margin-top: 0.15rem; min-height: 1em; }
.body-kpi .card-delta .pos { color: var(--green); }
.body-kpi .card-delta .neg { color: var(--red); }
.body-kpi .sparkline {
  position: absolute;
  bottom: 0.4rem;
  left: 0.5rem;
  right: 0.5rem;
  height: 22px;
  width: calc(100% - 1rem);
  opacity: 0.85;
}

/* Goal bar (94 → 82) */
.goal-bar {
  position: relative;
  height: 10px;
  background: var(--bg-card-hover);
  border-radius: 5px;
  overflow: hidden;
}
.goal-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--green));
  transition: width 0.6s ease;
}
.goal-bar-marker {
  position: absolute;
  top: -4px;
  width: 4px;
  height: 18px;
  background: var(--text);
  border-radius: 2px;
  transform: translateX(-50%);
}

/* Donut legend */
.donut-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.4rem;
  margin-top: 0.8rem;
  font-size: var(--ts-md);
}
.donut-legend span { display: flex; align-items: center; gap: 0.4rem; color: var(--text-tertiary); }
.donut-legend i {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.donut-legend strong { color: var(--text); margin-left: auto; }

/* Widget home compact */
.body-widget {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  margin: 0.8rem 0;
}
.body-widget header {
  display: flex; align-items: baseline; justify-content: space-between;
  padding: 0; margin-bottom: 0.8rem;
}
.body-widget h3 { margin: 0; font-size: 0.95rem; }
.body-widget header a { color: var(--blue); text-decoration: none; font-size: 0.8rem; }
.body-widget .row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; }
.body-widget .pill {
  text-align: center;
  padding: 0.4rem 0.2rem;
}
.body-widget .pill .lbl {
  font-size: var(--ts-2xs); color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.03em;
}
.body-widget .pill .val { font-size: 1.05rem; font-weight: 700; }
.body-widget .pill .delta { font-size: var(--ts-2xs); }
.body-widget .pill .delta.pos { color: var(--green); }
.body-widget .pill .delta.neg { color: var(--red); }
/* .body-widget .empty retiré → utilisé uniquement dans home.html.legacy
   (page non servie). Pour les vrais empty states : utiliser .ap-empty. */

@media (max-width: 600px) {
  .body-kpis { grid-template-columns: repeat(2, 1fr); }
  .body-kpis .body-kpi:last-child { grid-column: span 2; }
  .body-widget .row { grid-template-columns: repeat(5, 1fr); gap: 0.2rem; }
  .body-widget .pill .val { font-size: 0.95rem; }
}

/* ─── Login page ─── */
.login-wrap {
  display: flex;
  justify-content: center;
  padding: 2rem 1rem;
}
.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem 1.4rem 1.4rem;
}
.login-card h1 {
  margin: 0 0 0.4rem;
  font-size: 1.6rem;
  letter-spacing: -0.02em;
}
.login-sub {
  color: var(--text-tertiary);
  font-size: 0.9rem;
  margin: 0 0 1.2rem;
  line-height: 1.5;
}
.login-sub code {
  background: var(--bg-card-hover);
  padding: 0.1rem 0.4rem;
  border-radius: var(--radius-xs);
  font-size: var(--ts-md);
}
.login-error {
  background: rgba(255,59,48,0.15);
  border: 0.5px solid var(--red);
  color: var(--red);
  padding: 0.7rem 1rem;
  border-radius: var(--radius);
  margin: 0 0 1rem;
  font-size: 0.9rem;
}
.login-card form {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.login-card input[type="password"] {
  background: var(--bg-card-hover);
  border: 0.5px solid var(--border);
  border-radius: var(--radius);
  padding: var(--card-padding-lg);
  color: var(--text);
  font-size: var(--ts-base);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  width: 100%;
  box-sizing: border-box;
}
.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--blue);
}
.login-card button {
  background: var(--blue);
  color: white;
  border: none;
  border-radius: var(--radius);
  padding: var(--card-padding-lg);
  font-size: var(--ts-base);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.login-card button:active { opacity: 0.8; }
.login-tip {
  color: var(--text-tertiary);
  font-size: 0.8rem;
  margin: 1.2rem 0 0;
  line-height: 1.5;
}

/* ─── Responsive tweaks ─── */
@media (max-width: 600px) {
  main { padding: 0.75rem 1rem 4rem; }
  header { padding: 0.75rem 1rem 0.5rem; }
  .section-title { font-size: 1.35rem; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .card { padding: 0.85rem 0.95rem 1rem; }
  .card .card-value .num { font-size: 1.6rem; }
}

/* ─────────────────────────────────────────────
   Page /sleep — détail sommeil (Bevel-style)
   ───────────────────────────────────────────── */
.sleep-page { color: var(--text); padding-bottom: 2rem; }

/* .sleep-page .empty-state retiré → migré vers .ap-empty unifié */

/* Score global bar */
.sleep-score-bar {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-padding-lg);
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}

/* Timeline 24h style Bevel — nuit + siestes sur un axe 0h→24h */
.sleep-timeline-card {
  padding: 0.85rem 1rem 0.7rem;
  margin: 0.5rem 0 0.75rem;
}
.sleep-timeline-card .stl-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 0.45rem;
}
.sleep-timeline-card .stl-title {
  font-size: var(--ts-md);
  font-weight: 700;
  color: var(--c-sleep);
}
.sleep-timeline-card .stl-meta {
  font-size: var(--ts-xs);
  color: var(--text-tertiary);
  font-feature-settings: "tnum";
}
.sleep-timeline-card .stl-svg {
  display: block;
  width: 100%;
  height: 56px;
}
.sleep-timeline-card .stl-axis {
  display: flex; justify-content: space-between;
  font-size: var(--ts-2xs);
  color: var(--text-tertiary);
  font-feature-settings: "tnum";
  margin-top: 2px;
  padding: 0 1px;
}
.sleep-timeline-card .stl-legend {
  display: flex; align-items: center;
  font-size: var(--ts-xs);
  color: var(--text-tertiary);
  margin-top: 6px;
}
.sleep-timeline-card .stl-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 5px;
}
.sleep-score-label { font-size: 0.95rem; font-weight: 600; }
.sleep-score-right { display: flex; align-items: center; gap: 0.4rem; }
.sleep-score-num { font-size: 1.05rem; font-weight: 700; font-feature-settings: "tnum"; }
.sleep-score-pct { font-size: var(--ts-sm); color: var(--text-secondary); margin-right: 0.3rem; }
.sleep-score-mini { width: 28px; height: 28px; }
.sleep-score-mini circle { transition: stroke-dasharray 0.8s cubic-bezier(0.4,0,0.2,1); }

/* Période */
.sleep-period {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-padding-lg);
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow);
}
.sleep-period .sp-icon { font-size: var(--ts-base); }
.sleep-period .sp-label { font-size: 0.92rem; flex: 1; }
.sleep-period .sp-range { font-size: 0.92rem; font-feature-settings: "tnum"; color: var(--text-secondary); }

.sleep-times {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.85rem 0;
  display: grid; grid-template-columns: 1fr 1px 1fr;
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}
.sleep-times .st-cell { padding: 0 1rem; text-align: center; }
.sleep-times .st-divider { background: var(--border); height: 100%; }
.sleep-times .st-label { font-size: 0.72rem; color: var(--text-secondary); margin-bottom: 0.2rem; }
.sleep-times .st-value { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; font-feature-settings: "tnum"; }

/* Sub-scores grid : 2 colonnes */
/* Phases bandes (style inspiré Apple Santé, sans plagier) */
.phase-rows-card { padding: var(--card-padding); }
.phase-row {
  display: grid;
  grid-template-columns: 10px 70px 50px 1fr 38px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 0.5px solid rgba(255,255,255,0.06);
}
.phase-row:last-of-type { border-bottom: none; }
.phase-dot { width: 8px; height: 8px; border-radius: 50%; }
.phase-name { font-size: 0.82rem; font-weight: 600; color: var(--text); }
.phase-time { font-size: 0.82rem; font-variant-numeric: tabular-nums; color: var(--text-secondary); text-align: right; }
.phase-bar { height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.phase-bar-fill { height: 100%; border-radius: 3px; transition: width var(--motion-spring, 0.4s ease); }
.phase-pct { font-size: var(--ts-sm); font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); text-align: right; }

.sleep-subscores {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 0.85rem;
}
.ss-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--card-padding);
  display: flex; flex-direction: column; gap: 0.25rem;
}
.ss-icon { font-size: var(--ts-base); opacity: 0.85; }
.ss-level { font-size: 0.92rem; font-weight: 700; }
.ss-sublabel { font-size: 0.72rem; color: var(--text-secondary); }
.ss-bar { height: 3px; background: rgba(255,255,255,0.08); border-radius: 2px; margin-top: 0.3rem; overflow: hidden; }
.ss-bar-fill { height: 100%; border-radius: 2px; transition: width 0.6s ease; }
.ss-value { font-size: var(--ts-xs); color: var(--text-secondary); margin-top: 0.15rem; font-feature-settings: "tnum"; }
.ss-card[data-level="Donnée indispo"] .ss-level { color: var(--text-secondary); }

/* Insight narratif */
.sleep-insight {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  display: flex; gap: 0.7rem; align-items: flex-start;
  margin-bottom: 1.2rem;
  box-shadow: var(--shadow);
}
.sleep-insight .si-emoji { font-size: 1.1rem; flex-shrink: 0; }
.sleep-insight .si-title { font-size: 0.92rem; font-weight: 700; margin-bottom: 0.25rem; }
.sleep-insight .si-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.4; }

/* Phases — 4 cards en 2x2 */
.sleep-h3 {
  font-size: var(--ts-sm);
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 0.5rem 0 0.6rem;
}
.sleep-phases {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.sp-cell {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.8rem 0.9rem;
}
.sp-cell .spc-label { font-size: var(--ts-sm); color: var(--text-secondary); margin-bottom: 0.4rem; }
.sp-cell .spc-value-row { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; }
.sp-cell .spc-time { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.02em; font-feature-settings: "tnum"; line-height: 1.05; }
.sp-cell .spc-pct { font-size: 0.72rem; font-weight: 700; }
.sp-cell[data-phase="awake"] .spc-pct { color: #ff9f0a; }
.sp-cell[data-phase="rem"]   .spc-pct { color: #bf5af2; }
.sp-cell[data-phase="core"]  .spc-pct { color: #5e9eff; }
.sp-cell[data-phase="deep"]  .spc-pct { color: #3a55c4; }
.sp-cell .spc-ring { width: 38px; height: 38px; flex-shrink: 0; }
.sp-cell .spc-ring circle { transition: stroke-dasharray 0.8s cubic-bezier(0.4,0,0.2,1); }

/* Anneau Sommeil cliquable sur la home → page /sleep */
.bevel-ring-link {
  text-decoration: none; color: inherit;
  display: flex; flex-direction: column; align-items: center;
  cursor: pointer;
  transition: transform 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}
.bevel-ring-link:active { transform: scale(0.96); }

/* Barre stackée des phases (proportionnelle, pas timeline) */
.phase-stack-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-padding-lg);
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}
.phase-stack {
  display: flex;
  height: 18px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: rgba(255,255,255,0.04);
}
.ps-seg {
  height: 100%;
  transition: width 0.6s ease;
}
.ps-seg[data-phase="awake"] { background: #ff9f0a; }
.ps-seg[data-phase="rem"]   { background: #bf5af2; }
.ps-seg[data-phase="core"]  { background: #5e9eff; }
.ps-seg[data-phase="deep"]  { background: #3a55c4; }

.phase-stack-legend {
  display: flex; flex-wrap: wrap; gap: 0.6rem 0.9rem;
  margin-top: 0.6rem;
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.psl-item { display: flex; align-items: center; gap: 0.3rem; }
.psl-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.psl-item[data-phase="awake"] .psl-dot { background: #ff9f0a; }
.psl-item[data-phase="rem"]   .psl-dot { background: #bf5af2; }
.psl-item[data-phase="core"]  .psl-dot { background: #5e9eff; }
.psl-item[data-phase="deep"]  .psl-dot { background: #3a55c4; }
.phase-stack-note {
  font-size: var(--ts-xs);
  margin-top: 0.5rem;
  line-height: 1.35;
}
.muted { color: var(--text-secondary); opacity: 0.85; }

/* Widget FC sommeil (proxy 24h) */
.hr-summary-card {
  background: var(--bg-card);
  border: 0.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--card-padding-lg);
  margin-bottom: 0.85rem;
  box-shadow: var(--shadow);
}
.hrs-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}
.hrs-cell { text-align: center; padding: 0.3rem 0.2rem; }
.hrs-label { font-size: var(--ts-xs); color: var(--text-secondary); }
.hrs-value { font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; font-feature-settings: "tnum"; line-height: 1.05; margin-top: 0.15rem; }
.hrs-unit { font-size: var(--ts-2xs); color: var(--text-secondary); margin-top: 0.1rem; }
.hrs-drop {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 0.5px solid var(--border);
  font-size: var(--ts-md);
  display: flex; justify-content: space-between; align-items: center;
}
.hrs-drop-label { color: var(--text-secondary); }
.hrs-drop-value { font-weight: 700; font-feature-settings: "tnum"; }
.hrs-drop-value.good { color: #34c759; }
.hrs-drop-value.mid  { color: #ffd60a; }
.hrs-drop-value.bad  { color: #ff9f0a; }
.hrs-note { font-size: 0.68rem; margin-top: 0.5rem; line-height: 1.35; }

/* Graph FC nuit (Chart.js) */
.hr-chart-wrap {
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 0.5px solid var(--border);
  height: 180px;
  position: relative;
}
.hr-chart-wrap canvas { width: 100% !important; height: 160px !important; }
.hrs-axis {
  display: flex;
  justify-content: space-between;
  font-size: var(--ts-xs);
  color: var(--text-secondary);
  margin-top: 0.2rem;
}

/* ─── Apple Premium v2 — utility classes ─── */

/* Card de base — Glassmorphism Apple Premium v2.
   Background semi-transparent + backdrop-filter blur pour effet iOS
   natif où on perçoit le fond noir/gradient en transparence. Fallback
   solide pour les browsers sans support backdrop-filter.
*/
.ap-card {
  background: rgba(28, 28, 30, 0.65);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
  padding: var(--card-padding);
  transition: transform var(--motion-spring), background var(--motion-fast),
              border-left-color var(--motion-fast), padding-left var(--motion-fast),
              box-shadow var(--motion-fast);
  border-left: 0px solid transparent;
  position: relative;
  margin-bottom: 7px;
}
/* Fallback solide si pas de support backdrop-filter (anciens browsers) */
@supports not (backdrop-filter: blur(1px)) {
  .ap-card { background: var(--bg-card); }
}
section.ap-card, div.ap-card { margin-bottom: 7px; }
.ap-card:hover {
  transform: translateY(-2px);
  background: rgba(44, 44, 46, 0.7);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Bento layouts */
.ap-bento-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 7px; }
.ap-bento-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; margin-bottom: 7px; }
.ap-bento-2-1 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 7px; margin-bottom: 7px; }

/* Stat values + labels */
.ap-label { font-size: .78rem; font-weight: 700; letter-spacing: -.005em; opacity: .9; }
.ap-val { font-weight: 800; line-height: 1; letter-spacing: -0.025em; }
.ap-val-sm { font-weight: 700; line-height: 1; letter-spacing: -0.01em; }
.ap-meta { font-size: 0.62rem; opacity: 0.55; }

/* Head row (icon + label) */
.ap-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.ap-head .ap-icon { width: 16px; height: 16px; flex-shrink: 0; }

/* Apple arrow chevron */
.ap-arrow { color: var(--c-arrow); font-size: var(--ts-base); font-weight: 600; }

/* Motion FX — Stagger animation amplifiée (Apple Fitness style).
   Cascade plus marquée à l'arrivée : translate plus grand (16px vs 8),
   easing spring plus prononcé, delays plus larges (90ms step au lieu de
   50ms). Effet "vivant" plus visible. */
@keyframes ap-slide-up {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
.ap-fx-stagger > * {
  animation: ap-slide-up 520ms cubic-bezier(0.22, 1.2, 0.36, 1) backwards;
}
.ap-fx-stagger > *:nth-child(1) { animation-delay:   0ms; }
.ap-fx-stagger > *:nth-child(2) { animation-delay:  90ms; }
.ap-fx-stagger > *:nth-child(3) { animation-delay: 180ms; }
.ap-fx-stagger > *:nth-child(4) { animation-delay: 270ms; }
.ap-fx-stagger > *:nth-child(5) { animation-delay: 360ms; }
.ap-fx-stagger > *:nth-child(6) { animation-delay: 450ms; }
.ap-fx-stagger > *:nth-child(7) { animation-delay: 540ms; }
.ap-fx-stagger > *:nth-child(8) { animation-delay: 630ms; }
.ap-fx-stagger > *:nth-child(n+9) { animation-delay: 720ms; }
@media (prefers-reduced-motion: reduce) {
  .ap-fx-stagger > * { animation: none; }
}

/* Sport-encoded modifiers — accent border-left PERMANENT (la signature
   Apple Premium v2 promise). Avant : seulement au :hover → invisible
   sur mobile (cible #1 de l'app, touch sans hover). */
.ap-card.--cycling     { border-left: 3px solid var(--c-cycling);    padding-left: 11px; }
.ap-card.--hr          { border-left: 3px solid var(--c-hr);         padding-left: 11px; }
.ap-card.--sleep       { border-left: 3px solid var(--c-sleep);      padding-left: 11px; }
.ap-card.--recovery    { border-left: 3px solid var(--c-recovery);   padding-left: 11px; }
.ap-card.--nutrition   { border-left: 3px solid var(--c-nutrition);  padding-left: 11px; }
.ap-card.--running     { border-left: 3px solid var(--c-running);    padding-left: 11px; }
.ap-card.--walking     { border-left: 3px solid var(--c-walking);    padding-left: 11px; }
.ap-card.--body        { border-left: 3px solid var(--c-body);       padding-left: 11px; }
.ap-card.--strength    { border-left: 3px solid var(--c-strength);   padding-left: 11px; }
.ap-card.--mobility    { border-left: 3px solid var(--c-mobility);   padding-left: 11px; }
.ap-card.--rest        { border-left: 3px solid var(--c-rest);       padding-left: 11px; }
.ap-card.--reward      { border-left: 3px solid var(--c-reward);     padding-left: 11px; }
.ap-card.--weather     { border-left: 3px solid var(--c-weather);    padding-left: 11px; }
.ap-card.--ai          { border-left: 3px solid var(--c-ai);         padding-left: 11px; }
.ap-card.--phase       { border-left: 3px solid var(--c-phase);      padding-left: 11px; }
/* Au hover (desktop) : épaissir l'accent pour micro-feedback supplémentaire */
.ap-card.--cycling:hover, .ap-card.--hr:hover, .ap-card.--sleep:hover,
.ap-card.--recovery:hover, .ap-card.--nutrition:hover, .ap-card.--running:hover,
.ap-card.--walking:hover, .ap-card.--body:hover, .ap-card.--strength:hover,
.ap-card.--mobility:hover, .ap-card.--rest:hover, .ap-card.--reward:hover,
.ap-card.--weather:hover, .ap-card.--ai:hover, .ap-card.--phase:hover {
  border-left-width: 4px;
  padding-left: 10px;
}

/* ─── Focus-visible global (accessibilité clavier + Switch Control iOS) ──
   Apple HIG + WCAG 2.1 SC 2.4.7 : tout élément interactif doit avoir un
   indicateur de focus visible. Avant : aucun. Maintenant ring bleu cohérent
   sur tous les boutons, links, inputs, tabs. :focus-visible (vs :focus)
   évite le ring inutile sur clic souris.
*/
:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
  border-radius: inherit;
}
/* iOS WKWebView ne reset pas correctement l'outline par défaut sur
   certains éléments (button, input). On force l'outline propre. */
button:focus-visible, a:focus-visible, [role="button"]:focus-visible,
input:focus-visible, select:focus-visible, textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Icon color modifiers (utilisé sur SVG inline avec stroke="currentColor") */
.ap-icon--cycling   { color: var(--c-cycling); }
.ap-icon--hr        { color: var(--c-hr); }
.ap-icon--sleep     { color: var(--c-sleep); }
.ap-icon--recovery  { color: var(--c-recovery); }
.ap-icon--nutrition { color: var(--c-nutrition); }
.ap-icon--running   { color: var(--c-running); }
.ap-icon--walking   { color: var(--c-walking); }
.ap-icon--body      { color: var(--c-body); }
.ap-icon--strength  { color: var(--c-strength); }
.ap-icon--mobility  { color: var(--c-mobility); }
.ap-icon--rest      { color: var(--c-rest); }
.ap-icon--reward    { color: var(--c-reward); }
.ap-icon--weather   { color: var(--c-weather); }
.ap-icon--ai        { color: var(--c-ai); }
.ap-icon--phase     { color: var(--c-phase); }

/* Icon size scale (utilisé sur SVG inline). Default : 16px (--md). */
.ap-icon         { width: 16px; height: 16px; flex-shrink: 0; }
.ap-icon--xs     { width: 12px; height: 12px; }
.ap-icon--sm     { width: 14px; height: 14px; }
.ap-icon--md     { width: 16px; height: 16px; }
.ap-icon--lg     { width: 18px; height: 18px; }
.ap-icon--xl     { width: 20px; height: 20px; }

/* Text color utilities — alignées sur les tokens existants */
.text-tertiary   { color: var(--text-tertiary); }
.text-secondary  { color: var(--text-secondary); }
.text-muted      { color: rgba(255,255,255,0.5); }

/* Caption utility : ts-xs + tertiary, pattern récurrent meta/footnote */
.ap-caption {
  font-size: var(--ts-xs);
  color: var(--text-tertiary);
}
.ap-caption--upper {
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}

/* Layout primitives */
.inline-flex-center {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.flex-1-min0      { flex: 1; min-width: 0; }
.is-hidden        { display: none !important; }

/* ─── Apple Premium v2 — accessibilité : respect du paramètre système
   "Réduire le mouvement" (iOS Réglages > Accessibilité > Mouvement) ─── */
@media (prefers-reduced-motion: reduce) {
  .ap-card { transition: none; }
  .ap-card:hover { transform: none; }
  .ap-fx-stagger > * { animation: none; }
}

/* ─── Apple Premium v2 — mode édition home ─── */
@keyframes ap-wiggle {
  0%, 100% { transform: rotate(-0.5deg); }
  50% { transform: rotate(0.5deg); }
}
.ap-edit-mode #ap-home-grid > .ap-widget,
.ap-edit-mode .ap-widget--recovery-ring {
  animation: ap-wiggle 0.3s ease-in-out infinite;
}
.ap-edit-mode #ap-home-grid > .ap-widget:nth-child(2n) {
  animation-delay: -0.15s;
}
/* Désactive le hover lift en mode édition (sinon le wiggle est cassé par les transforms) */
.ap-edit-mode .ap-card:hover {
  transform: none !important;
  border-left: 0px solid transparent !important;
  padding-left: 14px !important;
}
.ap-sortable-ghost {
  opacity: 0.4;
  background: rgba(255,255,255,0.1);
}

@media (prefers-reduced-motion: reduce) {
  .ap-edit-mode #ap-home-grid > .ap-widget,
  .ap-edit-mode .ap-widget--recovery-ring {
    animation: none;
  }
}

/* ─── Apple Premium v2 — spacing entre widgets de la home ─── */
/* gap 7px = même valeur que .ap-bento-2/-3/-2-1 → cohérence visuelle entre
   l'espace inter-tuiles d'un bento et l'espace entre 2 widgets stackés. */
#ap-home-grid {
  display: flex;
  flex-direction: column;
  gap: 7px;
}


/* ═══════════════════════════════════════════════════════════════════
   COMPOSANTS UTILITAIRES Apple Premium v2 (extraction inline-styles)
   ═══════════════════════════════════════════════════════════════════ */

/* ─── .ap-page-header — header de page uniforme ────────────────────
   Pattern : icône colorée sport-encoded à gauche + titre h1 1.5rem 800
   en blanc à droite, + ligne secondaire date/meta optionnelle en dessous.
   Remplace les 8+ variantes inline dans body/sleep/calendar/workouts/etc.
   Usage :
     <header class="ap-page-header --sleep">
       <svg class="ap-page-header__icon"><use href="#icon-sleep"/></svg>
       <h1 class="ap-page-header__title">Sommeil</h1>
       <p class="ap-page-header__meta">mer. 13 mai</p>
     </header>
   --c-* hérités via modifier sur le wrapper.
*/
.ap-page-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0.5rem 0 1rem;
  flex-wrap: wrap;
}
.ap-page-header__icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.ap-page-header__title {
  font-size: var(--ts-xl);
  font-weight: 800;
  letter-spacing: -0.025em;
  margin: 0;
  /* Titre en blanc — la sémantique sport-encoded est portée par l'icône
     (audit UX : --c-sleep #bf5af2 sur noir bold n'atteignait pas le ratio
     WCAG AA 4.5:1 pour du texte bold large). */
  color: var(--text);
  line-height: 1.1;
}
.ap-page-header__meta {
  flex-basis: 100%;
  font-size: var(--ts-sm);
  color: var(--text-tertiary);
  margin: 0;
  line-height: 1.2;
}
.ap-page-header__actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
/* Sport-encoded : applique la couleur sur l'icône via currentColor */
.ap-page-header.--running    .ap-page-header__icon { color: var(--c-running); }
.ap-page-header.--cycling    .ap-page-header__icon { color: var(--c-cycling); }
.ap-page-header.--walking    .ap-page-header__icon { color: var(--c-walking); }
.ap-page-header.--sleep      .ap-page-header__icon { color: var(--c-sleep); }
.ap-page-header.--body       .ap-page-header__icon { color: var(--c-body); }
.ap-page-header.--nutrition  .ap-page-header__icon { color: var(--c-nutrition); }
.ap-page-header.--hr         .ap-page-header__icon { color: var(--c-hr); }
.ap-page-header.--weather    .ap-page-header__icon { color: var(--c-weather); }
.ap-page-header.--ai         .ap-page-header__icon { color: var(--c-ai); }
.ap-page-header.--phase      .ap-page-header__icon { color: var(--c-phase); }
.ap-page-header.--recovery   .ap-page-header__icon { color: var(--c-recovery); }
.ap-page-header.--strength   .ap-page-header__icon { color: var(--c-strength); }
.ap-page-header.--mobility   .ap-page-header__icon { color: var(--c-mobility); }
.ap-page-header.--reward     .ap-page-header__icon { color: var(--c-reward); }
.ap-page-header.--rest       .ap-page-header__icon { color: var(--c-rest); }
.ap-page-header.--default    .ap-page-header__icon { color: var(--text-secondary); }

/* ─── .ap-tile — pattern card unifié (style cards séances) ────────
   Layout : icône carrée pleine 36×36 (bg color-mix 14%, color SVG)
   + titre coloré sport + valeur + chevron. Pattern reproduit depuis
   web/templates/workouts.html pour cohérence visuelle entre home et
   pages détail séances. */
.ap-tile {
  padding: var(--card-padding) !important;
}
.ap-tile__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.ap-tile__icon svg {
  width: 18px;
  height: 18px;
}
.ap-tile__body {
  flex: 1;
  min-width: 0;
}
.ap-tile__head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 3px;
}
.ap-tile__title {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.ap-tile__pill {
  display: inline-block;
  padding: 2px 7px;
  border-radius: var(--radius-xs);
  font-size: 0.5rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.ap-tile__value {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.ap-tile__meta {
  font-size: 0.62rem;
  color: var(--text-tertiary);
  margin-top: 4px;
  line-height: 1.4;
}
.ap-tile__stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.62rem;
  color: var(--text-tertiary);
  font-weight: 500;
  margin-top: 5px;
}
.ap-arrow {
  font-size: 0.95rem;
  align-self: center;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* ─── Coach IA chat bubble — style iMessage Apple ───────────────────
   Pattern conversationnel chaleureux : avatar rond à gauche avec halo
   pulse subtil + bulle de message avec queue pointant vers l'avatar.
   Plus humain qu'une simple card de constat froid. */
.coach-ia-chat {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: var(--card-padding);
  background: rgba(28, 28, 30, 0.65);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  border: 0.5px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--c-ai);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  margin-bottom: 7px;
  transition: transform var(--motion-spring), background var(--motion-fast);
  -webkit-tap-highlight-color: transparent;
}
.coach-ia-chat:hover {
  transform: translateY(-2px);
  background: rgba(44, 44, 46, 0.7);
}
.coach-ia-chat:active { transform: scale(0.99); }

.coach-ia-chat__avatar {
  position: relative;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  background: color-mix(in srgb, var(--c-ai) 22%, transparent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--c-ai);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--c-ai) 30%, transparent),
    0 0 12px color-mix(in srgb, var(--c-ai) 35%, transparent);
  animation: coach-avatar-pulse 2.8s ease-in-out infinite;
}
.coach-ia-chat__avatar svg {
  width: 22px;
  height: 22px;
}
@keyframes coach-avatar-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--c-ai) 30%, transparent),
      0 0 12px color-mix(in srgb, var(--c-ai) 35%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 1px color-mix(in srgb, var(--c-ai) 50%, transparent),
      0 0 20px color-mix(in srgb, var(--c-ai) 55%, transparent);
  }
}

.coach-ia-chat__bubble {
  position: relative;
  flex: 1;
  min-width: 0;
  padding: 10px 12px 8px;
  background: color-mix(in srgb, var(--c-ai) 13%, transparent);
  border: 0.5px solid color-mix(in srgb, var(--c-ai) 22%, transparent);
  /* Border-radius asymétrique style iMessage : coin top-left aplati
     (côté avatar) pour suggérer la queue. */
  border-radius: 14px 14px 14px 4px;
  margin-top: 2px;
}
/* Queue pointant vers l'avatar (petit triangle en haut à gauche) */
.coach-ia-chat__bubble::before {
  content: "";
  position: absolute;
  top: 6px;
  left: -6px;
  width: 10px;
  height: 10px;
  background: color-mix(in srgb, var(--c-ai) 13%, transparent);
  border-left: 0.5px solid color-mix(in srgb, var(--c-ai) 22%, transparent);
  border-bottom: 0.5px solid color-mix(in srgb, var(--c-ai) 22%, transparent);
  transform: rotate(45deg);
  border-radius: 0 0 0 3px;
}

.coach-ia-chat__meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
}
.coach-ia-chat__name {
  font-size: var(--ts-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--c-ai);
}
.coach-ia-chat__time {
  font-size: var(--ts-2xs);
  color: var(--text-tertiary);
  font-weight: 500;
}
.coach-ia-chat__text {
  font-size: var(--ts-md);
  line-height: 1.5;
  color: var(--text);
  margin: 0 0 6px;
}
.coach-ia-chat__cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--c-ai);
  letter-spacing: -0.005em;
}
.coach-ia-chat__cta svg {
  width: 10px;
  height: 10px;
  transition: transform var(--motion-fast);
}
.coach-ia-chat:hover .coach-ia-chat__cta svg { transform: translateX(2px); }

@media (prefers-reduced-motion: reduce) {
  .coach-ia-chat__avatar { animation: none; }
}

/* ─── Coach IA chat FAB + bottom sheet (global, toutes pages) ──────── */
.coach-fab {
  position: fixed;
  right: 16px;
  bottom: calc(76px + env(safe-area-inset-bottom));  /* au-dessus du tab bar */
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--c-ai) 0%, #7d6ff0 50%, var(--c-mobility) 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 250;  /* au-dessus du tab bar (200) */
  box-shadow:
    0 4px 16px rgba(94, 92, 230, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset;
  transition: transform var(--motion-spring), box-shadow var(--motion-fast);
  -webkit-tap-highlight-color: transparent;
  animation: coach-fab-pulse 3.2s ease-in-out infinite;
}
.coach-fab svg {
  width: 26px; height: 26px;
  animation: coach-fab-bob 2.6s ease-in-out infinite;
}
.coach-fab:hover {
  transform: translateY(-2px);
  box-shadow:
    0 6px 22px rgba(94, 92, 230, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
}
.coach-fab:active { transform: scale(0.94); }
/* Scroll-aware : descend off-screen quand l'user scrolle vers le bas
   pour libérer la zone d'action du contenu. Le pulse reste actif (le
   FAB respire toujours, juste hors écran). */
.coach-fab.coach-fab--hidden {
  transform: translateY(140px);
  opacity: 0;
  pointer-events: none;
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1), opacity 200ms ease;
}
.coach-fab {
  transition: transform 280ms cubic-bezier(0.4, 0, 0.2, 1), opacity 200ms ease,
              box-shadow var(--motion-fast);
}
/* Pulse halo : visible côté glow + léger scale du bouton lui-même */
@keyframes coach-fab-pulse {
  0%, 100% {
    box-shadow: 0 4px 16px rgba(94,92,230,0.45), 0 0 0 1px rgba(255,255,255,0.08) inset;
    transform: scale(1);
  }
  50% {
    box-shadow: 0 6px 26px rgba(94,92,230,0.70), 0 0 0 1px rgba(255,255,255,0.16) inset;
    transform: scale(1.04);
  }
}
/* Bob subtil de l'icône SVG (effet "respiration") */
@keyframes coach-fab-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .coach-fab { animation: none; }
  .coach-fab svg { animation: none; }
}

/* Sheet : full bottom modal */
.coach-sheet {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  pointer-events: none;
}
.coach-sheet[hidden] { display: none; }
.coach-sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: auto;
}
.coach-sheet.is-open .coach-sheet__backdrop { opacity: 1; }
.coach-sheet__content {
  position: relative;
  background: rgba(28, 28, 30, 0.95);
  -webkit-backdrop-filter: saturate(180%) blur(30px);
  backdrop-filter: saturate(180%) blur(30px);
  border-top: 0.5px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-sheet) var(--radius-sheet) 0 0;
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  min-height: 60vh;
  padding-bottom: env(safe-area-inset-bottom);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: auto;
}
.coach-sheet.is-open .coach-sheet__content { transform: translateY(0); }
.coach-sheet__handle {
  width: 36px;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  margin: 8px auto 4px;
  flex-shrink: 0;
}
.coach-sheet__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 12px;
  border-bottom: 0.5px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.coach-sheet__title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.coach-sheet__avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--c-ai), var(--c-mobility));
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 10px rgba(94, 92, 230, 0.45);
}
.coach-sheet__avatar svg { width: 22px; height: 22px; }
.coach-sheet__title h3 {
  font-size: var(--ts-base);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 0;
}
.coach-sheet__sub {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  margin: 2px 0 0;
}
.coach-sheet__close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.coach-sheet__close:hover { background: rgba(255, 255, 255, 0.14); }

.coach-sheet__messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
}
.coach-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 0.88rem;
  line-height: 1.5;
  word-wrap: break-word;
  animation: coach-msg-in 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes coach-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.coach-msg--user {
  align-self: flex-end;
  background: var(--blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.coach-msg--assistant {
  align-self: flex-start;
  background: rgba(94, 92, 230, 0.18);
  color: var(--text);
  border: 0.5px solid rgba(94, 92, 230, 0.30);
  border-bottom-left-radius: 4px;
}
.coach-msg--welcome { background: rgba(94, 92, 230, 0.12); }
.coach-msg--welcome p { margin: 0 0 4px; }
.coach-msg--welcome p:last-child { margin-bottom: 0; }
.coach-msg--typing { display: flex; gap: 4px; padding: 12px 14px; }
.coach-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-ai);
  opacity: 0.6;
  animation: coach-typing-bounce 1.2s ease-in-out infinite;
}
.coach-dot:nth-child(2) { animation-delay: 0.15s; }
.coach-dot:nth-child(3) { animation-delay: 0.30s; }
@keyframes coach-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.coach-sheet__prompts {
  padding: 8px 16px;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  border-top: 0.5px solid rgba(255, 255, 255, 0.06);
}
.coach-sheet__prompts::-webkit-scrollbar { display: none; }
.coach-prompt {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.08);
  border: 0.5px solid rgba(255, 255, 255, 0.10);
  border-radius: var(--radius-pill);
  color: var(--text);
  font-size: var(--ts-sm);
  font-weight: 500;
  padding: 8px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: background var(--motion-fast);
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}
.coach-prompt:hover { background: rgba(255, 255, 255, 0.14); }
.coach-prompt:active { transform: scale(0.96); }

.coach-sheet__form {
  display: flex;
  gap: 8px;
  padding: 12px 16px 16px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.coach-sheet__input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 0.5px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-pill);
  color: var(--text);
  padding: 10px 16px;
  font-size: 16px;  /* anti-zoom iOS */
  font-family: inherit;
  min-height: 44px;
}
.coach-sheet__input:focus {
  outline: 2px solid var(--c-ai);
  outline-offset: 2px;
  background: rgba(255, 255, 255, 0.10);
}
.coach-sheet__send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--c-ai);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.coach-sheet__send:hover { background: color-mix(in srgb, var(--c-ai) 85%, white); }
.coach-sheet__send:active { transform: scale(0.92); }
.coach-sheet__send svg { width: 18px; height: 18px; }

/* Body class quand sheet ouverte : empêche le scroll de la page sous-jacente */
body.coach-sheet-open { overflow: hidden; }

/* ─── .ap-home-hero — vitrine immersive de la home ────────────────
   Glass card + mesh gradient ambient + ring SVG animé + counter
   animé. Dimensionne le score Forme du jour comme statement visuel.
   data-score-band : great (≥75) / good (60-74) / medium (45-59) / low (<45) */
.ap-home-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sheet);
  padding: 22px 20px;
  margin-bottom: 14px;
  background: rgba(28, 28, 30, 0.55);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border: 0.5px solid rgba(255, 255, 255, 0.08);
  isolation: isolate;
}
.ap-home-hero__bg {
  position: absolute;
  inset: -20%;
  z-index: 0;
  pointer-events: none;
  filter: blur(28px);
  opacity: 0.85;
  transform: translateZ(0);
}
.ap-home-hero[data-score-band="great"] .ap-home-hero__bg {
  background:
    radial-gradient(circle at 15% 25%, rgba(48, 209, 88, 0.50) 0%, transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(90, 200, 250, 0.42) 0%, transparent 50%),
    radial-gradient(circle at 50% 110%, rgba(48, 209, 88, 0.30) 0%, transparent 55%);
}
.ap-home-hero[data-score-band="good"] .ap-home-hero__bg {
  background:
    radial-gradient(circle at 15% 25%, rgba(90, 200, 250, 0.48) 0%, transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(10, 132, 255, 0.42) 0%, transparent 50%),
    radial-gradient(circle at 50% 110%, rgba(94, 92, 230, 0.28) 0%, transparent 55%);
}
.ap-home-hero[data-score-band="medium"] .ap-home-hero__bg {
  background:
    radial-gradient(circle at 15% 25%, rgba(255, 214, 10, 0.42) 0%, transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(255, 159, 10, 0.42) 0%, transparent 50%),
    radial-gradient(circle at 50% 110%, rgba(255, 159, 10, 0.26) 0%, transparent 55%);
}
.ap-home-hero[data-score-band="low"] .ap-home-hero__bg {
  /* Récup = zen apaisant indigo/cyan/violet (pas de rose alerte) */
  background:
    radial-gradient(circle at 15% 25%, rgba(94, 92, 230, 0.42) 0%, transparent 45%),
    radial-gradient(circle at 85% 70%, rgba(90, 200, 250, 0.38) 0%, transparent 50%),
    radial-gradient(circle at 50% 110%, rgba(191, 90, 242, 0.22) 0%, transparent 55%);
}
.ap-home-hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 18px;
}
.ap-home-hero__ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}
.ap-home-hero__ring-svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 0 12px rgba(255, 255, 255, 0.10));
}
.ap-home-hero__ring-fill {
  transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.ap-home-hero__score {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
  gap: 2px;
  line-height: 1;
}
.ap-home-hero__num {
  font-size: var(--ts-2xl);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}
.ap-home-hero__score small {
  font-size: var(--ts-md);
  font-weight: 600;
  color: var(--text-secondary);
  align-self: flex-end;
  margin-bottom: 8px;
}
.ap-home-hero__info {
  flex: 1;
  min-width: 0;
}
.ap-home-hero__label {
  font-size: var(--ts-2xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  font-weight: 700;
  margin-bottom: 4px;
}
.ap-home-hero__zone {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 4px;
}
.ap-home-hero__verdict {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
  font-weight: 500;
}
.ap-home-hero__verdict-emoji {
  display: inline-block;
  margin-right: 2px;
  vertical-align: -1px;
}
.ap-home-hero__cta {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 8px 14px 8px 16px;
  background: rgba(255, 255, 255, 0.10);
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-pill);
  color: var(--text);
  text-decoration: none;
  font-size: var(--ts-sm);
  font-weight: 700;
  letter-spacing: -0.005em;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background var(--motion-fast), transform var(--motion-feedback);
  -webkit-tap-highlight-color: transparent;
  min-height: 36px;
}
.ap-home-hero__cta:hover { background: rgba(255, 255, 255, 0.16); }
.ap-home-hero__cta:active { transform: scale(0.96); }
.ap-home-hero__cta svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  opacity: 0.7;
  transition: transform var(--motion-fast);
}
.ap-home-hero__cta:hover svg { transform: translateX(2px); opacity: 1; }
@media (max-width: 380px) {
  .ap-home-hero__content { gap: 14px; }
  .ap-home-hero__ring { width: 100px; height: 100px; }
  .ap-home-hero__num { font-size: 2.2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-home-hero__ring-fill { transition: none; }
  .aph-ring__fill { transition: none; }
}

/* ─── Variante --triplet : 3 mini-rings Effort/Récup/Sommeil style Bevel ─── */
.ap-home-hero.--triplet .ap-home-hero__content.ap-home-hero__triplet {
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
}
.aph-rings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}
.aph-ring {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;
  color: inherit;
  padding: 4px 0 0;
  -webkit-tap-highlight-color: transparent;
  transition: transform var(--motion-feedback);
}
.aph-ring:active { transform: scale(0.96); }
.aph-ring__svg {
  width: 88px;
  height: 88px;
  filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.08));
}
.aph-ring__fill {
  transition: stroke-dashoffset 1.1s cubic-bezier(0.4, 0, 0.2, 1);
}
.aph-ring__num {
  position: absolute;
  top: 32px;
  left: 0; right: 0;
  text-align: center;
  font-size: var(--ts-lg);
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.aph-ring__pct {
  position: absolute;
  top: 36px;
  right: calc(50% - 32px);
  font-size: var(--ts-2xs);
  color: var(--text-tertiary);
  font-weight: 600;
}
.aph-ring__label {
  margin-top: 6px;
  font-size: var(--ts-xs);
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.01em;
}
.ap-home-hero__verdict-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 4px;
  border-top: 0.5px solid rgba(255, 255, 255, 0.08);
}
.ap-home-hero__verdict-text {
  flex: 1;
  font-size: var(--ts-sm);
  color: var(--text-secondary);
  font-weight: 500;
  line-height: 1.35;
}
.ap-home-hero__cta-mini {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.10);
  border: 0.5px solid rgba(255, 255, 255, 0.15);
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  transition: background var(--motion-fast), transform var(--motion-feedback);
  -webkit-tap-highlight-color: transparent;
}
.ap-home-hero__cta-mini:active { transform: scale(0.92); }
.ap-home-hero__cta-mini svg { width: 12px; height: 12px; opacity: 0.85; }

@media (max-width: 380px) {
  .aph-ring__svg { width: 76px; height: 76px; }
  .aph-ring__num { top: 26px; font-size: var(--ts-md); }
  .aph-ring__pct { top: 30px; right: calc(50% - 26px); }
}

/* ─── .ap-icon-btn — bouton icône carré 44×44 ─────────────────────
   Apple HIG : tailles tactiles min 44×44px. Avant : variantes 34/36/40px
   en inline sur boutons nav date sleep/calendar/etc. Maintenant unifié.
   Usage :
     <button class="ap-icon-btn" aria-label="Précédent">‹</button>
     <button class="ap-icon-btn --sm" aria-label="...">‹</button>  (36×36 dense)
*/
.ap-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm, 10px);
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
  transition: background var(--motion-fast, 200ms ease), transform 80ms ease-out;
  -webkit-tap-highlight-color: transparent;
}
.ap-icon-btn:hover { background: var(--bg-card-hover); }
.ap-icon-btn:active { transform: scale(0.94); }
.ap-icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.ap-icon-btn svg { width: 18px; height: 18px; }
/* Variante dense (utilise quand l'espace est très contraint et le contexte
   secondaire — éviter sur actions primaires). */
.ap-icon-btn.--sm {
  width: 36px;
  height: 36px;
  font-size: 0.95rem;
}
.ap-icon-btn.--sm svg { width: 14px; height: 14px; }

/* ─── .ap-segmented — segmented control style iOS ────────────────
   Pattern type sélecteur jour/semaine/mois sur /body, /sleep, etc.
   Avant : 3 boutons inline avec styles divergents. Maintenant unifié.
   Usage :
     <div class="ap-segmented">
       <button class="ap-segmented__item is-active">J</button>
       <button class="ap-segmented__item">S</button>
       <button class="ap-segmented__item">M</button>
     </div>
*/
.ap-segmented {
  display: inline-flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm, 10px);
  padding: 3px;
  gap: 2px;
}
.ap-segmented__item {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: var(--ts-md);
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 7px;
  cursor: pointer;
  min-height: 36px;
  font-family: inherit;
  transition: background var(--motion-fast, 200ms ease), color var(--motion-fast, 200ms ease);
  -webkit-tap-highlight-color: transparent;
}
.ap-segmented__item:hover { color: var(--text); }
.ap-segmented__item.is-active {
  background: var(--bg-tertiary);
  color: var(--text);
}

/* ─── .ap-empty — empty state uniforme ─────────────────────────────
   Avant : 3+ patterns différents (body-widget .empty, sleep-page
   .empty-state, ap-card inline). Maintenant unifié.
   Usage :
     <div class="ap-empty">
       <svg class="ap-empty__icon"><use href="#icon-sleep"/></svg>
       <h3 class="ap-empty__title">Pas de données</h3>
       <p class="ap-empty__text">Description courte.</p>
       <button class="ap-btn">Action</button>
     </div>
*/
.ap-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
}
.ap-empty__icon {
  width: 48px;
  height: 48px;
  color: var(--text-tertiary);
  margin: 0 auto 0.8rem;
  display: block;
}
.ap-empty__title {
  font-size: var(--ts-base);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 0.4rem;
}
.ap-empty__text {
  font-size: var(--ts-md);
  color: var(--text-secondary);
  margin: 0 0 1rem;
  line-height: 1.5;
}
