:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6e8ec;
  --muted: #9aa3b2;
  --accent: #ff5a3c;
  --accent-2: #4cc38a;
  --warn: #f0a500;
  --radius: 12px;
}
/* Thème clair (activé via [data-theme="light"] sur <html>). */
[data-theme="light"] {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #eef1f6;
  --border: #d8dee8;
  --text: #1a1e27;
  --muted: #5b6472;
  --accent: #e8412a;
  --accent-2: #1f9d63;
  --warn: #b8770a;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; margin: .2rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 0 0 .6rem; }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
h4 { margin: .2rem 0; }
h5 { margin: .6rem 0 .2rem; font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
code { background: var(--panel-2); padding: .1rem .35rem; border-radius: 5px; }

/* Topbar */
.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: .7rem 1.2rem; background: var(--panel);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
  position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.topbar nav { display: flex; gap: .3rem; flex-wrap: wrap; margin-left: auto; }
.topbar nav a {
  color: var(--muted); padding: .35rem .7rem; border-radius: 8px; font-size: .9rem;
}
.topbar nav a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.topbar nav a.logout { color: var(--accent); }
.theme-toggle {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: .3rem .55rem; cursor: pointer; font-size: .95rem;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent); }

.wrap { max-width: 1100px; margin: 0 auto; padding: 1.4rem 1.2rem 4rem; }

/* Cards & grid */
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; margin-bottom: 1.2rem;
}
.card.highlight { border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.2rem; }

