/* Muscu V2 — interface mobile.
   Identité : fonte et acier (fond graphite), magnésie (texte), disque bleu 20 kg (accent),
   chiffres en Barlow Condensed façon tableau d'affichage. Polices servies localement (OFL). */

@font-face { font-family: "Barlow"; src: url("../fonts/barlow-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Condensed"; src: url("../fonts/barlow-condensed-600.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }

:root {
  --bg: #1a1d21;          /* fonte */
  --surface: #23272d;     /* acier */
  --surface-2: #2c3138;
  --line: #383e47;        /* rainure */
  --text: #eeece6;        /* magnésie */
  --muted: #9aa1ab;
  --accent: #2f6bff;      /* disque bleu */
  --accent-ink: #ffffff;
  --success: #1f9d55;
  --ready: #3ccf6e;
  --rest: #3ccf6e;        /* chrono : récupération entre deux séries */
  --between: #7cc8ff;     /* chrono : changement d'exercice */
  --over: #f5a524;        /* chrono : repos dépassé */
  --danger: #e5484d;
  --warn: #f5a524;
  --record: #ffc83d;      /* record personnel */

  --e1: #16a34a;
  --e2: #84cc16;
  --e3: #eab308;
  --e4: #f97316;
  --e5: #dc2626;

  --font-ui: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-num: "Barlow Condensed", "Barlow", system-ui, sans-serif;

  --fs-s: 13px;
  --fs-m: 16px;
  --fs-l: 20px;
  --fs-xl: 32px;
  --fw: 400;
  --fw-b: 600;

  --r: 12px;
  --gap: 12px;
  --tap: 48px;
  --tap-big: 54px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: var(--fw) var(--fs-m)/1.4 var(--font-ui);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, p { margin: 0; }
strong { font-weight: var(--fw-b); }
[hidden] { display: none !important; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; }
.screen { padding: 0 14px calc(90px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--gap); }
.screen.center { min-height: 100dvh; justify-content: center; padding-bottom: 24px; }
.splash { padding: 40vh 0 0; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: var(--fs-s); }
.big { font-size: var(--fs-l); font-weight: var(--fw-b); }
.empty { padding: 40px 0; text-align: center; display: grid; gap: var(--gap); }

/* ---------------------------------------------------------------- en-tête */
.topbar {
  position: sticky; top: 0; z-index: 5;
  margin: 0 -14px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-meta { font-size: var(--fs-s); color: var(--muted); display: flex; align-items: center; gap: 4px; }
.topbar-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; margin-top: 2px; }
.ex-name { font-family: var(--font-num); font-size: 24px; font-weight: var(--fw-b); line-height: 1.1; display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }

.sync-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 6px; background: var(--muted); cursor: pointer; flex: none; }
.sync-ok { background: var(--success); }
.sync-pending { background: var(--warn); animation: pulse 1.2s infinite; }
.sync-err { background: var(--danger); }
@keyframes pulse { 50% { opacity: .35; } }

/* ---------------------------------------------------------------- boutons */
.btn {
  min-height: var(--tap); padding: 0 16px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--surface-2); font-weight: var(--fw-b); font-size: var(--fs-m); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; color: var(--text);
  touch-action: manipulation; user-select: none;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-success { background: var(--success); border-color: var(--success); color: #fff; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-ghost { background: transparent; }
.btn-link { background: none; border: 0; color: var(--muted); font-weight: var(--fw); text-decoration: underline; min-height: 40px; }
.btn-chip { min-height: 38px; padding: 0 12px; border-radius: 999px; font-size: var(--fs-s); }
.btn-big { min-height: var(--tap-big); font-size: var(--fs-l); }
.btn-block { width: 100%; }
.btn-icon { min-width: var(--tap); padding: 0; font-size: var(--fs-l); }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-row .btn { flex: 1; }

/* ---------------------------------------------------------------- cartes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; display: grid; gap: 10px; }
.card-title { font-weight: var(--fw-b); display: flex; align-items: center; gap: 8px; }
.card-active { border-color: var(--accent); }
.card-warn { border-color: var(--warn); }
.notice { background: var(--surface); border-left: 3px solid var(--accent); padding: 10px 12px; border-radius: 8px; font-size: var(--fs-s); }
.notice-warn { border-left-color: var(--e4, #f97316); }
.tag { font-size: var(--fs-s); font-weight: var(--fw); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; }
.pill { font-size: var(--fs-s); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; align-self: flex-start; }
.badge { font-size: var(--fs-s); border-radius: 999px; padding: 1px 8px; font-weight: var(--fw-b); }
.badge-fail { background: color-mix(in srgb, var(--danger) 22%, transparent); color: #ff9b9e; }

/* ---------------------------------------------------------------- séance : tête d'exercice */
.media {
  position: relative; padding: 0; border: 0; border-radius: var(--r); overflow: hidden; background: #fff;
  aspect-ratio: 1 / 1; width: 100%; cursor: zoom-in;
}
.media.media-missing { display: none; }
.attrib { position: absolute; right: 4px; bottom: 3px; font-size: 10px; color: #555; background: rgba(255,255,255,.75); padding: 0 4px; border-radius: 4px; }

.hints { display: flex; flex-direction: column; gap: 6px; font-size: var(--fs-s); }

/* ---------------------------------------------------------------- séance : saisie */
.row { display: grid; gap: 6px; }

.step-btn {
  height: var(--tap-big); border-radius: var(--r); border: 1px solid var(--line); background: var(--surface-2);
  font-size: var(--fs-xl); font-weight: var(--fw); line-height: 1; cursor: pointer; touch-action: manipulation;
}
.step-btn:active { background: var(--line); }

.efforts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.effort {
  --c: var(--e3);
  height: var(--tap-big); border-radius: var(--r); border: 2px solid var(--c); cursor: pointer;
  background: color-mix(in srgb, var(--c) 14%, transparent); color: var(--c);
  font-size: var(--fs-l); font-weight: var(--fw-b); touch-action: manipulation;
}
.effort.on { background: var(--c); color: #fff; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 35%, transparent); }
.eff-1 { --c: var(--e1); } .eff-2 { --c: var(--e2); } .eff-3 { --c: var(--e3); } .eff-4 { --c: var(--e4); } .eff-5 { --c: var(--e5); }
.effort.eff-2.on, .effort.eff-3.on { color: #111; }

.fail {
  height: var(--tap); padding: 0 14px; border-radius: var(--r); border: 2px solid var(--danger); background: transparent;
  color: #ff8a8e; font-weight: var(--fw-b); cursor: pointer;
}
.fail.on { background: var(--danger); color: #fff; }

.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }

.bands { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.band {
  --c: #888;
  min-height: var(--tap-big); border-radius: var(--r); border: 2px solid var(--c); background: transparent; cursor: pointer;
  display: grid; align-content: center; justify-items: center; gap: 0; padding: 2px;
}
.band.on { background: var(--c); color: #fff; }
.band-vert { --c: #22c55e; } .band-violet { --c: #8b5cf6; } .band-rouge { --c: #ef4444; } .band-jaune { --c: #facc15; }
.band-noir { --c: #9aa3b2; }
.band-noir.on { background: #000; border-color: #e8ecf2; }
.band-jaune.on { color: #111; }

/* ---------------------------------------------------------------- historique des séries */
.history .sets, .exdetail .sets { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.setrow {
  width: 100%; display: flex; align-items: center; gap: 8px; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; min-height: var(--tap);
}
.setrow.static { cursor: default; }
.setrow-n { font-weight: var(--fw-b); color: var(--muted); width: 26px; }
.setrow-main { flex: 1; font-weight: var(--fw-b); }
.setrow-asym { font-size: var(--fs-s); color: var(--muted); }
.setrow-asym.asym-light { color: var(--warn); }
.setrow-asym.asym-marked { color: #ff8a8e; }
.effort-pill {
  --c: var(--e3);
  min-width: 26px; height: 26px; border-radius: 8px; background: var(--c); color: #fff;
  display: inline-grid; place-items: center; font-size: var(--fs-s); font-weight: var(--fw-b);
}
.effort-pill.eff-2, .effort-pill.eff-3 { color: #111; }

.comment { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 0 12px; }
.comment summary { min-height: var(--tap); display: flex; align-items: center; cursor: pointer; color: var(--muted); }
.comment[open] { padding-bottom: 12px; }
.comment-input, .input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: var(--tap);
}
.comment-input:focus, .input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.comment-view { white-space: pre-wrap; font-size: var(--fs-s); color: var(--muted); }

/* ---------------------------------------------------------------- listes d'exercices (menu) */
.exlist { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.exitem { display: flex; align-items: center; gap: 6px; }
.exitem-btn {
  flex: 1; display: flex; align-items: center; gap: 10px; text-align: left; min-height: 60px; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 6px 10px 6px 6px;
}
.exitem.current .exitem-btn { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.exitem.done .exitem-state { color: #4ade80; }
.exitem.current .exitem-state { color: var(--accent); }
.thumb { width: 48px; height: 48px; border-radius: 8px; overflow: hidden; background: #fff; flex: none; display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.media-missing { background: var(--surface-2); }
.exitem-txt { flex: 1; display: grid; min-width: 0; }
.exitem-name { font-weight: var(--fw-b); display: flex; gap: 6px; align-items: center; }
.exitem-sub { font-size: var(--fs-s); color: var(--muted); }
.exitem-state { width: 22px; text-align: center; font-weight: var(--fw-b); font-size: var(--fs-l); }

/* ---------------------------------------------------------------- accueil / historique */
.days { display: grid; gap: 10px; }
.daycard {
  display: grid; gap: 2px; text-align: left; padding: 16px; border-radius: var(--r); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); min-height: 76px;
}
.daycard.today { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.daycard-name { font-family: var(--font-num); font-size: 26px; font-weight: var(--fw-b); display: flex; align-items: center; gap: 8px; }
.daycard-sub { font-size: var(--fs-s); color: var(--muted); }
.home-links { display: grid; gap: 8px; margin-top: 6px; }
.remote-row { display: grid; gap: 8px; }

.histlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.histrow { display: flex; align-items: stretch; gap: 6px; }
.histrow-main {
  flex: 1; display: grid; text-align: left; gap: 2px; padding: 10px 12px; border-radius: var(--r); cursor: pointer;
  background: var(--surface); border: 1px solid var(--line);
}
.histrow-title { font-weight: var(--fw-b); }
.histrow-sub { font-size: var(--fs-s); color: var(--muted); }
.histrow .del { color: var(--muted); }

/* Records personnels */
.records-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.recrow { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 10px 12px; display: grid; gap: 2px; }
.recrow-name { font-weight: var(--fw-b); }
.recrow-best { font-family: var(--font-num); font-size: var(--fs-l); color: var(--record); }
.recrow-sub { font-size: var(--fs-s); color: var(--muted); }
.finish-records { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 4px; }
.finish-records li::before { content: "★ "; color: var(--record); }

/* ---------------------------------------------------------------- courbes de progression */
.progress-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: var(--gap); }
.progress-tabs .on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.progress-summary { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0 0 8px; font-size: var(--fs-s); color: var(--muted); }
.progress-summary strong { color: var(--text); font-family: var(--font-num); font-size: var(--fs-m); }
.progress-summary .up { color: var(--ready); }
.progress-summary .down { color: var(--warn); }
.progress-chart .chart { display: block; width: 100%; height: auto; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--font-num); }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart .pt { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.chart .pt.best { fill: var(--ready); stroke: var(--ready); }
.chart .pt.sel { stroke: var(--text); }
.chart .hit { fill: transparent; cursor: pointer; }
.progress-values { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 2px; }
.progress-values strong { font-family: var(--font-num); }

/* ---------------------------------------------------------------- formulaires */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: var(--fs-s); color: var(--muted); }
.form label.check, .check { display: flex; align-items: center; gap: 8px; color: var(--text); font-size: var(--fs-m); }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.row-check { min-height: var(--tap); }
.form-grid { grid-template-columns: 1fr 1fr; }
.form-grid .span2 { grid-column: span 2; }
.input-num { text-align: center; }
.form-error { color: #ff8a8e; font-size: var(--fs-s); }
.auth { width: 100%; }
.auth h1 { font-size: var(--fs-l); font-weight: var(--fw-b); }
select.input { appearance: auto; }

/* ---------------------------------------------------------------- dialogues / panneaux */
dialog { color: var(--text); }
.dlg {
  border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 0;
  width: min(92vw, 420px); max-height: 90dvh;
}
.dlg::backdrop, .sheet::backdrop { background: rgba(0, 0, 0, .6); }
.dlg-body { padding: 18px; display: grid; gap: 14px; }
.dlg-title { font-size: var(--fs-l); font-weight: var(--fw-b); }
.dlg-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.dlg-actions .btn { flex: 1; }
.dlg-notes .notes { display: grid; gap: 14px; max-height: 58dvh; overflow-y: auto; outline: none; }
.notes-rel h3 { font-size: var(--fs-m); font-weight: var(--fw-b); margin-bottom: 4px; }
.notes-rel h3 .small { font-weight: normal; }
.notes-rel ul { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.zoom { display: grid; gap: 8px; }
.zoom-img { width: 100%; max-width: 360px; justify-self: center; border-radius: var(--r); background: #fff; image-rendering: auto; }
.attrib-line { font-size: 11px; color: var(--muted); text-align: center; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 6px; font-size: var(--fs-s); }

.sheet {
  margin: auto 0 0; width: 100%; max-width: 100%; max-height: 88dvh; padding: 0; border: 0;
  border-radius: 18px 18px 0 0; background: var(--surface);
}
@media (min-width: 600px) { .sheet { max-width: 560px; margin: auto auto 0; } }
.sheet-inner { display: flex; flex-direction: column; max-height: 88dvh; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 8px 8px 16px; border-bottom: 1px solid var(--line); }
.sheet-title { font-size: var(--fs-l); font-weight: var(--fw-b); }
.sheet-content { overflow-y: auto; padding: 12px 14px calc(16px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.sheet-content .input { margin-bottom: 10px; }

/* ---------------------------------------------------------------- toast / mise à jour */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 100;
  background: #2a3242; color: var(--text); border-radius: 999px; padding: 10px 16px; font-size: var(--fs-s); font-weight: var(--fw-b);
  pointer-events: none;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .45); max-width: 92vw; text-align: center;
}
.toast-ok { background: #18432c; }
.toast-warn { background: #5a4110; }
.toast-error { background: #5c1d20; }
.update-bar .btn-row { flex-wrap: nowrap; }
.update-bar {
  position: fixed; left: 10px; right: 10px; bottom: calc(84px + env(safe-area-inset-bottom)); z-index: 90;
  max-width: 540px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--accent); border-radius: var(--r); padding: 8px 8px 8px 14px;
}
.clip-fallback { position: fixed; top: -1000px; opacity: 0; }

/* Petits écrans (hauteur) : on compacte pour garder la saisie visible */
@media (max-height: 780px) {
  :root { --tap-big: 48px; --fs-xl: 28px; --gap: 10px; }
  .topbar { padding-top: calc(6px + env(safe-area-inset-top)); padding-bottom: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* =====================================================================
   Écran de séance « carnet » (seance2.js)
   Haut : lecture (chrono, grille précédent / aujourd'hui). Bas : dock de saisie.
   ===================================================================== */
.s2 { height: 100dvh; display: flex; flex-direction: column; }
.s2-empty { justify-content: center; align-items: center; gap: 12px; padding: 24px; }
.s2-swipe {
  flex: 1; min-height: 0; overflow-y: auto; touch-action: pan-y;
  padding: calc(6px + env(safe-area-inset-top)) 16px 12px;
  display: flex; flex-direction: column; gap: 14px;
}
.ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ico-more { stroke-width: 3.6; }

/* En-tête */
.s2-top { display: flex; align-items: center; gap: 4px; }
.s2-nav { width: 36px; height: 40px; border: 0; background: none; color: var(--text); display: grid; place-items: center; border-radius: 8px; cursor: pointer; }
.s2-nav:disabled { opacity: .2; }
.s2-progress { flex: 1; display: flex; gap: 4px; height: 44px; align-items: center; background: none; border: 0; padding: 0 4px; cursor: pointer; }
.s2-seg { flex: 1; height: 8px; border-radius: 3px; background: var(--line); position: relative; overflow: hidden; }
.s2-seg::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--r, 0) * 100%); background: var(--muted); }
.s2-seg.done::after { background: var(--ready); }
.s2-seg.on.done::after { background: var(--ready); }
.s2-seg.on { height: 12px; background: color-mix(in srgb, var(--accent) 30%, var(--line)); }
.s2-seg.on::after { background: var(--accent); }
.s2-elapsed { font-family: var(--font-num); font-weight: 600; color: var(--muted); font-size: 16px; min-width: 46px; text-align: right; }
button.sync-dot { border: 0; padding: 0; }

.s2-title { display: flex; gap: 12px; align-items: center; }
.s2-thumb { width: 64px; height: 64px; border-radius: 10px; overflow: hidden; background: #fff; border: 0; padding: 0; flex: none; cursor: zoom-in; }
.s2-thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.s2-thumb.media-missing { display: none; }
.s2-titletxt { flex: 1; min-width: 0; }
.s2-pos { font-size: var(--fs-s); color: var(--muted); }
.s2-name { font-family: var(--font-num); font-weight: 600; font-size: 28px; line-height: 1.05; margin: 1px 0 2px; }
.s2-target { color: var(--muted); font-size: 15px; }
.s2-more {
  width: 44px; height: 44px; flex: none; border-radius: 22px; border: 1px solid var(--line); background: none;
  color: var(--text); display: grid; place-items: center; cursor: pointer;
}
.s2-more.has-note { border-color: var(--warn); color: var(--warn); }
.s2-hints { display: flex; flex-wrap: wrap; gap: 6px; }
.s2-chip-info { font-size: var(--fs-s); color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }

/* Chrono : l'élément qu'on lit de loin */
.s2-clock { text-align: center; }
.s2-time {
  font-family: var(--font-num); font-weight: 600; font-variant-numeric: tabular-nums;
  font-size: clamp(76px, 25vw, 120px); line-height: .9; letter-spacing: -.01em;
}
.s2-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 10px 0 6px; }
.s2-fill { display: block; height: 100%; width: calc(var(--p, 0) * 100%); background: var(--accent); transition: width .25s linear; }
.s2-restlabel { color: var(--muted); font-size: 15px; }
.s2-clock.idle .s2-time { color: var(--muted); }
.s2-clock.rest .s2-time { color: var(--rest); }
.s2-clock.rest .s2-fill { background: var(--rest); }
.s2-clock.between .s2-time { color: var(--between); }
.s2-clock.between .s2-fill { background: var(--between); }
.s2-clock.over .s2-time { color: var(--over); }
.s2-clock.over .s2-fill { background: var(--over); }

/* Grille carnet : précédent / aujourd'hui */
.s2-grid-scroll { overflow-x: auto; margin: 0 -6px; }
.s2-grid { border-collapse: separate; border-spacing: 6px 5px; }
.s2-grid th { font-weight: var(--fw); color: var(--muted); font-size: var(--fs-s); text-align: center; padding: 0; }
.s2-grid th.extra { color: var(--warn); }
.s2-grid .s2-rowlabel { text-align: left; white-space: nowrap; padding-right: 2px; min-width: 62px; }
.s2-unit { font-size: 12px; }
.s2-grid td { padding: 0; }
.s2-cell {
  position: relative; display: grid; place-items: center; align-content: center; gap: 1px;
  width: 52px; height: 60px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line);
  color: var(--text); padding: 0 0 7px; font: inherit;
}
button.s2-cell { cursor: pointer; }
.s2-cell::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: 5px; height: 4px; border-radius: 2px; background: var(--c, transparent); }
.s2-n { font-family: var(--font-num); font-size: 28px; line-height: 1; font-weight: 600; }
.s2-sub { font-size: 12px; color: var(--muted); line-height: 1.1; }
.s2-sub.band-txt { color: var(--c, var(--muted)); font-weight: 600; }
.s2-prev .s2-cell { background: transparent; border-style: dashed; }
.s2-prev .s2-n { color: #c8ccd2; }
.s2-cell.blank { background: transparent; border-style: dashed; opacity: .3; }
.s2-cell.next { border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.s2-cell.next .s2-n { color: #a9c1ff; }
.s2-cell.next.beat { border-color: var(--ready); background: color-mix(in srgb, var(--ready) 12%, transparent); }
.s2-cell.next.beat .s2-n { color: var(--ready); }
.s2-first { color: var(--muted); font-size: 14px; text-align: left; padding-left: 2px; }
.s2-mark { position: absolute; top: 5px; width: 8px; height: 8px; }
.s2-mark.fail { right: 5px; background: var(--danger); clip-path: polygon(0 0, 100% 0, 100% 100%); width: 10px; height: 10px; top: 3px; right: 3px; }
.s2-mark.asym-light { left: 5px; border-radius: 50%; border: 2px solid var(--warn); }
.s2-mark.asym-marked { left: 5px; border-radius: 50%; background: var(--warn); }
.s2-cell.record { border: 2px solid var(--record); }
.s2-record {
  position: absolute; top: -6px; left: 50%; transform: translateX(-50%); font-size: 10px; line-height: 14px;
  width: 14px; height: 14px; border-radius: 50%; background: var(--record); color: #1a1d21; text-align: center;
}

/* Dock de saisie */
.s2-dock {
  flex: none; background: var(--surface); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
  padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); display: grid; gap: 10px;
}
.s2-undo {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: var(--surface-2); border-radius: 10px; padding: 4px 4px 4px 12px; font-weight: var(--fw-b);
}
.s2-minline { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--muted); }
.s2-setup { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.s2-setno { font-family: var(--font-num); font-size: 24px; font-weight: 600; margin-right: auto; }
.s2-pill {
  display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border-radius: 21px;
  border: 1px solid var(--line); background: var(--bg); font-weight: var(--fw-b); font-size: 17px; color: var(--text); cursor: pointer;
}
.s2-pill .ico { width: 16px; height: 16px; color: var(--muted); }
.band-pill { border: 2px solid var(--c, var(--line)); }
.band-pill::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c, var(--muted)); }
.band-pill.band-noir::before { background: #000; box-shadow: 0 0 0 1px var(--text); }
.s2-sug {
  height: 42px; border-radius: 21px; padding: 0 14px; border: 1px dashed var(--ready); color: var(--ready);
  background: transparent; font-weight: var(--fw-b); font-size: 15px; cursor: pointer;
}

.s2-reps { display: flex; overflow-x: auto; padding: 1px 0; scrollbar-width: none; overscroll-behavior-x: contain; }
.s2-reps::-webkit-scrollbar { display: none; }
.s2-rep {
  flex: none; width: 50px; height: 54px; border: 0; background: transparent; color: var(--muted); cursor: pointer;
  font-family: var(--font-num); font-size: 28px; font-weight: 600; border-radius: 10px;
}
.s2-rep.target { background: var(--surface-2); color: var(--text); border-radius: 0; }
.s2-rep.tstart { border-radius: 10px 0 0 10px; }
.s2-rep.tend { border-radius: 0 10px 10px 0; }
.s2-rep.tstart.tend { border-radius: 10px; }
.s2-rep.on { background: var(--text); color: var(--bg); border-radius: 10px; }

.s2-mods { display: grid; grid-template-columns: auto 1fr; gap: 8px; }
.s2-fail {
  height: 44px; padding: 0 16px; border-radius: 10px; border: 2px solid var(--danger); background: transparent;
  color: #ff8a8e; font-weight: var(--fw-b); font-size: 15px; cursor: pointer;
}
.s2-fail.on { background: var(--danger); color: #fff; }
.s2-seg3 { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.s2-seg3 button {
  height: 44px; border: 0; border-right: 1px solid var(--line); background: transparent; cursor: pointer;
  font-weight: var(--fw-b); font-size: 14px; color: var(--muted); padding: 0 2px;
}
.s2-seg3 button:last-child { border-right: 0; }
.s2-seg3 .on.asym-none { background: var(--surface-2); color: var(--text); }
.s2-seg3 .on.asym-light { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.s2-seg3 .on.asym-marked { background: var(--warn); color: #1a1d21; }
.s2-seg3 .on.reason { background: var(--surface-2); color: var(--text); }
.s2-reasons { margin: 6px 0 12px; }

.s2-cap { font-size: var(--fs-s); color: var(--muted); text-align: center; }
.s2-efforts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.s2-effort {
  position: relative; height: 70px; border-radius: 12px; border: 0; background: var(--c, var(--e3)); color: #fff; cursor: pointer;
  display: grid; place-items: center; align-content: center; gap: 2px; padding: 4px 2px; touch-action: manipulation;
}
.s2-effort.eff-2, .s2-effort.eff-3 { color: #15181b; }
.s2-effort:active { transform: scale(.95); filter: brightness(1.12); }
.s2-effort-n { font-family: var(--font-num); font-size: 32px; line-height: 1; font-weight: 600; }
.s2-effort-l { font-size: 11px; line-height: 1.1; }
.s2-effort.was::before { content: ""; position: absolute; top: 6px; left: 50%; width: 6px; height: 6px; margin-left: -3px; border-radius: 50%; background: currentColor; }
.s2-efforts.select .s2-effort { opacity: .4; }
.s2-efforts.select .s2-effort.sel { opacity: 1; outline: 3px solid var(--text); outline-offset: 2px; }

.s2-complete { display: grid; gap: 10px; }
.s2-complete-title { font-family: var(--font-num); font-size: 24px; font-weight: 600; }
.s2-next { display: grid; gap: 0; padding: 8px 16px; min-height: 66px; }
.s2-next-name { font-weight: var(--fw); font-size: 15px; }

/* Panneaux de la séance */
.s2-sheet-body { display: grid; gap: 12px; }
.s2-field { display: grid; gap: 6px; font-size: var(--fs-s); color: var(--muted); }
.s2-advice { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.s2-loadstep { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; }
.s2-loadstep .step-btn { height: 64px; }
.s2-loadval {
  height: 64px; width: 100%; min-width: 0; text-align: center; border-radius: 12px; border: 1px solid var(--line); background: var(--bg);
  font-family: var(--font-num); font-size: 40px; font-weight: 600;
}
.s2-quick { display: flex; flex-wrap: wrap; gap: 6px; }
.s2-quick .btn-chip { font-family: var(--font-num); font-size: 18px; min-width: 56px; }
.s2-bandlist { display: grid; gap: 8px; }
.s2-bandbtn {
  display: flex; justify-content: space-between; align-items: center; height: 58px; padding: 0 16px; border-radius: 12px;
  border: 2px solid var(--c); background: transparent; color: var(--text); cursor: pointer;
}
.s2-bandbtn.on { background: var(--c); color: #fff; }
.s2-bandbtn.band-noir.on { background: #000; border-color: var(--text); }
.s2-bandbtn.band-jaune.on { color: #15181b; }
.s2-bandname { font-weight: var(--fw-b); font-size: 18px; }
.s2-bandkg { color: var(--muted); font-size: 14px; }
.s2-bandbtn.on .s2-bandkg { color: inherit; }

@media (max-height: 760px) {
  .s2-swipe { gap: 10px; }
  .s2-time { font-size: clamp(60px, 20vw, 84px); }
  .s2-thumb { width: 50px; height: 50px; }
  .s2-name { font-size: 24px; }
  .s2-cell { height: 54px; }
  .s2-effort { height: 60px; }
  .s2-rep { height: 48px; }
  .s2-dock { gap: 8px; padding-top: 10px; }
}

/* ---------------------------------------------------------------- coach IA et programme (V3) */
.chip-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--record); display: inline-block; }
.coach-home { text-align: left; cursor: pointer; border-color: var(--record); color: var(--text); font: inherit; gap: 4px; }
.coach-home-tag { font-size: 12px; font-weight: var(--fw-b); letter-spacing: .05em; text-transform: uppercase; color: var(--record); }
.coach-home-link { color: var(--between); font-weight: var(--fw-b); }
.coach { display: grid; gap: var(--gap); }
.coach-text { min-height: 0; line-height: 1.4; resize: vertical; }
.coach-label { display: grid; gap: 6px; }
.coach-msg { white-space: pre-wrap; line-height: 1.45; overflow-wrap: anywhere; }
.coach-wait { border-color: var(--accent); }
.coach-errors { margin: 0; padding-left: 18px; font-size: var(--fs-s); color: var(--muted); }
.coach-diff { display: grid; gap: 6px; }
.coach-day { font-weight: var(--fw-b); }
.coach-changes { list-style: none; margin: 2px 0 0; padding: 0; display: grid; gap: 4px; font-size: 15px; }
.coach-changes li { display: flex; gap: 8px; line-height: 1.35; }
.coach-changes b { width: 14px; flex: none; text-align: center; }
.ch-add b { color: var(--ready); } .ch-mod b { color: var(--record); } .ch-del b { color: var(--danger); } .ch-mov b { color: var(--muted); }
.coach-folds { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.coach-fold + .coach-fold { border-top: 1px solid var(--line); }
.coach-fold summary {
  min-height: 52px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between;
  font-weight: var(--fw-b); cursor: pointer; list-style: none;
}
.coach-fold summary::-webkit-details-marker { display: none; }
.coach-fold summary::after { content: '›'; color: var(--muted); transition: transform .15s; }
.coach-fold[open] summary::after { transform: rotate(90deg); }
.coach-fold-body { padding: 0 16px 16px; display: grid; gap: 10px; }
.coach-past { gap: 0; }
.coach-past-row {
  display: flex; justify-content: space-between; align-items: center; min-height: 46px; padding: 0; gap: 8px;
  background: none; border: 0; border-bottom: 1px solid var(--line); color: var(--text); font: inherit; cursor: pointer; text-align: left;
}
.coach-past-row:last-child { border-bottom: 0; }
.coach-state { font-size: var(--fs-s); color: var(--muted); }
.coach-state.st-applied { color: var(--ready); } .coach-state.st-done { color: var(--record); } .coach-state.st-error { color: #ff8a8e; }
.coach-dlg { display: grid; gap: 10px; max-height: 58dvh; overflow-y: auto; }
.prog { display: grid; gap: var(--gap); }
.prog-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface); border-radius: var(--r); }
.prog-tab { min-height: 42px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: inherit; cursor: pointer; }
.prog-tab.on { background: var(--accent); color: var(--accent-ink); font-weight: var(--fw-b); }
.prog-day .card-title { justify-content: space-between; font-family: var(--font-num); font-size: 22px; }
.prog-list { list-style: none; margin: 0; padding: 0; display: grid; }
.prog-list li { display: grid; gap: 2px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.prog-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.center-text { text-align: center; }
