/* ===== Mon Suivi — V1.5 ===== */
:root {
  --bg: #f7f2f6;
  --card: #ffffff;
  --card-2: #fbf8fa;
  --text: #2a2030;
  --muted: #7b6f80;
  --line: #ece3ea;
  --primary: #8e3b6e;
  --primary-2: #b4558f;
  --primary-soft: #f5e7f0;
  --kcal: #8e3b6e;
  --prot: #23866a;
  --prot-soft: #e1f3ed;
  --water: #2f7fc1;
  --water-soft: #e3effa;
  --steps: #c9821b;
  --steps-soft: #fbf0de;
  --sport: #e0674f;
  --sport-soft: #fde9e4;
  --good: #2f8a52;
  --good-soft: #e3f4e8;
  --mid: #b98412;
  --mid-soft: #fbf3dc;
  --warn: #c0581f;
  --warn-soft: #fdeee3;
  --period: #f9dbe4;
  --radius: 20px;
  --shadow: 0 1px 2px rgba(60, 20, 50, .05), 0 8px 24px rgba(60, 20, 50, .06);
  --on-primary: #fff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141016; --card: #201a23; --card-2: #19141b; --text: #f2eaf4; --muted: #a798ad; --line: #342b38;
    --primary: #e28fbe; --primary-2: #f0a9d0; --primary-soft: #3a2433; --kcal: #e28fbe;
    --prot: #66cfb0; --prot-soft: #19352e; --water: #7cb8ee; --water-soft: #1b2c3d;
    --steps: #f0b357; --steps-soft: #3a2c16; --sport: #f39480; --sport-soft: #3d221c;
    --good: #7fd49d; --good-soft: #1c3424; --mid: #e8c060; --mid-soft: #3a3016; --warn: #f2a46c; --warn-soft: #3d2a1c;
    --period: #4b2534; --shadow: none; --on-primary: #1a1220;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-text-size-adjust: 100%; }
body.noscroll { overflow: hidden; }
#app { max-width: 560px; margin: 0 auto; padding: 0 16px 110px; }
h2 { font-size: 1.15rem; margin: 24px 0 10px; letter-spacing: -.01em; }
h3 { font-size: 1rem; margin: 0 0 8px; }
h4 { margin: 14px 0 6px; font-size: .93rem; }
p { margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: .86rem; } .tiny { font-size: .75rem; }
.center { text-align: center; } .right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; } .row.between { justify-content: space-between; } .gap { gap: 8px; } .wrap { flex-wrap: wrap; }
.center-row { justify-content: center; }
.card .row + .row, .card > .row { margin-top: 10px; }
.pill { background: var(--primary-soft); color: var(--primary); border-radius: 99px; padding: 2px 10px; font-size: .8rem; font-weight: 700; }
.pill.soon { background: var(--steps-soft); color: var(--steps); }