/* Forms */
label { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
input, select, textarea {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  border-radius: 8px; padding: .5rem .6rem; font: inherit; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; }
.form-grid .full { grid-column: 1 / -1; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }
.inline-form > * { flex: 0 1 auto; }
.chk { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); }
.chk input { width: auto; }
.row-end { display: flex; gap: .8rem; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.toolbar { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-end; }
.visually-hidden-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Buttons */
.btn {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: .5rem .9rem; font: inherit; cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: .3rem .6rem; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: default; }
.link { background: none; border: none; color: var(--muted); cursor: pointer; font: inherit; padding: 0; }
.link:hover { color: var(--accent); }
.link.del:hover { color: var(--accent); }

/* Tags */
.tag {
  display: inline-block; background: var(--panel-2); border: 1px solid var(--border);
  border-radius: 6px; padding: .05rem .45rem; font-size: .72rem; color: var(--muted);
}
.tag.ok { color: var(--accent-2); border-color: var(--accent-2); }
.tag.warn { color: var(--warn); border-color: var(--warn); }
.tag.rx { color: var(--accent); border-color: var(--accent); }
.tag.manual { color: #28a745; border-color: #28a745; }
.tag.estimate { color: #dc3545; border-color: #dc3545; }
.tag.old { color: #ffc107; border-color: #ffc107; }
.tag.tag-hommes { color: #4a9eff; border-color: #4a9eff; }
.tag.tag-femmes { color: #e06cae; border-color: #e06cae; }

/* Lists */
.stat-list { list-style: none; padding: 0; margin: .4rem 0; }
.stat-list li { display: flex; align-items: center; gap: .5rem; padding: .3rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.stat-list li span:first-child { flex: 1; min-width: 8rem; }
/* La ligne "n athlètes" (span .block) passe sous les autres infos. */
.stat-list li .block { flex-basis: 100%; }
.lift-value.manual { color: #28a745; }
.lift-value.estimate { color: #dc3545; }
.lift-value.old { color: #ffc107; }
.session-list { list-style: none; padding: 0; margin: 0; }
.session-list li { display: flex; gap: .5rem; align-items: center; padding: .35rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.session-list .date { color: var(--muted); font-size: .8rem; min-width: 82px; }
.session-list .name { flex: 1; }
.score { font-weight: 700; color: var(--accent-2); }

/* Table */
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { text-align: left; padding: .4rem .3rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; }
/* Rend les tableaux larges défilables horizontalement sur petit écran. */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap .table { min-width: 30rem; }

/* Bars */
.bar-row { display: flex; align-items: center; gap: .6rem; margin: .3rem 0; font-size: .82rem; }
.bar-row span { flex: 0 0 120px; color: var(--muted); }
.bar { flex: 1; background: var(--panel-2); border-radius: 6px; height: 9px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); }

/* Blocks */
.block { background: var(--panel-2); border-radius: 8px; padding: .5rem .7rem; margin: .4rem 0; }
.block p { margin: .25rem 0 0; }

/* Week grid */
.week-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .7rem; }
.day-col { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; padding: .6rem; display: flex; flex-direction: column; }
.day-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.day-body { flex: 1; }
.day-col .empty { text-align: center; padding: 1rem 0; }
.edit-day { margin-top: .5rem; align-self: flex-start; }
.block-edit { display: flex; gap: .3rem; margin: .3rem 0; flex-wrap: wrap; }
.block-edit .b-desc { flex: 1; min-width: 160px; }

/* Sessions */
.session-card .session-head { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.session-head .grow, .grow { flex: 1; }
.feedback { margin-top: .8rem; border-top: 1px solid var(--border); padding-top: .7rem; }
.fb-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: .8rem; }
.fb-cols ul { margin: .2rem 0; padding-left: 1.1rem; font-size: .85rem; }
.adaptation { background: var(--panel-2); border-radius: 8px; padding: .6rem .8rem; margin-top: .7rem; border-left: 3px solid var(--accent); }

/* Chat */
.chat-card .chat { display: flex; flex-direction: column; gap: .5rem; max-height: 380px; overflow-y: auto; padding: .5rem 0; }
.msg { padding: .5rem .8rem; border-radius: 12px; max-width: 85%; white-space: pre-wrap; font-size: .9rem; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; }
.msg.assistant { align-self: flex-start; background: var(--panel-2); }
.suggestions { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.chip { background: var(--panel-2); border: 1px solid var(--border); border-radius: 14px; padding: .25rem .7rem; font-size: .8rem; color: var(--muted); cursor: pointer; }
.chip:hover { border-color: var(--accent); color: var(--text); }

/* Alerts / toast */
.alert { background: rgba(255,90,60,.12); border: 1px solid var(--accent); color: var(--text); padding: .5rem .8rem; border-radius: 8px; margin-bottom: .8rem; }
.toast {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%) translateY(2rem);
  background: var(--panel); border: 1px solid var(--accent-2); color: var(--text);
  padding: .6rem 1rem; border-radius: 10px; opacity: 0; pointer-events: none; transition: .25s;
  z-index: 50; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--accent); }

/* Dialog */
dialog { background: var(--panel); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); max-width: 640px; width: 92%; }
dialog::backdrop { background: rgba(0,0,0,.6); }

/* Login */

@media (max-width: 640px) {
  .topbar nav a { padding: .3rem .5rem; font-size: .82rem; }
  .wrap { padding: 1rem .8rem 3rem; }
  .card { padding: .9rem .85rem; }
  .grid { grid-template-columns: 1fr; }
  .inline-form { flex-direction: column; align-items: stretch; }
  .inline-form .chk { flex-direction: row; }
  .percentile-fit-score { min-width: 0; width: 100%; }
}

/* ── Fit Level (radar) ── */
.fitlevel .radar-wrap { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.radar { width: 340px; max-width: 100%; height: auto; overflow: visible; }
.radar-ring { fill: none; stroke: var(--border); stroke-width: 1; }
.radar-axis { stroke: var(--border); stroke-width: 1; }
.radar-label { fill: var(--muted); font-size: 11px; font-weight: 600; }
.radar-score { fill: var(--accent); font-size: 11px; }
.radar-data { fill: rgba(255,90,60,.28); stroke: var(--accent); stroke-width: 2; }
.fit-overall { flex: 1; min-width: 160px; }
.fit-score { font-size: 2.6rem; font-weight: 800; line-height: 1; }
.fit-score span { font-size: 1rem; color: var(--muted); font-weight: 500; }
.fit-strong { color: var(--accent-2); margin: .5rem 0 .2rem; }
.fit-weak { color: var(--warn); margin: .2rem 0; }

/* ── Évaluation mobilité ── */
.mobility { border-top: 1px solid var(--border); margin-top: .6rem; padding-top: .8rem; }
.mob-row { display: grid; grid-template-columns: minmax(220px, 1fr) auto; gap: .8rem; align-items: center; margin: .7rem 0; }
.mob-label { display: flex; flex-direction: column; }
.mob-input-wrap { display: flex; align-items: center; gap: .4rem; }
.mob-input { width: 6.2rem; }
.mob-focus-row { padding: .7rem .8rem; border: 1px solid var(--border); border-radius: 10px; }
.mob-focus-row.selected { border-color: var(--accent); background: rgba(255, 90, 60, .08); }
.mob-reco-box { margin: .8rem 0 1rem; padding: .8rem 1rem; border: 1px dashed var(--border); border-radius: 10px; background: var(--bg2, var(--bg)); }
.mob-rec-list { margin: .4rem 0 0 1rem; padding: 0; }
.mob-rec-list li { margin: .35rem 0; }
@media (max-width: 560px) { .mob-row { grid-template-columns: 1fr auto; } .mob-label { grid-column: 1 / -1; } }

/* ── Compétences gymniques ── */
.gym-skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-top: .8rem; }
.gym-skill-card { border: 1px solid var(--border); border-radius: 8px; padding: .8rem 1rem; background: var(--bg2, var(--bg)); }
.gym-skill-header { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; margin-bottom: .4rem; }
.gym-toggle { display: flex; align-items: center; gap: .35rem; cursor: pointer; font-size: .85rem; }
.gym-toggle input[type="checkbox"] { accent-color: var(--accent); width: 1.1rem; height: 1.1rem; }
.gym-toggle-label { color: var(--accent); font-weight: 600; }
.gym-scales { border-top: 1px solid var(--border); padding-top: .5rem; }
.gym-scale-item { display: flex; align-items: center; gap: .4rem; font-size: .88rem; margin: .25rem 0; cursor: pointer; }
.gym-scale-item input[type="checkbox"] { accent-color: var(--text-muted, #888); }
.hidden { display: none !important; }

/* ── Benchmark scaling ── */
.scaling-wrap { margin: .4rem 0; }
.full-input { width: 100%; }
.block { display: block; }

/* ── Timer WOD ── */
.timer-controls { display: flex; flex-wrap: wrap; gap: .6rem; justify-content: center; margin-top: .4rem; }
.timer-controls label { display: flex; flex-direction: column; font-size: .78rem; color: var(--muted); }
.timer-controls input, .timer-controls select { margin-top: .15rem; }
.timer-controls .int-pair { display: flex; align-items: center; gap: .2rem; }
.timer-controls .int-pair input { width: 3.2rem; }
.timer-buttons { display: flex; gap: .6rem; justify-content: center; margin-top: .8rem; }

/* ── Percentile Fit Score ── */
.percentile-fit-card { margin-bottom: 1rem; }
.percentile-fit-wrap { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; margin-bottom: .75rem; }
.percentile-fit-score { min-width: 130px; text-align: center; }
.big-score { font-size: 3rem; font-weight: 800; line-height: 1; color: var(--accent); }
.big-score-denom { font-size: 1.1rem; color: var(--muted); font-weight: 500; }
.percentile-fit-breakdown { flex: 1; display: flex; gap: 1.5rem; flex-wrap: wrap; }
.percentile-fit-breakdown > div { flex: 1; min-width: 140px; }

/* ═══════════════ GoMuscu — spécifique ═══════════════ */

/* Menu hamburger (mobile) */
.nav-toggle {
  display: none; background: var(--panel-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px; padding: .3rem .6rem; font-size: 1.1rem;
  cursor: pointer; line-height: 1; margin-left: auto;
}

/* Stat pills (dashboard) */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .8rem; margin-bottom: 1.2rem; }
.stat-pill { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem 1rem; text-align: center; }
.stat-pill .num { font-size: 1.9rem; font-weight: 800; line-height: 1; color: var(--accent); }
.stat-pill .lbl { color: var(--muted); font-size: .82rem; margin-top: .25rem; }

/* Filtres catalogue */
.filter-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.filter-bar input[type="search"] { flex: 1; min-width: 180px; }
.group-chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: 1.2rem; }
.group-chips .chip.active { border-color: var(--accent); color: var(--text); background: rgba(255,90,60,.12); }

/* Grille d'exercices */
.muscle-block { margin-bottom: 1.6rem; }
.muscle-block h2 { display: flex; align-items: center; gap: .5rem; }
.muscle-block .count { color: var(--muted); font-size: .85rem; font-weight: 500; }
.ex-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .9rem; }
.ex-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.ex-card .thumb {
  width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--panel-2);
  display: block; border-bottom: 1px solid var(--border);
}
.ex-card .body { padding: .6rem .7rem; display: flex; flex-direction: column; gap: .4rem; flex: 1; }
.ex-card .name { font-weight: 600; font-size: .92rem; line-height: 1.25; }
.ex-card .meta { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: auto; }
.ex-card .btn { width: 100%; }

/* Lien vidéo « voir la technique » (catalogue / programme / séance) */
.video-link { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--accent); }
.video-link:hover { text-decoration: underline; }
.ex-card .video-link { align-self: flex-start; }

/* Vignette compacte (liste d'items programme / séance) */
.ex-thumb-sm { width: 54px; height: 54px; border-radius: 8px; object-fit: cover; background: var(--panel-2); border: 1px solid var(--border); flex: 0 0 auto; }

/* Item de programme */
.item-row { display: flex; gap: .8rem; align-items: flex-start; padding: .7rem 0; border-bottom: 1px solid var(--border); }
.item-row .grow { flex: 1; min-width: 0; }
.item-row .item-title { font-weight: 600; }
.item-row .item-config { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .4rem; align-items: flex-end; }
.item-row .item-config label { font-size: .72rem; }
.item-row .item-config input { width: 4.6rem; }
.item-row .item-config input.reps { width: 5.5rem; }
.item-row .item-config input.notes { width: 12rem; }
.item-actions { display: flex; flex-direction: column; gap: .3rem; align-items: center; }

/* Séance — séries */
.set-line { display: flex; gap: .6rem; align-items: center; padding: .4rem 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.set-line .set-num { width: 2.4rem; color: var(--muted); font-size: .82rem; }
.set-line input.w, .set-line input.r { width: 5rem; }
.set-line.done { opacity: .7; }
.exo-block { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.exo-head { display: flex; gap: .8rem; align-items: center; margin-bottom: .6rem; }
.exo-head .name { font-weight: 700; font-size: 1.05rem; }

/* Barre de progression volume */
.vol-row { display: flex; align-items: center; gap: .6rem; margin: .35rem 0; font-size: .85rem; }
.vol-row .vlabel { flex: 0 0 130px; display: flex; gap: .35rem; align-items: center; }
.vol-row .vbar { flex: 1; background: var(--panel-2); border-radius: 6px; height: 10px; overflow: hidden; }
.vol-row .vfill { height: 100%; background: var(--accent); }
.vol-row .vnum { flex: 0 0 auto; color: var(--muted); min-width: 2.5rem; text-align: right; }

@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .topbar nav {
    display: none; flex-direction: column; align-items: stretch;
    width: 100%; margin-left: 0; margin-top: .5rem; gap: .1rem;
  }
  .topbar nav.open { display: flex; }
  .topbar nav a { padding: .55rem .6rem; }
  .item-row .item-config input.notes { width: 100%; }
}

/* ───────────────────────────── BadRoutines */
.disc-card { text-decoration: none; color: inherit; display: block; }
.disc-card:hover { border-color: var(--accent); }
.routine-card.selected { border-color: var(--accent-2); box-shadow: 0 0 0 1px var(--accent-2) inset; }
.routine-card .why { font-size: .93rem; }
.routine-card .meta, .meta { color: var(--muted); font-size: .88rem; }
.card.highlight { border-left: 4px solid var(--accent); }
.pick { display: inline-flex; align-items: center; gap: .5rem; font-size: .9rem; cursor: pointer; }
.pick.inline { margin-right: .8rem; }
/* iOS : tout champ < 16px déclenche un zoom au focus qui ne se défait plus. */
.pick input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent-2); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
.chip { padding: .35rem .7rem; border: 1px solid var(--border); border-radius: 999px;
        background: var(--panel); color: var(--text); text-decoration: none; font-size: .9rem; }
.chip:hover { border-color: var(--accent); }
.filters { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
           align-items: end; }
.grid.two { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Schémas de terrain : le SVG porte un viewBox, il se met à l'échelle seul. */
.court { max-width: 300px; margin: 0 auto; }
.court svg { width: 100%; height: auto; display: block; }
.court-note { font-size: .9rem; margin: .7rem 0 .4rem; }
.court-legend { list-style: none; padding: 0; margin: 0 0 .6rem;
                display: flex; flex-wrap: wrap; gap: .3rem .9rem; font-size: .85rem;
                color: var(--muted); }
.court-legend li { display: inline-flex; align-items: center; gap: .35rem; }
.court-legend .dot { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.court-legend .bar { width: 16px; height: 3px; border-radius: 2px; display: inline-block; }
