/* server/public/coach/coach.css
 *
 * Feuille propre à l'espace coach.
 *
 * Elle ne réutilise plus celle de /admin : cette dernière pose une barre
 * latérale bleu nuit (#101725) qui domine tout l'écran, et c'est précisément
 * ce que Christophe ne voulait pas. Les deux espaces n'ont de toute façon ni
 * le même public ni les mêmes contraintes — les découpler évite aussi qu'une
 * retouche pour l'un ne casse l'autre.
 *
 * La palette est celle de l'admin ActivGoals : gris neutres plutôt que bleutés,
 * orange plus vif, coins plus ronds, ombre discrète. Tout passe par des
 * variables pour que le mode sombre ne soit qu'un jeu de valeurs.
 */

:root {
  color-scheme: light;
  --orange: #f97316;
  --orange-soft: #fff1e8;
  --orange-ink: #9a3412;
  --text: #16181d;
  --muted: #6b7280;
  --bg: #f6f7f9;
  --card: #ffffff;
  --surface-2: #fbfbfc;
  --line: #e9eaee;
  --green: #22c55e;
  --green-soft: #ecfdf3;
  --red: #ef4444;
  --red-soft: #fef2f2;
  --amber: #d97706;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.06), 0 6px 20px rgba(16, 24, 40, 0.05);
  /* Le logo est un jeton comme les couleurs : UN seul element dans la page,
     dont la source suit le theme. Deux <img> empiles se seraient affiches
     tous les deux le jour ou la feuille ne charge pas. */
  --wordmark: url('/myhoopworkouts-wordmark-normal.png?v=20261022-3');
}

/* Mode sombre.
 * Deux déclencheurs, et il en faut deux : la préférence système pour ceux qui
 * ne toucheront jamais au sélecteur, et l'attribut explicite pour ceux qui
 * veulent choisir. Le `:not([data-theme="light"])` évite que la préférence
 * système écrase un choix « clair » assumé. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --orange: #fb923c;
    --orange-soft: #2a1a0e;
    --orange-ink: #fdba74;
    --text: #e8eaed;
    --muted: #9aa1ac;
    --bg: #14161a;
    --card: #1c1f25;
    --surface-2: #22262d;
    --line: #2e333b;
    --green: #34d399;
    --green-soft: #12251c;
    --red: #f87171;
    --red-soft: #2a1618;
    --amber: #fbbf24;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.3);
    --wordmark: url('/myhoopworkouts-wordmark-dark.png?v=20261022-3');
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --orange: #fb923c;
  --orange-soft: #2a1a0e;
  --orange-ink: #fdba74;
  --text: #e8eaed;
  --muted: #9aa1ac;
  --bg: #14161a;
  --card: #1c1f25;
  --surface-2: #22262d;
  --line: #2e333b;
  --green: #34d399;
  --green-soft: #12251c;
  --red: #f87171;
  --red-soft: #2a1618;
  --amber: #fbbf24;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 6px 20px rgba(0, 0, 0, 0.3);
  --wordmark: url('/myhoopworkouts-wordmark-dark.png?v=20261022-3');
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Structure ─────────────────────────────────────────────────────────── */



.status {
  font-size: 13px;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
}
.status.is-error { color: var(--red); border-color: var(--red); background: var(--red-soft); }

/* ── Blocs ─────────────────────────────────────────────────────────────── */

.panel { display: none; }
.panel.is-active { display: block; }

.toolbar {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 16px;
}
.control-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

input, select, textarea {
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--orange) 18%, transparent);
}

button {
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.12s ease, background 0.12s ease;
}
button:hover { filter: brightness(0.97); }
button.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
button.ghost { background: transparent; }
button.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }

.eyebrow {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.hint { margin: 0; font-size: 12px; line-height: 1.5; color: var(--muted); }

/* ── Tableaux ──────────────────────────────────────────────────────────── */

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 1100px) { .split { grid-template-columns: 1fr; } }

.table-wrap {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow-x: auto;
}
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
tbody td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.is-selected { background: var(--orange-soft); }