/* ---------- En-tête & navigation ---------- */
.top { display: flex; justify-content: space-between; align-items: center; padding: 14px 0 8px; position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--text); letter-spacing: -.01em; }
nav.bottom { position: fixed; bottom: 0; left: 0; right: 0; display: flex; justify-content: center; background: color-mix(in srgb, var(--card) 92%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
nav.bottom button { flex: 1; max-width: 108px; background: none; border: 0; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 5px 0; font: inherit; cursor: pointer; border-radius: 12px; }
nav.bottom button span { font-size: 1.3rem; filter: grayscale(.7); opacity: .8; transition: transform .15s; }
nav.bottom button small { font-size: .68rem; font-weight: 600; }
nav.bottom button.active { color: var(--primary); }
nav.bottom button.active span { filter: none; opacity: 1; transform: translateY(-1px) scale(1.08); }
.fab { position: fixed; right: max(16px, calc(50vw - 264px)); bottom: calc(80px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: linear-gradient(145deg, var(--primary-2), var(--primary)); color: var(--on-primary); font-size: 1.8rem; line-height: 1; box-shadow: 0 8px 22px rgba(142, 59, 110, .35); cursor: pointer; z-index: 9; }
.fab:active { transform: scale(.94); }

/* ---------- Cartes ---------- */
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin: 12px 0; box-shadow: var(--shadow); border: 1px solid var(--line); }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.card-head h3 { margin: 0; }
.card.hero { background: linear-gradient(140deg, var(--primary-soft) 0%, var(--card) 70%); }
.big { font-size: 1.7rem; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.big.neg { color: var(--warn); }
.proj { margin-top: 10px; }

/* ---------- Boutons & champs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--primary); color: var(--on-primary); border: 1px solid var(--primary); padding: 10px 16px; border-radius: 14px; font: inherit; font-weight: 650; cursor: pointer; text-decoration: none; min-height: 44px; }
.btn.small { padding: 6px 12px; font-size: .86rem; min-height: 36px; border-radius: 12px; }
.btn.ghost { background: transparent; color: var(--primary); }
.btn.danger-ghost { background: transparent; color: var(--warn); border-color: var(--warn); }
.btn.full { width: 100%; margin-top: 10px; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: wait; }
.water-btn { background: var(--water); border-color: var(--water); }
.icon-btn { background: var(--card); border: 1px solid var(--line); color: var(--text); width: 40px; height: 40px; border-radius: 12px; font-size: 1.05rem; cursor: pointer; flex-shrink: 0; }
.icon-btn.small { width: 32px; height: 32px; font-size: .8rem; border-radius: 10px; }
.icon-btn.active { background: var(--primary-soft); }
.link { background: none; border: 0; color: var(--primary); font: inherit; cursor: pointer; padding: 0; text-align: left; font-weight: 600; }
.input { width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); color: var(--text); font: inherit; min-height: 44px; }
.input:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.input.qty { width: 90px; flex-shrink: 0; }
.input.mini { width: 68px; padding: 6px 8px; min-height: 38px; text-align: center; }
.steps-input { width: 110px; min-height: 36px; padding: 6px 10px; }
textarea.input { margin-top: 8px; resize: vertical; }
label { display: block; font-size: .86rem; color: var(--muted); }
label .input { margin-top: 4px; color: var(--text); }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: .92rem; margin: 8px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form { display: grid; gap: 10px; }
.form.two { grid-template-columns: 1fr 1fr; }
details summary { cursor: pointer; color: var(--primary); margin-top: 10px; font-weight: 600; }

/* ---------- Puces & messages ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); font-size: .85rem; color: var(--text); }
button.chip { font: inherit; font-size: .85rem; cursor: pointer; text-align: left; }
.chip.ghost { cursor: pointer; color: var(--primary); font: inherit; font-size: .85rem; }
.chip.toggle { cursor: pointer; }
.chip.toggle input { display: none; }
.chip.toggle.on, .chip.on-chip { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 650; }
.chip.phase-regles { background: var(--period); }
.chip.phase-luteale, .chip.phase-folliculaire, .chip.phase-ovulation { background: var(--primary-soft); }
.presets { display: flex; flex-direction: column; gap: 6px; }
.presets .chip { border-radius: 14px; justify-content: space-between; width: 100%; }
.tip { background: var(--primary-soft); border-radius: 14px; padding: 10px 12px; font-size: .88rem; margin: 10px 0; }
.tip.warn { background: var(--warn-soft); }
.warn-text { color: var(--warn); font-weight: 600; }
.banner { background: linear-gradient(140deg, var(--primary-2), var(--primary)); color: var(--on-primary); border-radius: var(--radius); padding: 14px 16px; margin: 10px 0; }
.banner .btn { background: var(--on-primary); color: var(--primary); border-color: var(--on-primary); margin-top: 8px; }
.banner .btn.ghost { background: transparent; color: var(--on-primary); }
.banner.soft { background: var(--primary-soft); color: var(--text); }
.banner.soft .btn.ghost { color: var(--primary); border-color: var(--primary); }
.badge { font-size: .68rem; background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: 1px 6px; vertical-align: middle; }

/* ---------- Barres ---------- */
.bar { margin: 8px 0; }
.bar-head { display: flex; justify-content: space-between; font-size: .86rem; }
.bar-track { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 4px; }
.bar-track.lg { height: 12px; margin: 14px 0 6px; }
.bar-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary-2), var(--primary)); transition: width .4s ease; }
.bar-track.prot .bar-fill, .bar.prot .bar-fill { background: var(--prot); }
.prot-text { color: var(--prot); }
.dual-bar .bar-track { margin-top: 6px; }

