/* MCU v3 — design system (identité MCU : mascotte rouge-orangé). */

/* ── Jetons de thème ─────────────────────────────────────────────── */
:root {
  --bg: #f5f5f7; --bg2: #ffffff; --bg3: #ececf1; --bg4: #e2e2e9;
  --line: rgba(0, 0, 0, 0.09); --line2: rgba(0, 0, 0, 0.16);
  --txt: #121216; --txt2: #55556a; --txt3: #6a6a7c;   /* txt3 ≥ 4,5:1 sur bg et bg2 (AA) */
  --accent: #c93a17; --accent-ink: #ffffff; --accent-soft: rgba(201, 58, 23, 0.1); --accent-txt: #b3330f;
  --ok: #11803d; --ok-ink: #ffffff; --ok-soft: rgba(17, 128, 61, 0.12);   /* ok ≥ 4,5:1 sur bg et bg2 (AA) */
  --warn: #9a6200; --warn-soft: rgba(245, 165, 36, 0.16);
  --danger: #c42b2b; --danger-soft: rgba(196, 43, 43, 0.1);
  --superset: #2f6fe0; --superset-soft: rgba(47, 111, 224, 0.12);
--macro-protein: #2f6fe0; --macro-carbs: #9a6200; --macro-fat: #8e44ad;   /* barres de composition : texte blanc lisible (≥ 4,5:1) */
  --circuit: #7c3aed; --circuit-soft: rgba(124, 58, 237, 0.12);
  --record: #7a4bd6;
  --shadow: 0 6px 24px rgba(0, 0, 0, 0.08);
  --sil-edge: #9ca2b1; --sil-mid: #d8dbe3; --sil2-edge: #cf6c4b; --sil2-mid: #f5c7b6; --sil-line: rgba(0, 0, 0, 0.28);
  --r: 16px; --rs: 10px; --rx: 999px;
  --tab-h: 62px;
  --tr: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e0e11; --bg2: #17171c; --bg3: #222229; --bg4: #2c2c35;
    --line: rgba(255, 255, 255, 0.08); --line2: rgba(255, 255, 255, 0.16);
    --txt: #f2f2f5; --txt2: #a3a3b4; --txt3: #85859a;
    --accent: #ff5a36; --accent-ink: #1b0b06; --accent-soft: rgba(255, 90, 54, 0.15); --accent-txt: #ff7b5c;
    --ok: #2fd26b; --ok-ink: #04130a; --ok-soft: rgba(47, 210, 107, 0.14);
    --warn: #f5a524; --warn-soft: rgba(245, 165, 36, 0.15);
    --danger: #f06262; --danger-soft: rgba(240, 98, 98, 0.13);
    --superset: #6ea0ff; --superset-soft: rgba(110, 160, 255, 0.15);
    --circuit: #b58cff; --circuit-soft: rgba(181, 140, 255, 0.15);
    --record: #b58cff;
    --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
    --sil-edge: #4b5060; --sil-mid: #8a8fa3; --sil2-edge: #93391f; --sil2-mid: #e27a5c; --sil-line: rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e0e11; --bg2: #17171c; --bg3: #222229; --bg4: #2c2c35;
  --line: rgba(255, 255, 255, 0.08); --line2: rgba(255, 255, 255, 0.16);
  --txt: #f2f2f5; --txt2: #a3a3b4; --txt3: #85859a;
  --accent: #ff5a36; --accent-ink: #1b0b06; --accent-soft: rgba(255, 90, 54, 0.15); --accent-txt: #ff7b5c;
  --ok: #2fd26b; --ok-ink: #04130a; --ok-soft: rgba(47, 210, 107, 0.14);
  --warn: #f5a524; --warn-soft: rgba(245, 165, 36, 0.15);
  --danger: #f06262; --danger-soft: rgba(240, 98, 98, 0.13);
  --superset: #6ea0ff; --superset-soft: rgba(110, 160, 255, 0.15);
  --circuit: #b58cff; --circuit-soft: rgba(181, 140, 255, 0.15);
  --record: #b58cff;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  color-scheme: dark;
}

/* ── Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  font: 400 1rem/1.4 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--txt);
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent-txt); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

.boot { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--txt2); }
.boot img { border-radius: 18px; }
.noscript { padding: 24px; text-align: center; }

/* ── Structure de l'app ──────────────────────────────────────────── */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.topbar h1 { flex: 1; margin: 0; font-size: 1.06rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 40px; height: 40px; min-width: 40px; border-radius: var(--rx); border: 0; background: var(--bg3); color: var(--txt);
  display: inline-flex; align-items: center; justify-content: center; transition: background var(--tr);
}
.icon-btn:hover { background: var(--bg4); }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn.on { color: var(--accent-txt); background: var(--accent-soft); }   /* commande à distance active */
.sync-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.sync-dot[data-state="pending"] { background: var(--warn); }
.sync-dot[data-state="offline"] { background: var(--txt3); }
.sync-dot[data-state="error"] { background: var(--danger); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 0.8rem; display: inline-flex; align-items: center; justify-content: center; border: 0; overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.lg { width: 72px; height: 72px; font-size: 1.5rem; }

.banner { padding: 8px 14px; font-size: 0.85rem; background: var(--bg3); color: var(--txt2); text-align: center; }
.banner.warn { background: var(--warn-soft); color: var(--txt); }

main.view { flex: 1; width: 100%; max-width: 620px; margin: 0 auto; padding: 8px 0 calc(var(--tab-h) + 96px + env(safe-area-inset-bottom)); }
main.view.no-tabs { padding-bottom: calc(40px + env(safe-area-inset-bottom)); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: flex; justify-content: center;
  background: var(--bg2); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar-inner { display: flex; width: 100%; max-width: 620px; }
.tab {
  flex: 1; min-height: var(--tab-h); border: 0; background: none; color: var(--txt3); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 3px; font-size: 0.7rem; font-weight: 600; text-decoration: none;
}
.tab svg { width: 23px; height: 23px; }
.tab span { max-width: 100%; padding: 0 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* 6 onglets (coach, admin) sur un téléphone : libellés plus petits pour qu'ils ne se chevauchent pas. */
.tabbar-inner:has(> .tab:nth-child(6)) .tab { font-size: 0.62rem; }
.tab[aria-current="page"] { color: var(--accent-txt); }

/* Barre « LIVE » d'une séance réduite */
.livebar {
  position: fixed; left: 8px; right: 8px; bottom: calc(var(--tab-h) + 8px + env(safe-area-inset-bottom)); z-index: 29; max-width: 604px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--bg3);
  border: 1px solid var(--line2); box-shadow: var(--shadow); color: var(--txt); text-align: left; width: calc(100% - 16px);
}
.livebar .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
.livebar .lb-title { flex: 1; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.livebar .lb-time { font-weight: 800; color: var(--ok); }

/* ── Typographie / sections ──────────────────────────────────────── */
.section-title { margin: 20px 16px 8px; font-size: 0.74rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--txt2); display: flex; align-items: center; gap: 8px; }
.section-title .grow { flex: 1; }
.page-pad { padding: 0 14px; }
.muted { color: var(--txt2); }
.small { font-size: 0.85rem; }
.tiny { font-size: 0.75rem; }
.big-num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 10px; }
.center { text-align: center; }

/* Fil d'Ariane (v2) */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; padding: 6px 16px 0; font-size: 0.8rem; color: var(--txt2); }
.breadcrumb a { color: var(--accent-txt); text-decoration: none; }
.breadcrumb .sep { color: var(--txt3); }