.cell-main { display: block; font-weight: 600; }
.cell-sub { display: block; font-size: 12px; color: var(--muted); }

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  text-transform: capitalize;
}
.pill.good { background: var(--green-soft); color: var(--green); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.pill.warn { background: var(--orange-soft); color: var(--orange-ink); border-color: color-mix(in srgb, var(--orange) 30%, transparent); }
.pill.bad  { background: var(--red-soft); color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }

.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.compact-actions button { font-size: 12px; padding: 5px 9px; }

/* ── Panneau de détail ─────────────────────────────────────────────────── */

.detail {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}
.detail h2 { margin: 2px 0 0; font-size: 18px; }
.detail h3 { margin: 20px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.detail h3:first-of-type { margin-top: 12px; }
.detail .table-wrap { box-shadow: none; }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.empty-state {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ── Sélecteur de thème ────────────────────────────────────────────────── */

.theme-switch { display: flex; gap: 4px; }
.theme-switch button {
  font-size: 12px;
  padding: 5px 10px;
  color: var(--muted);
}
.theme-switch button.is-active {
  background: var(--orange-soft);
  border-color: color-mix(in srgb, var(--orange) 30%, transparent);
  color: var(--orange-ink);
}

/* ── Écran de connexion ────────────────────────────────────────────────── */
/*
 * Plein écran, centré, dans l'esprit de l'écran d'accueil de l'app mobile :
 * le logo d'abord, puis la seule action possible. Tant qu'on n'est pas
 * authentifié, la coquille applicative n'est pas rendue du tout — plutôt que
 * de laisser une barre latérale et des tableaux vides derrière un encart.
 */

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 28px;
  text-align: center;
}

/* `brightness(0) invert(1)` passait tout le logo en blanc pur sur fond
   sombre — l'orange de la marque compris, qui en est l'essentiel. Le jeton
   sert le variant sombre dessine pour ca, orange conserve. */
.login-logo {
  width: 230px;
  max-width: 100%;
  aspect-ratio: 1024 / 423;
  margin: 0 auto 12px;
  background: var(--wordmark) center / contain no-repeat;
}

.login-card h1 { margin: 0; font-size: 20px; }
.login-lead { margin: 0 0 8px; color: var(--muted); font-size: 14px; }

/* Les libellés sont alignés à gauche même si la carte est centrée : un label
   centré au-dessus d'un champ pleine largeur se lit mal. */
.login-card label { text-align: left; }
.login-card input { width: 100%; }
.login-submit { width: 100%; margin-top: 4px; }

.login-status { min-height: 20px; font-size: 13px; color: var(--muted); }
.login-status.is-error { color: var(--red); }
.login-status.is-ok { color: var(--green); }

/* Blocs d'une séance : une ligne compacte par bloc, ordonnée. */
.block-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.block-row button { padding: 4px 10px; font-size: 13px; }

/* Les fleches d'ordre sont empilees a gauche : elles doivent rester a la meme
   place d'un bloc a l'autre pour qu'on puisse cliquer plusieurs fois de suite
   sans repositionner la souris. */
.block-order { display: flex; flex-direction: column; gap: 2px; }
.block-order button { padding: 1px 7px; line-height: 1.3; font-size: 12px; }
.block-order button:disabled { opacity: 0.3; cursor: default; }

.block-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.block-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.block-line input, .block-line select { margin: 0; }
.block-target select { width: auto; }

.preset-row { margin: 8px 0 4px; }
.preset-row button { font-size: 13px; }

/* Total de contenu, affiche a cote du titre de section : c'est un reperage,
   pas un titre — d'ou la casse et le poids distincts du h3 qui l'accueille. */
.blocks-total {
  float: right;
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.blocks-total.is-over { color: var(--red); }

/* Séances jouées (pilotage de séance, migration 117) */
.played-session { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.played-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; }
.played-head .cell-sub { display: inline; }
.played-label { display: block; margin-top: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
.played-skips { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.played-reason { color: var(--muted); }
.played-note { margin: 4px 0 0; font-size: 13px; white-space: pre-wrap; }

/* Sélecteur d'exercices : la liste est bornée en hauteur pour que les filtres
   et les blocs déjà posés restent visibles pendant qu'on cherche. */
.picker { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; background: var(--surface-2); }
.picker .hint { margin: 6px 2px 4px; }
.picker-list { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.picker-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.picker-item:hover { border-color: var(--orange); }
.picker-item .cell-sub { margin-top: 1px; }

/* Case à cocher avec son libellé sur la même ligne : le `label` global est en
   colonne, ce qui placerait la case au-dessus du texte. */
.check-inline { flex-direction: row !important; align-items: center; gap: 8px; color: var(--text); }
.check-inline input { width: auto; }

.detail label { margin-bottom: 10px; }
.detail textarea { width: 100%; resize: vertical; font-family: inherit; }

/* ── Mise en page : bandeau fixe ───────────────────────────────────────── */
/*
 * Le bandeau reste visible au défilement. La barre latérale a disparu : elle
 * immobilisait 268px de large pour trois onglets, alors que les tableaux de
 * cette interface ont besoin de place.
 */

.app-shell { min-height: 100vh; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 22px;
  /* Translucide + flou : le contenu qui passe dessous reste devine, ce qui
     rend le defilement lisible au lieu de donner un bandeau opaque flottant. */
  background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: saturate(180%) blur(8px);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.brand { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 600; }
.brand b { color: var(--orange); font-weight: 800; }
/* Le vrai logo, pas l'icone ronde suivie du nom retape en HTML.
   `aspect-ratio` porte les proportions une seule fois : seule la hauteur se
   regle, la largeur suit. */
.brand-mark {
  height: 36px;
  aspect-ratio: 1024 / 423;
  flex: 0 0 auto;
  background: var(--wordmark) center / contain no-repeat;
}

.tabs { display: flex; gap: 4px; flex: 1; }
.tab {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 7px 13px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.tab:hover { background: var(--surface-2); color: var(--text); }
.tab.is-active {
  background: var(--orange-soft);
  color: var(--orange-ink);
  border-color: color-mix(in srgb, var(--orange) 30%, transparent);
}

/* Sélecteur à segments — pendant de SegmentedTabs dans l'app : un cadre, des
   pastilles de largeur égale, l'active pleine. Il subdivise UNE section ; les
   onglets du bandeau portent les sections elles-mêmes. Le fond plein de
   l'active le distingue des onglets du haut, dont l'actif est seulement teinté :
   sans cet écart, deux rangées de boutons presque identiques se superposaient
   sans qu'on sache laquelle commandait l'autre. */
.segments {
  display: flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  max-width: 520px;
}
.segment {
  flex: 1;
  min-height: 36px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.segment:hover { background: var(--surface-2); color: var(--text); }
.segment.is-active { background: var(--orange); color: #fff; font-weight: 700; }

/* Sélecteur de dossier.
 *
 * Il a remplacé une invite du navigateur où il fallait TAPER le numéro d'un
 * dossier dans une liste. On choisissait un rangement en lisant une
 * énumération — alors que l'arborescence est juste à côté, à l'écran. */
.picker-back {
  position: fixed; inset: 0; z-index: 70;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; background: rgba(16, 24, 40, 0.45);
}
.picker {
  width: 100%; max-width: 420px; max-height: 80vh;
  display: flex; flex-direction: column;
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.picker-head { padding: 14px 16px 10px; border-bottom: 1px solid var(--line); }
.picker-head strong { display: block; font-size: 14px; }
.picker-head span { font-size: 12px; color: var(--muted); }
.picker-list { overflow: auto; padding: 8px; }
.picker-foot { padding: 10px 16px; border-top: 1px solid var(--line); text-align: right; }
/* Le dossier d'où l'on part : montré pour se repérer, mais pas choisissable. */
.lib-node[disabled] { opacity: 0.45; cursor: default; }
.lib-node[disabled]:hover { background: transparent; }

/* Cible d'un glisser-déposer. */
.lib-node.is-drop {
  background: var(--orange-soft); color: var(--orange-ink);
  outline: 2px dashed var(--orange); outline-offset: -2px;
}
tr[draggable="true"] { cursor: grab; }
tr.is-dragging { opacity: 0.45; }

/* Bibliothèque rangée : l'arborescence à gauche, le contenu à droite. Sous
   860px la colonne passe au-dessus — un arbre de dossiers large de 90px ne
   sert à rien. */
.library { display: grid; grid-template-columns: 250px 1fr; gap: 16px; align-items: start; }
@media (max-width: 860px) { .library { grid-template-columns: 1fr; } }

.lib-tree {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px; min-width: 0;
}
.lib-group { margin-bottom: 10px; }
.lib-group .eyebrow { display: block; padding: 4px 6px 6px; }
.lib-node {
  display: flex; align-items: center; gap: 6px;
  width: 100%; text-align: left; padding: 6px 8px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
}
.lib-node:hover { background: var(--surface-2); }
.lib-node.is-active { background: var(--orange-soft); color: var(--orange-ink);
                      border-color: color-mix(in srgb, var(--orange) 30%, transparent); }
.lib-node .lib-name { flex: 1; min-width: 0; overflow: hidden;
                      text-overflow: ellipsis; white-space: nowrap; }
.lib-node .lib-count { font-size: 11px; color: var(--muted); flex: none; }
.lib-node.is-active .lib-count { color: inherit; }
/* Marque un dossier reçu : on ne peut ni le modifier ni y ranger. */
.lib-node .lib-ro { font-size: 11px; color: var(--muted); flex: none; }

/* Les deux moities de l'arbre : ce qui est a soi, ce qu'on a recu. Le trait
   separe plus nettement que deux en-tetes seules — c'est cette frontiere qui
   decide de ce qu'on peut modifier. */
/* Les acces deja donnes, dans la meme fenetre que le partage : c'est la
   moitie « dans le temps », celle qu'on consulte quand un joueur s'en va. */
.share-granted-title { display: block; margin: 16px 0 6px; }
.share-grant {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; margin-bottom: 6px;
  border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.share-grant-name { flex: 1; min-width: 0; font-size: 13px;
                    overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-grant button { font-size: 12px; padding: 4px 9px; }

.lib-group--shared { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
/* Le rayon vide se dit, il ne se cache pas : sans ce texte on ne savait pas
   si la fonction manquait ou si rien n'avait encore ete recu. */
.lib-empty { margin: 4px 8px 0; font-size: 12px; line-height: 1.45; color: var(--muted); }

/* Le lien public, dans la fenetre de partage, a cote des acces nommes. */
.share-link-row { display: flex; align-items: center; gap: 6px; }
.share-link-row input {
  flex: 1; min-width: 0; font-size: 12px; padding: 5px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.share-link-row button { font-size: 12px; padding: 4px 9px; white-space: nowrap; }
/* Le nom de l'auteur, au-dessus de SON arbre : savoir de qui vient un systeme
   fait partie de ce qu'on lit. */
.lib-owner {
  display: block; padding: 8px 6px 4px;
  font-size: 11px; font-weight: 700; color: var(--muted);
}

.lib-body { min-width: 0; }
.lib-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-bottom: 12px;
}
.lib-head h3 { margin: 0; font-size: 16px; }
.lib-path { font-size: 12px; color: var(--muted); }
.lib-head .actions { margin-left: auto; }

/* Plays : une section par catégorie tactique, TOUJOURS affichée même vide —
   comme dans l'app. Un coach doit voir d'emblée les trois tiroirs dont il
   dispose, pas découvrir leur existence en créant son premier play. */
.play-group { margin-bottom: 22px; }
.play-group .eyebrow { display: block; margin-bottom: 8px; }
.play-group .hint { padding: 4px 2px 2px; font-style: italic; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }
.whoami { font-size: 13px; color: var(--muted); }
button.sm { font-size: 13px; padding: 6px 11px; }

.main { max-width: min(1600px, 96vw); margin: 0 auto; padding: 22px 22px 60px; }

.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 22px; }
.page-head p { margin: 0; flex: 1; color: var(--muted); font-size: 14px; }

/* Bandeau d'information (coach délégué). */
.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  margin-bottom: 16px;
  border: 1px solid color-mix(in srgb, var(--amber) 35%, var(--line));
  border-radius: var(--radius);
  background: var(--orange-soft);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.notice strong { display: block; margin-bottom: 2px; }

/* Actions reservees a l'abonnement coach : visibles mais inertes, pour que le
   coach delegue voie ce qui existe sans decouvrir l'interdit apres le clic. */
button:disabled,
button.is-locked {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Onglet Séances : liste OU éditeur, jamais les deux ────────────────── */

/* `.stage` remplace `.split` ici : ses deux enfants occupent tour à tour toute
   la largeur, au lieu de se partager l'écran. Composer une séance demande de
   la place — sélecteur d'exercices, blocs, assistants — et la colonne étroite
   d'un `.split` rendait le tout illisible. */
.stage > * { width: 100%; }

.editor-view { padding: 18px 20px; }

/* Au-delà d'une certaine largeur, une ligne de formulaire qui traverse tout
   l'écran devient pénible à lire : on borne sans revenir à deux colonnes. */
.editor-view > label,
.editor-view > .control-row,
.editor-view .picker,
.editor-view #woBlocks,
.editor-view #woAssistants { max-width: 860px; }

/* Les trois champs d'un play sur une ligne, et le nom qui prend le reste.
   Sous 620px ils se remettent les uns sous les autres — trois selects serres
   cote a cote ne se lisent plus. */
.play-fields { align-items: flex-end; gap: 12px; }
.play-fields .grow { flex: 1; min-width: 180px; }
.play-fields label { margin-bottom: 0; }
@media (max-width: 620px) { .play-fields { flex-direction: column; align-items: stretch; } }

.editor-view .detail-header {
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

/* ── Éditeur de diagramme ───────────────────────────────────────────────── */

:root {
  --court-floor: #dfb98a;
  --court-line: #ffffff;
  --dg-offense: #1f2937;
  --dg-offense-fill: #ffffff;
  --dg-defense: #dc2626;
  --dg-ball: #f97316;
  --dg-select: #6b7280;
}
/* Le choix EXPLICITE de sombre, et lui seul.
 *
 * `:root:not([data-theme="light"])` trainait ici en plus, hors de toute
 * media query : en theme « Systeme » sur un OS clair, l'attribut est absent,
 * le selecteur matchait, et le terrain passait en vert fonce pendant que le
 * reste de la page restait clair. La regle de la preference systeme est juste
 * en dessous, a sa place. */
:root[data-theme="dark"] {
  --court-floor: #1a4d2e;
  --court-line: #ffffff;
  --dg-offense: #f8fafc;
  --dg-offense-fill: #1e293b;
  --dg-select: #cbd5e1;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --court-floor: #1a4d2e;
    --court-line: #ffffff;
    --dg-offense: #f8fafc;
    --dg-offense-fill: #1e293b;
    --dg-select: #cbd5e1;
  }
}

/* Trois colonnes : phases, terrain, outils. Le terrain prend ce qui reste —
   c'est la seule zone qui gagne vraiment a etre large. */
.dg-layout {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 250px;
  gap: 14px;
  align-items: start;
  max-width: none;
}
@media (max-width: 1000px) {
  .dg-layout { grid-template-columns: 1fr; }
}

.dg-side, .dg-tools {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px;
}
.dg-side-head { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.dg-side-head .eyebrow { margin: 0; }
/* Annuler / rétablir : deux fleches, en tete de colonne. Elles valent pour
   tout le dessin, pas seulement pour les phases. */
.dg-head-line { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.dg-history { display: flex; gap: 4px; }
.dg-history button { padding: 2px 9px; font-size: 15px; line-height: 1.3; }
.dg-history button:disabled { opacity: 0.4; cursor: default; }

.dg-phase-name-input { width: 100%; margin-bottom: 8px; font-size: 13px; }
.dg-phase-strip { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow-y: auto; margin-bottom: 8px; }
.dg-phase {
  display: flex; align-items: baseline; gap: 6px;
  text-align: left; padding: 7px 9px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.dg-phase.is-active { border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.dg-phase-num { font-weight: 700; }
.dg-phase-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Le terrain ne prend plus toute la largeur disponible : il est dimensionne
   en pixels par applyCourtSize() pour tenir dans le cadre, hauteur comprise.
   Sans ce plafond il debordait sous le pli et on ne voyait meme pas le
   demi-terrain en entier. */
.dg-stage { display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.dg-court-col {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 100%; min-width: 0;
}

/* Vidéo ouverte et place suffisante : elle passe A COTE du terrain.
   `layoutVideo()` pose la classe — la décision tient à la largeur RESTANTE
   pour le terrain, que le CSS seul ne sait pas mesurer ici (la colonne du
   milieu dépend déjà de deux colonnes fixes et de la fenêtre). */
.dg-stage.has-video-side { flex-direction: row; align-items: flex-start; gap: 14px; }
.dg-stage.has-video-side .dg-court-col { flex: 1 1 0; width: auto; }
/* La poignee de partage. Invisible quand la video est empilee : il n'y a
   alors rien a partager, les deux prennent toute la largeur. */
.dg-video-grip { display: none; }
.dg-stage.has-video-side .dg-video-grip {
  display: block;
  flex: 0 0 8px;
  align-self: stretch;
  min-height: 120px;
  margin: 0 -3px;          /* la zone de prise deborde du gap, sans l'elargir */
  border-radius: 999px;
  cursor: col-resize;
  background: var(--line);
  opacity: 0.6;
  touch-action: none;      /* sinon le doigt fait defiler la page au lieu de tirer */
  transition: opacity 0.12s, background 0.12s;
}
.dg-stage.has-video-side .dg-video-grip:hover,
.dg-stage.has-video-side .dg-video-grip.is-dragging {
  opacity: 1;
  background: var(--orange);
}

.dg-stage.has-video-side .dg-video {
  flex: 0 0 var(--dg-video-col);
  width: var(--dg-video-col);
  margin-top: 0;
  /* Le terrain tient dans la fenêtre, pas la colonne des outils : sans cela
     la vidéo partirait vers le haut dès qu'on descend dans l'inspecteur. */
  position: sticky;
  top: 12px;
}
.dg-canvas {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 12px;
  overflow: auto;           /* zoome au-dela du cadre : on fait defiler */
  max-width: 100%;
  display: flex;
  justify-content: center;
}
/* Pas de selection de texte sur le terrain : un double-clic surlignait les
   numeros des joueurs, et le glisser suivant deplacait la SELECTION au lieu
   du joueur — il fallait cliquer ailleurs pour retrouver la main. */
.dg-svg { display: block; touch-action: none; user-select: none; -webkit-user-select: none; }

/* Barre de zoom sous le terrain, comme dans l'outil de reference. */
.dg-zoombar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.dg-zoombar button { padding: 3px 10px; font-size: 13px; }
.dg-zoombar span { min-width: 46px; text-align: center; font-size: 13px; font-weight: 600; }
/* Pendant le choix de l'auteur d'une action, le curseur dit que le prochain
   clic ne selectionne pas mais designe. */
.dg-svg.is-picking { cursor: crosshair; }

.dg-player { cursor: grab; }
/* Mise en avant : un carre gris clair a fond leger, dessine SOUS le symbole.
   Il remplace l'anneau orange, qui se confondait avec le rond de possession
   et colorait un symbole dont la couleur veut dire autre chose. */
.dg-select {
  fill: var(--dg-select);
  fill-opacity: 0.18;
  stroke: var(--dg-select);
  stroke-width: 1.5;
  pointer-events: none;
}
/* Le numero d'un attaquant EST son symbole depuis qu'il n'a plus de carre :
   il en reprend donc a peu pres la taille (cote 25,5 en unites viewBox). */
.dg-label { font: 700 30px system-ui, sans-serif; fill: var(--dg-offense); }
/* Doublure a la couleur du fond, dessinee SOUS le numero : sans elle un
   chiffre nu se perd sur le parquet. */
.dg-label-halo {
  font: 700 30px system-ui, sans-serif;
  fill: var(--dg-offense-fill);
  stroke: var(--dg-offense-fill);
  /* Une doublure de 5 encadrait le chiffre comme un autocollant. 3 suffit a le
     separer du parquet. */
  stroke-width: 3;
}
/* Le defenseur porte son numero DANS un disque plein : il ne peut pas suivre
   les attaquants a 30 sans deborder. 19 tient dans r=12,75. */
.dg-label-on-fill { font: 700 19px system-ui, sans-serif; fill: #fff; }
/* Cercle du porteur, et sa doublure a la couleur du fond — meme raison que le
   halo du numero : un trait nu se perd sur le parquet. */
.dg-carrier { stroke: var(--dg-offense); stroke-width: 2; }
.dg-carrier-halo { stroke: var(--dg-offense-fill); stroke-width: 3.5; }
.dg-rebound { font: 700 15px system-ui, sans-serif; fill: currentColor; }

.dg-ball { cursor: grab; }
.dg-ball.is-dragging { opacity: 0.65; cursor: grabbing; }
.dg-ball-count { font: 700 14px system-ui, sans-serif; fill: var(--dg-offense); }

.dg-action { color: var(--dg-offense); cursor: pointer; }
.dg-action--pass, .dg-action--handoff { color: #2563eb; }
.dg-action--shot { color: #ea580c; }
.dg-action--screen { color: #7c3aed; }
.dg-action--rebound { color: #0d9488; }
/* L'action selectionnee GARDE la couleur de son type : la repeindre en orange
   la faisait passer pour un tir, puisque c'est la couleur du tir. C'est
   l'aureole dessinee SOUS elle qui la designe. */
.dg-action-glow {
  stroke: var(--orange);
  stroke-width: 9;
  opacity: 0.4;
  pointer-events: none;
}
.dg-hit { cursor: pointer; }

/* Reperes d'aimantation, traces le temps du geste. Cyan : aucune autre couleur
   du diagramme ne l'emploie, donc un repere ne peut pas se lire comme une
   action. Memes valeurs que l'app (DiagramEditor.tsx). */
.dg-guide {
  fill: none;
  stroke: #22d3ee;
  stroke-width: 3;
  stroke-dasharray: 10, 7;
  pointer-events: none;
}

/* Liseré sous le pointillé : le cyan seul se perdait sur le parquet clair. */
.dg-guide-halo {
  fill: none;
  stroke: rgba(8, 47, 73, 0.55);
  stroke-width: 6;
  pointer-events: none;
}

.dg-handle { fill: none; stroke: var(--orange); stroke-width: 3; cursor: grab; pointer-events: none; }
.dg-handle--control { fill: var(--orange); fill-opacity: 0.85; }
/* Cible de clic large mais invisible : l'anneau visible reste fin pour ne pas
   masquer le joueur, sur lequel le depart tombe presque toujours. */
.dg-handle-hit { fill: transparent; cursor: grab; }
.dg-handle-link { stroke: var(--orange); stroke-width: 1.5; stroke-dasharray: 4,4; opacity: 0.6; }

.dg-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 8px; }
.dg-grid--coach { grid-template-columns: repeat(7, 1fr); }
.dg-chip { padding: 6px 0; font-weight: 700; }
.dg-chip--def { color: var(--dg-defense); border-color: color-mix(in srgb, var(--dg-defense) 40%, var(--line)); }
.dg-chip--ball { color: var(--dg-ball); border-color: color-mix(in srgb, var(--dg-ball) 40%, var(--line)); }
/* Attaquant qui porte le ballon : la pastille reprend le symbole du terrain —
   le numero, et un ballon en haut a droite. */
/* « Avec ballon » : le numero ENTOURE D'UN CERCLE, comme sur le terrain. La
   pastille portait un point orange en coin — une deuxieme convention a
   apprendre pour dire ce que le dessin dit deja autrement. */
.dg-chip--carrier { border-color: transparent; background: transparent; padding: 3px 0; }
/* Le rond est porte par le CHIFFRE, pas par le bouton : en absolu sur le
   bouton il se centrait sur la boite, pas sur le glyphe, et flottait a cote du
   numero. Ici il EST la boite du numero, donc centre par construction. */
.dg-chip--carrier .dg-ring {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px;
  border: 2px solid currentColor; border-radius: 50%;
}
.dg-chip--carrier:hover { background: var(--surface-2); }
/* Phase en ecart avec la precedente. Ambre et non rouge : ce n'est pas une
   erreur — un coach a le droit de poser une position a la main. On signale,
   on ne condamne pas. */
/* Vignettes de phase. La bande passe en colonne de cartes : une vignette a
   cote d'un libelle sur une ligne serait illisible a cette largeur. */
.dg-phase-strip.has-thumbs .dg-phase { flex-wrap: wrap; }
.dg-thumb {
  width: 100%; height: auto; margin-top: 6px;
  border: 1px solid var(--line); border-radius: 6px;
  background: var(--surface-2);
}
/* Le terrain d'une vignette est reduit d'environ quatre fois : un trait de 1,6
   unite y deviendrait un cheveu de 0,4px, et une passe disparaitrait purement
   et simplement. On epaissit donc tout ce qui est fin — trait, tetes,
   pointilles — pour que le dessin SURVIVE a la reduction.
   Les attributs de presentation du SVG cedent devant le CSS, donc ces regles
   l'emportent sans toucher au rendu du terrain principal. */
.dg-thumb .dg-action path { stroke-width: 6; }
.dg-thumb .dg-action line { stroke-width: 7; }
.dg-thumb .dg-action circle { stroke-width: 6; }
.dg-thumb .dg-action--pass path,
.dg-thumb .dg-action--handoff path,
.dg-thumb .dg-action--shot path { stroke-dasharray: 26, 18; }
.dg-thumb .dg-action--move path { stroke-dasharray: 8, 18; }
/* La zone de clic invisible ne doit pas, elle, devenir un gros trait noir. */
.dg-thumb .dg-hit { stroke-width: 0; }
.dg-thumbs-toggle {
  width: 100%; margin: 6px 0 8px;
  font-size: 11px; padding: 5px 8px;
}
.dg-thumbs-toggle.is-on { color: var(--orange-ink); border-color: var(--orange); }

.dg-phase.has-issue { border-color: var(--amber); }
.dg-phase-warn {
  margin-left: auto;
  align-self: center;
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
}

/* Le bandeau de la phase courante, pose AU-DESSUS du terrain : sous lui, il
   aurait demande de defiler pour decouvrir qu'il y avait un probleme. */
.dg-warn {
  margin-bottom: 10px;
  padding: 10px 12px;
  border: 1px solid var(--amber);
  border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--amber) 10%, transparent);
}
.dg-warn-head {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}
.dg-warn-head strong { font-size: 13px; }
.dg-warn-list {
  margin: 0 0 6px;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--text);
}

.dg-actions-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 10px; }
/* Materiel du terrain : meme grille que les actions, dessin sous les joueurs. */
.dg-elements-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 10px; }
.dg-element { cursor: grab; }
.dg-element.is-dragging { cursor: grabbing; opacity: 0.85; }
/* Etat de l'enregistrement automatique, pose a cote des boutons d'action.
   Discret par defaut : il ne doit se faire remarquer qu'en cas d'echec. */
.save-state {
  align-self: center;
  margin-left: 4px;
  font-size: 12px;
  color: var(--muted);
}
.save-state.is-error { color: var(--red); font-weight: 600; }

/* Pendant le deroule, les positions dessinees sont interpolees et non
   stockees : un clic designerait autre chose que ce qu'on voit. */
.dg-svg.is-playing { pointer-events: none; }

.dg-act {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; padding: 6px 8px; text-align: left;
}
/* Le symbole garde une largeur fixe : sans elle, une fleche et un ecran
   decalaient leurs libelles l'un par rapport a l'autre. */
.dg-act-glyph { width: 30px; height: 16px; flex: none; }
/* Action armee : le bouton reste allume tant qu'on n'a pas designe son auteur.
   Le curseur en croix ne suffisait pas — rien ne disait qu'un clic sur un
   joueur allait creer quelque chose plutot que le selectionner. */
.dg-act.is-armed {
  background: var(--orange);
  border-color: var(--orange);
  color: #fff;
  font-weight: 700;
}
.dg-tools .eyebrow { display: block; margin: 10px 0 6px; }
.dg-tools .eyebrow:first-child { margin-top: 0; }
#dgInspector h4 { margin: 4px 0 8px; font-size: 14px; }

/* Glisser : l'empreinte reste au point de depart, le symbole deplace
   s'allege pour qu'on voie le terrain sous lui pendant qu'on vise. */
.dg-ghost { opacity: 0.28; pointer-events: none; }
.dg-player.is-dragging { opacity: 0.65; cursor: grabbing; }

/* Joueur vise par une extremite d'action pendant le glisser : on montre
   l'attache AVANT le relachement, sinon elle se decouvre apres coup. */
.dg-player.is-snap circle,
.dg-player.is-snap text { filter: drop-shadow(0 0 7px var(--orange)); }

/* ── Résultats ──────────────────────────────────────────────────────────── */

.res-summary { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
.res-kpi {
  flex: 1; min-width: 150px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}
.res-kpi-val { display: block; font-size: 24px; font-weight: 700; line-height: 1.1; }
.res-kpi-lbl { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }

/* Trois paliers, pas un dégradé : le coach cherche « où ça coince », pas une
   note précise — et un dégradé continu ne se lit pas d'un coup d'œil. */
.res-spot { text-align: center; }
.res-spot.is-good { background: color-mix(in srgb, var(--green) 14%, transparent); }
.res-spot.is-mid  { background: color-mix(in srgb, var(--orange) 14%, transparent); }
.res-spot.is-low  { background: color-mix(in srgb, var(--red) 14%, transparent); }

.res-chart {
  width: 100%; height: 170px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 4px 0;
}
.res-grid { stroke: var(--line); stroke-width: 1; }
.res-axis { fill: var(--muted); font-size: 10px; }
.res-line { fill: none; stroke: var(--orange); stroke-width: 2.5; vector-effect: non-scaling-stroke; }
.res-dot { fill: var(--orange); stroke: var(--surface); stroke-width: 2; }
.res-dates { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Exercices de la bibliothèque publique : visibles pour qu'on retrouve celui
   sur lequel le groupe a tiré, mais non cliquables — rien à y modifier. */
tr.is-readonly { cursor: default; }
tr.is-readonly .cell-main { font-weight: 500; }

.res-scope { margin: 0 0 10px; }
.res-day {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.res-day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 6px; }
.res-day-rows { display: flex; flex-direction: column; gap: 3px; }
.res-day-row { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; }

/* ── Résultats : équipe puis joueur, même vocabulaire visuel ────────────── */

.res-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.res-big { font-size: 30px; font-weight: 700; line-height: 1; }
.res-lbl { display: block; font-size: 13px; color: var(--muted); margin-top: 3px; }
/* Objectif atteint : la seule lecture commune a tous les types d'exercice. */
.res-goal { text-align: right; flex: 0 0 auto; }
.res-goal-v { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.res-goal-l { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; max-width: 210px; }
@media (max-width: 560px) {
  .res-head { flex-direction: column; align-items: flex-start; }
  .res-goal { text-align: left; }
  .res-goal-l { max-width: none; }
}

.cols { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.col-court { flex: 0 0 300px; max-width: 100%; }
.col-rest { flex: 1 1 320px; min-width: 0; }
.res-court { width: 100%; height: auto; display: block; border-radius: 8px; }

/* Une ligne par spot : intitulé, cumul, courbe, écart. */
.spot-row {
  display: grid; grid-template-columns: 58px 76px 1fr 84px;
  align-items: center; gap: 10px;
  padding: 9px 11px; border-bottom: 1px solid var(--line);
}
.spot-row:last-child { border-bottom: 0; }
/* Variante sans courbe : le cumul prend la place laissee par la sparkline. */
.spot-row.is-plain { grid-template-columns: 58px 1fr 84px; }

/* Une ligne par séance d'un joueur : date, mesure, réussite brute, verdict. */
.sess-row {
  display: grid; grid-template-columns: 94px 92px 1fr auto;
  align-items: center; gap: 10px;
  padding: 9px 11px; border-bottom: 1px solid var(--line);
}
.sess-row:last-child { border-bottom: 0; }
.sess-row .sr-day { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.sess-row .sr-v { font-weight: 700; font-variant-numeric: tabular-nums; }
.sess-row .sr-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sess-row .sr-badge { text-align: right; }
/* Retour du coach : la ligne et son fil depliable forment un bloc. */
.sess-item { border-bottom: 1px solid var(--line); }
.sess-item:last-child { border-bottom: 0; }
.sess-item .sess-row { border-bottom: 0; }
.sess-row .sr-cmt { margin-left: 6px; }
.sess-row .sr-cmt.has-comments { border-color: var(--orange); }
.sess-thread { padding: 4px 11px 12px; background: var(--surface-2); }
.sess-thread .cmt { padding: 8px 0; border-bottom: 1px solid var(--line); }
.sess-thread .cmt:last-child { border-bottom: 0; }
.sess-thread .cmt-meta { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.sess-thread .cmt-meta span { color: var(--muted); font-size: 12px; }
.sess-thread .cmt-body { white-space: pre-wrap; margin-top: 3px; }
.sess-thread .cmt-actions { display: flex; gap: 6px; margin-top: 6px; }
.sess-thread .cmt-form { display: grid; gap: 8px; margin-top: 8px; }
.sess-thread .cmt-form textarea { width: 100%; resize: vertical; font-family: inherit; }
.sess-thread .cmt-form-row { display: flex; align-items: center; gap: 8px; }
.sess-thread .cmt-form-row .cmt-hint { flex: 1; margin: 0; }
@media (max-width: 560px) {
  .sess-row { grid-template-columns: 70px 76px 1fr; }
  .sess-row .sr-badge { grid-column: 1 / -1; text-align: left; }
}
.spot-row .s { color: var(--muted); font-size: 12px; }
.spot-row .cum { font-weight: 700; font-variant-numeric: tabular-nums; }
.spot-row .frac { display: block; font-size: 11.5px; color: var(--muted); font-weight: 400; }
.spot-row .trend { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }
.trend.up { color: var(--green); font-weight: 600; }
.trend.down { color: var(--red); font-weight: 600; }
.trend.flat { color: var(--muted); }
.spark { height: 34px; width: 100%; display: block; }
.spark-empty { color: var(--muted); font-size: 12px; }

.res-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 8px; }
.res-player {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px;
  text-align: left; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.res-player { white-space: normal; }
.res-player .rp-name, .res-player .rp-sub { min-width: 0; overflow-wrap: anywhere; }
.res-player:hover { border-color: var(--orange); }
.rp-name { font-weight: 600; }
.rp-pct { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.rp-sub { font-size: 11.5px; color: var(--muted); }
.rp-go { font-size: 11.5px; color: var(--orange); text-align: right; }

.res-player-card {
  margin-top: 16px; padding: 14px;
  border: 1px solid var(--orange); border-radius: var(--radius);
  background: var(--surface);
}
.hint.is-error { color: var(--red); }

@media (max-width: 560px) {
  .spot-row { grid-template-columns: 46px 64px 1fr 72px; gap: 7px; }
  .spot-row.is-plain { grid-template-columns: 46px 1fr 72px; }
}

.chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px;
  /* Repere de l'info-bulle, positionnee en absolu dans la boite. */
  position: relative; }

/* Cible de clic d'un point : invisible, mais assez large pour etre visee au
   doigt. Les points dessines ne font que 7 px. */
.pt-hit { cursor: pointer; }
.pt-tip {
  position: absolute; z-index: 5;
  display: flex; flex-direction: column; gap: 2px;
  padding: 7px 10px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  font-size: 12.5px; white-space: nowrap;
}
.pt-tip .pt-who { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--text); }
.pt-tip .pt-who i { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.pt-tip .pt-val { font-size: 16px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.pt-tip .pt-when { color: var(--muted); font-variant-numeric: tabular-nums; }
.res-chart2 { width: 100%; max-width: 720px; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.chart-legend .lg { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }

/* Légende des séances sous les courbes par spot : elles n'ont pas la place
   d'un axe, et une pente sans date ne dit pas sur quoi elle se lit. */
.spark-dates {
  display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline;
  margin: 0 0 8px; font-size: 11.5px; color: var(--muted);
}
.spark-dates .sd { font-variant-numeric: tabular-nums; }
.spark-dates .sd.is-last { color: var(--text); font-weight: 600; }

/* Sélecteur de spot du graphique d'équipe. */
.chart-picker { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 8px; }
.tabish {
  border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
  border-radius: 7px; padding: 4px 11px; font-size: 12.5px;
}
.tabish.on { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.chart-legend .lg-avg i { background: var(--text); opacity: 0.55; }
.chart-legend .lg-scope { margin-left: auto; font-weight: 600; color: var(--text); }


/* ── Agrandissement d'un graphique ──────────────────────────────────────────
   Plein écran plutôt qu'une boîte centrée : sur un graphique on veut de la
   place, et le zoom n'a d'intérêt que si le cadre est grand. */
/* Masquee par la classe `.hidden` de la maison (display:none !important) : un
   attribut [hidden] serait battu par le `display: flex` ci-dessous, et la
   surcouche resterait affichee en permanence. */
.zoom-overlay {
  position: fixed; inset: 0; z-index: 60;
  display: flex; flex-direction: column;
  background: var(--bg);
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
}
.zo-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.zo-title { font-weight: 600; font-size: 14px; flex: 1; min-width: 0;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.zo-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.zo-tools button { padding: 3px 10px; font-size: 13px; }
.zo-tools #zoomLevel { min-width: 52px; text-align: center; font-size: 13px; font-weight: 600;
                       font-variant-numeric: tabular-nums; }
.zo-body {
  flex: 1; min-height: 0; overflow: hidden; position: relative;
  /* Le glisser sert à se déplacer : le navigateur ne doit pas le prendre pour
     un défilement ou un pincement de page. */
  touch-action: none; cursor: grab; background: var(--bg);
}
.zo-body.is-panning { cursor: grabbing; }
.zo-canvas { position: absolute; top: 0; left: 0; width: 1200px; transform-origin: 0 0; }
.zo-canvas .res-chart2 { width: 100%; max-width: none; height: auto;
  /* Deja agrandi : le curseur ne doit plus promettre un zoom au clic. */
  cursor: default; }
.zo-canvas .chart-legend { margin-top: 10px; font-size: 13px; }
.zo-hint { margin: 0; padding: 8px 14px; font-size: 12px; color: var(--muted);
           border-top: 1px solid var(--line); background: var(--surface); }
/* Le graphique de la page annonce qu'il s'ouvre en grand. */
.res-chart2 { cursor: zoom-in; }
@media (max-width: 560px) {
  .zo-bar { flex-wrap: wrap; }
  .zo-title { flex: 1 0 100%; }
}


/* Mise en avant d'un joueur : on estompe les autres plutot que de les cacher,
   pour garder le contexte de comparaison. */
.pl-serie { transition: opacity .12s ease; }
.pl-serie.is-dim { opacity: 0.16; }
.pl-serie.is-lead path { stroke-width: 3.2; }
.chart-legend .lg-pick {
  display: inline-flex; align-items: center; gap: 4px;
  background: none; border: 0; padding: 0; margin: 0;
  font: inherit; color: inherit; cursor: pointer;
}
.chart-legend .lg-pick.is-dim { opacity: 0.35; }


/* Terrain : repere de l'info-bulle, et les pastilles annoncent qu'elles
   repondent au clic. */
.court-wrap { position: relative; }
.spot-hit { cursor: pointer; }
.pt-tip { cursor: pointer; pointer-events: auto; }

/* ── Vidéo de référence d'un système ────────────────────────────────────── */
/* On cale en regardant le dessin ET la vidéo : ils doivent être dans le même
   champ de vision. D'où deux refus successifs :
     · pas dans la colonne des phases (250px) — un lecteur y tiendrait dans un
       timbre-poste et les trois boutons de calage s'y empilaient ;
     · pas sous le terrain non plus — on y faisait l'aller-retour en
       permanence entre la vidéo et le dessin.
   Donc À CÔTÉ du terrain dès que la fenêtre le permet, et sous lui seulement
   quand elle ne le permet pas.
   Repliée par défaut : la plupart des systèmes n'ont pas de vidéo. */
.dg-video {
  --dg-video-col: 330px;
  width: 100%;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: var(--surface-2);
}
.dg-video > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}
.dg-video .control-row { margin-top: 10px; }
.dg-video input[type="url"] { flex: 1; min-width: 160px; font-size: 13px; }
/* Import d'une video a soi : le libelle de la source prend la place libre,
   la barre d'avancement n'apparait que pendant l'envoi. */
.dg-video-upload .hint { flex: 1; min-width: 0; }
.dg-video-progress { display: block; width: 100%; margin-top: 8px; height: 6px; }

/* Le cadre garde le rapport 16/9 avant même que le lecteur arrive : sans lui,
   la colonne sautait de hauteur au chargement de l'iframe. */
.dg-video-frame {
  margin-top: 10px;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}
.dg-video-frame iframe,
.dg-video-frame > div { width: 100%; height: 100%; border: 0; }
/* Video importee : sans regle, la balise <video> prenait sa taille native et
   le cadre (overflow hidden) n'en montrait que le haut. Elle tient dans le
   cadre ; le cadre prend le format de la video (portrait de telephone compris),
   plafonne en hauteur pour ne pas pousser le terrain hors de l'ecran. */
.dg-video-frame video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.dg-video-frame.is-hosted { max-height: 70vh; margin-left: auto; margin-right: auto; }
.dg-video-cue { margin-top: 10px; }

/* Point d'étape dans la liste des phases. En rouge quand il RECULE : la vidéo
   ne repassera jamais dessus, donc la phase est inatteignable. */
.dg-phase-cue {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--orange-soft);
  color: var(--orange-ink);
}
.dg-phase-cue.is-bad { background: var(--red-soft); color: var(--red); }

/* Fin de l'action, et partage de la vidéo. Sous les points d'étape, dont
   ils dépendent : une fin sans vidéo n'a pas d'objet. */
.dg-video-end { margin-top: 10px; }
.dg-video-share {
  display: block;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  cursor: pointer;
}
.dg-video-share input { margin-right: 6px; }
.dg-video-share .hint { display: block; margin: 4px 0 0 22px; }

/* ─── Progressions d'exercices ─────────────────────────────────────────── */
.prog-pill { margin-left: 6px; font-weight: 500; }
.prog-block { margin: 10px 0 14px; }
.prog-row { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.prog-row:first-of-type { border-top: 0; }
.prog-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.prog-main input { font-size: 12px; }
.prog-candidates { margin-top: 6px; }
.prog-previous { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.prog-previous li { margin: 2px 0; }
.progression-band {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px;
  margin-top: 6px; padding: 6px 10px; border-radius: 8px;
  background: var(--orange-soft); border: 1px dashed color-mix(in srgb, var(--orange) 40%, transparent);
  font-size: 12px;
}
.progression-band .prog-label { font-weight: 600; color: var(--orange-ink); }
.progression-band .prog-item { display: inline-flex; align-items: center; gap: 6px; }
.progression-band .prog-title { font-weight: 500; }
.progression-band button { padding: 2px 8px; font-size: 12px; }
.progression-band .prog-dismiss { margin-left: auto; }

/* ─── Thèmes, format, brouillons (migration 113) ───────────────────────── */
.badge-row { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin: 2px 0 4px; }
.detail .badge-row { margin: 0 0 12px; }
.draft-notice {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
  margin: 0 0 12px; padding: 8px 12px; border-radius: 8px; font-size: 13px;
  background: var(--orange-soft); color: var(--orange-ink);
  border: 1px solid color-mix(in srgb, var(--orange) 30%, transparent);
}
.draft-notice span { flex: 1; min-width: 200px; }
.ex-description { margin: 0 0 12px; white-space: pre-wrap; line-height: 1.5; }
.inline-label { flex-direction: row !important; align-items: center; gap: 6px; }
.inline-label select { width: auto; }

/* ── Défis ──────────────────────────────────────────────────────────────────
   Fenêtre de lancement, liste (Progrès › Défis) et classement. */
.picker.challenge-launcher { max-width: 520px; }
.challenge-launcher .picker-list { display: flex; flex-direction: column; gap: 6px; }
.ch-email-row { display: flex; gap: 6px; }
.ch-email-row input { flex: 1; min-width: 0; }
.ch-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ch-chips:empty { display: none; }
.ch-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 10px; font-size: 12.5px;
  background: var(--orange-soft); color: var(--orange-ink);
  border: 1px solid color-mix(in srgb, var(--orange) 30%, transparent); border-radius: 999px;
}
.ch-chip button {
  border: 0; background: transparent; color: inherit; cursor: pointer;
  min-height: 0; padding: 0 6px; font-size: 15px; line-height: 1;
}
.ch-section { display: block; margin-top: 8px; }
.ch-checks { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 2px 0; }
.ch-checks .check-inline { margin: 0; }
.ch-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 10px; margin-bottom: 6px; }
.ch-group summary { cursor: pointer; font-weight: 600; font-size: 13px; }
.ch-group .ch-checks { margin-top: 6px; }
.ch-public { margin-top: 8px; }

#challengesBody h3 { margin: 20px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--muted); }
#challengesBody tbody tr { cursor: pointer; }

.ch-message {
  margin: 12px 0; padding: 8px 12px;
  border-left: 3px solid var(--orange); background: var(--surface-2);
  font-style: italic; white-space: pre-wrap;
}
.ch-board .ch-rank { font-weight: 700; font-variant-numeric: tabular-nums; width: 56px; }
.ch-board .ch-value { display: block; font-weight: 700; font-size: 16px; font-variant-numeric: tabular-nums; }
.ch-board tr.is-clickable { cursor: pointer; }
.ch-board tr.is-clickable:hover { background: var(--surface-2); }
.ch-board tr.is-me .cell-main { font-weight: 700; }
.ch-board tr.is-selected { background: var(--orange-soft); }
.ch-pending { margin: 0 0 6px; padding-left: 18px; font-size: 13px; }
.ch-confirm {
  margin-top: 10px; padding: 10px 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  border: 1px solid var(--red); border-radius: var(--radius-sm); background: var(--red-soft);
}
.ch-confirm > span { flex: 1; min-width: 200px; }
.ch-confirm .hint { flex-basis: 100%; }
.ch-board tbody tr:not(.is-clickable) { cursor: default; }

/* Commande hors de portée de l'abonnement : visible, grisée, avec la pastille
   du niveau requis en haut à droite (CoachBadge de l'app). Le clic est capté
   par l'enveloppe, qui affiche l'explication. */
.gated { position: relative; display: inline-block; cursor: help; }
.gated.is-block { display: block; padding: 8px 10px; border: 1px dashed var(--line); border-radius: var(--radius-sm); }
.gated > *:not(.tier-badge) { opacity: 0.5; pointer-events: none; }
.gated:focus-visible { outline: 2px solid #FF6B35; outline-offset: 2px; }
.tier-badge {
  position: absolute; top: -8px; right: -8px;
  padding: 2px 6px; border-radius: 4px;
  background: #FF6B35; color: #fff;
  font-size: 10px; font-weight: 700; line-height: 1.3;
  text-transform: uppercase; letter-spacing: 0.5px;
  pointer-events: none; white-space: nowrap;
}
.gate-tip { margin: 6px 0 0; color: var(--orange-ink); }

/* ── Compte (lecture) ────────────────────────────────────────────────────── */
.account-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}
.account-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  min-width: 0;
}
.account-wide { grid-column: 1 / -1; }
.account-card .hint { margin-top: 6px; }
.account-field { display: block; margin-top: 10px; font-size: 13px; color: var(--muted); }
.account-field .control-row { margin-top: 4px; }
.account-field input { flex: 1; min-width: 0; }
.account-dl {
  display: grid;
  grid-template-columns: minmax(120px, max-content) 1fr;
  gap: 8px 14px;
  margin: 12px 0 0;
  font-size: 14px;
}
.account-dl:empty { display: none; }
.account-dl dt { color: var(--muted); }
.account-dl dd { margin: 0; overflow-wrap: anywhere; }
.account-tier { margin: 10px 0 0; font-size: 16px; }
.account-store-note { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px !important; }
.account-usage { margin: 10px 0 8px; font-size: 15px; }
.account-meter {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.account-meter > span { display: block; height: 100%; background: var(--green); }
.account-meter.is-high > span { background: var(--orange); }
.account-meter.is-over > span { background: var(--red); }
.account-videos { margin-top: 12px; }
.account-videos .num { text-align: right; white-space: nowrap; }

/* ── Colonne d'outils en cartes (2026-11-26) ──────────────────────────────
   Chaque famille d'outils (formations, joueurs, ballon, materiel, actions,
   selection) a sa carte et son titre en gras, au style du bloc « Vidéo de
   référence » : la colonne se lisait comme une seule liste. */
.dg-tools {
  border: 0;
  background: transparent;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dg-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  padding: 10px 12px;
}
.dg-card-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
}
.dg-card > :last-child { margin-bottom: 0; }
details.dg-card > summary.dg-card-title { margin: 0; cursor: pointer; }
details.dg-card[open] > summary.dg-card-title { margin-bottom: 8px; }
.dg-formations .hint { margin-bottom: 8px; }
.dg-formations-sub {
  display: block;
  margin: 8px 0 4px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}
.dg-formations-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.dg-formation {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 4px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
  min-width: 0;
}
.dg-formation .dg-formation-thumb { margin-top: 0; background: var(--card); }
.dg-formation:hover .dg-formation-thumb { border-color: var(--orange); }
.account-video-content .cell-main { margin-left: 4px; }
.account-video-content .cell-sub { display: block; }
.account-video-actions { white-space: nowrap; text-align: right; }
.account-video-actions button + button { margin-left: 4px; }

/* ── Carte « Bibliothèque » d'un exercice (superadmin, migration 128) ───── */
.lib-sets { display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0; }
.lib-sets .lib-set { margin: 0; }
.lib-missing { margin: 10px 0; font-size: 13px; line-height: 1.6; }
.lib-table-wrap { overflow-x: auto; }
.lib-texts th[scope="row"] { white-space: nowrap; vertical-align: top; padding-top: 10px; font-weight: 500; }
.lib-texts td { vertical-align: top; }
.lib-texts input, .lib-texts textarea { width: 100%; min-width: 160px; font-size: 13px; }
.lib-texts .is-missing { border-color: var(--orange); background: var(--orange-soft); }
.detail .lib-title { margin: 14px 0 6px; font-size: 13px; font-weight: 600; }
.res-court-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.res-court-head h3 { margin: 0; }

/* Liste des systemes : video jointe. */
.play-video-badge { display: inline-flex; vertical-align: -3px; margin-left: 6px; color: var(--orange-ink); }