/* ---------- Anneaux du jour ---------- */
.rings4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; text-align: center; }
.mring svg { width: 100%; max-width: 76px; display: block; margin: 0 auto; }
.mring .bg { fill: none; stroke: var(--line); stroke-width: 7; }
.mring .fg { fill: none; stroke-width: 7; stroke-linecap: round; transition: stroke-dasharray .5s ease; }
.mring .v { font-size: 13px; font-weight: 800; text-anchor: middle; fill: var(--text); }
.mring b { display: block; font-size: .78rem; margin-top: 2px; }
.mring small { display: block; font-size: .68rem; color: var(--muted); }
.mring.kcal .fg { stroke: var(--kcal); } .mring.prot .fg { stroke: var(--prot); } .mring.water .fg { stroke: var(--water); } .mring.steps .fg { stroke: var(--steps); }
.mring.full b::after { content: ' ✓'; color: var(--good); }

/* ---------- Semaine en pastilles ---------- */
.week-strip { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 12px 0 2px; }
.wd { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 6px 0 4px; display: flex; flex-direction: column; align-items: center; gap: 1px; font: inherit; color: var(--text); cursor: pointer; min-height: 62px; }
.wd small { font-size: .66rem; color: var(--muted); font-weight: 600; }
.wd b { font-size: .95rem; }
.wd i { font-style: normal; font-size: .6rem; min-height: 12px; }
.wd.logged { background: var(--primary-soft); }
.wd.ok { background: var(--good-soft); border-color: var(--good); }
.wd.today { outline: 2px solid var(--primary); outline-offset: -2px; }
.wd.future { opacity: .45; }
.legend-mini { margin: 4px 2px 0; }