/* ── Cartes, puces ───────────────────────────────────────────────── */
.card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); margin: 10px 14px; padding: 14px; }
.card.flat { box-shadow: none; }
.card.tap { cursor: pointer; transition: border-color var(--tr), transform 120ms; width: calc(100% - 28px); text-align: left; display: block; color: inherit; font: inherit; }
.card.tap:hover { border-color: var(--line2); }
.card.tap:active { transform: scale(0.99); }
/* Carte réordonnable : poignée + lien côte à côte (components/common.js sortableCard) */
.sort-card { display: flex; align-items: stretch; padding: 0; transition: border-color var(--tr); }
.sort-card:hover { border-color: var(--line2); }
.sort-card > .drag-handle { display: flex; align-items: center; padding: 0 4px 0 12px; }
.card-link { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 6px; background: none; border: 0; color: inherit; font: inherit; text-align: left; cursor: pointer; border-radius: 0 var(--r) var(--r) 0; }
.card-link:active { transform: scale(0.99); }
.sort-card.dragging { opacity: 0.6; border-color: var(--accent); }
/* Installation de l'app (components/install.js) */
.install-banner { display: flex; align-items: center; gap: 10px; margin: 8px 14px; padding: 12px 10px 12px 14px; border-radius: var(--r); background: var(--bg2); border: 1px solid var(--line); }
.install-banner b { display: block; }
ol.steps { margin: 8px 0 14px; padding-left: 1.3em; display: grid; gap: 6px; font-size: 0.95rem; }
.install-others summary { cursor: pointer; font-weight: 700; padding: 6px 0; }
.install-others > div { margin-top: 10px; }
.btn-row.flush { padding: 0; margin-top: 10px; }
/* Nutrition et calculs corporels */
.day-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; }
.icon-btn.flip svg { transform: scaleX(-1); }
.big-kcal { font-size: 1.1rem; } .big-kcal b { font-size: 1.6rem; font-variant-numeric: tabular-nums; }
.right { text-align: right; margin-right: 6px; }
.progress.over > div { background: var(--warn); }
.macros { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.meal .card-title { margin: 0; }
.food-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.food-row .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.week-bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; height: 110px; margin-top: 10px; }
.week-col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; border-radius: 6px; background: var(--bg3); overflow: hidden; }
.bar { width: 100%; background: var(--accent); opacity: 0.55; }
.bar.current { opacity: 1; }
details.calc { margin-top: 12px; } details.calc summary, .card details summary { cursor: pointer; font-weight: 700; font-size: 0.9rem; padding: 4px 0; }
ul.sources { margin: 6px 0 0; padding-left: 1.2em; font-size: 0.8rem; display: grid; gap: 4px; }
ul.sources a { color: var(--accent); }
.calc-grid { display: grid; gap: 2px; margin: 10px 0; }
.calc-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.calc-row > b { text-align: right; font-variant-numeric: tabular-nums; }
.calc-row > .tiny { grid-column: 1 / -1; }
/* Silhouette (D29) */
.sil-figs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; align-items: end; margin-top: 8px; }
.sil-figs.one { grid-template-columns: minmax(0, 220px); justify-content: center; }
.sil-figs figure { margin: 0; text-align: center; min-width: 0; }
.sil-figs figcaption { display: grid; gap: 1px; margin-top: 4px; }
.sil { display: block; width: 100%; height: auto; max-height: 320px; margin: 0 auto; }
.sil .s0 { stop-color: var(--sil-edge); } .sil .s1 { stop-color: var(--sil-mid); }
.sil.sim .s0 { stop-color: var(--sil2-edge); } .sil.sim .s1 { stop-color: var(--sil2-mid); }
.sil .contact { stroke: var(--sil-line); stroke-width: 0.4; }
.sil .fig > * { stroke: var(--sil-edge); stroke-width: 1.2; stroke-opacity: 0; }   /* contour : visible seulement pendant le tracé initial */
.sil.sim .fig > * { stroke: var(--sil2-edge); }
.sil .relief { fill: none; stroke: var(--sil-edge); stroke-width: 0.7; stroke-linecap: round; }   /* reliefs musculaires : opacité portée par chaque tracé (H41) */
.sil.sim .relief { stroke: var(--sil2-edge); }
.sil-slider { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; margin-top: 12px; font-size: 0.9rem; }
.sil-slider b { font-variant-numeric: tabular-nums; }
.sil-slider input[type="range"] { grid-column: 1 / -1; width: 100%; min-height: 32px; margin: 0; accent-color: var(--accent); }
.sil-out { display: grid; grid-template-columns: repeat(auto-fill, minmax(98px, 1fr)); gap: 6px; margin: 12px 0 8px; }
.sil-out > div { display: grid; background: var(--bg3); border-radius: var(--rs); padding: 6px 8px; min-width: 0; }
.sil-out b { font-variant-numeric: tabular-nums; }
.sil-out .d { font-size: 0.72rem; color: var(--txt2); min-height: 1em; }
.sil-sub { margin-top: 12px; font-weight: 700; }
.sil-gallery { display: flex; gap: 6px; overflow-x: auto; padding: 6px 0 8px; scroll-snap-type: x proximity; }
.sil-gallery button { flex: 0 0 74px; display: grid; gap: 1px; justify-items: center; border: 1px solid var(--line); background: var(--bg2); color: var(--txt); border-radius: var(--rs); padding: 4px; font: inherit; scroll-snap-align: start; }
.sil-gallery button .sil { max-height: 110px; }
.sil-gallery button .lvl { font-weight: 700; font-size: 0.8rem; }
.sil-gallery button.me .lvl::after { content: " · vous"; color: var(--accent-txt); font-weight: 600; }
.sil-gallery button[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
/* Séance en direct : charge reprise, réglage rapide, historique (v3.4) */
.set-prev-btn { border: 0; background: none; color: var(--txt2); font: inherit; font-size: 0.82rem; padding: 6px 2px; min-height: 36px; white-space: nowrap; text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }
.set-prev-btn:disabled { color: var(--txt3); text-decoration: none; cursor: default; }
.quick-adj { display: flex; align-items: center; gap: 6px; margin: 4px 0 2px; }
.quick-adj > span { min-width: 56px; }
.quick-adj button { flex: 1; min-height: 40px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg2); color: var(--txt); font-weight: 800; font-variant-numeric: tabular-nums; }
button.ex-name { border: 0; background: none; padding: 0; text-align: left; color: inherit; font: inherit; font-weight: 800; font-size: 1.05rem; cursor: pointer; }
/* Nom d'exercice cliquable (séance en direct, éditeur de séance) : cible confortable au doigt. */
.ex-head button.ex-name, button.ex-name.link-btn { min-height: 40px; display: flex; align-items: center; }
.danger-zone { border-color: var(--danger-soft); }
details.skipped { margin: 10px 0; }
details.skipped > summary { cursor: pointer; font-weight: 700; padding: 8px 14px; }
.copy-meal { width: 100%; margin: 6px 0 2px; }
.link-btn.reveal { display: block; margin: -4px 0 10px auto; font-size: 0.85rem; }
/* Administration */
pre.log { max-height: 320px; overflow: auto; margin: 0; padding: 10px; border-radius: 8px; background: var(--bg3); font-size: 0.75rem; white-space: pre-wrap; word-break: break-word; }
.list-head { padding: 14px 14px 4px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--txt3); }
.card.done { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 6%, var(--bg2)); }
.card-title { font-size: 1.05rem; font-weight: 700; margin: 0; }
.card-sub { color: var(--txt2); font-size: 0.85rem; margin-top: 3px; }
.chev { color: var(--txt3); font-size: 1.4rem; line-height: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: var(--rx); font-size: 0.74rem; font-weight: 600; background: var(--bg3); color: var(--txt2); white-space: nowrap; }
.chip.accent { background: var(--accent-soft); color: var(--accent-txt); }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.superset { background: var(--superset-soft); color: var(--superset); }
.chip.circuit { background: var(--circuit-soft); color: var(--circuit); }
.chip.record { background: color-mix(in srgb, var(--record) 18%, transparent); color: var(--record); }
.type-mecanique { --type: #ff7b3d; }
.type-metabolique { --type: #34b3d9; }
.type-overreaching { --type: #b565ff; }
.type-custom { --type: #8b8b9c; }
.chip.type { background: color-mix(in srgb, var(--type) 18%, transparent); color: var(--type); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 6px 14px; }
.stat { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--rs); padding: 10px 8px; text-align: center; }
.stat .v { font-size: 1.3rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 0.68rem; color: var(--txt2); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ── Boutons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px;
  border-radius: var(--rs); border: 0; font-weight: 700; font-size: 0.98rem; background: var(--bg3); color: var(--txt);
  transition: opacity var(--tr), transform 100ms, background var(--tr); text-decoration: none; user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ok { background: var(--ok); color: var(--ok-ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; border: 1px solid var(--line2); }
.btn.full { width: 100%; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 0.86rem; }
.btn svg { width: 18px; height: 18px; }
.btn-row { display: flex; gap: 10px; padding: 8px 14px; flex-wrap: wrap; }
.btn-row > .btn { flex: 1; }
.link-btn { background: none; border: 0; padding: 6px; color: var(--accent-txt); font-weight: 600; }

/* ── Formulaires ─────────────────────────────────────────────────── */
.field { margin-bottom: 14px; }
.field label, .field .label { display: block; font-size: 0.82rem; color: var(--txt2); margin-bottom: 6px; font-weight: 600; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: var(--rs); border: 1px solid var(--line2);
  background: var(--bg3); color: var(--txt); font-size: 1rem; transition: border-color var(--tr);
}
.field textarea { min-height: 90px; resize: vertical; }
.field input[type="file"] { padding: 6px; color: var(--txt2); font-size: 0.9rem; }
.field input[type="file"]::file-selector-button {
  margin-right: 10px; padding: 8px 14px; border: 1px solid var(--line2); border-radius: var(--rs);
  background: var(--bg2); color: var(--txt); font: inherit; font-weight: 600; cursor: pointer;
}
.chips + .field { margin-top: 12px; }
.input:focus, .field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); }
.field .error { color: var(--danger); font-size: 0.8rem; margin-top: 4px; }
.field.invalid input, .field.invalid select { border-color: var(--danger); }
.field-row { display: flex; gap: 10px; }
.field-row > .field { flex: 1; min-width: 0; }
.check { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; }
/* Case à cocher dans un .field : ne pas hériter du style des libellés (.field label = bloc, petit, gras). */
.field label.check { display: flex; font-size: 0.9rem; color: var(--txt); font-weight: 400; margin-bottom: 0; }
.check input[type="checkbox"], .check input[type="radio"] {
  width: 24px; height: 24px; min-height: 0; margin: 0; padding: 0; border: 0; background: none; flex-shrink: 0; accent-color: var(--accent);
}
.check > span { line-height: 1.5; padding-top: 2px; }   /* 1re ligne centrée sur la case de 24 px (cible minimale WCAG 2.2) */
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: var(--rs); font-size: 0.9rem; margin-bottom: 12px; }
.segmented { display: flex; background: var(--bg3); border-radius: var(--rs); padding: 3px; gap: 3px; }
.segmented button { flex: 1; min-height: 38px; border: 0; border-radius: 8px; background: none; color: var(--txt2); font-weight: 700; font-size: 0.88rem; }
.segmented button[aria-pressed="true"] { background: var(--bg2); color: var(--txt); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
/* Onglets de l'administration (5) : défilement horizontal plutôt que libellés coupés. */
.segmented[data-t="admin-tabs"] { flex-wrap: wrap; }
.segmented[data-t="admin-tabs"] button { flex: 1 0 auto; padding: 0 12px; white-space: nowrap; }
/* Comptes (administration) : texte sur toute la largeur, rôle et menu en dessous. */
.user-row { flex-wrap: wrap; }
.user-row .li-main { flex: 1 1 100%; }
.user-row .li-sub { overflow-wrap: anywhere; }
.user-row select { flex: 1; width: auto; min-width: 0; }

/* ── Authentification ────────────────────────────────────────────── */
.auth { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 18px; }
.auth-logo { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }
.auth-logo img { width: 84px; height: 84px; border-radius: 22px; }
.auth-logo h1 { margin: 10px 0 0; font-size: 2.2rem; font-weight: 900; letter-spacing: -1px; }
.auth-logo p { margin: 2px 0 0; color: var(--txt2); }
.auth-box { width: 100%; max-width: 400px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; box-shadow: var(--shadow); }

/* ── États vides / chargement ────────────────────────────────────── */
.empty { text-align: center; padding: 40px 24px; color: var(--txt2); }
.empty .ic { font-size: 2.6rem; margin-bottom: 8px; }
.empty .hint { font-size: 0.86rem; color: var(--txt3); margin-top: 6px; }
.empty .btn { margin-top: 16px; }
.skeleton { background: linear-gradient(90deg, var(--bg3), var(--bg4), var(--bg3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--rs); min-height: 64px; margin: 10px 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ── Panneau bas (sheet) et dialogues ────────────────────────────── */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, 0.55); display: flex; align-items: flex-end; justify-content: center; opacity: 0; transition: opacity var(--tr); }
.overlay.open { opacity: 1; }
.sheet {
  width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; background: var(--bg2); border-radius: var(--r) var(--r) 0 0;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom)); transform: translateY(24px); transition: transform var(--tr);
}
.overlay.open .sheet { transform: none; }
.sheet-grip { width: 38px; height: 5px; border-radius: 3px; background: var(--line2); margin: 4px auto 10px; }
.sheet-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 1.12rem; }
@media (min-width: 640px) { .overlay { align-items: center; } .sheet { border-radius: var(--r); } }

