/* ==========================================================================
   Gymini — feuille de styles
   ========================================================================== */
:root {
  --bg: #f3f5f7;
  --bg-elev: #ffffff;
  --bg-soft: #e9eef2;
  --ink: #0e1b26;
  --ink-2: #4a5966;
  --ink-3: #8794a0;
  --line: #e2e8ed;
  --accent: #0fb5a3;
  --accent-ink: #ffffff;
  --accent-soft: #d5f5f1;
  --accent-2: #6d5efc;
  --navy: #0d2333;
  --danger: #ef4c5a;
  --danger-soft: #fde4e7;
  --warn: #f5a524;
  --gold: #f2b01e;
  --shadow: 0 1px 2px rgba(14, 27, 38, .05), 0 8px 24px rgba(14, 27, 38, .06);
  --shadow-lg: 0 10px 40px rgba(14, 27, 38, .18);
  --radius: 20px;
  --radius-sm: 12px;
  --nav-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a1118; --bg-elev: #131d26; --bg-soft: #1b2732; --ink: #eef3f6; --ink-2: #a9b6c1; --ink-3: #6c7b88;
    --line: #22303c; --accent-soft: #0f3a37; --navy: #0b1a25; --danger-soft: #3a1a20;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0a1118; --bg-elev: #131d26; --bg-soft: #1b2732; --ink: #eef3f6; --ink-2: #a9b6c1; --ink-3: #6c7b88;
  --line: #22303c; --accent-soft: #0f3a37; --navy: #0b1a25; --danger-soft: #3a1a20;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.4;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.02em; }
h1 { font-size: 30px; font-weight: 800; }
h2 { font-size: 21px; font-weight: 750; }
h3 { font-size: 17px; font-weight: 700; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.center { text-align: center; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Structure ---------- */
#app { min-height: 100dvh; }
.page {
  max-width: 760px; margin: 0 auto;
  padding: calc(var(--safe-t) + 18px) 16px calc(var(--nav-h) + var(--safe-b) + 90px);
  animation: fadeUp .25s ease;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.topbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; min-height: 48px; }
.topbar h1, .topbar h2 { flex: 1; min-width: 0; }
.topbar .title-center { flex: 1; text-align: center; font-weight: 700; font-size: 18px; }

.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-head h2 { font-size: 19px; }

/* ---------- Navigation du bas ---------- */
.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + var(--safe-b)); width: min(560px, calc(100% - 20px));
  height: var(--nav-h); display: flex; align-items: center; justify-content: space-around;
  background: color-mix(in srgb, var(--bg-elev) 88%, transparent);
  backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px);
  border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow-lg); z-index: 50; padding: 0 6px;
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 8px 0;
  color: var(--ink-3); font-size: 11px; font-weight: 600; border-radius: 18px; transition: color .15s, background .15s;
}
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--accent); background: var(--accent-soft); }