/* ---------- Coach & checklist ---------- */
.coach-tip { display: flex; gap: 12px; align-items: flex-start; background: linear-gradient(140deg, var(--water-soft), var(--card) 75%); }
.coach-ic { font-size: 1.5rem; width: 42px; height: 42px; border-radius: 14px; background: var(--card); display: grid; place-items: center; flex-shrink: 0; box-shadow: var(--shadow); }
.coach-hero { display: flex; gap: 14px; align-items: flex-start; }
.coach-hero h2 { margin: 0 0 4px; }
.big-ic { width: 56px; height: 56px; font-size: 2rem; }
.checklist ul { list-style: none; padding: 0; margin: 10px 0 0; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.checklist li:last-child { border-bottom: 0; }
.checklist .ck { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; font-size: .75rem; font-weight: 800; flex-shrink: 0; }
.checklist li.ok .ck { background: var(--good); border-color: var(--good); color: #fff; }
.checklist li.ok .grow { color: var(--muted); }
.checklist li.skip .ck { background: var(--muted); border-color: var(--muted); }
.time-in { display: inline-block; width: auto; padding: 1px 4px; font-size: 16px; border-radius: 8px; }
.meal-slot.skipped { opacity: .75; }
.report-actions { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.session-card.stale { border-left: 4px solid var(--warn, #e0a030); }
.mini-choices button { background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; font-size: 1.05rem; padding: 2px 7px; margin-left: 4px; cursor: pointer; }
.measure-due { background: linear-gradient(140deg, var(--steps-soft), var(--card) 75%); }
.session-card { border-left: 4px solid var(--sport); }
.status-tiles { display: grid; gap: 10px; }
.st { border-radius: 14px; padding: 12px; background: var(--card-2); border-left: 4px solid var(--line); }
.st small { color: var(--muted); font-size: .78rem; } .st b { display: block; font-size: 1.3rem; } .st p { font-size: .85rem; margin: 2px 0 0; }
.st.good { border-left-color: var(--good); background: var(--good-soft); }
.st.mid { border-left-color: var(--mid); background: var(--mid-soft); }
.st.warn { border-left-color: var(--warn); background: var(--warn-soft); }

/* ---------- Séries & stats ---------- */
.streaks, .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin: 12px 0; }
.streaks div, .stats div { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 10px 4px; }
.stats div { background: var(--card-2); }
.streaks b, .stats b { display: block; font-size: 1.35rem; }
.streaks span, .stats span { font-size: .72rem; color: var(--muted); }

/* ---------- Repas ---------- */
.date-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0; }
.sticky-sum { position: sticky; top: 64px; z-index: 4; }
.meal-slot { border-left: 4px solid var(--primary-2); }
.meal-slot.slot-petitdej, .meal-slot.slot-shour { border-left-color: var(--steps); }
.meal-slot.slot-dejeuner { border-left-color: var(--prot); }
.meal-slot.slot-diner, .meal-slot.slot-ftour { border-left-color: var(--primary); }
.meal-slot.slot-collation { border-left-color: var(--water); }
.items { list-style: none; padding: 0; margin: 6px 0; }
.items li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.items li:last-child { border-bottom: 0; }
.kcal { font-weight: 750; white-space: nowrap; }
.results { list-style: none; padding: 0; margin: 8px 0; max-height: 50vh; overflow-y: auto; }
.results li { display: flex; align-items: center; gap: 6px; }
.res { flex: 1; display: flex; justify-content: space-between; align-items: center; gap: 10px; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 10px 2px; color: var(--text); font: inherit; cursor: pointer; }
.res > span:last-child { text-align: right; white-space: nowrap; }
.tabs { display: flex; gap: 6px; margin: 10px 0 4px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: var(--card-2); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: .84rem; color: var(--text); cursor: pointer; white-space: nowrap; }
.tabs button.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 650; }
.nutri-table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.nutri-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
.nutri-table td:last-child { text-align: right; }
.prot-row td { color: var(--prot); }
.calc { background: var(--card-2); border-radius: 12px; padding: 10px 12px; margin: 10px 0; }

/* ---------- Fenêtres ---------- */
#modal { display: none; position: fixed; inset: 0; z-index: 30; }
#modal.show { display: block; }
.backdrop { position: absolute; inset: 0; background: rgba(20, 10, 20, .45); animation: fade .2s; }
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-width: 560px; margin: 0 auto; max-height: 92vh; overflow-y: auto; background: var(--card); border-radius: 24px 24px 0 0; padding: 18px 16px calc(20px + env(safe-area-inset-bottom)); animation: up .25s ease; }
@keyframes up { from { transform: translateY(30px); opacity: .5; } to { transform: none; opacity: 1; } }
@keyframes fade { from { opacity: 0; } }
.modal-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-bottom: 8px; }
.modal-head h3 { margin: 0; }
.sheet ol, .sheet ul { padding-left: 20px; margin: 4px 0; }
.sheet li { margin: 4px 0; }
.sheet .results, .sheet .items { padding-left: 0; }
.errors li::marker { content: '✗  '; color: var(--warn); }
.checks li::marker { content: '✓  '; color: var(--good); }
.quick-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 6px; }
.quick-grid button { background: var(--card-2); border: 1px solid var(--line); border-radius: 18px; padding: 14px 6px; font: inherit; font-size: .8rem; font-weight: 600; color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.quick-grid button span { font-size: 1.6rem; }
.measure-fields { display: grid; gap: 10px; margin: 10px 0; }
.mf small { display: block; margin-top: 3px; font-size: .74rem; }

/* ---------- Sport ---------- */
.goal-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.goal { background: var(--card-2); border: 1px solid var(--line); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.goal.ok { background: var(--good-soft); border-color: var(--good); }
.goal .gi { font-size: 1.3rem; }
.goal small { font-size: .7rem; }
.dots { display: flex; gap: 5px; align-items: center; margin: 3px 0; }
.dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--sport); }
.goal.ok .dots i.on { background: var(--good); }
.zone-chips .chip { padding: 8px 12px; }
.prog summary { color: var(--text); margin: 0; list-style: none; }
.prog summary::-webkit-details-marker { display: none; }
.prog summary::after { content: ' ▾'; color: var(--muted); }
.ex-list { list-style: none; padding: 0; margin: 8px 0; }
.ex-list li { display: flex; justify-content: space-between; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ex-list li:last-child { border-bottom: 0; }
.card.ex.complete { border-color: var(--prot); }
.sets { margin: 8px 0; }
.set { display: flex; align-items: center; gap: 6px; padding: 5px 0; }
.set.done .input { background: var(--prot-soft); }
.set-n { width: 22px; height: 22px; border-radius: 50%; background: var(--line); font-size: .75rem; display: grid; place-items: center; flex-shrink: 0; }
.check-btn { margin-left: auto; width: 42px; height: 42px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); color: var(--muted); font-size: 1.1rem; font-weight: 800; cursor: pointer; flex-shrink: 0; }
.check-btn.on { background: var(--prot); border-color: var(--prot); color: #fff; }
#timer { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(80px + env(safe-area-inset-bottom)); background: var(--text); color: var(--bg); border-radius: 18px; padding: 8px 10px 8px 16px; display: none; align-items: center; gap: 10px; z-index: 20; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
#timer.show { display: flex; }
#timer .btn.ghost { color: var(--bg); border-color: var(--bg); }

/* ---------- Progrès ---------- */
.compare { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.cmp { background: var(--card-2); border: 1px solid var(--line); border-radius: 16px; padding: 10px; display: flex; flex-direction: column; gap: 1px; }
.cmp b { font-size: 1.25rem; } .cmp em { font-style: normal; font-size: .75rem; color: var(--muted); margin-left: 2px; }
.cmp span { font-size: .8rem; font-weight: 700; color: var(--muted); }
.cmp.good { background: var(--good-soft); border-color: var(--good); } .cmp.good span { color: var(--good); }
.cmp.bad span { color: var(--warn); }
.cmp small { font-size: .72rem; }
.milestones { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; scrollbar-width: none; }
.milestones span { background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 6px 12px; font-size: .8rem; white-space: nowrap; }
.m-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.m-table th, .m-table td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.m-table th:first-child, .m-table td:first-child { text-align: left; }
.m-table td.good { color: var(--good); font-weight: 700; }
.table-scroll { overflow-x: auto; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.bdg { text-align: center; background: var(--card-2); border-radius: 14px; padding: 10px 4px; opacity: .35; filter: grayscale(1); }
.bdg.ok { opacity: 1; filter: none; background: var(--primary-soft); }
.bdg span { font-size: 1.5rem; display: block; }
.bdg small { font-size: .7rem; }

/* ---------- Calendrier ---------- */
.cal-head, .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-head span { text-align: center; font-size: .75rem; color: var(--muted); padding: 4px 0; }
.cal-cell { min-height: 60px; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; display: flex; flex-direction: column; align-items: center; gap: 2px; font: inherit; color: var(--text); cursor: pointer; overflow: hidden; }
.cal-cell.out { opacity: .4; }
.cal-cell.today .dn { background: var(--primary); color: var(--on-primary); border-radius: 50%; width: 22px; height: 22px; display: grid; place-items: center; }
.cal-cell.sel { outline: 2px solid var(--primary); outline-offset: -1px; }
.cal-cell.period { background: var(--period); }
.cal-cell.period-pred { background: repeating-linear-gradient(135deg, var(--period) 0 4px, var(--card-2) 4px 8px); }
.dn { font-size: .8rem; font-weight: 650; }
.marks { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
.ic { font-size: .6rem; line-height: 1; display: flex; align-items: center; gap: 1px; }
.plan-ic { opacity: .45; }
.m { font-size: .62rem; font-weight: 700; border-radius: 5px; padding: 0 4px; line-height: 1.5; }
.m.done { background: var(--sport); color: #fff; }
.m.done.t-B { background: var(--water); } .m.done.t-C { background: var(--prot); } .m.done.t-cours, .m.done.t-perso { background: var(--primary-soft); color: var(--text); }
.m.plan { border: 1px dashed var(--primary); color: var(--primary); }
.ok-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--good); }
.lg-period { display: inline-block; width: 12px; height: 10px; background: var(--period); border-radius: 3px; vertical-align: middle; }
.legend { line-height: 2; }
.cal-day { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 6px; }

/* ---------- Graphiques ---------- */
.chart { width: 100%; height: auto; display: block; margin: 6px 0; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { font-size: 9px; fill: var(--muted); }
.chart .goal { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.chart .line { fill: none; stroke: var(--primary); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--primary); stroke: var(--card); stroke-width: 2; }
.chart .dot-raw { fill: var(--muted); opacity: .6; }
.chart .hit { fill: transparent; cursor: pointer; }
.legend-row { display: flex; gap: 14px; font-size: .74rem; color: var(--muted); flex-wrap: wrap; }
.lg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--muted); opacity: .6; }
.lg-line { display: inline-block; width: 16px; height: 2px; background: var(--primary); vertical-align: middle; }
.lg-goal { display: inline-block; width: 16px; border-top: 2px dashed var(--muted); vertical-align: middle; }
#tip { position: absolute; display: none; background: var(--text); color: var(--bg); font-size: .78rem; padding: 4px 8px; border-radius: 8px; pointer-events: none; z-index: 40; white-space: nowrap; }
#tip.show { display: block; }

/* ---------- Toast & célébrations ---------- */
#toast { position: fixed; left: 16px; right: 16px; top: 14px; max-width: 520px; margin: 0 auto; background: var(--text); color: var(--bg); padding: 12px 14px; border-radius: 16px; z-index: 50; opacity: 0; transform: translateY(-20px); transition: .25s; pointer-events: none; font-size: .9rem; }
#toast.show { opacity: 1; transform: none; }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 60; overflow: hidden; }
.confetti span { position: absolute; top: -40px; animation: fall 2.6s ease-in forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); opacity: .2; } }

