
:root{
  --bg:#f6f2ea; --card:#fffdf8; --ink:#28302f; --muted:#68716d; --line:#ded8cc;
  --accent:#445b55; --accent2:#e8eee9; --danger:#8d3f3f; --dangerbg:#f6e9e7;
}
*{box-sizing:border-box}
html,body{margin:0;min-height:100%;background:var(--bg);color:var(--ink);font-family:Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif}
body{padding:env(safe-area-inset-top) 0 env(safe-area-inset-bottom)}
#app{max-width:900px;margin:auto;padding:24px 18px 60px}
.topbar{display:flex;align-items:center;justify-content:space-between;margin-bottom:22px}
h1{font-size:1.35rem;margin:.15rem 0 0} h2{font-size:1.7rem;margin:.25rem 0 .55rem} h3{font-size:1.18rem;margin:.2rem 0 .55rem}
.eyebrow,.sectionTitle{font-size:.76rem;letter-spacing:.11em;font-weight:800;color:var(--muted)}
.sectionTitle{margin-bottom:10px}
.card{background:var(--card);border:1px solid var(--line);border-radius:22px;padding:22px;box-shadow:0 8px 30px rgba(50,45,36,.05)}
.view.hidden,.hidden{display:none!important}
.lead{color:var(--muted);line-height:1.55}
label{display:block;font-weight:650;font-size:.92rem;margin:17px 0 7px}
input[type=password],textarea{width:100%;margin-top:7px;border:1px solid var(--line);border-radius:14px;background:#fff;padding:13px 14px;font:inherit;color:var(--ink)}
textarea{resize:vertical;line-height:1.5}
button,.fileButton{border:0;border-radius:14px;padding:12px 16px;font-weight:750;font:inherit;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.primary{background:var(--accent);color:white;width:100%;margin-top:14px}
.secondary{background:var(--accent2);color:var(--ink);width:100%;margin:7px 0}
.ghost{background:transparent;border:1px solid var(--line);color:var(--ink)}
.danger{background:var(--dangerbg);color:var(--danger);width:100%;margin-top:7px}
.hint,.small{font-size:.84rem;color:var(--muted);line-height:1.5}
.error{color:var(--danger);font-size:.9rem;margin-top:10px;min-height:1.2em}
.success{color:#3e6650;font-size:.9rem;margin-top:10px;min-height:1.2em}
.lockIcon{font-size:2rem}
.hero{display:flex;align-items:center;justify-content:space-between;gap:20px;margin-bottom:16px}
.progressRing{min-width:78px;height:78px;border-radius:50%;display:grid;place-items:center;border:8px solid var(--accent2);font-weight:800}
.exercise{margin-bottom:16px}
.scaleBlock{margin:18px 0}
.scaleHeader{display:flex;justify-content:space-between;color:var(--muted);font-size:.9rem}
input[type=range]{width:100%;accent-color:var(--accent)}
.checkline{display:flex;align-items:center;gap:10px;background:var(--accent2);padding:12px;border-radius:14px}
.checkline input{width:18px;height:18px}
.grid2{display:grid;grid-template-columns:1fr 1fr;gap:16px;margin-bottom:16px}
.fileButton input{display:none}
.privacy p{line-height:1.5}
dialog{border:0;border-radius:22px;padding:0;max-width:460px;background:transparent}
dialog::backdrop{background:rgba(24,27,26,.45)}
.dialogCard{background:var(--card);padding:24px;border-radius:22px;border:1px solid var(--line)}
.dialogActions{display:grid;grid-template-columns:1fr 1fr;gap:8px}
@media(max-width:650px){.grid2{grid-template-columns:1fr}.hero{align-items:flex-start}.card{padding:18px}#app{padding:18px 14px 50px}}

.appnav{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-bottom:16px;background:#ebe6dc;padding:5px;border-radius:16px}
.navbtn{background:transparent;color:var(--muted)}
.navbtn.active{background:var(--card);color:var(--ink);box-shadow:0 2px 10px rgba(50,45,36,.07)}
.dashboardHero{display:flex;align-items:center;justify-content:space-between;margin-bottom:16px}
.statPill{min-width:110px;background:var(--accent2);border-radius:18px;padding:15px;text-align:center}
.statPill strong{display:block;font-size:1.65rem}.statPill span{font-size:.75rem;color:var(--muted)}
.chartWrap{width:100%;overflow:hidden}
#progressChart{display:block;width:100%;height:auto;max-height:360px}
.legend{display:flex;flex-wrap:wrap;gap:12px;margin-top:12px;font-size:.78rem;color:var(--muted)}
.legend span{display:flex;align-items:center;gap:6px}.legend i{display:inline-block;width:18px;height:3px;border-radius:2px;background:#445b55}
.legend .l2{opacity:.75}.legend .l3{opacity:.5}.legend .l4{opacity:.3}
.metricList{display:grid;gap:10px}.metricRow{display:grid;grid-template-columns:1fr auto;gap:10px;align-items:center}
.metricBar{grid-column:1/-1;height:7px;background:#ebe6dc;border-radius:8px;overflow:hidden}.metricFill{height:100%;background:var(--accent)}
.kindBadge{display:inline-block;font-size:.72rem;font-weight:800;letter-spacing:.06em;padding:5px 8px;border-radius:999px;background:var(--accent2);color:var(--muted);margin-bottom:8px}
@media(max-width:650px){.dashboardHero{align-items:flex-start}.statPill{min-width:95px}}

.brandSubtitle{margin-top:-8px;color:var(--muted);font-size:.92rem;letter-spacing:.02em}

/* V4.1 mobile QA */
.chartWrap{min-width:0}
#progressChart{width:100%;max-width:100%;min-width:0}
.dashboardGrid{min-width:0}
@media(max-width:420px){
  .dashboardHero{gap:12px}
  .dashboardHero .lead{font-size:.98rem;line-height:1.55}
  .statPill{min-width:86px;padding:12px 9px}
  .legend{gap:9px 12px;font-size:.74rem}
  .legend span{min-width:calc(50% - 12px)}
}

/* ===========================
   ÉLAN V5 — MODERNE MINIMALISTE
   =========================== */
:root{
  --v5-blue:#1d5fd1;
  --v5-blue-soft:#eaf2ff;
  --v5-bg:#f6f8fc;
  --v5-card:#ffffff;
  --v5-text:#182033;
  --v5-muted:#697386;
  --v5-line:#e7ebf2;
  --v5-shadow:0 10px 30px rgba(29,52,92,.07);
}
body.v5{
  background:var(--v5-bg);
  color:var(--v5-text);
  padding-bottom:86px;
}
body.v5 main{max-width:760px}
body.v5 .card{
  background:var(--v5-card);
  border:1px solid var(--v5-line);
  border-radius:22px;
  box-shadow:var(--v5-shadow);
}
body.v5 h1,body.v5 h2,body.v5 h3{letter-spacing:-.025em}
body.v5 h1{font-size:2rem}
body.v5 .brandSubtitle{color:var(--v5-muted)}
body.v5 .eyebrow, body.v5 .sectionTitle{
  color:var(--v5-blue);
  font-weight:800;
  letter-spacing:.09em;
}
body.v5 .lead,body.v5 .small,body.v5 .hint{color:var(--v5-muted)}
body.v5 button.primary{
  background:var(--v5-blue);
  border-radius:14px;
  box-shadow:0 8px 18px rgba(29,95,209,.18);
}
body.v5 button.secondary{
  background:#fff;
  border:1px solid var(--v5-line);
  color:var(--v5-text);
  border-radius:14px;
}
body.v5 input,body.v5 textarea{
  background:#fbfcff;
  border:1px solid #dfe5ef;
  border-radius:14px;
  color:var(--v5-text);
}
body.v5 input:focus,body.v5 textarea:focus{
  outline:2px solid rgba(29,95,209,.16);
  border-color:var(--v5-blue);
}
body.v5 .appnav{
  background:#edf1f7;
  border-radius:16px;
  position:sticky;
  top:8px;
  z-index:8;
}
body.v5 .navbtn.active{color:var(--v5-blue);box-shadow:none}
body.v5 .hero{
  background:linear-gradient(145deg,#ffffff 55%,#edf4ff);
  overflow:hidden;
  position:relative;
}
body.v5 .hero:after{
  content:"";
  position:absolute;
  width:150px;height:150px;
  border:18px solid rgba(29,95,209,.07);
  border-radius:50%;
  right:-55px;top:-55px;
}
body.v5 .statPill{
  background:var(--v5-blue-soft);
  color:var(--v5-blue);
}
body.v5 .metricBar{background:#edf1f7}
body.v5 .metricFill{background:var(--v5-blue)}
body.v5 .chartWrap{
  background:#fbfcff;
  border:1px solid var(--v5-line);
  border-radius:18px;
  padding:8px;
}
body.v5 .privacy{border-style:solid}
body.v5 .bottomNav{
  position:fixed;
  left:50%;
  transform:translateX(-50%);
  bottom:10px;
  width:min(calc(100% - 20px),720px);
  background:rgba(255,255,255,.96);
  border:1px solid var(--v5-line);
  box-shadow:0 14px 40px rgba(29,52,92,.14);
  border-radius:22px;
  padding:7px;
  display:grid;
  grid-template-columns:repeat(4,1fr);
  z-index:30;
  backdrop-filter:blur(12px);
}
body.v5 .bottomNav.hidden{display:none}
body.v5 .bottomNavItem{
  appearance:none;border:0;background:transparent;box-shadow:none;
  color:var(--v5-muted);padding:7px 4px;border-radius:14px;
  display:flex;flex-direction:column;align-items:center;gap:2px;
  font-size:.69rem;font-weight:700;
}
body.v5 .bottomNavItem.active{
  color:var(--v5-blue);background:var(--v5-blue-soft);
}
body.v5 .navIcon{font-size:1.15rem;line-height:1.1}
@media(max-width:520px){
  body.v5 main{padding-left:12px;padding-right:12px}
  body.v5 .card{border-radius:19px}
  body.v5 .hero{padding:20px}
  body.v5 .appnav{display:none}
  body.v5 .dashboardHero{display:grid;grid-template-columns:1fr auto}
}

/* V5.0.1 — correction navigation mobile */
body.v5{padding-bottom:calc(104px + env(safe-area-inset-bottom,0px))}
body.v5 .bottomNav{bottom:calc(10px + env(safe-area-inset-bottom,0px));visibility:visible;opacity:1}
body.v5 .bottomNav.hidden{display:none !important}

/* V5.0.3 — navigation structurelle
   La barre est enfant de homeView : aucun JS ne décide de sa visibilité. */
body.v5 .bottomNav{
  display:grid !important;
  bottom:calc(10px + env(safe-area-inset-bottom,0px));
  visibility:visible !important;
  opacity:1 !important;
  z-index:100;
}
body.v5 #homeView.hidden .bottomNav{display:none !important}
body.v5{padding-bottom:calc(112px + env(safe-area-inset-bottom,0px))}

/* V5.1.1 — présentation pédagogique des exercices */
body.v5 #exerciseText{font-size:1.02rem;line-height:1.58;color:var(--v5-text)}
body.v5 .exerciseIntro{margin:0 0 16px}
body.v5 .exerciseSteps{list-style:none;counter-reset:elanstep;margin:8px 0 18px;padding:0;display:grid;gap:12px}
body.v5 .exerciseSteps li{counter-increment:elanstep;position:relative;padding-left:46px;min-height:34px;display:flex;align-items:center}
body.v5 .exerciseSteps li::before{content:counter(elanstep);position:absolute;left:0;width:32px;height:32px;border-radius:50%;display:grid;place-items:center;background:var(--v5-blue-soft);color:var(--v5-blue);font-weight:800}
body.v5 .exerciseTip{margin:14px 0 4px;padding:14px 16px;border-radius:14px;background:#f6f8ff;border-left:3px solid var(--v5-blue);color:var(--v5-muted);line-height:1.5}
@media(max-width:520px){body.v5 #exerciseText{font-size:1rem;line-height:1.52}body.v5 .exerciseSteps{gap:10px}body.v5 .exerciseTip{padding:12px 14px}}

/* V5.2.1 — historique des challenges réussis */
body.v5 .historyHeader{margin-bottom:14px}
body.v5 .historyHeader strong{font-size:1.65rem}
body.v5 .challengeHistory{display:grid;gap:10px}
body.v5 .historyItem{display:flex;gap:12px;padding:13px 0;border-top:1px solid rgba(20,35,55,.08)}
body.v5 .historyItem:first-child{border-top:0}
body.v5 .historyCheck{flex:0 0 30px;width:30px;height:30px;border-radius:50%;display:grid;place-items:center;background:var(--v5-blue-soft);color:var(--v5-blue);font-weight:900}
body.v5 .historyBody{min-width:0;flex:1}
body.v5 .historyTop{display:flex;justify-content:space-between;gap:10px;align-items:flex-start}
body.v5 .historyScore{white-space:nowrap;font-size:.82rem;font-weight:700;color:var(--v5-blue);background:var(--v5-blue-soft);padding:4px 8px;border-radius:999px}
body.v5 .historyMeta{font-size:.78rem;color:var(--v5-muted);margin-top:3px}
body.v5 .historyBody p{margin:7px 0 0;color:var(--v5-muted);line-height:1.45}
@media(max-width:520px){body.v5 .historyTop{display:block}body.v5 .historyScore{display:inline-block;margin-top:6px}}

body.v5 .exerciseWhy{margin:18px 0 6px;padding:15px 16px;border-radius:14px;background:#f4f8f6;border:1px solid #e2ebe6;}
body.v5 .exerciseWhyTitle{font-weight:800;color:var(--v5-ink);margin-bottom:7px;font-size:.98rem;}
body.v5 .exerciseWhyText{color:var(--v5-muted);line-height:1.5;font-size:.96rem;}
@media(max-width:520px){body.v5 .exerciseWhy{padding:13px 14px;margin-top:16px}body.v5 .exerciseWhyText{font-size:.94rem}}

/* V5.3.0 — challenge personnalisé */
body.v5 .weeklyMarkersCard{display:none!important}
body.v5 .challengeCalibration{
  margin:20px 0;
  padding:16px;
  border:1px solid var(--v5-line);
  border-radius:18px;
  background:#fbfcff;
}
body.v5 .calibLabel{display:flex;justify-content:space-between;gap:12px;font-weight:700;margin:12px 0 4px}
body.v5 #usualnessScale{width:100%}
body.v5 .stretchEstimate{margin-top:16px;padding:14px;border-radius:14px;background:var(--v5-blue-soft)}
body.v5 .stretchTop{display:flex;justify-content:space-between;gap:12px;font-weight:700}
body.v5 .stretchTop strong{color:var(--v5-blue);white-space:nowrap}
body.v5 .stretchBar{height:8px;margin:10px 0 8px;border-radius:999px;background:rgba(29,95,209,.12);overflow:hidden}
body.v5 .stretchBar span{display:block;height:100%;width:0;border-radius:inherit;background:var(--v5-blue)}
body.v5 .historyStretch{display:inline-block;margin-left:6px;white-space:nowrap;font-size:.78rem;font-weight:700;color:var(--v5-text);background:#eef2f8;padding:4px 8px;border-radius:999px}
@media(max-width:520px){body.v5 .stretchTop{align-items:flex-start}body.v5 .historyStretch{margin:6px 0 0}}