/* ── Toast ───────────────────────────────────────────────────────── */
.toasts { position: fixed; left: 0; right: 0; bottom: calc(var(--tab-h) + 80px + env(safe-area-inset-bottom)); z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 12px; }
.toast { pointer-events: auto; max-width: 520px; padding: 10px 16px; border-radius: var(--rx); background: var(--txt); color: var(--bg); font-size: 0.9rem; font-weight: 600; box-shadow: var(--shadow); animation: toastIn 180ms ease-out; display: flex; gap: 12px; align-items: center; }
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: var(--ok-ink); }
.toast button { background: none; border: 0; color: inherit; font-weight: 800; text-decoration: underline; padding: 0; }
@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } }

/* ── Listes ──────────────────────────────────────────────────────── */
.list { margin: 6px 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 0; border-bottom: 1px solid var(--line); background: none; width: 100%; text-align: left; color: inherit; font: inherit; }
.list-item:last-child { border-bottom: 0; }
button.list-item:hover { background: var(--bg3); }
.li-icon { width: 40px; height: 40px; border-radius: var(--rs); background: var(--accent-soft); color: var(--accent-txt); display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
/* Photo d'exercice (D42) : vignette dans les listes, grande image sur la fiche. */
.li-photo { object-fit: cover; padding: 0; background: var(--bg3); }
.ex-photo { display: block; width: 100%; max-height: 320px; object-fit: cover; border-radius: var(--rs); margin-bottom: 12px; background: var(--bg3); }
/* Bouton de création au-dessus des listes (avant : en bas de la liste, hors de vue). */
.create-ex { margin-top: 10px; gap: 6px; }
.groups-card summary { cursor: pointer; font-weight: 700; }
.groups-card .list-item { gap: 4px; }
.li-main { flex: 1; min-width: 0; }
.li-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-sub { font-size: 0.8rem; color: var(--txt2); margin-top: 2px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--bg3); border: 1px solid var(--line2); border-radius: var(--rs); padding: 0 12px; }
.search input { flex: 1; border: 0; background: none; min-height: 44px; outline: none; }
/* Choix sur plusieurs lignes : tout reste visible. Avant, une rangée défilante à barre masquée ne se faisait pas glisser à
   la souris (PC) et rien ne montrait les choix cachés (téléphone). */
