:root {
  --bg: #0b1418;
  --ink: #edf3ef;
  --muted: #96a7a5;
  --muted2: #8a9e9c; /* V1 #6e8583 : contraste 4,1:1 sur les cartes, relevé à 5,7:1 */
  --card: #142327;
  --card-alt: #192b2d;
  --line: #294042;
  --accent: #bcedcc;
  --accent-deep: #234b3d;
  --warm: #f4c28e;
  --error: #ffaaa5;
  --radius: 21px;
  --tabbar: 76px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; background: var(--bg); -webkit-text-size-adjust: 100%; }
body { margin:0; min-height:100vh; background:var(--bg); color:var(--ink); font-size:15px; line-height:1.45; }
button, input, select, textarea { font:inherit; color:inherit; }
button { cursor:pointer; touch-action:manipulation; -webkit-tap-highlight-color:transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity:0.4; cursor: not-allowed; }
#app-content:focus { outline: none; }
/* overflow-x: clip (et non hidden) pour que le bouton Enregistrer collant fonctionne */
.app-shell { max-width: 540px; min-height:100svh; margin:auto; position:relative; padding:0 var(--safe-right) calc(var(--tabbar) + 16px + var(--safe-bottom)) var(--safe-left); overflow-x:clip; }
@media(min-width:700px) { body {background:#091014;} .app-shell { border-left:1px solid #182c30; border-right:1px solid #182c30; box-shadow:0 0 100px #01090b; } }
.topbar { min-height:calc(70px + var(--safe-top)); display:flex; align-items:center; justify-content:space-between; padding:calc(10px + var(--safe-top)) 20px 8px; position:relative; z-index:2; }
.brand { display:flex; align-items:center; gap:10px; border:0; padding:0; min-height:44px; background:none; color:var(--ink); text-align:left; }
.brand-mark { display:flex; align-items:center; justify-content:center; width:39px; height:39px; border-radius:12px; background:var(--accent); color:#103329; font-size:29px; line-height:1; font-weight:700; }
.brand-text { font-size:16px; font-weight:850; letter-spacing:.055em; line-height:1.05; }
.brand-text>span { color:var(--accent); }
.brand-text small { display:block; font-size:10px; letter-spacing:.17em; font-weight:650; color:var(--muted); margin-top:5px; }
.icon-button { height:44px; width:44px; display:grid; place-items:center; border:1px solid var(--line); border-radius:12px; color:var(--muted); background:var(--card); font-size:24px; line-height:1; padding:0; }
.icon-button svg { width:20px; height:20px; stroke:currentColor; fill:none; stroke-linecap:round; stroke-linejoin:round; stroke-width:1.65; }
#app-content { padding: 6px 18px 20px; }
.tabbar { position:fixed; z-index:10; width:min(100%,540px); bottom:0; left:50%; transform:translateX(-50%); height:calc(var(--tabbar) + var(--safe-bottom)); padding:8px calc(8px + var(--safe-right)) calc(8px + var(--safe-bottom)) calc(8px + var(--safe-left)); display:grid; grid-template-columns: repeat(4,1fr); gap:4px; border-top:1px solid #2a3c3c; background:rgba(15,27,30,.97); backdrop-filter:blur(18px); -webkit-backdrop-filter:blur(18px); }
.tab { display:flex; flex-direction:column; gap:3px; align-items:center; justify-content:center; padding:4px 0; background:transparent; border:0; color:#91a3a2; font-size:12px; font-weight:600; border-radius:14px; }
.tab svg { width:22px; height:22px; fill:none; stroke:currentColor; stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round; }
.tab.active { color:var(--accent); background:#1b3430; }
h1,h2,h3,p { margin-top:0; }
h1 { font-size:28px; line-height:1.13; letter-spacing:-.035em; margin:6px 0 8px; font-weight:750; }
h2 { font-size:18px; line-height:1.25; letter-spacing:-.02em; margin:0; font-weight:750; }
h3 { font-size:15px; letter-spacing:-.01em; margin:0; }
.eyebrow { text-transform:uppercase; color:var(--accent); letter-spacing:.14em; font-size:11px; font-weight:750; }
.subtle { color:var(--muted); font-size:14px; line-height:1.5; }
.subtle strong { color:var(--ink); }
.small { font-size:13px; color:var(--muted); }
.hero { overflow:hidden; position:relative; padding:18px 20px 20px; border-radius:24px; margin:4px 0 14px; background:radial-gradient(ellipse at 100% 0%,#285c50 0%,transparent 58%),linear-gradient(128deg,#1c413a,#122827 72%); border:1px solid #315a4d; }
.hero:after { content:"↗"; position:absolute; font-size:190px; line-height:1; right:-30px; top:-22px; font-weight:200; color:#b2f2c5; opacity:.1; pointer-events:none; }
.hero h1 { max-width:320px; margin:8px 0 12px; font-size:26px; position:relative; z-index:1; }
.hero .eyebrow { color:#c9f9d7; position:relative; z-index:1; }
.pill { display:inline-block; position:relative; z-index:1; border:1px solid #407568; background:rgba(170,230,195,.1); border-radius:99px; color:#c5ecd4; padding:6px 10px; font-size:12px; font-weight:680; letter-spacing:.02em; }
.section-head { display:flex; justify-content:space-between; align-items:center; margin:22px 1px 8px; gap:10px; }
.text-button { color:var(--accent); background:none; border:0; font-size:14px; font-weight:650; padding:0; min-height:44px; display:inline-flex; align-items:center; text-align:left; }
.text-button.block { display:flex; width:100%; }
.today h2 { margin-bottom:6px; }
.today-row { display:flex; gap:12px; align-items:center; padding:12px 0; border-bottom:1px solid var(--line); }
.today-row strong { display:block; font-size:15px; }
.today-row small { display:block; color:var(--muted); font-size:13px; margin-top:2px; }
.status { width:30px; height:30px; flex:0 0 auto; border-radius:50%; display:grid; place-items:center; border:1.5px dashed #4f6a66; color:#0e3027; font-weight:850; font-size:15px; }
.status.done { border:0; background:var(--accent); }
.today .primary { margin-top:16px; }
.today .secondary { margin-top:8px; }
.stats { display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.stat { border-radius:17px; padding:14px 14px 13px; background:var(--card); border:1px solid var(--line); min-height:98px; }
.stat .value { font-size:26px; font-weight:780; letter-spacing:-.04em; line-height:1.3; font-variant-numeric:tabular-nums; margin:4px 0 3px; }
.stat .value small { font-size:14px; color:var(--muted); font-weight:500; letter-spacing:0; }
.stat .label { color:var(--muted); font-size:13px; }
.stat .foot { font-size:12px; color:var(--muted2); }
.card { border:1px solid var(--line); background:var(--card); border-radius:20px; padding:17px; margin-bottom:12px; }
.card-soft { background:linear-gradient(130deg,#17312d,#142526 80%); border-color:#315c50; }
.card-header { display:flex; align-items:center; justify-content:space-between; gap:8px; margin-bottom:12px; }
.card-header .tag { border-radius:99px; padding:6px 9px; background:#203a36; color:var(--accent); font-size:11px; font-weight:750; white-space:nowrap; }
.progress-block { margin:12px 0 16px; }
.progress-line { display:flex; justify-content:space-between; margin-bottom:7px; align-items:baseline; gap:8px; }
.progress-line .name { font-size:14px; color:var(--ink); }
.progress-line .num { font-size:13px; color:var(--muted); font-variant-numeric:tabular-nums; text-align:right; }
.track { width:100%; height:7px; border-radius:99px; background:#29403e; overflow:hidden; }
.fill { height:100%; width:0; background:var(--accent); border-radius:99px; transition:width .25s; }
.fill.warm { background:var(--warm); }
.fill.blue { background:#8dc8db; }
.empty { color:var(--muted); border:1px dashed #35504d; border-radius:15px; padding:22px 14px; text-align:center; line-height:1.5; font-size:14px; }
.chart { margin:0; width:100%; display:block; }
.chart svg { display:block; width:100%; height:auto; }
.chart-summary { color:var(--muted); font-size:13px; margin-top:6px; }
.chart-labels { display:flex; justify-content:space-between; color:var(--muted2); font-size:12px; margin-top:4px; }
.primary { width:100%; min-height:52px; display:flex; align-items:center; justify-content:center; gap:9px; padding:12px 14px; font-size:16px; font-weight:750; color:#0e3027; background:var(--accent); border:0; border-radius:15px; }
.primary:active { transform:scale(.99); }
.secondary { width:100%; min-height:48px; padding:10px 12px; border:1px solid #4b7868; background:#1c3c35; color:var(--accent); border-radius:13px; font-size:15px; font-weight:700; }
.quiet { min-height:46px; color:var(--muted); background:transparent; border:1px solid var(--line); border-radius:12px; padding:11px 12px; font-size:14px; }
.wide { width:100%; margin-top:9px; }
.danger { color:var(--error) !important; }
.back-button { background:none; border:0; color:var(--accent); font-size:15px; font-weight:650; min-height:44px; padding:0 2px; }
.fineprint { color:var(--muted2); font-size:12px; line-height:1.55; }
.page-head { margin:6px 1px 18px; }
.page-head p { font-size:14px; color:var(--muted); line-height:1.55; max-width:420px; margin:0; }
.field { display:block; margin:0 0 16px; }
.field label, .field > span:not(.field-help):not(.field-error) { display:block; font-size:14px; font-weight:650; margin:0 0 8px; color:#dbe6df; }
/* 16 px minimum : en dessous, Safari iOS zoome sur le champ à chaque appui */
.field input:not([type="checkbox"]):not([type="file"]), .field select, .field textarea { width:100%; min-height:48px; padding:12px; border:1px solid #385252; background:#101c20; border-radius:12px; color:var(--ink); font-size:16px; }
.field input[type="file"] { font-size:15px; max-width:100%; }
.field textarea { min-height:84px; resize:vertical; line-height:1.45; }
.field input[type=date] { color-scheme: dark; display:block; -webkit-appearance:none; appearance:none; text-align:left; }
.field ::placeholder { color:#7d9391; }
.field [aria-invalid="true"] { border-color:var(--error) !important; }
.field-error { display:block; color:var(--error); font-size:13px; font-weight:600; margin-top:6px; }
.field-help { color:var(--muted2); font-size:13px; font-weight:400; display:block; margin-top:6px; }
.cols-2 { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.mini-field { display:block; }
.field .mini-field span:not(.field-error) { display:block; font-size:13px; font-weight:500; color:var(--muted); margin-bottom:6px; }
.date-nav { display:grid; grid-template-columns:48px minmax(0,1fr) 48px; gap:8px; align-items:center; }
.date-nav .icon-button { width:48px; height:48px; font-size:26px; }
.rate { margin-bottom:18px; }
.rate-title { display:flex; justify-content:space-between; align-items:baseline; gap:8px; margin-bottom:9px; }
.rate-title strong { font-size:14px; }
.rate-title span { font-size:12px; color:var(--muted); text-align:right; }
.ratings { display:grid; grid-template-columns:repeat(5,1fr); gap:7px; }
.rating { height:48px; border-radius:12px; border:1px solid #36504c; background:#102124; color:var(--muted); font-size:16px; font-weight:750; }
.rating.selected { border-color:#bbe8c8; background:#285144; color:#d4f3db; }
.checkbox-field { display:flex; gap:12px; align-items:center; min-height:56px; padding:13px; border:1px solid var(--line); background:#102124; border-radius:13px; margin-bottom:17px; font-size:14px; line-height:1.4; cursor:pointer; }
.checkbox-field input { appearance:none; -webkit-appearance:none; width:26px; height:26px; margin:0; flex:0 0 auto; border:1px solid #698076; border-radius:7px; background:transparent; }
.checkbox-field input:checked { border-color:var(--accent); background:var(--accent); }
.checkbox-field input:checked::after { content:"✓"; display:block; color:#0e3027; font-weight:850; font-size:18px; line-height:26px; text-align:center; }
/* Bouton d'enregistrement toujours accessible au pouce, au-dessus de la barre d'onglets */
.form-actions { position:sticky; bottom:calc(var(--tabbar) + 8px + var(--safe-bottom)); z-index:3; margin:4px -17px -17px; padding:14px 17px 17px; border-radius:0 0 20px 20px; background:linear-gradient(to bottom, rgba(20,35,39,0), var(--card) 26%); }
.segmented { border:0; padding:0; margin:0 0 4px; min-width:0; }
.segmented legend { font-size:14px; font-weight:650; color:#dbe6df; padding:0; margin-bottom:8px; }
.seg-row { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.seg { position:relative; display:block; cursor:pointer; }
.seg input { position:absolute; opacity:0; width:1px; height:1px; margin:0; }
.seg span { display:block; min-height:60px; padding:10px 12px; border:1px solid #3a5350; border-radius:14px; background:#102124; color:var(--muted); font-weight:750; font-size:16px; }
.seg small { display:block; font-weight:500; font-size:12px; margin-top:2px; }
.seg input:checked + span { border-color:var(--accent); background:#214838; color:#d4f3db; }
.notice { padding:13px 14px; border-radius:13px; border:1px solid #415d4f; background:#193229; font-size:13px; line-height:1.6; color:#bdd4c2; margin:12px 0; }
.notice strong { color:var(--ink); }
.notice-alert { border-color:#7a4a47; background:#2a1c1d; color:#ffd9d6; }
.notice-draft { border-color:#6b5a3a; background:#262116; color:#f3dcb9; }
.notice-draft .text-button { color:var(--warm); }
.notice-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:10px; }
.update-banner { margin:0 18px 8px; padding:6px 14px; border-radius:13px; background:#1c3c35; border:1px solid #4b7868; font-size:14px; display:flex; align-items:center; justify-content:space-between; gap:10px; }
.exercise { display:grid; grid-template-columns:1fr auto; align-items:center; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.exercise:last-of-type { border-bottom:0; }
.exercise strong { font-size:15px; display:block; font-weight:650; }
.exercise small { font-size:13px; color:var(--muted); line-height:1.4; display:block; margin-top:3px; }
.exercise .reps { color:var(--accent); white-space:nowrap; font-size:14px; font-weight:800; font-variant-numeric: tabular-nums; }
.session-row { display:flex; align-items:center; justify-content:space-between; padding:10px 0; border-bottom:1px solid var(--line); gap:10px; }
.session-row:last-child { border:0; }
.session-row .day { font-size:14px; font-weight:700; }
.session-row .desc { color:var(--muted); font-size:13px; margin-top:3px; }
.session-row .right { color:var(--accent); font-size:12px; font-weight:800; }
.marker { display:inline-flex; align-items:center; justify-content:center; width:36px; height:36px; border-radius:11px; background:#25473c; color:var(--accent); font-size:14px; font-weight:750; flex:0 0 auto; }
.summary-line { display:flex; justify-content:space-between; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--line); font-size:14px; }
.summary-line:last-child { border:0; }
.summary-line span { color:var(--muted); }
.summary-line strong { font-variant-numeric:tabular-nums; text-align:right; }
.inline-actions { display:flex; gap:14px; }
.steps { margin:14px 0 16px; padding-left:20px; color:var(--muted); font-size:14px; line-height:1.5; }
.steps li { margin-bottom:6px; }
/* En haut de l'écran : ne masque jamais le bouton Enregistrer, collé en bas */
.toast { position:fixed; z-index:100; top:calc(12px + var(--safe-top)); left:50%; transform:translate(-50%,-20px); background:#d4eed9; color:#183128; font-size:14px; line-height:1.45; padding:12px 16px; border-radius:12px; width:max-content; max-width: min(420px, calc(100vw - 32px)); opacity:0; visibility:hidden; transition:opacity .2s, transform .2s; box-shadow:0 8px 35px #001a1966; text-align:center; }
.toast.show { opacity:1; transform:translate(-50%,0); visibility:visible; }
hr { border:0; height:1px; background:var(--line); margin:16px 0; }
@media (prefers-reduced-motion: reduce){ *, *::after, *::before { transition:none !important; animation:none !important; } }