/* ---------- Connexion ---------- */
.auth { max-width: 420px; margin: 0 auto; padding: 8vh 4px 40px; }
.auth-brand { font-weight: 800; font-size: 1.6rem; color: var(--primary); text-align: center; margin-bottom: 18px; }
.auth h3 { margin-top: 10px; }
.auth .form { margin: 12px 0; }
.auth .link { display: inline-block; margin: 8px 0; }
.auth ol { padding-left: 20px; }
.input.code { font-size: 1.5rem; letter-spacing: .4em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { background: #fff; border-radius: 16px; padding: 12px; width: 220px; margin: 12px auto; }
.qr img { width: 100%; display: block; }
code.secret { display: block; word-break: break-all; background: var(--card-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: .9rem; user-select: all; }
.sync-ind { background: none; border: 0; font-size: .9rem; color: var(--muted); cursor: pointer; padding: 6px; min-width: 32px; }
.sync-ind.error { color: var(--warn); }

@media (max-width: 380px) {
  .form.two { grid-template-columns: 1fr; }
  .cal-cell { min-height: 52px; }
  .input.mini { width: 58px; }
  .mring .v { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ---------- V1.6 : check-in, salle, objectifs ---------- */
.choices { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.choice { flex: 1 1 auto; min-width: 54px; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 8px; font: inherit; font-size: .85rem; color: var(--text); cursor: pointer; }
.choice.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); font-weight: 700; }
.sleep-h { font-size: 1rem; margin: 6px 0; }
.sleep-line { margin: 10px 0 0; color: var(--muted); }
.explain { border-left: 4px solid var(--water); background: linear-gradient(140deg, var(--water-soft), var(--card) 75%); }
.explain ul { padding-left: 18px; margin: 6px 0; }
.gym-btn { background: linear-gradient(140deg, var(--sport), #c94f6d); border-color: transparent; margin: 4px 0 2px; }
.plan-list { padding-left: 22px; margin: 10px 0; }
.plan-list li { margin: 0 0 10px; }
.plan-list li > .grow { display: inline-block; width: calc(100% - 44px); vertical-align: top; }
.plan-list li .icon-btn { float: right; }
.goal-list { display: grid; gap: 10px; }
.gl { display: flex; gap: 10px; align-items: flex-start; }
.gl > span { font-size: 1.4rem; }
.good-text { color: var(--good); font-weight: 600; }
.trends { padding-left: 18px; }
.trends li { margin: 6px 0; }

/* ---------- Douleurs ---------- */
.choices.col { flex-direction: column; }
.choices.col .choice { text-align: left; }
.small-choices .choice { padding: 6px 8px; font-size: .8rem; min-width: 44px; }
.pains-card { border-left: 4px solid var(--warn); }
.pain-row { padding: 6px 0; border-bottom: 1px solid var(--line); }
.pain-row:last-child { border-bottom: 0; }
.cause-list { padding-left: 18px; }
.cause-list li { margin: 6px 0; }

/* ---------- Composer un repas ---------- */
.compose-items li { gap: 6px; }
.compose-total { font-size: 1rem; }

/* ---------- IA ---------- */
.ai-card { border-left: 4px solid var(--primary); }
.ai-loading { text-align: center; padding: 30px 0; }
.spinner { width: 42px; height: 42px; margin: 0 auto 12px; border-radius: 50%; border: 4px solid var(--primary-soft); border-top-color: var(--primary); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
pre.sent { white-space: pre-wrap; word-break: break-word; background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; font-size: .74rem; max-height: 50vh; overflow: auto; }
.budget { margin: 6px 0 10px; }
.bar-fill.warn { background: var(--warn); }
.report h3 { margin-top: 4px; }
.report ul { padding-left: 18px; margin: 4px 0; }
.report.flat { box-shadow: none; margin: 8px 0; }
.motivation { background: var(--primary-soft); border-radius: 14px; padding: 10px 12px; font-size: .9rem; }
.ask-box { margin-top: 10px; }

/* ---------- Rééquilibre ---------- */
.rebal-card { border-left: 4px solid var(--water); background: linear-gradient(140deg, var(--water-soft), var(--card) 75%); }
.digest-list { padding-left: 4px; list-style: none; }
.digest-list li { margin: 8px 0; }
.day-w { padding: 6px 0; border-bottom: 1px solid var(--line); gap: 8px; }

/* ---------- Menu de la semaine ---------- */
.seg { display: flex; background: var(--card-2); border: 1px solid var(--line); border-radius: 14px; padding: 3px; margin: 8px 0 4px; }
.seg button { flex: 1; background: none; border: 0; border-radius: 11px; padding: 8px 4px; font: inherit; font-size: .86rem; font-weight: 650; color: var(--muted); cursor: pointer; }
.seg button.active { background: var(--card); color: var(--primary); box-shadow: var(--shadow); }
.planned { background: var(--primary-soft); border-radius: 14px; padding: 10px 12px; margin: 6px 0 8px; }
.planned .row { margin-top: 6px; }
.plan-meals { list-style: none; padding: 0; margin: 6px 0; }
.plan-meals li { display: grid; grid-template-columns: 7.5em 1fr auto auto; align-items: center; gap: 6px; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.plan-meals li:last-child { border-bottom: 0; }
.plan-meals li > span:first-child { font-size: .78rem; color: var(--muted); }
.plan-meals li.eaten .link { color: var(--good); }
.pm-actions { display: flex; gap: 4px; }
.plan-day.past { opacity: .6; }
.plan-day.today-card { border-color: var(--primary); }
.shop { list-style: none; padding: 0; margin: 4px 0; }
.shop li { display: flex; align-items: center; gap: 6px; border-bottom: 1px solid var(--line); }
.shop li .check { flex: 1; margin: 6px 0; }
.shop li.done .grow { text-decoration: line-through; color: var(--muted); }
.tomorrow-card { border-left: 4px solid var(--steps); }

/* ---------- Schéma des mensurations ---------- */
.mf.with-fig { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); }
.mf.with-fig:last-child { border-bottom: 0; }
.mfig { flex-shrink: 0; background: var(--card-2); border-radius: 12px; padding: 4px; }
.mf-skin { fill: var(--line); stroke: var(--muted); stroke-width: .8; stroke-linejoin: round; }
.mf-tape { fill: none; stroke: var(--primary); stroke-width: 1.4; stroke-dasharray: 2.5 2; opacity: .55; }
.mf-tape-front { stroke: var(--primary); stroke-width: 3.2; stroke-linecap: round; }
.mf-dim { stroke: var(--muted); stroke-width: .8; stroke-dasharray: 2 2; }
.mf-note { font-size: 7px; fill: var(--muted); }

/* iPhone : un texte de champ < 16 px provoque un zoom automatique qui ne se défait pas. 16 px = pas de zoom. */
input, select, textarea, .input { font-size: 16px; }
.input.mini { font-size: 16px; }

/* ---------- Semaine + menu latéral ---------- */
.week-days { list-style: none; padding: 0; margin: 10px 0; }
.week-days li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); }
.week-days li:last-child { border-bottom: 0; }
.week-days li.is-today { background: var(--primary-soft); border-radius: 12px; padding: 9px 8px; }
.week-days li.past { opacity: .55; }
.week-days.compact li { padding: 6px 0; }
.wd-name { width: 36px; flex-shrink: 0; text-align: center; display: flex; flex-direction: column; }
.wd-name small { color: var(--muted); font-size: .72rem; }
.sub-head { margin: 6px 0; } .sub-head h2 { margin: 0; }
.coach-quick { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer; }
.targets { display: grid; gap: 10px; }
.tg { background: var(--card-2); border-radius: 14px; padding: 10px 12px; }
.tg .row { margin-top: 6px; }
.drawer-wrap { position: fixed; inset: 0; z-index: 35; }
.drawer-backdrop { position: absolute; inset: 0; background: rgba(20, 10, 20, .45); animation: fade .2s; }
.drawer { position: absolute; top: 0; bottom: 0; left: 0; width: min(300px, 82vw); background: var(--card); padding: 16px 12px calc(16px + env(safe-area-inset-bottom)); overflow-y: auto; box-shadow: 4px 0 24px rgba(0,0,0,.2); animation: slidein .2s ease; }
@keyframes slidein { from { transform: translateX(-30px); opacity: .5; } to { transform: none; opacity: 1; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: var(--primary); font-size: 1.1rem; }
.drawer h5 { margin: 14px 8px 4px; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.drawer button:not(.icon-btn) { display: flex; gap: 12px; align-items: center; width: 100%; background: none; border: 0; padding: 10px 8px; border-radius: 10px; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.drawer button:not(.icon-btn):hover, .drawer button:not(.icon-btn):active { background: var(--primary-soft); }
button:disabled.icon-btn { opacity: .35; }

/* ---------- 3.2 : rappels, ➕, recettes ---------- */
.rem-block { border-top: 1px solid var(--line); padding-top: 4px; margin-top: 10px; }
.rem-block h4 { margin: 8px 0 4px; }
.quick-plan { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; font: inherit; color: var(--text); cursor: pointer; border-color: var(--good); background: var(--good-soft); }
.sheet .quick-grid { grid-template-columns: repeat(4, 1fr); }
.sheet .quick-grid button { font-size: .74rem; padding: 12px 4px; }
.ai-recipe { background: var(--primary-soft); border-radius: 14px; padding: 10px 12px; margin: 8px 0; }
