/* Layout: une colonne pensée pour le téléphone à la salle ; la vue coach s'élargit pour le tableau.
   Couleurs: celles des disques de musculation calibrés (bleu 20 kg, jaune 15 kg, vert 10 kg, rouge 25 kg). */
:root {
  --bg: #eef1f4; --surface: #ffffff; --surface-2: #e3e8ed; --ink: #17212b; --muted: #55636f; --line: #cdd5dc;
  --accent: #1747b5; --accent-ink: #ffffff; --accent-soft: #dfe7f8;
  --ok: #17693c; --ok-soft: #dcefe3; --warn: #7a5600; --warn-soft: #fbedc2; --bad: #ad1f26; --bad-soft: #f9dfe0;
  --display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif; --body: "Barlow", "Segoe UI", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #11171d; --surface: #1a222a; --surface-2: #27313b; --ink: #edf1f4; --muted: #a2afba; --line: #36424d;
  --accent: #86a8f5; --accent-ink: #0d1a33; --accent-soft: #223156;
  --ok: #7fd3a0; --ok-soft: #173427; --warn: #f0cb68; --warn-soft: #3a2f0f; --bad: #f59a9e; --bad-soft: #421d20; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #11171d; --surface: #1a222a; --surface-2: #27313b; --ink: #edf1f4; --muted: #a2afba; --line: #36424d;
  --accent: #86a8f5; --accent-ink: #0d1a33; --accent-soft: #223156;
  --ok: #7fd3a0; --ok-soft: #173427; --warn: #f0cb68; --warn-soft: #3a2f0f; --bad: #f59a9e; --bad-soft: #421d20; color-scheme: dark }
* { box-sizing: border-box }
body { background: var(--bg); color: var(--ink); font: 400 16px/1.45 var(--body); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 10; background: var(--surface) }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.1; margin: 0; text-wrap: balance }
h1 { font-size: 2rem } h2 { font-size: 1.5rem } h3 { font-size: 1.28rem }
p { margin: 0 } a { color: var(--accent) }
button, input, textarea, select { font: inherit; color: inherit }
button { cursor: pointer }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.num { font-variant-numeric: tabular-nums }
.muted { color: var(--muted) } .small { font-size: .875rem }
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--surface); border-bottom: 1px solid var(--line); padding: 8px max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px)) }
.top-in { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; max-width: 1040px; margin: auto }
.brand { font: 700 1.3rem/1 var(--display); letter-spacing: .01em }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 6px; font-weight: 500; font-size: .9rem; min-height: 36px }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink) }
.demo { background: var(--warn-soft); color: var(--warn); font-size: .85rem; padding-block: 6px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)) }
.demo-in { max-width: 1040px; margin: auto; display: flex; gap: 8px 12px; justify-content: space-between; flex-wrap: wrap; align-items: center }
.demo button { background: none; border: 0; text-decoration: underline; padding: 2px 0; color: inherit; font-weight: 600 }
main { max-width: 620px; margin: auto; padding-block: 20px 110px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: grid; gap: 16px }
main.wide { max-width: 1040px }
main > * { min-width: 0 }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; display: grid; gap: 12px; min-width: 0 }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap } .between { justify-content: space-between }
.stack { display: grid; gap: 8px; min-width: 0 }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; min-height: 44px; font-weight: 500 }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600 }
.btn.block { width: 100%; font-size: 1.05rem; min-height: 52px }
.btn.danger { color: var(--bad); border-color: var(--bad) }
.link { background: none; border: 0; color: var(--accent); padding: 8px 0; text-decoration: underline; font-weight: 500; min-height: 40px }
.nav { position: fixed; inset: auto 0 0; z-index: 5; background: var(--surface); border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 4px max(8px, env(safe-area-inset-right, 0px)) calc(4px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px)) }
.nav button { flex: 1; max-width: 200px; border: 0; background: none; padding: 12px 4px; font-weight: 500; color: var(--muted); border-radius: 8px; min-height: 48px }
.nav button[aria-current="page"] { color: var(--accent); background: var(--accent-soft); font-weight: 600 }
.session { display: flex; justify-content: space-between; gap: 12px; align-items: center; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; min-height: 76px }
.session:hover { border-color: var(--accent) }
.go { font: 700 1.1rem var(--display); color: var(--accent); white-space: nowrap }
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 99px; font-size: .8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); white-space: nowrap }
.pill.ok { background: var(--ok-soft); color: var(--ok) } .pill.tire, .pill.pasplus { background: var(--warn-soft); color: var(--warn) }
.pill.douleur { background: var(--bad-soft); color: var(--bad) } .pill.new { background: var(--accent); color: var(--accent-ink) }
.reply { background: var(--accent-soft); border-radius: 10px; padding: 12px 16px; display: grid; gap: 4px }
.last { background: var(--surface-2); border-radius: 8px; padding: 8px 12px; font-size: .92rem }
.hint { color: var(--accent); font-size: .92rem; font-weight: 500 }
.set { display: grid; grid-template-columns: 2rem minmax(0,1fr) minmax(0,1fr) 2.75rem; gap: 8px; align-items: center }
.set input { width: 100%; min-height: 46px; text-align: center; font-size: 1.15rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); font-variant-numeric: tabular-nums }
.set .x { width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.3rem }
.set-head { font-size: .8rem; color: var(--muted); text-align: center; font-weight: 600 }
.chips { display: flex; flex-wrap: wrap; gap: 6px }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 12px; min-height: 40px; font-size: .92rem; font-weight: 500 }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface); border-color: var(--ink) }
.field { display: grid; gap: 4px; font-size: .875rem; font-weight: 500; color: var(--muted); min-width: 0 }
.field input, .field textarea, .field select, .inp { width: 100%; min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); font-size: 1rem; font-weight: 400 }
textarea { resize: vertical; min-height: 72px }
.file { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px dashed var(--line); border-radius: 8px; font-weight: 500; font-size: .92rem; cursor: pointer }
.file input { position: absolute; opacity: 0; width: 1px; height: 1px }
.file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px }
.timer { position: fixed; z-index: 6; left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(72px + env(safe-area-inset-bottom, 0px)); max-width: 588px; margin: auto; background: var(--ink); color: var(--surface); border-radius: 10px; padding: 8px 8px 8px 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px }
.timer b { font: 700 1.8rem/1 var(--display); font-variant-numeric: tabular-nums }
.timer button { background: none; border: 0; color: inherit; text-decoration: underline; min-height: 44px; padding: 0 8px }
.toast { position: fixed; z-index: 7; top: calc(64px + env(safe-area-inset-top, 0px)); left: 16px; right: 16px; max-width: 420px; margin: auto; background: var(--ok); color: var(--surface); padding: 10px 14px; border-radius: 8px; font-weight: 600; text-align: center }
.line { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 2px 12px; padding-block: 8px; border-top: 1px solid var(--line) }
.line:first-child { border-top: 0 }
.up { color: var(--ok); font-weight: 600 } .down { color: var(--muted); font-weight: 600 }
.client { display: flex; justify-content: space-between; gap: 12px; align-items: center; width: 100%; text-align: left; background: none; border: 0; border-top: 1px solid var(--line); padding: 12px 0; min-height: 60px }
.client:first-of-type { border-top: 0 }
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface) }
table.grid { border-collapse: separate; border-spacing: 0; font-size: .9rem; font-variant-numeric: tabular-nums }
.grid th, .grid td { border-bottom: 1px solid var(--line); border-right: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; white-space: nowrap }
.grid td.cm { white-space: normal; min-width: 130px; max-width: 200px }
.grid th { background: var(--surface-2); font-weight: 600 }
.grid .ex { position: sticky; left: 0; background: var(--surface); z-index: 1; white-space: normal; min-width: 140px; max-width: 170px; font-weight: 500 }
.grid th.ex { background: var(--surface-2) }
.flag-tire { background: var(--warn-soft) } .flag-douleur { background: var(--bad-soft) }
.chart text { font: 500 12px var(--body); fill: var(--muted); font-variant-numeric: tabular-nums }
.chart { display: block; width: 100%; height: auto; touch-action: pan-y }
.tip { min-height: 1.4em; font-size: .92rem; font-weight: 500 }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px }
details > summary { cursor: pointer; font-weight: 600; min-height: 32px }
@media (prefers-reduced-motion: no-preference) { .session, .btn, .chip { transition: border-color .12s, background .12s } }

/* Application réelle */
html { -webkit-text-size-adjust: 100% }
body { margin: 0 }
[hidden] { display: none !important }
.h3 { font: 700 1.28rem/1.1 var(--display) }
.err { color: var(--bad) }
.btn-link { text-decoration: none; display: inline-flex; align-items: center }
.check { gap: 6px; min-height: 44px; flex-wrap: nowrap }
.check input { width: 20px; height: 20px; flex: none }
.danger-link { color: var(--bad) }
.steps { margin: 0; padding-left: 1.25rem; display: grid; gap: 6px }
.toast.bad { background: var(--bad) }
.btn:disabled { opacity: .6 }