.live-pill {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + 20px + var(--safe-b)); z-index: 49;
  display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px;
  background: var(--navy); color: #fff; border-radius: 999px; box-shadow: var(--shadow-lg);
  font-weight: 650; font-size: 14px; border: 0; white-space: nowrap; max-width: calc(100% - 32px);
}
.live-pill .dot { width: 10px; height: 10px; border-radius: 50%; background: #2ee6a8; box-shadow: 0 0 0 0 rgba(46,230,168,.6); animation: pulse 1.6s infinite; }
.live-pill .time { font-variant-numeric: tabular-nums; color: #7ef0cb; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(46,230,168,.6); } 70% { box-shadow: 0 0 0 10px rgba(46,230,168,0); } 100% { box-shadow: 0 0 0 0 rgba(46,230,168,0); } }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 700; font-size: 15px;
  background: var(--bg-soft); color: var(--ink); transition: transform .08s, opacity .15s, background .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn svg { width: 19px; height: 19px; flex: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 35%, transparent); }
.btn.dark { background: var(--navy); color: #fff; }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.ghost { background: transparent; color: var(--accent); padding-left: 8px; padding-right: 8px; }
.btn.outline { background: transparent; border: 1.5px solid var(--line); }
.btn.block { width: 100%; }
.btn.lg { padding: 17px 22px; font-size: 17px; border-radius: 18px; }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 11px; }
.icon-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 0; display: inline-grid; place-items: center; flex: none;
  background: var(--bg-elev); color: var(--ink); box-shadow: var(--shadow);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.flat { box-shadow: none; background: var(--bg-soft); }
.icon-btn.sm { width: 36px; height: 36px; }
.icon-btn.sm svg { width: 18px; height: 18px; }
.icon-btn.on { color: var(--gold); }
.fab {
  position: fixed; right: max(18px, calc(50% - 360px)); bottom: calc(var(--nav-h) + 24px + var(--safe-b)); z-index: 45;
  width: 60px; height: 60px; border-radius: 20px; border: 0; background: var(--accent); color: #fff;
  display: grid; place-items: center; box-shadow: 0 10px 30px color-mix(in srgb, var(--accent) 45%, transparent);
}
.fab svg { width: 28px; height: 28px; }

/* ---------- Cartes ---------- */
.card { background: var(--bg-elev); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.tap { transition: transform .1s; cursor: pointer; }
.card.tap:active { transform: scale(.985); }
.list-card { background: var(--bg-elev); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.list-item:last-child { border-bottom: 0; }
.list-item.tap { cursor: pointer; }
.list-item.tap:active { background: var(--bg-soft); }

.hero {
  background: radial-gradient(120% 140% at 100% 0%, #1fd3bd 0%, #0fb5a3 35%, #0d2333 100%);
  color: #fff; border-radius: 26px; padding: 22px; box-shadow: var(--shadow-lg); position: relative; overflow: hidden;
}
.hero::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%; background: rgba(255,255,255,.08); }
.hero .eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: .12em; opacity: .8; font-weight: 700; }
.hero h2 { color: #fff; font-size: 24px; margin: 6px 0 4px; }
.hero .btn { background: #fff; color: var(--navy); }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: var(--bg-elev); border-radius: 18px; padding: 14px 12px; box-shadow: var(--shadow); }
.stat .v { font-size: 24px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--ink-3); font-weight: 600; margin-top: 2px; }

/* ---------- Puces / filtres ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chip {
  flex: none; border: 1.5px solid var(--line); background: var(--bg-elev); color: var(--ink-2);
  padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 650; white-space: nowrap;
}
.chip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
:root[data-theme="dark"] .chip.on { background: var(--accent); border-color: var(--accent); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip.on { background: var(--accent); border-color: var(--accent); } }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: var(--bg-soft); color: var(--ink-2); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.gold { background: #fff3d1; color: #a26b00; }

.segmented { display: flex; background: var(--bg-soft); border-radius: 14px; padding: 4px; gap: 4px; }
.segmented button { flex: 1; border: 0; background: transparent; padding: 9px 6px; border-radius: 10px; font-weight: 650; font-size: 14px; color: var(--ink-2); }
.segmented button.on { background: var(--bg-elev); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- Formulaires ---------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.input, select.input, textarea.input {
  width: 100%; border: 1.5px solid var(--line); background: var(--bg-elev); border-radius: 14px;
  padding: 13px 14px; font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; appearance: none;
}
textarea.input { min-height: 90px; resize: vertical; }
select.input {
  padding-right: 42px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 20px;
}
details.activity summary { list-style: none; display: flex; align-items: center; gap: 10px; cursor: pointer; }
details.activity summary::-webkit-details-marker { display: none; }
details.activity .chev { color: var(--ink-3); transition: transform .2s; flex: none; }
details.activity[open] .chev { transform: rotate(180deg); }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.search { position: relative; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--ink-3); }
.search .input { padding-left: 44px; background: var(--bg-elev); border-color: transparent; box-shadow: var(--shadow); }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; }
.switch input { appearance: none; width: 50px; height: 30px; border-radius: 999px; background: var(--bg-soft); position: relative; transition: background .2s; flex: none; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(20px); }
.days { display: flex; gap: 6px; }
.days button { flex: 1; aspect-ratio: 1; max-width: 46px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--bg-elev); font-weight: 700; font-size: 14px; color: var(--ink-2); }
.days button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.colors { display: flex; gap: 10px; flex-wrap: wrap; }
.colors button { width: 34px; height: 34px; border-radius: 50%; border: 3px solid transparent; outline: 2px solid transparent; }
.colors button.on { border-color: var(--bg-elev); outline-color: var(--ink); }

.stepper { display: flex; align-items: center; background: var(--bg-soft); border-radius: 16px; overflow: hidden; }
.stepper button { width: 46px; height: 56px; border: 0; background: transparent; font-size: 24px; font-weight: 500; color: var(--ink-2); flex: none; }
.stepper input { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; text-align: center; font-size: 24px; font-weight: 800; height: 56px; outline: none; font-variant-numeric: tabular-nums; }
.stepper-label { font-size: 12px; font-weight: 700; color: var(--ink-3); text-align: center; margin-top: 6px; text-transform: uppercase; letter-spacing: .06em; }

/* ---------- Connexion / NIP ---------- */
.login { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 20px; text-align: center; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 850; font-size: 28px; letter-spacing: -.04em; }
.brand .logo { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, #1fd3bd, #0d2333); display: grid; place-items: center; color: #fff; }
.brand .logo svg { width: 26px; height: 26px; }
.profiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 22px; margin: 34px 0; max-width: 520px; }
.profile-tile { background: none; border: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; width: 96px; }
.profile-tile .avatar { width: 88px; height: 88px; font-size: 32px; transition: transform .15s; }
.profile-tile:active .avatar { transform: scale(.94); }
.profile-tile span { font-weight: 700; font-size: 15px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  color: #fff; font-weight: 800; font-size: 17px; background: var(--accent); overflow: hidden; object-fit: cover;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.xl { width: 110px; height: 110px; font-size: 40px; }
.pin-dots { display: flex; gap: 14px; justify-content: center; margin: 26px 0 30px; height: 18px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink-3); transition: all .15s; }
.pin-dots i.on { background: var(--accent); border-color: var(--accent); transform: scale(1.1); }
.pin-dots.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.pinpad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px; justify-content: center; }
.pinpad button { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--bg-elev); box-shadow: var(--shadow); font-size: 28px; font-weight: 600; display: grid; place-items: center; }
.pinpad button:active { background: var(--accent-soft); }
.pinpad button.ghost { background: transparent; box-shadow: none; }
.pinpad button.ok { background: var(--accent); color: #fff; }
.pinpad button svg { width: 26px; height: 26px; }

/* ---------- Exercices ---------- */
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
.ex-card { background: var(--bg-elev); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; cursor: pointer; position: relative; transition: transform .1s; }
.ex-card:active { transform: scale(.97); }
.ex-card .thumb { aspect-ratio: 1 / 1; }
.ex-card .body { padding: 10px 12px 12px; }
.ex-card .name { font-weight: 700; font-size: 14px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 35px; }
.ex-card .meta { font-size: 12px; color: var(--ink-3); margin-top: 4px; font-weight: 600; }
.ex-card .fav { position: absolute; top: 8px; right: 8px; color: var(--gold); filter: drop-shadow(0 1px 2px rgba(0,0,0,.3)); }
.ex-card .fav svg { width: 20px; height: 20px; }
.thumb { background: var(--bg-soft); position: relative; overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.sm { width: 54px; height: 54px; border-radius: 14px; flex: none; }
.thumb .count { position: absolute; bottom: 6px; right: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; }
.placeholder { width: 100%; height: 100%; display: grid; place-items: center; color: #fff; position: relative; }
.placeholder svg { width: 42%; height: 42%; opacity: .95; }
.placeholder .ph-label { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; font-size: 11px; font-weight: 700; opacity: .85; letter-spacing: .04em; text-transform: uppercase; }
.thumb.sm .placeholder svg { width: 55%; height: 55%; }
.thumb.sm .ph-label { display: none; }

/* Galerie d'images (mode « flip-book ») */
.gallery { position: relative; border-radius: 24px; overflow: hidden; background: var(--bg-elev); box-shadow: var(--shadow); aspect-ratio: 4 / 3.2; touch-action: pan-y; user-select: none; }
.gallery img, .gallery .placeholder { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .35s ease; }
.gallery img.on, .gallery .placeholder { opacity: 1; }
.gallery .dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 6px; }
.gallery .dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(120,130,140,.45); transition: all .2s; }
.gallery .dots i.on { background: var(--accent); width: 20px; border-radius: 4px; }
.gallery .play { position: absolute; top: 12px; right: 12px; border: 0; border-radius: 999px; background: rgba(13,35,51,.75); color: #fff; padding: 7px 12px; font-size: 13px; font-weight: 700; display: flex; gap: 6px; align-items: center; backdrop-filter: blur(6px); }
.gallery .play svg { width: 15px; height: 15px; }
.gallery .num { position: absolute; top: 12px; left: 12px; background: rgba(13,35,51,.6); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px; }

.img-manager { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.img-manager .it { position: relative; aspect-ratio: 1; border-radius: 14px; overflow: hidden; background: var(--bg-soft); }
.img-manager .it img { width: 100%; height: 100%; object-fit: cover; }
.img-manager .it .tools { position: absolute; inset: auto 0 0 0; display: flex; justify-content: space-between; padding: 4px; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
.img-manager .it .tools button { width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(255,255,255,.9); color: #111; display: grid; place-items: center; }
.img-manager .it .tools button svg { width: 15px; height: 15px; }
.img-manager .it .pos { position: absolute; top: 5px; left: 5px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; font-weight: 800; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; }
.img-manager .add { aspect-ratio: 1; border-radius: 14px; border: 2px dashed var(--line); background: transparent; color: var(--ink-3); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 700; }
.img-manager .add svg { width: 26px; height: 26px; }

/* ---------- Programmes / séances ---------- */
.prog-card { position: relative; overflow: hidden; padding-left: 22px; }
.prog-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c, var(--accent)); }
.thumb-row { display: flex; gap: 6px; margin-top: 12px; overflow: hidden; }
.thumb-row .thumb { width: 42px; height: 42px; border-radius: 11px; flex: none; }
.thumb-row .more { width: 42px; height: 42px; border-radius: 11px; background: var(--bg-soft); display: grid; place-items: center; font-size: 13px; font-weight: 800; color: var(--ink-2); flex: none; }
.we-item { display: flex; gap: 12px; padding: 14px 14px 14px 10px; border-bottom: 1px solid var(--line); align-items: flex-start; background: var(--bg-elev); }
.we-item:last-child { border-bottom: 0; }
.we-item .handle { display: flex; flex-direction: column; gap: 2px; padding-top: 4px; }
.we-item .handle button { width: 28px; height: 24px; border: 0; background: transparent; color: var(--ink-3); display: grid; place-items: center; padding: 0; }
.we-item .handle button svg { width: 18px; height: 18px; }
.we-fields { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 10px; }
.we-fields label { white-space: nowrap; display: flex; flex-direction: column; gap: 3px; font-size: 10px; font-weight: 800; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.we-fields input { width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 7px 6px; font-size: 15px; font-weight: 700; text-align: center; background: var(--bg); outline: none; }
.we-fields input:focus { border-color: var(--accent); }
.save-ind { font-size: 12px; font-weight: 700; color: var(--ink-3); }

/* ---------- Lecteur d'entraînement ---------- */
.player { padding-bottom: calc(40px + var(--safe-b)); }
.player .topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); margin: calc(-18px - var(--safe-t)) -16px 12px; padding: calc(var(--safe-t) + 10px) 16px 10px; }
.chrono { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; color: var(--accent); }
.chrono svg { width: 17px; height: 17px; }
.ex-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 12px; margin: 0 -16px; scrollbar-width: none; scroll-snap-type: x proximity; }
.ex-strip::-webkit-scrollbar { display: none; }
.ex-strip button { flex: none; border: 2px solid transparent; padding: 0; background: none; border-radius: 15px; position: relative; scroll-snap-align: center; }
.ex-strip button .thumb { width: 52px; height: 52px; border-radius: 13px; }
.ex-strip button.on { border-color: var(--accent); }
.ex-strip button .done { position: absolute; right: -4px; top: -4px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; border: 2px solid var(--bg); }
.ex-strip button .done svg { width: 11px; height: 11px; }
.ex-strip .add { width: 52px; height: 52px; border-radius: 13px; border: 2px dashed var(--line); display: grid; place-items: center; color: var(--ink-3); }

.rings { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 22px 0 18px; text-align: center; }
.ring { position: relative; width: 100%; max-width: 110px; aspect-ratio: 1; margin: 0 auto; display: grid; place-items: center; border: 0; background: none; padding: 0; }
.ring > svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring .track { stroke: var(--bg-soft); }
.ring .bar { stroke: var(--accent); stroke-linecap: round; transition: stroke-dashoffset .5s ease; }
.ring.rest .bar { stroke: #ff8a8a; }
.ring.rest.running .bar { stroke: var(--warn); transition: stroke-dashoffset 1s linear; }
.ring .val { font-size: 27px; font-weight: 800; letter-spacing: -.03em; font-variant-numeric: tabular-nums; position: relative; }
.ring .val svg { width: 30px; height: 30px; color: #ff6b6b; }
.ring-label { font-size: 13px; color: var(--ink-2); font-weight: 600; margin-top: 8px; line-height: 1.2; }

.log-panel { background: var(--bg-elev); border-radius: 24px; padding: 16px; box-shadow: var(--shadow); }
.log-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.log-grid > * { min-width: 0; }
.set-list .list-item { padding: 11px 16px; }
.set-num { width: 30px; font-weight: 800; color: var(--accent); }
.suggest { display: flex; gap: 10px; align-items: flex-start; background: var(--accent-soft); border-radius: 16px; padding: 12px 14px; font-size: 14px; color: var(--ink); }
.suggest svg { width: 20px; height: 20px; color: var(--accent); flex: none; margin-top: 1px; }
.timer-big { font-size: 54px; font-weight: 800; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: -.03em; }

/* ---------- Historique (journal) ---------- */
.hist-day { background: var(--bg-elev); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow); margin-bottom: 12px; }
.hist-day .head { padding: 11px 16px; background: var(--bg-soft); font-weight: 750; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hist-day .line { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.hist-day .line .n { color: var(--accent); font-weight: 750; width: 28px; }
.hist-day .line .n.set-time { width: auto; min-width: 52px; font-size: 14px; }
.hist-day .line .t { margin-left: auto; color: var(--ink-3); font-size: 14px; }
.hist-day .line .c { font-size: 13px; color: var(--ink-3); font-style: italic; }

/* ---------- Graphique ---------- */
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--ink-3); font-size: 11px; font-weight: 600; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: url(#chartFill); }
.chart .pt { fill: var(--bg-elev); stroke: var(--accent); stroke-width: 2.5; }
.chart .pt.pr { fill: var(--gold); stroke: var(--gold); }

/* ---------- Calendrier ---------- */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 6px; text-align: center; }
.cal .dow { font-size: 12px; font-weight: 700; color: var(--accent); padding-bottom: 8px; text-transform: lowercase; }
.cal .d { min-height: 56px; display: flex; flex-direction: column; align-items: center; gap: 3px; padding-top: 4px; border-radius: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.cal .d.out { color: var(--ink-3); opacity: .5; }
.cal .d.today > span:first-child { color: var(--accent); font-weight: 850; }
.cal .d.tap { cursor: pointer; }
.cal .badge { font-size: 10.5px; font-weight: 800; color: #fff; padding: 2px 6px; border-radius: 999px; background: var(--accent); }
.cal .badge.mid { background: #b8b46a; }
.cal .badge.low { background: #e08a6d; }
.cal .plan { color: var(--accent); opacity: .8; }
.cal .plan svg { width: 18px; height: 18px; }

.bars .bar-row { display: grid; grid-template-columns: 110px 1fr 34px; gap: 10px; align-items: center; margin-bottom: 9px; font-size: 14px; font-weight: 600; }
.bars .track { height: 10px; border-radius: 999px; background: var(--bg-soft); overflow: hidden; }
.bars .fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

/* ---------- Feuilles modales ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(5, 12, 18, .45); z-index: 100; opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.sheet-backdrop.on { opacity: 1; }
.sheet {
  position: fixed; left: 50%; bottom: 0; transform: translate(-50%, 100%); width: min(640px, 100%);
  max-height: 92dvh; background: var(--bg); border-radius: 28px 28px 0 0; z-index: 101;
  transition: transform .28s cubic-bezier(.2, .9, .3, 1); display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.sheet.on { transform: translate(-50%, 0); }
.sheet.full { height: 92dvh; }
.sheet .grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 10px auto 4px; flex: none; }
.sheet .sheet-head { display: flex; align-items: center; gap: 10px; padding: 6px 18px 12px; flex: none; }
.sheet .sheet-head h3 { flex: 1; font-size: 19px; }
.sheet .sheet-body { overflow-y: auto; padding: 4px 18px 18px; flex: 1; -webkit-overflow-scrolling: touch; }
.sheet .sheet-foot { padding: 12px 18px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 10px; flex: none; background: var(--bg); }
@media (min-width: 700px) {
  .sheet { bottom: 50%; transform: translate(-50%, 60%); border-radius: 28px; opacity: 0; transition: transform .25s, opacity .2s; max-height: 86dvh; }
  .sheet.on { transform: translate(-50%, 50%); opacity: 1; }
  .sheet.full { height: 86dvh; }
  .sheet .grabber { display: none; }
  .sheet .sheet-head { padding-top: 18px; }
}

.pick-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.pick-item .check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; color: #fff; transition: all .15s; }
.pick-item .check svg { width: 15px; height: 15px; opacity: 0; }
.pick-item.on .check { background: var(--accent); border-color: var(--accent); }
.pick-item.on .check svg { opacity: 1; }
.group-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
.group-card { border: 0; border-radius: 16px; padding: 16px 14px; text-align: left; color: #fff; font-weight: 750; font-size: 16px; background: linear-gradient(135deg, var(--navy), #19445e); position: relative; overflow: hidden; min-height: 64px; }
.group-card small { display: block; font-weight: 600; opacity: .7; font-size: 12px; margin-top: 2px; }
.group-card::after { content: ""; position: absolute; right: -20px; top: -20px; width: 80px; height: 80px; border-radius: 50%; background: rgba(255,255,255,.07); }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; top: calc(var(--safe-t) + 12px); left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: calc(100% - 32px); max-width: 420px; }
.toast { background: var(--navy); color: #fff; padding: 12px 18px; border-radius: 16px; font-weight: 650; font-size: 15px; box-shadow: var(--shadow-lg); animation: toastIn .25s ease; display: flex; gap: 10px; align-items: center; }
.toast.err { background: var(--danger); }
.toast.pr { background: linear-gradient(135deg, #f2b01e, #f97316); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-10px) scale(.96); } }

.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty svg { width: 54px; height: 54px; opacity: .5; margin-bottom: 10px; }
.empty h3 { color: var(--ink); margin-bottom: 6px; }

.feel { display: flex; justify-content: space-between; gap: 6px; }
.feel button { flex: 1; font-size: 28px; padding: 10px 0; border-radius: 14px; border: 2px solid transparent; background: var(--bg-elev); filter: grayscale(1); opacity: .6; }
.feel button.on { border-color: var(--accent); filter: none; opacity: 1; }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 900px) {
  .page { padding-top: 36px; }
  h1 { font-size: 34px; }
}

/* ---------- Vidéo intégrée ---------- */
.video { position: relative; width: 100%; aspect-ratio: 16 / 9; border-radius: 18px; overflow: hidden; background: #000; }
.video.portrait { aspect-ratio: 9 / 16; max-width: 360px; margin: 0 auto; }
.video iframe, .video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.cat-dots { display: flex; gap: 4px; margin-top: 6px; }
.cat-dots i { width: 8px; height: 8px; border-radius: 50%; }

/* ---------- Attributs d'un exercice ---------- */
.attrs { padding: 6px 18px; }
.attr { display: grid; grid-template-columns: 128px 1fr; gap: 10px; align-items: center; padding: 11px 0; border-bottom: 1px solid var(--line); }
.attr:last-child { border-bottom: 0; }
.attr .k { font-size: 13px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .04em; }
.attr .v { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Glisser-déposer ---------- */
[data-drag] { touch-action: none; cursor: grab; color: var(--ink-3); display: grid; place-items: center; flex: none; width: 34px; align-self: stretch; border: 0; background: transparent; padding: 0; }
[data-drag] svg { width: 22px; height: 22px; }
[data-drag]:active { cursor: grabbing; }
.sorting { user-select: none; -webkit-user-select: none; }
[data-sort].dragging { position: relative; z-index: 20; background: var(--bg-elev); box-shadow: var(--shadow-lg); border-radius: 16px; transition: none; }
.sorting [data-sort]:not(.dragging) { transition: transform .15s; }
.sortable-list { overflow: visible; }
.sortable-list .list-item { gap: 8px; padding-left: 6px; }
.order-num { width: 20px; text-align: center; font-weight: 800; font-size: 13px; color: var(--accent); flex: none; }
.we-item .handle [data-drag] { height: 36px; color: var(--accent); }
.est-card { display: flex; align-items: center; gap: 14px; width: 100%; border: 0; padding: 14px 16px; color: inherit; }
.est-card .avatar { border-radius: 14px; }

/* ---------- Recommandations ---------- */
.rate { display: inline-flex; align-items: center; gap: 3px; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap; }
.rate-green { background: #d9f3e2; color: #15803d; }
.rate-orange { background: #ffedd5; color: #c2410c; }
.rate-red { background: var(--danger-soft); color: var(--danger); }
.ex-card.risk-red { outline: 3px solid var(--danger); outline-offset: -3px; }
.ex-card.risk-red .name { color: var(--danger); }
.ex-card .rate { position: absolute; top: 8px; left: 8px; }
.pick-item.risk-red .grow > div:first-child { color: var(--danger); }
.risk-banner { display: flex; gap: 10px; align-items: flex-start; border-radius: 16px; padding: 12px 14px; font-size: 14px; margin-top: 12px; }
.risk-banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.risk-banner.red { background: var(--danger-soft); color: var(--danger); }
.risk-banner.orange { background: #ffedd5; color: #9a3412; }
.risk-banner.green { background: #d9f3e2; color: #15803d; }
/* ---------- Dossier client ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 16px; padding: 2px 16px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; border: 0; background: var(--bg-soft); color: var(--ink-2); font-weight: 700; padding: 9px 14px; border-radius: 12px; }
.tabs button.on { background: var(--navy); color: #fff; }
.note { border-left: 4px solid var(--accent); padding: 10px 14px; background: var(--bg-elev); border-radius: 0 14px 14px 0; box-shadow: var(--shadow); margin-bottom: 10px; }
.note .meta { font-size: 12px; color: var(--ink-3); font-weight: 700; margin-bottom: 4px; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.note p { margin: 0; white-space: pre-line; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpi { background: var(--bg-elev); border-radius: 16px; padding: 12px 14px; box-shadow: var(--shadow); }
.kpi .v { font-size: 22px; font-weight: 800; }
.kpi .l { font-size: 12px; color: var(--ink-3); font-weight: 700; }
.kpi .d { font-size: 12px; font-weight: 800; }
.kpi .d.up { color: #15803d; } .kpi .d.down { color: var(--danger); }
.parq-q { display: flex; gap: 10px; flex-direction: column; padding: 14px 0; border-bottom: 1px solid var(--line); }
.parq-q .segmented { width: 100%; max-width: 260px; }
.parq-q .segmented button.on[data-v="1"] { background: var(--danger-soft); color: var(--danger); }
@media print {
  .tabbar, .live-pill, .fab, .no-print, .topbar .icon-btn, .tabs { display: none !important; }
  body { background: #fff; }
  .page { padding: 0; max-width: none; }
  .card, .kpi, .list-card, .note { box-shadow: none !important; border: 1px solid #ddd; break-inside: avoid; }
  .section { break-inside: avoid; }
}

/* ---------- Mode administrateur : interface rouge pour savoir d'un coup d'œil dans quel mode on est ---------- */
:root[data-mode="admin"] { --accent: #e5484d; --accent-soft: #fde4e4; }
:root[data-mode="admin"][data-theme="dark"] { --accent-soft: #3d1a1d; }
@media (prefers-color-scheme: dark) { :root[data-mode="admin"]:not([data-theme="light"]) { --accent-soft: #3d1a1d; } }
.mode-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.mode-switch button.on { color: var(--accent); }

/* ---------- Recadrage de la photo ---------- */
.crop-wrap { position: relative; width: 280px; height: 280px; margin: 0 auto; border-radius: 18px; overflow: hidden; background: var(--bg-soft); }
.crop-canvas { display: block; cursor: grab; }
.crop-canvas:active { cursor: grabbing; }
.crop-mask { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 400px rgba(0, 0, 0, .55); outline: 2px solid rgba(255, 255, 255, .9); pointer-events: none; }
input[type="range"] { accent-color: var(--accent); }

/* ---------- Lecteur : précédent / suivant dans la barre du haut (toujours visibles) ---------- */
.player .nav-arrow { flex: none; width: 34px; height: 34px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: var(--bg-soft); color: var(--ink-2); }
.player .nav-arrow svg { width: 18px; height: 18px; }
.player .nav-arrow:disabled { opacity: .3; }
.player .nav-arrow:not(:disabled):active { background: var(--accent-soft); color: var(--accent); }
.set-time { flex: none; min-width: 52px; font-weight: 750; font-size: 14px; color: var(--accent); font-variant-numeric: tabular-nums; }
.player .topbar { gap: 8px; }

/* ---------- Vignette agrandissable (listes du sélecteur, aléatoire, éditeur de séance) ---------- */
.thumb.zoomable { cursor: zoom-in; }
.thumb .zoom-badge { position: absolute; right: 3px; bottom: 3px; width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0, 0, 0, .55); color: #fff; display: grid; place-items: center; pointer-events: none; }
.thumb .zoom-badge svg { width: 11px; height: 11px; stroke-width: 3; }

/* ---------- Tableau de bord du gym ---------- */
.col-chart { width: 100%; height: auto; display: block; }
.col-chart rect { fill: color-mix(in srgb, var(--accent) 45%, transparent); }
.col-chart rect.peak { fill: var(--accent); }
.col-chart .lbl { font-size: 10px; fill: var(--ink-3); font-weight: 600; }
.col-chart .val { font-size: 11px; fill: var(--ink); font-weight: 800; }
.col-chart .axis { stroke: var(--line); }
.eq-bars .bar-row { margin-bottom: 0; }
.eq-bars .eq-sub { margin: 0 0 10px; font-size: 11px; }
.kpi .d.muted { color: var(--ink-3); font-weight: 600; }
