/* ============================================================
   CONSILIUM — volet Sport
   Thème sombre par défaut, thème clair via [data-theme="light"],
   accent personnalisable via --accent (posé en JS depuis le compte).
   ============================================================ */

/* Chaque skin est un jeu complet de tokens ; Aurora est le défaut (:root).
   La couleur d'accent (--accent) reste personnalisable par compte. */
:root {
  --accent: #7c5cff;
  --accent-2: color-mix(in srgb, var(--accent) 55%, #43e0e6);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 80%, white);
  --grad: linear-gradient(135deg, var(--accent), var(--accent-2));

  --font-body: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: var(--font-body);
  --radius: 22px;
  --card-border-w: 1px;
  --card-shadow: var(--shadow-soft);

  --bg: #0e1120;
  --bg-image: linear-gradient(170deg, #131024 0%, #0e1120 45%, #0d1420 100%);
  --bg-2: #10131f;
  --panel: rgba(255, 255, 255, 0.05);
  --panel-2: rgba(255, 255, 255, 0.08);
  --field: rgba(0, 0, 0, 0.28);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.18);
  --text: #eef0f8;
  --muted: #8d93ab;
  --danger: #f2545b;
  --success: #2fbf71;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.22);
  --halo-1: color-mix(in srgb, var(--accent) 20%, transparent);
  --halo-2: color-mix(in srgb, var(--accent-2) 13%, transparent);
}

/* ---- Onyx : sport-tech sombre OLED, menthe et glace */
:root[data-skin="onyx"] {
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --radius: 16px;
  --bg: #07090e;
  --bg-image: none;
  --bg-2: #0a0d13;
  --panel: #0d1118;
  --panel-2: #11151d;
  --field: #0a0e14;
  --border: #1a212c;
  --border-strong: #2a3442;
  --muted: #6b7484;
  --text: #e8ecf1;
  --halo-1: transparent;
  --halo-2: transparent;
}

/* ---- Stadium : éditorial clair, bordures franches, ombres dures */
:root[data-skin="stadium"] {
  color-scheme: light;
  --font-body: "Archivo", system-ui, sans-serif;
  --font-display: "Bricolage Grotesque", "Archivo", sans-serif;
  --radius: 14px;
  --card-border-w: 2px;
  --card-shadow: 4px 4px 0 #16130f;
  --accent-text: color-mix(in srgb, var(--accent) 85%, black);
  --grad: var(--accent);
  --bg: #f5f0e6;
  --bg-image: none;
  --bg-2: #ede7d8;
  --panel: #ffffff;
  --panel-2: #faf6ec;
  --field: #f5f0e6;
  --border: #16130f;
  --border-strong: #16130f;
  --text: #16130f;
  --muted: #77705f;
  --shadow: 6px 6px 0 rgba(22, 19, 15, 0.22);
  --shadow-soft: 3px 3px 0 rgba(22, 19, 15, 0.18);
  --halo-1: transparent;
  --halo-2: transparent;
}

/* ---- Forge : anthracite chaud, braise et laiton */
:root[data-skin="forge"] {
  --font-body: "Rajdhani", system-ui, sans-serif;
  --radius: 14px;
  --bg: #141010;
  --bg-image: linear-gradient(180deg, #191211 0%, #141010 60%);
  --bg-2: #181212;
  --panel: #1d1615;
  --panel-2: #241b19;
  --field: #171110;
  --border: rgba(255, 150, 80, 0.12);
  --border-strong: rgba(255, 150, 80, 0.28);
  --text: #f3ece7;
  --muted: #9c8d84;
  --halo-1: rgba(255, 90, 31, 0.14);
  --halo-2: rgba(255, 176, 32, 0.08);
}

/* ---- Atelier : clair minimal premium, laiton discret */
:root[data-skin="atelier"] {
  color-scheme: light;
  --font-display: "DM Serif Display", Georgia, serif;
  --radius: 18px;
  --accent-text: color-mix(in srgb, var(--accent) 80%, black);
  --bg: #f7f5f2;
  --bg-image: none;
  --bg-2: #f0ede8;
  --panel: #ffffff;
  --panel-2: #faf8f5;
  --field: #f2efe9;
  --border: rgba(28, 26, 23, 0.09);
  --border-strong: rgba(28, 26, 23, 0.22);
  --text: #1c1a17;
  --muted: #8a8578;
  --shadow: 0 14px 34px rgba(28, 26, 23, 0.10);
  --shadow-soft: 0 5px 16px rgba(28, 26, 23, 0.07);
  --halo-1: transparent;
  --halo-2: transparent;
}

/* ---- Forêt : sous-bois sombre, émeraude */
:root[data-skin="foret"] {
  --radius: 20px;
  --bg: #0a120d;
  --bg-image: linear-gradient(170deg, #0c1710 0%, #0a120d 55%, #0b1410 100%);
  --bg-2: #0d1710;
  --panel: rgba(220, 255, 232, 0.05);
  --panel-2: rgba(220, 255, 232, 0.09);
  --field: rgba(0, 0, 0, 0.3);
  --border: rgba(220, 255, 232, 0.1);
  --border-strong: rgba(220, 255, 232, 0.2);
  --text: #eaf5ee;
  --muted: #8ba394;
  --halo-1: rgba(58, 223, 124, 0.12);
  --halo-2: rgba(182, 240, 156, 0.07);
}

/* ---- Abysse : océan profond, cyan et indigo */
:root[data-skin="abysse"] {
  --font-body: "Sora", system-ui, sans-serif;
  --radius: 22px;
  --bg: #08111f;
  --bg-image: linear-gradient(175deg, #0a1526 0%, #08111f 50%, #071726 100%);
  --bg-2: #0a1424;
  --panel: rgba(140, 190, 255, 0.06);
  --panel-2: rgba(140, 190, 255, 0.1);
  --field: rgba(0, 10, 25, 0.4);
  --border: rgba(140, 190, 255, 0.12);
  --border-strong: rgba(140, 190, 255, 0.24);
  --text: #e9f1fb;
  --muted: #7f93ac;
  --halo-1: rgba(56, 189, 248, 0.13);
  --halo-2: rgba(129, 140, 248, 0.1);
}

/* ---- Néon : cyber nuit, rose et cyan électriques */
:root[data-skin="neon"] {
  --font-body: "Space Grotesk", system-ui, sans-serif;
  --radius: 12px;
  --bg: #0a0714;
  --bg-image: linear-gradient(160deg, #120a1e 0%, #0a0714 55%);
  --bg-2: #0d0918;
  --panel: rgba(255, 61, 220, 0.05);
  --panel-2: rgba(255, 61, 220, 0.09);
  --field: rgba(0, 0, 0, 0.4);
  --border: rgba(255, 61, 220, 0.22);
  --border-strong: rgba(255, 61, 220, 0.4);
  --text: #f5eaff;
  --muted: #9b8bb0;
  --shadow: 0 0 24px color-mix(in srgb, var(--accent) 30%, transparent);
  --shadow-soft: 0 0 14px color-mix(in srgb, var(--accent) 18%, transparent);
  --halo-1: color-mix(in srgb, var(--accent) 16%, transparent);
  --halo-2: color-mix(in srgb, var(--accent-2) 12%, transparent);
}

/* ---- Papier : carnet d'entraînement clair, encre et manuscrit */
:root[data-skin="papier"] {
  color-scheme: light;
  --font-body: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Caveat", cursive;
  --radius: 10px;
  --card-border-w: 1.5px;
  --bg: #f4efe3;
  --bg-image: none;
  --bg-2: #ece6d6;
  --panel: #fffdf6;
  --panel-2: #f9f5ea;
  --field: #f2ecdd;
  --border: rgba(43, 43, 51, 0.16);
  --border-strong: rgba(43, 43, 51, 0.32);
  --text: #2b2b33;
  --muted: #7d7a70;
  --accent-text: color-mix(in srgb, var(--accent) 85%, black);
  --shadow: 0 8px 22px rgba(43, 43, 51, 0.12);
  --shadow-soft: 0 3px 10px rgba(43, 43, 51, 0.08);
  --halo-1: transparent;
  --halo-2: transparent;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }
:root[data-skin="stadium"], :root[data-skin="atelier"], :root[data-skin="papier"] { color-scheme: light; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  background-image: var(--bg-image);
  background-attachment: fixed;
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  transition: background 0.25s ease, color 0.25s ease;
}

h1, h2, .brand-name, .stat-tile .val, .train-chrono, .date-badge b, .congrats h1 {
  font-family: var(--font-display);
}

/* Halos d'ambiance, teintés par le skin */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(700px 400px at 85% -10%, var(--halo-1), transparent 65%),
    radial-gradient(600px 380px at -10% 100%, var(--halo-2), transparent 60%);
  pointer-events: none;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }

/* ------------------------------------------------ Structure générale */

#app { display: flex; min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  background: color-mix(in srgb, var(--panel) 65%, transparent);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--border);
  z-index: 30;
}

.brand { display: flex; align-items: center; gap: 12px; padding: 6px 10px 22px; }
.brand-logo { width: 40px; height: 40px; display: block; flex: none; }
.brand-logo svg { width: 100%; height: 100%; display: block; }
.brand-name { font-weight: 800; letter-spacing: 0.14em; font-size: 15px; }
.brand-sub { font-size: 11px; color: var(--muted); letter-spacing: 0.06em; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border-radius: 13px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14.5px;
  transition: background 0.16s ease, color 0.16s ease;
}
.nav-link svg { width: 19px; height: 19px; flex: none; }
.nav-link:hover { color: var(--text); background: color-mix(in srgb, var(--text) 5%, transparent); }
.nav-link.active {
  color: var(--accent-text);
  background: var(--accent-soft);
  font-weight: 600;
}

.sidebar-user {
  display: flex; align-items: center; gap: 11px;
  padding: 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
}
.avatar {
  width: 36px; height: 36px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.sidebar-user .who { flex: 1; min-width: 0; }
.sidebar-user .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .who span { font-size: 11.5px; color: var(--muted); }
.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px; flex: none;
  border-radius: 10px;
  color: var(--muted);
  transition: background 0.16s ease, color 0.16s ease;
}
.icon-btn:hover { background: color-mix(in srgb, var(--text) 7%, transparent); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; }

.main {
  flex: 1;
  margin-left: 248px;
  padding: 34px 38px 60px;
  max-width: 1160px;
  width: 100%;
}

/* Barre mobile en bas */
.tabbar { display: none; }

@media (max-width: 900px) {
  .sidebar { display: none; }
  .main { margin-left: 0; padding: 18px 16px 104px; }
  .tabbar {
    display: flex;
    position: fixed;
    left: 12px; right: 12px; bottom: 12px;
    z-index: 40;
    padding: 8px;
    gap: 4px;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: color-mix(in srgb, var(--panel) 82%, transparent);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
  }
  .tab-link {
    flex: 1;
    display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 2px;
    border-radius: 15px;
    color: var(--muted);
    font-size: 10.5px; font-weight: 600;
  }
  .tab-link svg { width: 21px; height: 21px; }
  .tab-link.active { color: var(--accent-text); background: var(--accent-soft); }
}

/* ------------------------------------------------ En-têtes de page */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.page-head p { color: var(--muted); margin-top: 4px; font-size: 14.5px; }

/* ------------------------------------------------ Boutons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px;
  border-radius: 13px;
  font-weight: 600; font-size: 14.5px;
  border: 1px solid transparent;
  transition: transform 0.12s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn svg { width: 17px; height: 17px; }
.btn:active { transform: scale(0.97); }

.btn-primary {
  color: #fff;
  background: var(--grad);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 40%, transparent);
}
.btn-primary:hover { box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 55%, transparent); }
:root[data-skin="stadium"] .btn-primary { border: 2px solid #16130f; box-shadow: 3px 3px 0 #16130f; }

.btn-ghost { border-color: var(--border-strong); color: var(--text); background: transparent; }
.btn-ghost:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }

.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }

.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 10px; }

/* ------------------------------------------------ Cartes & champs */

.card {
  background: var(--panel);
  border: var(--card-border-w) solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--card-shadow);
}

.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 7px; letter-spacing: 0.03em; }
.input, .select, .textarea {
  width: 100%;
  padding: 11px 14px;
  border-radius: 12px;
  background: var(--field);
  border: 1px solid var(--border);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: color-mix(in srgb, var(--accent) 60%, transparent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 72px; }

/* ------------------------------------------------ Tuiles de stats */

.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

.stat-tile { position: relative; overflow: hidden; padding: 18px 20px; }
.stat-tile .ico {
  width: 38px; height: 38px;
  border-radius: 12px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
  margin-bottom: 14px;
}
.stat-tile .ico svg { width: 19px; height: 19px; }
.stat-tile .val { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.stat-tile .val small { font-size: 15px; font-weight: 600; color: var(--muted); margin-left: 3px; }
.stat-tile .lbl { color: var(--muted); font-size: 12.5px; font-weight: 500; margin-top: 3px; }

/* ------------------------------------------------ Grilles du tableau de bord */

.dash-grid { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
@media (max-width: 900px) { .dash-grid { grid-template-columns: 1fr; } }

.card h3 { font-size: 15.5px; font-weight: 700; margin-bottom: 16px; display: flex; align-items: center; justify-content: space-between; }
.card h3 .more { font-size: 12.5px; color: var(--accent-text); font-weight: 600; }

.chart-wrap svg { width: 100%; height: auto; display: block; }
.chart-bar { fill: color-mix(in srgb, var(--accent) 80%, var(--accent-2)); }
.chart-bar-empty { fill: color-mix(in srgb, var(--muted) 22%, transparent); }
.chart-label { fill: var(--muted); font-size: 9.5px; font-family: inherit; }
.chart-value { fill: var(--text); font-size: 9.5px; font-weight: 600; font-family: inherit; }
.chart-line { stroke: var(--accent); stroke-width: 2.4; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#areaGrad); opacity: 0.6; }
.chart-dot { fill: var(--accent); stroke: var(--panel); stroke-width: 2; }
.chart-grid-line { stroke: var(--border); stroke-width: 1; }

/* ------------------------------------------------ Records */

.pr-row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--border); }
.pr-row:last-child { border-bottom: none; }
.pr-rank { width: 26px; height: 26px; flex: none; border-radius: 9px; display: grid; place-items: center; font-size: 12px; font-weight: 800; background: var(--accent-soft); color: var(--accent-text); }
.pr-row .who { flex: 1; min-width: 0; }
.pr-row .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pr-row .who span { font-size: 11.5px; color: var(--muted); }
.pr-val { text-align: right; font-variant-numeric: tabular-nums; }
.pr-val b { font-size: 15px; }
.pr-val span { display: block; font-size: 11px; color: var(--muted); }

/* ------------------------------------------------ Listes de séances */

.month-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: capitalize; letter-spacing: 0.05em; margin: 26px 0 12px; }
.month-title:first-child { margin-top: 0; }

.workout-card {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 18px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: transform 0.14s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.workout-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); box-shadow: var(--shadow); }

.date-badge {
  width: 52px; flex: none;
  text-align: center;
  padding: 8px 0;
  border-radius: 14px;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.date-badge b { display: block; font-size: 19px; font-weight: 800; line-height: 1.1; }
.date-badge span { font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

.workout-card .body { flex: 1; min-width: 0; }
.workout-card .body b { display: block; font-size: 15px; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workout-meta { display: flex; gap: 14px; color: var(--muted); font-size: 12.5px; flex-wrap: wrap; }
.workout-meta span { display: inline-flex; align-items: center; gap: 5px; }
.workout-meta svg { width: 13px; height: 13px; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.chip {
  font-size: 11px; font-weight: 600;
  padding: 3.5px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------ Éditeur de séance */

.editor-head { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: end; margin-bottom: 18px; }
@media (max-width: 700px) { .editor-head { grid-template-columns: 1fr 1fr; } .editor-head .field-name { grid-column: 1 / -1; } }

.exo-block { margin-bottom: 14px; padding: 18px; }
.exo-block-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.exo-block-head .ico {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  font-size: 15px;
}
.exo-block-head .who { flex: 1; min-width: 0; }
.exo-block-head .who b { display: block; font-size: 15px; }
.exo-block-head .who span { font-size: 12px; color: var(--muted); }

.sets-grid { display: grid; grid-template-columns: 44px 1fr 1fr 40px; gap: 8px; align-items: center; }
.sets-grid .head { font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; letter-spacing: 0.05em; text-transform: uppercase; }
.set-num {
  width: 30px; height: 30px; margin: 0 auto;
  border-radius: 10px;
  display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700;
  background: var(--field);
  color: var(--muted);
}
.set-input { text-align: center; padding: 9px 8px; font-variant-numeric: tabular-nums; font-weight: 600; }
.set-input::-webkit-outer-spin-button, .set-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.set-input[type="number"] { -moz-appearance: textfield; appearance: textfield; }

.add-set-btn {
  width: 100%; margin-top: 10px;
  padding: 9px;
  border-radius: 11px;
  border: 1.5px dashed var(--border-strong);
  color: var(--muted);
  font-weight: 600; font-size: 13px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.add-set-btn:hover { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 50%, transparent); background: var(--accent-soft); }

.last-time { font-size: 12px; color: var(--muted); margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.last-time svg { width: 13px; height: 13px; }

.add-exo-btn {
  width: 100%;
  padding: 16px;
  border-radius: 18px;
  border: 2px dashed var(--border-strong);
  color: var(--muted);
  font-weight: 600; font-size: 14.5px;
  display: flex; align-items: center; justify-content: center; gap: 9px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.add-exo-btn:hover { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.add-exo-btn svg { width: 19px; height: 19px; }

.editor-actions {
  position: sticky; bottom: 16px;
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 12px;
  margin-top: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  backdrop-filter: blur(16px);
  box-shadow: var(--shadow);
  z-index: 10;
}
@media (max-width: 900px) { .editor-actions { bottom: 96px; } }

/* ------------------------------------------------ Page Exercices */

.filter-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; align-items: center; }
.filter-bar .input { max-width: 260px; }
.muscle-chip {
  font-size: 12.5px; font-weight: 600;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--muted);
  transition: all 0.15s ease;
}
.muscle-chip.active { border-color: transparent; }

.exo-row {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.13s ease, border-color 0.15s ease;
}
.exo-row:hover { transform: translateX(3px); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.exo-row .who { flex: 1; min-width: 0; }
.exo-row .who b { display: block; font-size: 14px; }
.exo-row .pr { text-align: right; font-variant-numeric: tabular-nums; }
.exo-row .pr b { font-size: 14px; }
.exo-row .pr span { display: block; font-size: 11px; color: var(--muted); }

/* ------------------------------------------------ Réglages */

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 800px) { .settings-grid { grid-template-columns: 1fr; } }

.theme-cards { display: flex; gap: 12px; }
.theme-card {
  flex: 1;
  border-radius: 16px;
  border: 2px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.13s ease;
}
.theme-card:hover { transform: translateY(-2px); }
.theme-card.active { border-color: var(--accent); }
.theme-card .preview { height: 74px; position: relative; }
.theme-card .preview::after {
  content: ""; position: absolute; left: 12px; top: 12px;
  width: 55%; height: 10px; border-radius: 5px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.theme-card .preview::before {
  content: ""; position: absolute; left: 12px; top: 30px;
  width: 75%; height: 30px; border-radius: 8px;
}
.theme-card[data-set="dark"] .preview { background: #0d0f1a; }
.theme-card[data-set="dark"] .preview::before { background: #1b2036; }
.theme-card[data-set="light"] .preview { background: #eef0f7; }
.theme-card[data-set="light"] .preview::before { background: #ffffff; }
.theme-card .name { text-align: center; font-size: 13px; font-weight: 600; padding: 9px; background: var(--panel-2); }

.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatch {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid transparent;
  transition: transform 0.13s ease, border-color 0.15s ease;
}
.swatch:hover { transform: scale(1.12); }
.swatch.active { border-color: var(--text); }
.swatch-custom { position: relative; overflow: hidden; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); }
.swatch-custom input { position: absolute; inset: -8px; opacity: 0; cursor: pointer; }

/* ------------------------------------------------ Administration */

.user-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.user-table th {
  text-align: left; font-size: 11px; font-weight: 700;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.user-table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.user-table tr:last-child td { border-bottom: none; }
.badge {
  display: inline-block;
  font-size: 11px; font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge-admin { background: var(--accent-soft); color: var(--accent-text); }
.badge-user { background: color-mix(in srgb, var(--muted) 15%, transparent); color: var(--muted); }
.badge-off { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.badge-on { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }

.table-scroll { overflow-x: auto; }

/* ------------------------------------------------ Modales */

.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(5, 6, 14, 0.55);
  backdrop-filter: blur(6px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn 0.18s ease;
}
.modal {
  width: 100%; max-width: 520px;
  max-height: min(84vh, 720px);
  display: flex; flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: var(--shadow);
  animation: popIn 0.2s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@media (max-width: 700px) {
  .modal-overlay { place-items: end center; padding: 0; }
  .modal { max-width: 100%; border-radius: 22px 22px 0 0; max-height: 88vh; animation: slideUp 0.22s ease; }
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 12px; }
.modal-head b { font-size: 16.5px; font-weight: 700; }
.modal-body { padding: 6px 22px 22px; overflow-y: auto; }

@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(0.94); } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }

/* Sélecteur d'exercice */
.picker-list { margin-top: 12px; }
.picker-group { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin: 14px 0 6px; }
.picker-item {
  display: flex; align-items: center; gap: 11px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 12px;
  transition: background 0.14s ease;
}
.picker-item:hover { background: var(--accent-soft); }
.picker-item .dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.picker-item b { font-size: 14px; font-weight: 500; flex: 1; }
.picker-item span { font-size: 11px; color: var(--muted); }

/* ------------------------------------------------ Toasts */

#toast-root {
  position: fixed;
  left: 50%; bottom: 26px;
  transform: translateX(-50%);
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
@media (max-width: 900px) { #toast-root { bottom: 104px; } }
.toast {
  padding: 12px 22px;
  border-radius: 999px;
  font-size: 13.5px; font-weight: 600;
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  animation: popIn 0.2s ease;
}
.toast-error { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.toast-ok { color: var(--success); border-color: color-mix(in srgb, var(--success) 40%, transparent); }

/* ------------------------------------------------ États vides */

.empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--muted);
}
.empty .ico {
  width: 64px; height: 64px;
  margin: 0 auto 16px;
  border-radius: 20px;
  display: grid; place-items: center;
  background: var(--accent-soft);
  color: var(--accent-text);
}
.empty .ico svg { width: 30px; height: 30px; }
.empty b { display: block; color: var(--text); font-size: 16px; margin-bottom: 5px; }
.empty p { font-size: 13.5px; margin-bottom: 18px; }

/* ------------------------------------------------ Page de connexion */

.login-page {
  min-height: 100vh;
  display: grid; place-items: center;
  padding: 20px;
}
.login-card {
  width: 100%; max-width: 400px;
  padding: 38px 34px;
  text-align: center;
}
.login-logo { width: 104px; height: 104px; margin: 0 auto 18px; display: block; }

/* ---- Assemblage du logo : les 28 triangles convergent pour former le C.
   Blanc (l'original d'Adrian) sur les skins sombres, teinte du skin sur
   les skins clairs où le blanc disparaîtrait. */
.logo-assemblage { width: 100%; height: 100%; overflow: visible; color: #ffffff; filter: drop-shadow(0 6px 24px color-mix(in srgb, var(--accent) 35%, transparent)); }
:root[data-skin="stadium"] .logo-assemblage,
:root[data-skin="atelier"] .logo-assemblage,
:root[data-skin="papier"] .logo-assemblage { color: var(--accent); }
.logo-assemblage .tri {
  opacity: 0;
  transform: translate(var(--dx), var(--dy)) rotate(var(--rot)) scale(0.6);
  transform-origin: center;
  transform-box: fill-box;
  animation: triAssemble 0.9s cubic-bezier(0.2, 0.75, 0.25, 1.12) forwards;
  animation-delay: var(--d);
}
@keyframes triAssemble {
  60% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

/* ---- Écran de transition entre mondes (sport / sommeil / nutrition) */
.monde-overlay {
  position: fixed; inset: 0;
  z-index: 400;
  background: var(--bg);
  background-image: var(--bg-image);
  display: grid; place-items: center;
  animation: fadeIn 0.12s ease;
  transition: opacity 0.32s ease;
}
.monde-overlay.out { opacity: 0; pointer-events: none; }
.monde-logo { width: 150px; height: 150px; }
/* Transition rapide : l'assemblage est accéléré par rapport à la connexion */
.monde-overlay .logo-assemblage .tri {
  animation-duration: 0.5s;
  animation-delay: calc(var(--d) * 0.35);
}
.login-card h1 { font-size: 22px; font-weight: 800; letter-spacing: 0.16em; }
.login-card .sub { color: var(--muted); font-size: 13.5px; margin: 6px 0 28px; }
.login-card .field { text-align: left; margin-bottom: 14px; }
.login-error {
  color: var(--danger);
  font-size: 13px; font-weight: 600;
  min-height: 20px;
  margin: 4px 0 10px;
}

/* ------------------------------------------------ Divers */

.muted { color: var(--muted); }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 16px; }
hr.sep { border: none; border-top: 1px solid var(--border); margin: 18px 0; }

.skeleton {
  border-radius: 14px;
  background: linear-gradient(100deg, var(--panel) 40%, var(--panel-2) 50%, var(--panel) 60%);
  background-size: 200% 100%;
  animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------ Vignettes d'exercices animées */

/* Deux images alternées (départ / arrivée du mouvement) : rendu « GIF »
   sans GIF. Fond blanc permanent : les illustrations sont sur fond blanc. */
.exo-thumb {
  position: relative;
  width: 54px; height: 54px; flex: none;
  border-radius: 13px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--border);
  cursor: zoom-in;
  display: block;
}
.exo-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.exo-thumb img + img { opacity: 0; animation: exoFlip 1.8s steps(1) infinite; }
@keyframes exoFlip { 50%, 99% { opacity: 1; } }

.exo-thumb.sm { width: 42px; height: 42px; border-radius: 11px; }
.exo-thumb.lg {
  width: 100%; max-width: 340px; height: 200px;
  border-radius: 16px;
  margin: 0 auto;
}
.exo-thumb.lg img { object-fit: contain; }
.exo-thumb-fallback { display: grid; place-items: center; cursor: default; }
.exo-thumb-fallback svg { width: 45%; height: 45%; }

/* Visionneuse plein écran (fond blanc, comme l'illustration) */
.viewer-overlay {
  position: fixed; inset: 0; z-index: 300;
  background: #fff;
  display: flex; flex-direction: column;
  animation: fadeIn 0.15s ease;
}
.viewer-overlay header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  color: #14161f;
}
.viewer-overlay header b { font-size: 17px; }
.viewer-overlay .btn-ghost { color: #14161f; border-color: rgba(0,0,0,0.2); }
.viewer-stage { flex: 1; position: relative; }
.viewer-stage img {
  position: absolute; inset: 0; margin: auto;
  max-width: 94%; max-height: 90%;
  object-fit: contain;
}
.viewer-stage img + img { opacity: 0; animation: exoFlip 1.8s steps(1) infinite; }

/* ------------------------------------------------ Supersets (éditeur) */

.ss-link { display: flex; justify-content: center; margin: -6px 0; position: relative; z-index: 2; }
.ss-link button {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--panel);
  border: 1.5px dashed var(--border-strong);
  color: var(--muted);
  transition: all 0.15s ease;
}
.ss-link button svg { width: 16px; height: 16px; }
.ss-link button:hover { color: var(--accent-text); border-color: var(--accent); }
.ss-link button.on {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-style: solid; border-color: transparent;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 45%, transparent);
}
.exo-block.linked { border-left: 3px solid var(--accent); }

/* ------------------------------------------------ Bannière « Reprendre » */

.resume-banner {
  display: flex; align-items: center; gap: 14px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: linear-gradient(120deg, var(--accent-soft), var(--panel) 60%);
}
.resume-banner .ico {
  width: 44px; height: 44px; flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
}
.resume-banner .ico svg { width: 20px; height: 20px; }
.resume-banner .who { flex: 1; }
.resume-banner .who b { display: block; font-size: 15px; }
.resume-banner .who span { font-size: 12.5px; color: var(--muted); }
.resume-banner > svg { width: 20px; height: 20px; color: var(--muted); }

.workout-card .train-go {
  width: 42px; height: 42px; flex: none;
  border-radius: 50%;
  color: var(--accent-text);
  background: var(--accent-soft);
}
.workout-card .train-go svg { width: 18px; height: 18px; margin-left: 2px; }

.picker-item .exo-thumb { cursor: pointer; }

/* ------------------------------------------------ Mode entraînement */

body.training .tabbar { display: none; }

.train-head {
  position: sticky; top: 0; z-index: 25;
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px;
  margin: -12px -4px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(14px);
}
.train-head .who b { font-size: 15px; display: block; }
.train-chrono {
  font-variant-numeric: tabular-nums;
  font-weight: 800; font-size: 20px;
  letter-spacing: 0.02em;
  color: var(--accent-text);
}

.train-progress {
  height: 7px;
  border-radius: 4px;
  background: var(--field);
  overflow: hidden;
}
.train-progress i {
  display: block; height: 100%; width: 0;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.3s ease;
}

.train-exos { display: flex; gap: 12px; margin-bottom: 14px; }
.train-exo-card { flex: 1; min-width: 0; }
.train-exo-card.half .exo-thumb.lg { height: 150px; }
.train-exo-name { margin-top: 10px; }
.train-exo-name b { font-size: 16px; }
.rest-chip {
  display: inline-flex; align-items: center; gap: 5px;
  background: var(--accent-soft); color: var(--accent-text);
  border: none; cursor: pointer;
}
.rest-chip svg { width: 12px; height: 12px; }

.train-set-row {
  display: grid;
  grid-template-columns: 48px 1fr 1.1fr 1.1fr 46px;
  gap: 8px;
  align-items: center;
  padding: 6px 0;
}
.train-set-row .set-num {
  width: 38px; height: 38px;
  font-size: 13px;
  display: flex; align-items: center; justify-content: center; gap: 1px;
}
.train-set-row .set-num small { font-size: 10px; color: var(--muted); }
.prev-cell {
  font-size: 12px; color: var(--muted);
  text-align: center;
  font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.train-set-row .set-input { font-size: 16px; padding: 10px 6px; }
.train-set-row.done .set-input {
  border-color: color-mix(in srgb, var(--success) 40%, transparent);
  background: color-mix(in srgb, var(--success) 8%, var(--field));
}

.set-check {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: grid; place-items: center;
  border: 2px solid color-mix(in srgb, var(--success) 45%, transparent);
  color: var(--success);
  background: transparent;
  transition: all 0.15s ease;
}
.set-check svg { width: 18px; height: 18px; }
.set-check.on {
  background: var(--success);
  border-color: var(--success);
  color: #fff;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--success) 40%, transparent);
}

.round-group {
  border-left: 3px solid var(--accent);
  border-radius: 3px;
  padding-left: 10px;
  margin-bottom: 14px;
}
.round-group:last-of-type { margin-bottom: 4px; }

.train-bottom {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 45;
  display: flex; align-items: center; gap: 18px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--panel) 85%, transparent);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}
.train-bottom .icon-btn.big { width: 46px; height: 46px; }
.train-bottom .icon-btn.big svg { width: 22px; height: 22px; }
.train-bottom .icon-btn:disabled { opacity: 0.3; }
.rest-btn {
  width: 58px; height: 58px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent);
}
.rest-btn svg { width: 26px; height: 26px; }

.rest-pill {
  position: fixed;
  left: 50%; transform: translateX(-50%);
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 46;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  background: var(--panel);
  box-shadow: var(--shadow);
  animation: popIn 0.2s ease;
}
.rest-count {
  font-size: 24px; font-weight: 800;
  font-variant-numeric: tabular-nums;
  min-width: 66px; text-align: center;
  color: var(--accent-text);
}

.rest-choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.rest-choice {
  padding: 14px;
  border-radius: 13px;
  border: 1.5px solid var(--border-strong);
  font-weight: 700; font-size: 16px;
  font-variant-numeric: tabular-nums;
  transition: all 0.14s ease;
}
.rest-choice:hover { border-color: var(--accent); color: var(--accent-text); }
.rest-choice.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
}

/* Marges du mode entraînement : laisser la place à la barre du bas */
body.training .main { padding-bottom: 170px; }

/* ------------------------------------------------ Félicitations */

.congrats-overlay {
  position: fixed; inset: 0; z-index: 120;
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(8px);
  display: grid; place-items: center;
  padding: 20px;
  animation: fadeIn 0.2s ease;
}
.congrats {
  width: 100%; max-width: 440px;
  max-height: 90vh; overflow-y: auto;
  text-align: center;
  padding: 32px 26px;
  animation: popIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.25);
}
.congrats-trophy {
  width: 88px; height: 88px;
  margin: 0 auto 16px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 10px 32px color-mix(in srgb, var(--accent) 50%, transparent);
  animation: trophyPop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
.congrats-trophy svg { width: 40px; height: 40px; }
@keyframes trophyPop { 0% { transform: scale(0.3) rotate(-12deg); opacity: 0; } 70% { transform: scale(1.1) rotate(3deg); } }
.congrats h1 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.congrats-stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 22px 0;
}
.congrats-stats > div {
  padding: 12px 6px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.congrats-stats b { display: block; font-size: 17px; font-variant-numeric: tabular-nums; }
.congrats-stats b .muted { font-size: 12px; }
.congrats-stats span { font-size: 10.5px; color: var(--muted); font-weight: 600; }
@media (max-width: 480px) { .congrats-stats { grid-template-columns: repeat(2, 1fr); } }

/* ------------------------------------------------ Effets de vie (JS + CSS) */

/* Entrée en cascade des blocs à chaque changement de vue */
#main > * { animation: viewIn 0.38s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
#main > *:nth-child(2) { animation-delay: 0.05s; }
#main > *:nth-child(3) { animation-delay: 0.1s; }
#main > *:nth-child(4) { animation-delay: 0.15s; }
#main > *:nth-child(5) { animation-delay: 0.2s; }
#main > *:nth-child(n+6) { animation-delay: 0.25s; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } }

/* Les barres de volume se dessinent */
.chart-wrap .chart-bar, .chart-wrap .chart-bar-empty {
  transform-origin: center 150px;
  animation: growBar 0.7s cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
}
@keyframes growBar { from { transform: scaleY(0); } }

/* La courbe de progression se trace */
.chart-line { stroke-dasharray: 1200; stroke-dashoffset: 1200; animation: drawLine 1.1s ease-out forwards; }
@keyframes drawLine { to { stroke-dashoffset: 0; } }
.chart-area { animation: fadeIn 0.9s ease 0.4s both; }

/* Le chrono d'entraînement respire */
.train-chrono { animation: chronoPulse 2s ease-in-out infinite; }
@keyframes chronoPulse {
  0%, 100% { text-shadow: 0 0 0 transparent; }
  50% { text-shadow: 0 0 18px color-mix(in srgb, var(--accent) 55%, transparent); }
}

/* Validation d'une série : petit rebond */
.set-check.on { animation: checkPop 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.5); }
@keyframes checkPop { 0% { transform: scale(0.6); } 70% { transform: scale(1.15); } }

/* Confettis de fin de séance */
#confetti-canvas {
  position: fixed; inset: 0;
  z-index: 130;
  pointer-events: none;
}

/* ------------------------------------------------ Équilibre tri-piliers */

.section-title {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 800;
  margin: 26px 0 14px;
  letter-spacing: 0.01em;
}
.section-title svg { width: 18px; height: 18px; color: var(--accent-text); }

.balance-wrap { display: flex; align-items: center; gap: 26px; }
@media (max-width: 700px) { .balance-wrap { flex-direction: column; gap: 16px; } }

.ring-wrap { position: relative; flex: none; display: grid; place-items: center; }
.ring-wrap > svg { display: block; }
.ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.ring-center b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.ring-center b small { font-size: 13px; color: var(--muted); }
.ring-center > span { font-size: 9.5px; color: var(--muted); font-weight: 600; line-height: 1.25; margin-top: 3px; letter-spacing: 0.04em; text-transform: uppercase; }
.ring-arc { transition: stroke-dasharray 0.8s cubic-bezier(0.2, 0.8, 0.3, 1); }

.pillar-rows { flex: 1; width: 100%; display: flex; flex-direction: column; }
.pillar-row {
  display: flex; align-items: center; gap: 13px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.pillar-row:last-child { border-bottom: none; padding-bottom: 2px; }
.pillar-row:first-child { padding-top: 2px; }
.pillar-ico {
  width: 40px; height: 40px; flex: none;
  border-radius: 13px;
  display: grid; place-items: center;
}
.pillar-ico svg { width: 19px; height: 19px; }
.pillar-row .who { flex: 1; min-width: 0; }
.pillar-row .who b { display: flex; align-items: center; gap: 8px; font-size: 14.5px; }
.pillar-score { font-size: 11px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pillar-row .who > span { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pillar-row .who .qstars { font-style: normal; color: #ffb020; letter-spacing: 1px; font-size: 12px; }
.pillar-row > svg { flex: none; }
.pillar-action {
  width: 38px; height: 38px; flex: none;
  border-radius: 12px;
  display: grid; place-items: center;
  color: var(--muted);
  border: 1.5px dashed var(--border-strong);
  transition: all 0.15s ease;
}
.pillar-action:hover { color: var(--accent-text); border-color: var(--accent); background: var(--accent-soft); }
.pillar-action svg { width: 16px; height: 16px; }

.qdots { display: flex; gap: 7px; flex: none; }
.qdots button {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  transition: all 0.14s ease;
}
.qdots button:hover { transform: scale(1.15); border-color: #2fbf71; }
.qdots button.on { background: #2fbf71; border-color: #2fbf71; }
.qdots.big { justify-content: center; margin: 6px 0 4px; gap: 12px; }
.qdots.big button { width: 44px; height: 44px; }
.qdots.big button.on { background: #4f8cff; border-color: #4f8cff; }
.qdots.verte button:hover { border-color: #2fbf71; }
.qdots.verte button.on { background: #2fbf71; border-color: #2fbf71; }

/* La rangée de pilier est un lien vers son pôle */
a.pillar-row { color: inherit; transition: background 0.14s ease; border-radius: 12px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
a.pillar-row:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
a.pillar-row > svg:last-child { width: 17px; height: 17px; color: var(--muted); flex: none; }

.teaser-card { border-style: dashed; }

/* ------------------------------------------------ Questionnaire santé */

.quiz-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.quiz-score {
  font-size: 22px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.quiz-score small { font-size: 13px; }

.quiz-q { padding: 14px 0 4px; border-bottom: 1px solid var(--border); }
.quiz-q:last-child { border-bottom: none; }
.quiz-q > label {
  display: flex; align-items: center; gap: 8px;
  font-size: 13.5px; font-weight: 600;
  margin-bottom: 12px;
}
.quiz-q > label svg { width: 16px; height: 16px; color: var(--muted); }

.quiz-chips { display: flex; gap: 8px; flex-wrap: wrap; padding-bottom: 10px; }
.quiz-chips button {
  padding: 10px 16px;
  min-height: 44px;
  border-radius: 12px;
  border: 1.5px solid var(--border-strong);
  font-weight: 600; font-size: 13.5px;
  color: var(--muted);
  transition: all 0.14s ease;
}
.quiz-chips button:hover { border-color: var(--accent); color: var(--accent-text); }
.quiz-chips button.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent-text);
  animation: checkPop 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.quiz-niveaux { display: flex; gap: 10px; padding-bottom: 10px; }
.quiz-niveaux button {
  flex: 1; max-width: 60px; height: 44px;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  transition: all 0.14s ease;
}
.quiz-niveaux button:hover { border-color: var(--coul); transform: scale(1.06); }
.quiz-niveaux button.on { background: var(--coul); border-color: var(--coul); animation: checkPop 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.4); }

.quiz-visages { display: flex; gap: 10px; padding-bottom: 10px; }
.quiz-visages button {
  flex: 1; max-width: 60px; height: 52px;
  border-radius: 14px;
  border: 2px solid var(--border-strong);
  color: var(--muted);
  display: grid; place-items: center;
  transition: all 0.14s ease;
}
.quiz-visages button svg { width: 30px; height: 30px; }
.quiz-visages button:hover { color: var(--accent-text); border-color: var(--accent); transform: scale(1.06); }
.quiz-visages button.on {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  animation: checkPop 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

.stepper { display: flex; align-items: center; gap: 18px; padding-bottom: 10px; }
.stepper button {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid var(--border-strong);
  font-size: 22px; font-weight: 600;
  color: var(--accent-text);
  transition: all 0.14s ease;
}
.stepper button:hover { border-color: var(--accent); background: var(--accent-soft); }
.stepper b { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; min-width: 90px; text-align: center; }
.stepper b small { font-size: 15px; color: var(--muted); font-weight: 600; }

/* Composition du score santé */
.compo-ligne { padding: 9px 0; border-bottom: 1px solid var(--border); }
.compo-ligne:last-of-type { border-bottom: none; }
.compo-tete { display: flex; justify-content: space-between; align-items: center; font-size: 13.5px; margin-bottom: 6px; }
.compo-tete b { font-weight: 600; }
.compo-tete span { font-variant-numeric: tabular-nums; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.compo-barre { height: 7px; border-radius: 4px; background: var(--field); overflow: hidden; }
.compo-barre i { display: block; height: 100%; border-radius: 4px; background: var(--grad); transition: width 0.5s ease; }
.compo-detail { font-size: 11.5px; color: var(--muted); margin-top: 5px; }

/* ------------------------------------------------ Page Personnalisation */

.skins-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 700px) { .skins-grid { grid-template-columns: repeat(2, 1fr); } }

.skin-card {
  border-radius: 16px;
  border: 2px solid var(--border);
  overflow: hidden;
  cursor: pointer;
  text-align: left;
  transition: transform 0.14s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  background: var(--panel);
}
.skin-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.skin-card.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* Mini-aperçu du skin, dessiné avec ses propres couleurs */
.skin-preview { height: 88px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.skin-preview .ligne { height: 9px; border-radius: 5px; width: 55%; }
.skin-preview .carte { flex: 1; border-radius: 9px; display: flex; align-items: center; gap: 7px; padding: 0 9px; }
.skin-preview .rond { width: 18px; height: 18px; border-radius: 50%; flex: none; }
.skin-preview .barres { flex: 1; display: flex; align-items: flex-end; gap: 3px; height: 22px; }
.skin-preview .barres i { flex: 1; border-radius: 2px; display: block; }
.skin-card .skin-name { padding: 9px 12px; font-size: 13px; font-weight: 700; display: flex; align-items: center; justify-content: space-between; }
.skin-card .skin-name span { font-size: 10.5px; font-weight: 600; color: var(--muted); }

/* ------------------------------------------------ Sélecteur de visuel (exo perso) */

.visuel-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; max-height: 300px; overflow-y: auto; }
.visuel-item {
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  padding: 0;
  transition: border-color 0.14s ease, transform 0.13s ease;
}
.visuel-item:hover { transform: scale(1.04); }
.visuel-item.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.visuel-item img { width: 100%; height: 74px; object-fit: contain; display: block; background: #fff; }
.visuel-item b { display: block; font-size: 9.5px; font-weight: 600; color: #444; padding: 4px 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff; }