.filters { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 14px; }
.filter { border: 1px solid var(--line2); background: var(--bg2); color: var(--txt2); border-radius: var(--rx); padding: 6px 12px; font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.filter[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

/* ── Frise des semaines (macrocycle) ─────────────────────────────── */
.timeline { display: flex; gap: 3px; padding: 6px 14px; overflow-x: auto; }
.tl-week { flex: 1 0 18px; min-width: 18px; height: 34px; border-radius: 6px; background: color-mix(in srgb, var(--type) 30%, var(--bg3)); display: flex; align-items: flex-end; justify-content: center; font-size: 0.58rem; color: var(--txt2); padding-bottom: 2px; position: relative; }
.tl-week.current { outline: 2px solid var(--accent); outline-offset: 1px; }
.tl-week.done { background: var(--type); color: #fff; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; padding: 4px 14px; font-size: 0.75rem; color: var(--txt2); }
.legend span::before { content: ""; display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; background: var(--type); vertical-align: -1px; }

/* ── Séance en direct ────────────────────────────────────────────── */
.live-head { position: sticky; top: 0; z-index: 25; background: var(--bg2); border-bottom: 1px solid var(--line); padding: calc(8px + env(safe-area-inset-top)) 12px 10px; }
.live-tag { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.1em; color: var(--ok); text-transform: uppercase; }
.live-title { font-weight: 800; font-size: 1.12rem; }
.live-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 8px; background: var(--bg3); border-radius: var(--rs); padding: 8px; }
.live-metrics .m { text-align: center; }
.live-metrics .m .l { font-size: 0.62rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--txt2); }
.live-metrics .m .v { font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.live-metrics .m.time .v { color: var(--ok); }
.progress { height: 4px; background: var(--bg4); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.progress > div { height: 100%; background: var(--ok); width: 0; transition: width 300ms; }

.ex-card { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); margin: 12px 10px; padding: 12px; }
.ex-card.superset { border-left: 4px solid var(--superset); }
.ex-card.complete { border-color: var(--ok); }
.ex-head { display: flex; align-items: center; gap: 10px; }
.ex-letter { width: 30px; height: 30px; border-radius: 8px; background: var(--superset); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.ex-name { flex: 1; font-weight: 800; font-size: 1.05rem; }
button.ex-name { text-align: left; }
.ex-meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 8px 0; font-size: 0.8rem; color: var(--txt2); }
.ex-meta b { color: var(--txt); }
.ex-meta > span { display: inline-flex; align-items: center; gap: 4px; }
.ex-meta svg { width: 14px; height: 14px; flex-shrink: 0; }
.ex-note { background: var(--bg3); border-radius: 8px; padding: 8px 10px; font-size: 0.85rem; margin: 6px 0; color: var(--txt2); }

.sets { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
.sets th { font-size: 0.66rem; letter-spacing: 0.08em; color: var(--txt3); font-weight: 700; text-transform: uppercase; padding: 0 4px; text-align: center; }
.sets td { padding: 0 3px; text-align: center; vertical-align: middle; }
.set-row td:first-child { width: 40px; }
.set-num { width: 34px; height: 34px; border-radius: 8px; border: 0; background: var(--bg3); font-weight: 800; color: var(--txt2); font-size: 0.85rem; }
.set-num[data-type="warmup"] { color: var(--warn); }
.set-num[data-type="drop"] { color: var(--superset); }
.set-num[data-type="failure"] { color: var(--danger); }
.set-num[data-type="amrap"] { color: var(--circuit); }
.set-prev { color: var(--txt3); font-size: 0.82rem; white-space: nowrap; }
.set-input { width: 100%; max-width: 86px; min-height: 42px; border-radius: 8px; border: 1px solid transparent; background: var(--bg3); text-align: center; font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; color: var(--txt); }
.set-input:focus { outline: none; border-color: var(--accent); }
.set-check { width: 42px; height: 42px; border-radius: 10px; border: 2px solid var(--line2); background: transparent; color: var(--ok-ink); display: inline-flex; align-items: center; justify-content: center; }
.set-check svg { width: 22px; height: 22px; }
.set-row.done .set-check { background: var(--ok); border-color: var(--ok); }
.set-row.done .set-input { background: color-mix(in srgb, var(--ok) 12%, var(--bg3)); }
.set-row.current .set-num { outline: 2px solid var(--ok); }
.record-badge { display: inline-flex; align-items: center; gap: 4px; margin: 2px auto; padding: 2px 9px; border-radius: var(--rx); background: color-mix(in srgb, var(--record) 20%, transparent); color: var(--record); font-size: 0.72rem; font-weight: 800; }
/* Façon de charger (D53-D56) : mode, charge réelle sous la saisie, gauche / droite, écart, poids du corps manquant */
.load-mode { margin: 4px 0 8px; }
.load-mode .segmented button { font-size: 0.8rem; min-height: 34px; padding: 0 6px; }
.load-mode .tiny { margin-top: 4px; }
.set-eff { font-size: 0.68rem; font-weight: 700; color: var(--accent-txt); margin-top: 2px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.set-eff:empty { display: none; }
.set-num small { font-size: 0.62rem; font-weight: 800; color: var(--accent); margin-left: 1px; }
.set-num.twin { display: inline-flex; align-items: center; justify-content: center; background: none; border: 1px dashed var(--line2); }
.set-row.side-L td { padding-bottom: 0; }
.side-gap { display: inline-block; margin: 0 auto 2px; padding: 2px 9px; border-radius: var(--rx); background: var(--bg3); color: var(--txt2); font-size: 0.72rem; font-weight: 700; }
.ex-warn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: var(--warn-soft); font-size: 0.82rem; }
.ex-warn > span { flex: 1 1 200px; }
.balance-row { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 8px; margin: 8px 0; font-size: 0.85rem; }
.balance-track { height: 12px; border-radius: 6px; background: var(--bg3); overflow: hidden; }
.balance-fill { height: 100%; border-radius: 6px; background: var(--ok); }
.balance-fill.weak { background: var(--warn); }
.balance-v { font-variant-numeric: tabular-nums; min-width: 64px; text-align: right; }
.add-set { width: 100%; border: 1px dashed var(--line2); background: none; color: var(--ok); border-radius: 10px; min-height: 40px; font-weight: 700; margin-top: 4px; }

.adj-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.adj { min-height: 44px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg3); font-weight: 800; font-variant-numeric: tabular-nums; }
.adj.neg { color: var(--danger); }
.adj.pos { color: var(--ok); }

/* Minuteur de repos (barre flottante) */
.restbar {
  position: fixed; left: 8px; right: 8px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 60; max-width: 604px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r); background: var(--bg2); border: 1px solid var(--ok);
  box-shadow: var(--shadow);
}
.ring { position: relative; width: 58px; height: 58px; flex-shrink: 0; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--bg4); stroke-width: 6; }
.ring .bar { fill: none; stroke: var(--ok); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset 250ms linear; }
.ring .pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 800; }
.rest-main { flex: 1; min-width: 0; }
.rest-label { font-size: 0.66rem; font-weight: 800; letter-spacing: 0.08em; color: var(--ok); text-transform: uppercase; }
.rest-time { font-size: 1.7rem; font-weight: 900; font-variant-numeric: tabular-nums; line-height: 1.1; }
.rest-next { font-size: 0.78rem; color: var(--txt2); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.rest-actions { display: flex; flex-direction: column; gap: 6px; }
.restbar.ending { animation: flash 0.5s 3; }
@keyframes flash { 50% { background: var(--ok-soft); } }
.rest-full { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 20px 0; }
.rest-full .ring { width: 220px; height: 220px; }
.rest-full .ring .pct { font-size: 3rem; font-weight: 900; }

/* Circuit */
.circuit-card { background: linear-gradient(180deg, var(--circuit-soft), var(--bg2) 60%); border: 1px solid color-mix(in srgb, var(--circuit) 35%, transparent); border-radius: var(--r); margin: 12px 10px; padding: 12px; }
.circuit-clock { text-align: center; padding: 14px; border-radius: var(--r); background: var(--bg2); border: 1px solid var(--line); margin: 10px 0; }
.circuit-clock .t { font-size: 3rem; font-weight: 900; font-variant-numeric: tabular-nums; }
.circuit-step { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: var(--rs); }
.circuit-step.current { background: var(--circuit-soft); }
.circuit-step .n { width: 28px; height: 28px; border-radius: 50%; background: var(--bg3); display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 0.8rem; }
.circuit-step.current .n { background: var(--circuit); color: #fff; }

/* ── Tableaux (résumé, indicateurs) ──────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th { text-align: left; color: var(--txt2); font-weight: 600; padding: 6px 6px; border-bottom: 1px solid var(--line); }
.table td { padding: 7px 6px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.table tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }

/* ── Graphiques ──────────────────────────────────────────────────── */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--txt3); font-size: 10px; }
.chart .line { fill: none; stroke: var(--ok); stroke-width: 2.5; stroke-linejoin: round; }
.chart .line.prev { stroke: var(--txt3); stroke-dasharray: 4 4; stroke-width: 1.5; }
.chart .area { fill: var(--ok-soft); }
.chart .dot { fill: var(--ok); }
.chart .bar-rect { fill: var(--accent); }
.heatmap { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.heatmap .d { aspect-ratio: 1; border-radius: 4px; background: var(--bg3); }
.heatmap .d[data-n="1"] { background: color-mix(in srgb, var(--ok) 40%, var(--bg3)); }
.heatmap .d[data-n="2"] { background: color-mix(in srgb, var(--ok) 70%, var(--bg3)); }
.heatmap .d[data-n="3"] { background: var(--ok); }
.heatmap .d.out { opacity: 0.25; }
.heatmap .d.today { outline: 2px solid var(--accent); }
.bars .b { display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 0.9rem; }
.bars .b .name { flex: 1; }
.bars .b .val { font-weight: 800; font-variant-numeric: tabular-nums; }

/* Calendrier (journal) */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal .h { font-size: 0.7rem; color: var(--txt3); font-weight: 700; }
.cal .c { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 50%; border: 0; background: none; font-variant-numeric: tabular-nums; font-size: 0.9rem; color: var(--txt); }
.cal .c.out { color: var(--txt3); }
.cal .c.today { background: var(--ok); color: var(--ok-ink); font-weight: 800; }
.cal .c.has::after { content: ""; position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--ok); }
.cal .c.selected { outline: 2px solid var(--accent); }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 0 14px; }
.photo-grid button { aspect-ratio: 3 / 4; border: 0; padding: 0; border-radius: 10px; overflow: hidden; background: var(--bg3); position: relative; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid .pending { position: absolute; left: 4px; bottom: 4px; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.compare img { width: 100%; border-radius: 10px; }

/* Pastilles 💡 */
.tip-btn { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; min-width: 28px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); background: var(--warn-soft); font-size: 0.9rem; line-height: 1; padding: 0; }
.tip-body p { margin: 0 0 10px; line-height: 1.5; }
.tip-sources { margin: 10px 0 0; padding-left: 18px; font-size: 0.86rem; }
.tip-sources li { margin-bottom: 6px; }
.tip-disclaimer { font-size: 0.75rem; color: var(--txt3); margin-top: 12px; }

/* Importation Excel */
.import-row { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.import-row:last-child { border-bottom: 0; }
.fix { border-left: 3px solid var(--warn); padding-left: 10px; margin: 8px 0; font-size: 0.86rem; }
.fix.ok { border-left-color: var(--ok); }

/* Divers */
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.kbd { font-variant-numeric: tabular-nums; font-weight: 700; }
.drag-handle { color: var(--txt3); cursor: grab; touch-action: none; padding: 6px; background: none; border: 0; }
.dragging { opacity: 0.6; }
.drop-target { outline: 2px dashed var(--accent); outline-offset: 2px; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.9rem; }
.dl dt { color: var(--txt2); }
.dl dd { margin: 0; font-weight: 600; }

/* ── Informations légales (D38) ─────────────────────────────────── */
.legal h3 { font-size: 0.95rem; margin: 16px 0 4px; }
.legal p, .legal li { font-size: 0.9rem; line-height: 1.45; }
.legal ul { padding-left: 18px; margin: 4px 0; }
.legal a { color: var(--accent-txt); overflow-wrap: anywhere; }
.legal-missing { color: var(--danger); font-weight: 600; }
.legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 2px 12px; padding: 12px 14px; }
.legal-links .link-btn { font-size: 0.82rem; font-weight: 600; min-height: 32px; }
.inline-link { color: var(--accent-txt); font-weight: 600; text-decoration: underline; }
.pwd-meter { min-height: 1.2em; margin: -4px 0 6px; color: var(--txt2); }
.pwd-meter[data-ok="false"] { color: var(--danger); }
.pwd-meter[data-ok="true"] { color: var(--ok); }

/* ── Objectif de silhouette (D39) ───────────────────────────────── */
.sil-tap { display: block; width: 100%; padding: 0; border: 0; background: none; border-radius: var(--rs); cursor: pointer; }
.sil-tap:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sil-goal { margin: 12px 0 0; }
.sil-goal p, .goal-preview p { margin: 4px 0; }
.goal-time { font-weight: 700; color: var(--accent-txt); margin: 6px 0; }
.goal-preview { background: var(--bg3); border-radius: var(--rs); padding: 8px 10px; margin: 8px 0 12px; }
.sil-goal-hint { margin: 10px 0 0; }
.warn-text { color: var(--warn); font-weight: 600; }

/* ── Nutrition v3.8 : scanner de code-barres, portions, recettes (D43, D44) ── */
.food-search-row { gap: 8px; align-items: stretch; }
.scan-btn { flex: 0 0 auto; gap: 6px; padding: 0 14px; }
button.chip { border: 0; min-height: 32px; padding: 4px 12px; font-size: 0.8rem; cursor: pointer; }
button.chip:hover { background: var(--accent-soft); color: var(--accent-txt); }
.scan-frame { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: var(--rs); overflow: hidden; margin-bottom: 10px; }
.scan-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-line { position: absolute; left: 8%; right: 8%; top: 50%; height: 2px; background: #e5484d; box-shadow: 0 0 8px #e5484d; }
.scan-manual { margin-top: 12px; }
.scan-manual .row { gap: 8px; }
.scan-manual input { flex: 1; min-width: 0; min-height: 44px; border: 1px solid var(--line2); border-radius: var(--rs); padding: 0 12px; background: var(--bg2); color: var(--txt); }
/* Entrée du journal modifiable d'un appui (D46). */
.food-entry-edit { background: none; border: 0; padding: 4px 0; min-height: 36px; text-align: left; color: inherit; font: inherit; cursor: pointer; min-width: 0; }
.food-entry-edit:hover > div:first-child { text-decoration: underline; }
.food-tabs { padding: 8px 0 4px; }
.bulk-list { max-height: 260px; overflow: auto; padding-left: 18px; }
/* Mesures ménagères (D47) : cuillère à soupe, cuillère à café, mug, autre ; « Nombre » × poids de la mesure. */
.measures { margin-bottom: 12px; padding: 10px 12px; background: var(--bg3); border-radius: var(--rs); }
.measures .chips { margin-top: 6px; }
button.chip[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.measure-count { gap: 8px; align-items: center; margin-top: 10px; }
.measure-count input { width: 72px; min-height: 40px; border: 1px solid var(--line2); border-radius: var(--rs); padding: 0 10px; background: var(--bg2); color: var(--txt); font: inherit; }
.measures button.chip:not([aria-pressed="true"]) { background: var(--bg2); }
/* Ajout rapide (D48) : bouton « ＋ » au-dessus de la barre d'onglets, à droite de la colonne de l'app. */
.fab {
  position: fixed; z-index: 28; right: max(14px, calc(50% - 310px + 14px)); bottom: calc(var(--tab-h) + 14px + env(safe-area-inset-bottom));
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink);
  display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow); cursor: pointer;
}
.fab svg { width: 26px; height: 26px; }
.fab.above-live { bottom: calc(var(--tab-h) + 76px + env(safe-area-inset-bottom)); }
.quick-bar { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.quick-bar .chip { gap: 4px; }
.quick-bar .chip.current { background: var(--accent); color: var(--accent-ink); }
.quick-links li { margin: 6px 0; }
.quick-links code { word-break: break-all; font-size: 0.78rem; }
/* Composition d'un repas (D50) : une barre, trois couleurs en proportion des grammes, la valeur au milieu. */
.macro-bar { display: flex; height: 20px; border-radius: 10px; overflow: hidden; margin: 6px 0 4px; background: var(--bg3); }
.macro-bar > div { display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.7rem; font-weight: 700; white-space: nowrap; overflow: hidden; min-width: 3px; }
.mb-protein { background: var(--macro-protein); }
.mb-carbs { background: var(--macro-carbs); }
.mb-fat { background: var(--macro-fat); }
.macro-legend { display: flex; gap: 14px; justify-content: center; margin: 4px 0 8px; }
.macro-legend span { display: inline-flex; align-items: center; gap: 5px; }
.macro-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
/* Changement de jour (D49) : la page glisse dans le sens du geste. */
@keyframes slide-next { from { transform: translateX(28px); opacity: 0.4; } to { transform: none; opacity: 1; } }
@keyframes slide-prev { from { transform: translateX(-28px); opacity: 0.4; } to { transform: none; opacity: 1; } }
main.view.slide-next { animation: slide-next 180ms ease-out; }
main.view.slide-prev { animation: slide-prev 180ms ease-out; }
@media (prefers-reduced-motion: reduce) { main.view.slide-next, main.view.slide-prev { animation: none; } }
/* Bilan nutrition (D51) : calendriers vert / orange / rouge et signe du sens de l'écart. */
.ncal { width: 100%; border-collapse: separate; border-spacing: 3px; table-layout: fixed; }
.ncal th { font-size: 0.68rem; color: var(--txt3); font-weight: 600; padding: 2px 0; }
.ncal td { padding: 0; }
.cal-day { width: 100%; min-height: 38px; border: 1px solid transparent; border-radius: 8px; background: var(--bg3); color: var(--txt2); font: inherit; font-size: 0.78rem; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; cursor: pointer; padding: 2px 0; }
.cal-day .sign { font-weight: 800; font-size: 0.85rem; }
.cal-day.ok { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.cal-day.near { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.cal-day.off { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.cal-day.empty { opacity: 0.55; }
.cal-day.current { border: 2px dashed var(--txt3); }
.cal-legend { display: flex; flex-wrap: wrap; gap: 6px 12px; font-size: 0.72rem; color: var(--txt2); margin-top: 6px; }
.cal-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 4px; vertical-align: -1px; border: 1px solid; }
.cal-legend .ok { background: var(--ok-soft); border-color: var(--ok); }
.cal-legend .near { background: var(--warn-soft); border-color: var(--warn); }
.cal-legend .off { background: var(--danger-soft); border-color: var(--danger); }
.recap-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.recap-row:first-of-type { border-top: 0; }
.recap-row .counts { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.chip.danger-chip { background: var(--danger-soft); color: var(--danger); }
