/* Valuebet Analytics — système de design.
 *
 * DEUX THÈMES CHOISIS, PAS UN THÈME INVERSÉ. Le mode sombre a ses propres
 * valeurs : fond graphite (jamais le noir absolu), cartes un cran plus
 * claires, texte clair mais pas blanc pur, bordures à faible contraste. La
 * hiérarchie — titre de page, KPI, titre de section, valeur, libellé — est la
 * même dans les deux ; seules les valeurs des jetons changent.
 *
 * LES COULEURS ONT UN RÔLE, UN SEUL.
 *  · bleu Valuebet (--marque) : actions, éléments actifs, séries de graphique ;
 *  · vert (--bon) : une valeur POSITIVE (ROI, CLV, P&L) — rien d'autre ;
 *  · rouge (--grave) : une valeur négative, une erreur ;
 *  · orange (--alerte) : une mesure fragile (couverture, effectif).
 * Le tableau de bord ne vire donc pas au vert parce que les résultats sont
 * bons : seuls les chiffres le sont.
 *
 * ⚠️ LA PAIRE DIVERGENTE DES GRAPHIQUES RESTE BLEU ↔ ROUGE. Elle est validée
 * par script (bande de clarté, séparation daltonienne, contraste sur le fond)
 * dans les deux modes, et ses armes sont à iso-clarté l'une de l'autre : sans
 * ça, un écart négatif paraîtrait plus fort qu'un écart positif de même
 * ampleur. Un vert/rouge serait illisible pour un daltonien sur la matrice ;
 * le signe du chiffre, lui, est toujours écrit.
 *
 * ⚠️ AUCUNE RESSOURCE EXTERNE. Pas de CDN, pas de police distante. La page
 * doit fonctionner derrière un tunnel SSH, sur une VM sans accès sortant.
 */

/* ══ JETONS ═══════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;

  --fond-page:    #f4f6f9;
  --fond-carte:   #ffffff;
  --fond-sous:    #f7f8fa;
  --fond-survol:  #f0f3f7;
  --encre:        #101828;
  --encre-2:      #475467;
  --encre-muet:   #667085;   /* 4,6:1 sur le fond de page — lisible, pas décoratif */
  --bordure:      #e4e8ee;
  --bordure-forte:#cfd6e0;
  --grille:       #edf0f4;
  --axe:          #c9d1dc;

  --marque:       #2a78d6;
  --marque-fort:  #1d64bd;
  --marque-doux:  rgba(42, 120, 214, .09);
  --marque-bord:  rgba(42, 120, 214, .35);
  /* Le fond du bouton principal : sous texte blanc, ≥ 4,5:1 dans les deux thèmes. */
  --marque-bouton:#2170cf;
  --marque-bouton-fort:#1a5fb4;
  --serie-2:      #b7791f;

  /* Divergent des graphiques : pôles validés. */
  --pos:          #2a78d6;
  --neg:          #e34948;
  --neutre:       #eef1f5;
  /* Armes à iso-clarté (L OKLab ≈ .81 / .62 / .43 de chaque côté). */
  --pos-1: #9ec5f4;  --pos-2: #3987e5;  --pos-3: #184f95;
  --neg-1: #f6b9b8;  --neg-2: #e34948;  --neg-3: #98211f;

  --bon:          #0e8a4f;
  --bon-doux:     rgba(14, 138, 79, .10);
  --grave:        #cf3b36;
  --grave-doux:   rgba(207, 59, 54, .09);
  --alerte:       #b25b12;
  --alerte-doux:  rgba(178, 91, 18, .09);

  /* Barre latérale : graphite dans les deux thèmes. */
  --sb-fond:      #0f1520;
  --sb-encre:     #c3cad6;
  --sb-muet:      #7a8597;
  --sb-survol:    rgba(255, 255, 255, .05);
  --sb-actif:     rgba(255, 255, 255, .09);
  --sb-bord:      rgba(255, 255, 255, .07);

  --r:   12px;
  --r-s: 8px;
  --ombre: 0 1px 2px rgba(16, 24, 40, .04), 0 1px 3px rgba(16, 24, 40, .05);
  --ombre-survol: 0 2px 4px rgba(16, 24, 40, .05), 0 6px 16px rgba(16, 24, 40, .07);
  --ombre-pop: 0 12px 32px rgba(16, 24, 40, .14), 0 2px 6px rgba(16, 24, 40, .06);

  --sb-l: 248px;
  --police: "Inter", "InterVariable", -apple-system, BlinkMacSystemFont,
            "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --fond-page:    #13171d;
  --fond-carte:   #1a1f27;
  --fond-sous:    #20262f;
  --fond-survol:  #252c36;
  --encre:        #e6e9ee;
  --encre-2:      #adb5c1;
  --encre-muet:   #8d97a6;   /* 5,6:1 sur les cartes */
  --bordure:      rgba(255, 255, 255, .07);
  --bordure-forte:rgba(255, 255, 255, .13);
  --grille:       rgba(255, 255, 255, .05);
  --axe:          rgba(255, 255, 255, .16);

  --marque:       #4f8fdc;
  --marque-fort:  #6ea3e6;
  --marque-doux:  rgba(79, 143, 220, .13);
  --marque-bord:  rgba(79, 143, 220, .45);
  --marque-bouton:#2f6fc0;
  --marque-bouton-fort:#3a7bcf;
  --serie-2:      #cf9e4a;

  --pos:          #3987e5;
  --neg:          #e66767;
  --neutre:       #28303a;
  --pos-1: #b7d3f6;  --pos-2: #3987e5;  --pos-3: #1c5cab;
  --neg-1: #f4c4c4;  --neg-2: #e66767;  --neg-3: #a83230;

  --bon:          #43b97c;
  --bon-doux:     rgba(67, 185, 124, .12);
  --grave:        #ec6b65;
  --grave-doux:   rgba(236, 107, 101, .11);
  --alerte:       #e0964f;
  --alerte-doux:  rgba(224, 150, 79, .11);

  --sb-fond:      #0e1116;
  --sb-encre:     #b9c1cd;
  --sb-muet:      #6c7686;
  --sb-bord:      rgba(255, 255, 255, .06);

  --ombre: none;
  --ombre-survol: 0 0 0 1px rgba(255, 255, 255, .06);
  --ombre-pop: 0 14px 36px rgba(0, 0, 0, .5), 0 0 0 1px rgba(255, 255, 255, .06);
}

/* ══ BASE ═════════════════════════════════════════════════════════════ */

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  background: var(--fond-page);
  color: var(--encre);
  font: 14px/1.5 var(--police);
  /* Chiffres tabulaires : sans ça, une colonne de nombres ne s'aligne pas
     et l'œil ne peut plus comparer deux lignes d'un coup. */
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
/* Transition de thème : posée le temps d'une bascule seulement, jamais en
   permanence — sinon chaque survol hériterait d'un fondu. */
html.theme-transition, html.theme-transition *, html.theme-transition *::before {
  transition: background-color .22s ease, border-color .22s ease,
              color .22s ease, fill .22s ease, stroke .22s ease !important;
}

svg { display: block; }
a { color: var(--marque); text-decoration: none; }
a:hover { text-decoration: underline; }

input, select, button, textarea { font: inherit; color: inherit; }

input[type="number"], input[type="date"], input[type="text"],
input[type="search"], select {
  font-size: 13px;
  color: var(--encre);
  background: var(--fond-carte);
  border: 1px solid var(--bordure-forte);
  border-radius: var(--r-s);
  padding: 7px 10px;
  min-width: 0;
  width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover { border-color: var(--encre-muet); }
input:focus, select:focus, button:focus-visible, a:focus-visible,
.champ-tete:focus-visible {
  outline: none;
  border-color: var(--marque);
  box-shadow: 0 0 0 3px var(--marque-doux);
}
button:focus-visible, a:focus-visible { border-radius: var(--r-s); }

.aide { font-size: 12px; color: var(--encre-muet); line-height: 1.45; }

/* ══ BOUTONS ══════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 16px;
  border-radius: var(--r-s); border: 1px solid transparent;
  font-size: 13.5px; font-weight: 550; white-space: nowrap;
  cursor: pointer; user-select: none;
  transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s, transform .06s;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor;
           stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.btn-petit { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn-primaire { background: var(--marque-bouton); color: #fff; border-color: var(--marque-bouton); }
.btn-primaire:hover:not(:disabled) { background: var(--marque-bouton-fort); border-color: var(--marque-bouton-fort); }
.btn-primaire:disabled { opacity: .7; cursor: progress; }
.btn-secondaire { background: var(--fond-carte); color: var(--encre); border-color: var(--bordure-forte); }
.btn-secondaire:hover:not(:disabled) { background: var(--fond-survol); }
.btn-fantome { background: transparent; color: var(--encre-2); border-color: var(--bordure-forte); }
.btn-fantome:hover:not(:disabled) { background: var(--fond-survol); color: var(--encre); }
.btn:disabled { cursor: not-allowed; }

/* L'état « à relancer » : les filtres ont changé depuis la dernière
   analyse. Un halo discret, pas une animation qui clignote. */
.btn-primaire.a-relancer { box-shadow: 0 0 0 3px var(--marque-doux), 0 0 0 1px var(--marque); }

#analyser { min-width: 118px; font-weight: 600; }
#analyser .roue {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  display: none; animation: tourne .7s linear infinite;
}
#analyser.charge .roue { display: inline-block; }
@keyframes tourne { to { transform: rotate(360deg); } }

.icone-btn {
  width: 38px; height: 38px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-s); border: 1px solid var(--bordure-forte);
  background: var(--fond-carte); color: var(--encre-2); cursor: pointer;
  transition: background-color .12s, color .12s;
}
.icone-btn:hover { background: var(--fond-survol); color: var(--encre); }
.icone-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor;
                 stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#theme .ic-soleil { display: none; }
:root[data-theme="dark"] #theme .ic-soleil { display: block; }
:root[data-theme="dark"] #theme .ic-lune { display: none; }

/* Contrôle segmenté : un choix exclusif, toujours visible. */
.segmente {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--fond-sous); border: 1px solid var(--bordure);
  border-radius: 9px;
}
.segmente button {
  border: 0; background: transparent; color: var(--encre-2);
  font-size: 12.5px; font-weight: 550; padding: 5px 11px;
  border-radius: 6px; cursor: pointer; white-space: nowrap;
  transition: background-color .12s, color .12s, box-shadow .12s;
}
.segmente button:hover { color: var(--encre); }
.segmente button.actif {
  background: var(--fond-carte); color: var(--encre);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 0 0 1px var(--bordure);
}
:root[data-theme="dark"] .segmente button.actif { background: var(--fond-survol); }
.segmente-mini button { padding: 4px 8px; font-size: 11.5px; }
.segmente-plein { display: flex; }
.segmente-plein button { flex: 1 1 0; }

/* ══ STRUCTURE ════════════════════════════════════════════════════════ */

.app {
  display: grid;
  grid-template-columns: var(--sb-l) minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns .2s ease;
  /* La colonne de la barre latérale garde sa teinte jusqu'en bas de page,
     même au-delà de la hauteur de l'écran. */
  background: linear-gradient(to right, var(--sb-fond) var(--sb-l), transparent var(--sb-l));
}
html.sb-replie { --sb-l: 72px; }

.cadre { max-width: 1520px; margin: 0 auto; width: 100%; }
.principal { min-width: 0; display: flex; flex-direction: column; }

/* ── Barre latérale ────────────────────────────────────────────────── */

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow: hidden;
  background: var(--sb-fond); color: var(--sb-encre);
  display: flex; flex-direction: column;
  border-right: 1px solid var(--sb-bord);
  z-index: 40;
}
.sb-marque {
  display: flex; align-items: center; gap: 11px;
  padding: 18px 16px 18px 18px; min-height: 70px;
}
.sb-logo svg { width: 32px; height: 32px; }
.sb-logo rect { fill: var(--marque); }
.sb-logo path { fill: none; stroke: #fff; stroke-width: 2.2;
                stroke-linecap: round; stroke-linejoin: round; }
.sb-nom { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.sb-nom b { color: #fff; font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.sb-nom span { color: var(--sb-muet); font-size: 12px; font-weight: 500; letter-spacing: .02em; }
.sb-replier {
  margin-left: auto; width: 28px; height: 28px; border-radius: 7px;
  border: 1px solid var(--sb-bord); background: transparent; color: var(--sb-muet);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.sb-replier:hover { color: #fff; background: var(--sb-survol); }
.sb-replier svg { width: 16px; height: 16px; fill: none; stroke: currentColor;
                  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
                  transition: transform .2s; }

.sb-nav { flex: 1 1 auto; overflow-y: auto; padding: 6px 10px; display: flex;
          flex-direction: column; gap: 2px; }
.sb-lien {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: 8px;
  color: var(--sb-encre); font-size: 13.5px; font-weight: 500;
  white-space: nowrap; position: relative;
  transition: background-color .12s, color .12s;
}
.sb-lien:hover { background: var(--sb-survol); color: #fff; text-decoration: none; }
.sb-lien svg { width: 18px; height: 18px; flex: 0 0 auto; fill: none; stroke: currentColor;
               stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.sb-lien.actif { background: var(--sb-actif); color: #fff; }
.sb-lien.actif svg { opacity: 1; color: #8bb8f0; }
.sb-lien.actif::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; border-radius: 0 3px 3px 0; background: var(--marque);
}
.sb-sep { height: 1px; background: var(--sb-bord); margin: 10px 8px; }

.sb-pied {
  padding: 14px 18px 18px; border-top: 1px solid var(--sb-bord);
  font-size: 12px; color: var(--sb-muet); display: flex; flex-direction: column; gap: 3px;
}
.sb-statut { display: flex; align-items: center; gap: 8px; color: var(--sb-encre); font-weight: 500; }
.sb-statut .point { width: 7px; height: 7px; border-radius: 50%; background: var(--sb-muet); flex: 0 0 auto; }
.sb-statut .point.ok { background: #43b97c; box-shadow: 0 0 0 3px rgba(67, 185, 124, .18); }
.sb-statut .point.ko { background: #ec6b65; box-shadow: 0 0 0 3px rgba(236, 107, 101, .18); }
.sb-maj { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Barre latérale réduite : icônes seules. */
html.sb-replie .sb-nom, html.sb-replie .sb-lien span, html.sb-replie .sb-pied > .sb-maj,
html.sb-replie .sb-statut span:last-child { display: none; }
html.sb-replie .sb-marque { flex-direction: column; padding: 16px 0 12px; gap: 12px; }
html.sb-replie .sb-replier { margin: 0; }
html.sb-replie .sb-replier svg { transform: rotate(180deg); }
html.sb-replie .sb-lien { justify-content: center; padding: 10px 0; }
html.sb-replie .sb-pied { align-items: center; padding: 14px 0; }

/* ── Barre du haut ─────────────────────────────────────────────────── */

.barre-haut {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--fond-page) 86%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--bordure);
  padding: 0 32px;
}
.barre-haut-cadre { display: flex; align-items: center; gap: 16px; min-height: 76px; padding: 12px 0; }
.titre-page { min-width: 0; flex: 1 1 auto; }
.titre-page h1 {
  margin: 0; font-size: 22px; line-height: 1.2; font-weight: 650;
  letter-spacing: -.02em; display: flex; align-items: baseline; gap: 9px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.h1-marque { color: var(--encre-muet); font-weight: 550; font-size: 15px; letter-spacing: -.005em; }
.h1-sep { color: var(--bordure-forte); font-weight: 400; }
.sous-titre { margin: 3px 0 0; color: var(--encre-2); font-size: 13px; }
.actions-haut { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.menu-mobile { display: none; }

.periode {
  display: flex; align-items: center; gap: 4px; height: 38px;
  padding: 0 6px 0 11px; border-radius: var(--r-s);
  border: 1px solid var(--bordure-forte); background: var(--fond-carte);
}
.periode:focus-within { border-color: var(--marque); box-shadow: 0 0 0 3px var(--marque-doux); }
.periode > svg { width: 16px; height: 16px; fill: none; stroke: var(--encre-muet);
                 stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.periode input[type="date"] {
  border: 0; background: transparent; padding: 4px 2px; width: auto;
  font-size: 13px; font-weight: 500; box-shadow: none;
}
.periode input[type="date"]:focus { box-shadow: none; }
.periode .fleche { color: var(--encre-muet); font-size: 12px; }

/* ── Barre des filtres principaux ─────────────────────────────────── */

.barre-filtres { padding: 18px 32px 0; }
.filtres-principaux { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; }

.menu { position: relative; display: flex; flex-direction: column; gap: 5px; }
.menu-titre {
  font-size: 11.5px; font-weight: 600; color: var(--encre-muet);
  letter-spacing: .02em;
}
.menu-btn {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 38px; min-width: 148px; max-width: 260px; padding: 0 10px 0 12px;
  border-radius: var(--r-s); border: 1px solid var(--bordure-forte);
  background: var(--fond-carte); color: var(--encre);
  font-size: 13.5px; font-weight: 550; cursor: pointer;
  transition: border-color .12s, background-color .12s;
}
.menu-btn:hover { border-color: var(--encre-muet); }
.menu-btn.filtre-actif { border-color: var(--marque-bord); background: var(--marque-doux); }
.menu-btn .menu-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-btn svg, .btn .chev { width: 15px; height: 15px; fill: none; stroke: var(--encre-muet);
                            stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
                            flex: 0 0 auto; transition: transform .15s; }
.menu.ouvert .menu-btn svg { transform: rotate(180deg); }

.menu-pop {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 60;
  min-width: 240px; max-width: 340px; max-height: 380px; overflow-y: auto;
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: 10px; box-shadow: var(--ombre-pop); padding: 6px;
  animation: pop .12s ease-out;
}
.menu-pop-large { min-width: 300px; }
.menu-pop-droite { left: auto; right: 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 7px; background: transparent;
  text-align: left; cursor: pointer; font-size: 13.5px; color: var(--encre);
}
.menu-item:hover, .menu-item:focus-visible { background: var(--fond-survol); box-shadow: none; }
.menu-item .coche { width: 16px; height: 16px; flex: 0 0 auto; fill: none; stroke: var(--marque);
                    stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; visibility: hidden; }
.menu-item.choisi { font-weight: 600; }
.menu-item.choisi .coche { visibility: visible; }
.menu-item .compte { margin-left: auto; color: var(--encre-muet); font-size: 12px; }
#pp-export .menu-item { flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 12px; }
#pp-export .menu-item span { font-size: 12px; color: var(--encre-muet); }
.menu-sep { height: 1px; background: var(--bordure); margin: 5px 4px; }
.menu-recherche { padding: 4px 4px 6px; }
.menu-recherche input { padding: 6px 9px; }
.menu-note { padding: 6px 10px 4px; font-size: 11.5px; color: var(--encre-muet); }

.btn-avances { position: relative; height: 38px; }
.btn-avances .lib-mobile { display: none; }
.pastille {
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: var(--marque-bouton); color: #fff; font-size: 11px; font-weight: 650;
  display: inline-flex; align-items: center; justify-content: center;
}

.contexte {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 14px; padding: 10px 0 2px; border-top: 1px dashed var(--bordure);
}
.contexte-ligne {
  margin: 0; font-size: 13px; color: var(--encre-2); flex: 1 1 360px; min-width: 0;
  /* Les critères sont des blocs insécables : c'est ENTRE eux que la ligne
     se coupe, jamais au milieu de l'un. */
  display: flex; flex-wrap: wrap; align-items: baseline; row-gap: 2px;
}
.contexte-ligne b { color: var(--encre); font-weight: 600; }
.contexte-ligne .sep { color: var(--encre-muet); margin: 0 7px; opacity: .6; }
/* Un critère ne se coupe pas en deux lignes : « Tous les / bookmakers » se
   lirait comme deux filtres. */
.contexte-ligne > span:not(.sep), .contexte-ligne > b { white-space: nowrap; }
.modifie {
  font-size: 12px; font-weight: 550; color: var(--alerte);
  background: var(--alerte-doux); padding: 3px 9px; border-radius: 20px;
}
.menu-droite { margin-left: auto; }

/* ── Contenu ───────────────────────────────────────────────────────── */

.contenu { padding: 18px 32px 56px; flex: 1 1 auto; }
.page { display: flex; flex-direction: column; gap: 18px; animation: apparition .18s ease-out; }
.si-donnees { display: flex; flex-direction: column; gap: 18px; }
@keyframes apparition { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
body.sans-donnees .si-donnees { display: none; }

.grille-2 { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grille-3 { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grille-tables { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grille-tables .pleine { grid-column: 1 / -1; }

/* ── Cartes ────────────────────────────────────────────────────────── */

.carte {
  background: var(--fond-carte);
  border: 1px solid var(--bordure);
  border-radius: var(--r);
  box-shadow: var(--ombre);
  padding: 20px 22px;
  min-width: 0;
}
.carte-tete {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 14px; flex-wrap: wrap;
}
.carte-tete h2 { margin: 0; font-size: 15px; font-weight: 620; letter-spacing: -.01em; }
.carte-sous { margin: 3px 0 0; font-size: 12.5px; color: var(--encre-muet); }
.carte-outils { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.carte-table { padding-bottom: 12px; }
.lien-voir { font-size: 13px; font-weight: 550; white-space: nowrap; }

.barre-outils { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.select-mini { width: auto; padding: 6px 30px 6px 10px; }
input.input-mini { width: 84px; }
.champ-texte { max-width: 360px; }
input.recherche { width: 240px; }
.barre-page { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ── Analyses rapides ──────────────────────────────────────────────── */

.presets { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.presets-titre { font-size: 12px; font-weight: 600; color: var(--encre-muet); letter-spacing: .02em; }
.puces { display: flex; gap: 7px; flex-wrap: wrap; }
.puce {
  display: inline-flex; align-items: center; gap: 6px;
  height: 30px; padding: 0 12px; border-radius: 20px;
  border: 1px solid var(--bordure-forte); background: var(--fond-carte);
  color: var(--encre-2); font-size: 12.5px; font-weight: 550; cursor: pointer;
  transition: border-color .12s, background-color .12s, color .12s;
}
.puce:hover { border-color: var(--marque-bord); color: var(--encre); background: var(--marque-doux); }
.puce.actif { border-color: var(--marque); background: var(--marque-doux); color: var(--marque-fort); }
:root[data-theme="dark"] .puce.actif { color: var(--marque-fort); }
.puces-axes .puce { height: 34px; padding: 0 15px; font-size: 13px; }

/* ══ KPI ══════════════════════════════════════════════════════════════ */

.kpis { display: grid; gap: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kpis-secondaires { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpis-secondaires[data-n="5"] { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpis-secondaires[data-n="6"] { grid-template-columns: repeat(6, minmax(0, 1fr)); }
#aa-panneau { display: flex; flex-direction: column; gap: 18px; }

.kpi {
  background: var(--fond-carte); border: 1px solid var(--bordure);
  border-radius: var(--r); box-shadow: var(--ombre);
  padding: 20px 22px 18px; min-width: 0; position: relative;
  display: flex; flex-direction: column;
  transition: box-shadow .15s, border-color .15s;
}
.kpi-lien { cursor: pointer; }
.kpi-lien:hover { box-shadow: var(--ombre-survol); border-color: var(--bordure-forte); }
.kpi-lien:focus-visible { outline: 2px solid var(--marque); outline-offset: 2px; }
.kpi-lien::after {
  content: "→"; position: absolute; top: 18px; right: 18px; font-size: 14px;
  color: var(--encre-muet); opacity: 0; transition: opacity .15s, transform .15s;
}
.kpi-lien:hover::after, .kpi-lien:focus-visible::after { opacity: 1; transform: translateX(2px); }
.kpi .titre {
  display: flex; align-items: center; gap: 9px; min-height: 30px;
  font-size: 13px; font-weight: 550; color: var(--encre-2); margin-bottom: 12px;
}
.kpi .ic {
  width: 30px; height: 30px; border-radius: 8px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--fond-sous); color: var(--encre-2); border: 1px solid var(--bordure);
}
.kpi .ic svg { width: 16px; height: 16px; fill: none; stroke: currentColor;
               stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.kpi .valeur {
  font-size: 34px; line-height: 1.05; font-weight: 650; letter-spacing: -.03em;
  white-space: nowrap; min-height: 42px; display: flex; align-items: flex-end;
}
.kpi .sous { font-size: 12.5px; color: var(--encre-muet); margin-top: 6px; }
.kpi .ligne2 {
  display: flex; align-items: baseline; gap: 7px; margin-top: 12px; padding-top: 11px;
  border-top: 1px solid var(--bordure);
}
.kpi .ligne2 b { font-size: 16px; font-weight: 650; letter-spacing: -.01em; }
.kpi .ligne2 span { font-size: 12px; color: var(--encre-muet); }
.kpi .details { font-size: 12px; color: var(--encre-muet); margin-top: auto; padding-top: 10px;
                display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.kpi .fragile { color: var(--alerte); font-weight: 600; }

/* Le ROI : la métrique financière, en tête d'affiche. */
.kpi-roi .valeur { font-size: 40px; min-height: 42px; }
.kpi-roi .ic { background: var(--bon-doux); color: var(--bon); border-color: transparent; }
/* La CLV : la mesure par rapport à la clôture — accent bleu, pas vert. */
.kpi-clv .ic { background: var(--marque-doux); color: var(--marque); border-color: transparent; }
.kpi-clv::before, .kpi-roi::before {
  content: ""; position: absolute; left: -1px; right: -1px; top: -1px; height: 3px;
  border-radius: var(--r) var(--r) 0 0;
}
.kpi-roi::before { background: var(--encre-muet); opacity: .25; }
.kpi-roi.pos-bord::before { background: var(--bon); opacity: .7; }
.kpi-roi.neg-bord::before { background: var(--grave); opacity: .7; }
.kpi-clv::before { background: var(--marque); opacity: .7; }

.kpis-secondaires .kpi { padding: 16px 18px; }
.kpis-secondaires .kpi .titre { margin-bottom: 8px; font-size: 12.5px; }
.kpis-secondaires .kpi .valeur { font-size: 24px; min-height: 0; }
.kpis-secondaires .kpi .titre { min-height: 0; }

/* ⚠️ Le SIGNE porte le sens, pas seulement la couleur : « +7,67 % » se lit
   même en noir et blanc, et reste juste pour un daltonien. */
.pos { color: var(--bon); }
.neg { color: var(--grave); }

.note-methodo {
  margin: -4px 0 0; font-size: 12px; color: var(--encre-muet); line-height: 1.5;
  display: flex; flex-direction: column; gap: 2px;
}
.note-methodo span:empty { display: none; }

.couv-ligne { margin: 10px 0 0; font-size: 12px; color: var(--encre-muet); }
.couv-ligne:empty { display: none; }
.couv-ligne.fragile { color: var(--alerte); font-weight: 600; }
caption.note-tri {
  caption-side: bottom; text-align: left; padding: 8px 2px 0;
  font-size: 12px; color: var(--encre-muet);
}
.aa-param {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--r);
  background: var(--fond-sous); border: 1px solid var(--bordure);
}
.aa-param-texte { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; min-width: 0; font-size: 13px; }
.aa-param-texte b { font-weight: 600; overflow-wrap: anywhere; }
.menu-note + .menu-item { margin-top: 2px; }

/* ── Squelettes de chargement ─────────────────────────────────────── */

.squelette {
  position: relative; overflow: hidden; background: var(--fond-sous);
  border-radius: 6px; color: transparent !important;
}
.squelette::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--fond-carte) 70%, transparent), transparent);
  transform: translateX(-100%); animation: lueur 1.2s infinite;
}
@keyframes lueur { to { transform: translateX(100%); } }
.kpi.chargement .valeur { width: 58%; height: 34px; }
.kpi.chargement .sous { width: 40%; height: 12px; }
body.en-analyse .graphe, body.en-analyse .carte-table .enrob,
body.en-analyse .kpis .kpi:not(.chargement) { opacity: .45; transition: opacity .15s; }
body.en-analyse .graphe { pointer-events: none; }

/* ── État vide ─────────────────────────────────────────────────────── */

.etat-vide {
  text-align: center; padding: 56px 24px; margin-bottom: 18px;
  background: var(--fond-carte); border: 1px dashed var(--bordure-forte);
  border-radius: var(--r);
}
.etat-vide-icone {
  width: 52px; height: 52px; margin: 0 auto 16px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--marque-doux); color: var(--marque);
}
.etat-vide-icone svg { width: 24px; height: 24px; fill: none; stroke: currentColor;
                       stroke-width: 1.9; stroke-linecap: round; }
.etat-vide h2 { margin: 0 0 6px; font-size: 17px; font-weight: 620; }
.etat-vide p { margin: 0 0 20px; color: var(--encre-2); }
.etat-vide-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ── Avertissements ────────────────────────────────────────────────── */

#avertissements { display: flex; flex-direction: column; gap: 8px; }
#avertissements:not(:empty) { margin-bottom: 18px; }
.avert {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 14px; border-radius: 10px; font-size: 12.5px; line-height: 1.45;
  background: var(--alerte-doux);
  border: 1px solid color-mix(in srgb, var(--alerte) 26%, transparent);
  color: var(--encre);
}
.avert .ic-av { width: 16px; height: 16px; flex: 0 0 auto; margin-top: 1px; fill: none;
                stroke: var(--alerte); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.avert.grave { background: var(--grave-doux);
               border-color: color-mix(in srgb, var(--grave) 30%, transparent); }
.avert.grave .ic-av { stroke: var(--grave); }
.avert b { font-weight: 650; }
.avert { cursor: pointer; }
/* Deux lignes par défaut : un long avertissement ne pousse pas les KPI hors
   de l'écran. Un clic le déplie ; l'impression le montre en entier. */
.avert-texte {
  flex: 1 1 auto; min-width: 0;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden;
}
.avert.deplie .avert-texte { display: block; -webkit-line-clamp: unset; overflow: visible; }
.avert-plus { align-self: flex-start; font-size: 12.5px; border: 0; background: none;
              color: var(--marque); cursor: pointer; padding: 2px 4px; }

/* ══ GRAPHIQUES ═══════════════════════════════════════════════════════ */

.graphe { min-height: 120px; }
.graphe svg { width: 100%; height: auto; overflow: visible; }
.axe-txt { fill: var(--encre-muet); font-size: 11px; font-family: var(--police); }
.val-txt { fill: var(--encre-2); font-size: 11px; font-weight: 600; font-family: var(--police); }
.n-txt { fill: var(--encre-muet); font-size: 10.5px; font-family: var(--police); }
.grille-ligne { stroke: var(--grille); stroke-width: 1; }
.ligne-zero { stroke: var(--axe); stroke-width: 1.25; }
.serie { fill: none; stroke: var(--marque); stroke-width: 2.2;
         stroke-linejoin: round; stroke-linecap: round; }
.serie-2 { fill: none; stroke: var(--serie-2); stroke-width: 2; stroke-dasharray: 5 4;
           stroke-linejoin: round; stroke-linecap: round; }
.aire { fill: var(--marque); opacity: .07; }
.pt { fill: var(--fond-carte); stroke: var(--marque); stroke-width: 2; cursor: pointer; }
.pt:hover { fill: var(--marque); }
.pt-2 { fill: var(--fond-carte); stroke: var(--serie-2); stroke-width: 2; cursor: pointer; }
.barre { cursor: pointer; transition: opacity .1s; }
.barre:hover { opacity: .8; }

/* Couverture insuffisante : hachure + contour. La couleur seule ne suffit
   pas — c'est la règle d'accessibilité, et ici elle sert aussi la justesse. */
.faible { stroke: var(--encre-muet); stroke-width: 1; stroke-dasharray: 3 2; }

.legende { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--encre-2); }
.legende:empty { display: none; }
.legende .l { display: inline-flex; align-items: center; gap: 7px; }
.legende .trait { width: 18px; height: 0; border-top: 2.5px solid var(--marque); }
.legende .trait.t2 { border-top: 2.5px dashed var(--serie-2); }

.vide { color: var(--encre-muet); font-size: 13px; padding: 36px 0; text-align: center; }

/* ══ TABLEAUX ═════════════════════════════════════════════════════════ */

.enrob { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -22px; padding: 0 22px; }
.tableau { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tableau th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .02em;
  color: var(--encre-muet); padding: 8px 12px; white-space: nowrap;
  border-bottom: 1px solid var(--bordure); background: var(--fond-carte);
  position: sticky; top: 0; user-select: none;
}
.tableau th.triable { cursor: pointer; }
.tableau th.triable:hover { color: var(--encre); }
.tableau th.actif { color: var(--marque); }
.tableau td { padding: 10px 12px; border-bottom: 1px solid var(--bordure); vertical-align: middle; }
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau tbody tr { transition: background-color .08s; }
.tableau tbody tr:hover td { background: var(--fond-sous); }
.tableau .num, .tableau th.num { text-align: right; white-space: nowrap; }
.tableau td.nom { font-weight: 550; max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tableau .sub { display: block; font-size: 11.5px; color: var(--encre-muet); font-weight: 400; }
.tableau .sub.fragile { color: var(--alerte); }
.tableau-dense { font-size: 12.5px; }
.tableau-dense td { padding: 8px 10px; white-space: nowrap; }
.tableau-dense th { padding: 7px 10px; }
.tableau .vide-ligne td { text-align: center; color: var(--encre-muet); padding: 24px; }
td.num { text-align: right; }

.etiq {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.etiq.joue { background: var(--marque-doux); color: var(--marque-fort); }
.etiq.nonjoue { background: var(--fond-sous); color: var(--encre-muet); border: 1px solid var(--bordure); }
.etiq.won  { background: var(--bon-doux); color: var(--bon); }
.etiq.lost { background: var(--grave-doux); color: var(--grave); }
.etiq.void { background: var(--fond-sous); color: var(--encre-2); }
.etiq.unsettled { background: transparent; color: var(--encre-muet); border: 1px dashed var(--axe); }

.pagination { display: flex; gap: 10px; align-items: center; justify-content: flex-end;
              margin-top: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--encre-2); }
.plus { display: flex; justify-content: center; padding-top: 10px; }
.plus:empty { display: none; }

/* ══ MATRICE ══════════════════════════════════════════════════════════ */

.matrice { width: 100%; border-collapse: separate; border-spacing: 3px; font-size: 11.5px; }
.matrice th { font-weight: 600; color: var(--encre-muet); font-size: 11px; padding: 4px; }
.matrice th.lig { text-align: right; white-space: nowrap; padding-right: 8px; }
.matrice td { border-radius: 7px; padding: 9px 5px; text-align: center;
              cursor: pointer; line-height: 1.3; border: 1.5px solid transparent;
              transition: border-color .1s; }
.matrice td.cliquable:hover { border-color: var(--encre); }
.matrice td.zero { cursor: default; color: var(--encre-muet); background: var(--fond-sous); }
.matrice td .n { display: block; font-size: 10px; opacity: .85; }
.matrice td .v { display: block; font-weight: 650; font-size: 12.5px; }

/* ══ INFOBULLE ════════════════════════════════════════════════════════ */

#bulle {
  position: fixed; pointer-events: none; z-index: 90; max-width: 290px;
  background: var(--fond-carte); color: var(--encre);
  border: 1px solid var(--bordure); border-radius: 9px;
  padding: 10px 12px; font-size: 12px; line-height: 1.5;
  box-shadow: var(--ombre-pop); opacity: 0;
  transition: opacity .08s;
}
#bulle.on { opacity: 1; }
#bulle .t { font-weight: 650; margin-bottom: 4px; }
#bulle .l { display: flex; justify-content: space-between; gap: 16px; }
#bulle .l span:first-child { color: var(--encre-muet); }
#bulle .l span:last-child { font-variant-numeric: tabular-nums; }
#bulle .w { color: var(--alerte); margin-top: 5px; font-size: 11.5px; }

/* ══ TIROIR DES FILTRES AVANCÉS ═══════════════════════════════════════ */

.voile {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(10, 14, 20, .38);
  animation: fondu .15s ease-out;
}
:root[data-theme="dark"] .voile { background: rgba(0, 0, 0, .55); }
@keyframes fondu { from { opacity: 0; } to { opacity: 1; } }

.tiroir {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 80;
  width: min(500px, 100vw);
  background: var(--fond-carte); border-left: 1px solid var(--bordure);
  box-shadow: var(--ombre-pop);
  display: flex; flex-direction: column;
  transform: translateX(104%); visibility: hidden;
  transition: transform .22s ease, visibility 0s linear .22s;
}
.tiroir.ouvert { transform: none; visibility: visible; transition: transform .22s ease; }
.tiroir-tete {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 22px 16px; border-bottom: 1px solid var(--bordure);
}
.tiroir-tete h2 { margin: 0; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.tiroir-corps { flex: 1 1 auto; overflow-y: auto; padding: 8px 22px 20px; }
.tiroir-pied {
  display: flex; align-items: center; gap: 12px; padding: 14px 22px;
  border-top: 1px solid var(--bordure); background: var(--fond-sous);
}
.tiroir-pied #etat { flex: 1 1 auto; text-align: center; }

/* Les sections repliables. L'en-tête porte la valeur courante : l'état se
   lit sans rien ouvrir. */
.champ { min-width: 0; }
.champ.pliable { border-bottom: 1px solid var(--bordure); }
.champ-tete {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; padding: 14px 2px; border: 0; background: none; cursor: pointer;
  text-align: left; border-radius: 6px;
}
.champ-nom { font-size: 13.5px; font-weight: 600; color: var(--encre); }
.champ-tete::after {
  content: ""; width: 7px; height: 7px; flex: 0 0 auto; margin: 0 4px 3px 0;
  border-right: 1.8px solid var(--encre-muet); border-bottom: 1.8px solid var(--encre-muet);
  transform: rotate(45deg); transition: transform .15s;
}
.champ.pliable.ouvert > .champ-tete::after { transform: rotate(-135deg); margin-bottom: -3px; }
.resume {
  margin-left: auto; font-size: 12.5px; color: var(--encre-muet);
  max-width: 55%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.resume.actif { color: var(--marque); font-weight: 600; }
.champ-corps { display: flex; flex-direction: column; gap: 10px; padding: 0 0 16px; }
.champ.pliable:not(.ouvert) > .champ-corps { display: none; }
.sous-champ { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.sous-bloc { display: flex; flex-direction: column; gap: 8px; }
.sous-titre-bloc { font-size: 12px; font-weight: 600; color: var(--encre-2); }

.paire { display: flex; gap: 8px; align-items: center; }
.paire > span { color: var(--encre-muet); font-size: 12.5px; white-space: nowrap; }
.paire select { width: auto; }
/* Mise : le mode Kelly et ses trois réglages. */
#mise-mode { margin-bottom: 10px; }
.sous-lib { display: block; font-size: 12px; font-weight: 600; color: var(--encre-2); margin: 2px 0 5px; }
#mise-bloc-kelly select { width: 100%; }
#mise-bloc-kelly .paire { margin-top: 8px; }
.paire-unite input { max-width: 120px; }

.interrupteur { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.interrupteur input { width: 16px; height: 16px; accent-color: var(--marque); }

/* ══ GROUPES DE CASES À COCHER ═════════════════════════════════════════
   ⚠️ LE CTRL+CLIC EST MORT, ET C'EST LE POINT. Un `<select multiple>`
   demande de savoir qu'il faut maintenir Ctrl, ne montre pas la sélection
   quand la liste dépasse sa hauteur, et perd tout au moindre clic simple.
   Une case cochée est visible, cliquable au doigt, et ne se perd pas. */

.cases {
  border: 1px solid var(--bordure);
  border-radius: 10px;
  background: var(--fond-sous);
  overflow: hidden;
}
.cases-barre {
  display: flex; gap: 6px; align-items: center; padding: 7px;
  border-bottom: 1px solid var(--bordure); flex-wrap: wrap;
  background: var(--fond-carte);
}
.cases-barre input[type="search"] { flex: 1 1 110px; min-width: 0; font-size: 12.5px; padding: 5px 9px; }
.cases-barre button {
  font-size: 11.5px; padding: 4px 9px; white-space: nowrap; cursor: pointer;
  border: 1px solid var(--bordure-forte); border-radius: 6px;
  background: var(--fond-carte); color: var(--encre-2);
}
.cases-barre button:hover { background: var(--fond-survol); color: var(--encre); }

/* Le défilement est sur la LISTE, jamais sur la page : une longue liste de
   bookmakers ne doit pas repousser le bouton d'analyse hors de l'écran. */
.cases-liste { max-height: 232px; overflow-y: auto; padding: 5px; }
.cases-liste.courte { max-height: none; overflow: visible; }

.case {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 8px; border-radius: 7px; cursor: pointer;
  font-size: 13px; line-height: 1.25; user-select: none;
}
.case:hover { background: var(--fond-survol); }
.case input { margin: 0; flex: 0 0 auto; width: 15px; height: 15px; cursor: pointer;
              accent-color: var(--marque); }
.case span { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.case.masquee { display: none; }
/* Une case cochée doit se voir SANS lire la case : le fond porte le signal,
   pour que l'état de la sélection se lise d'un coup d'œil sur la liste. */
.case:has(input:checked) { background: var(--marque-doux); color: var(--encre); }
.case-tous { font-weight: 600; border-bottom: 1px solid var(--bordure);
             border-radius: 7px 7px 0 0; margin-bottom: 3px; }
.case-tous:has(input:checked) { background: transparent; color: var(--marque-fort); }
.case-option { border: 1px solid var(--bordure); background: var(--fond-carte); }

.cases-vide { padding: 10px 8px; font-size: 12px; color: var(--encre-muet); }

/* ── EV / cote par sport, EV par tranche de cote ──────────────────── */

.ev-sport {
  border: 1px solid var(--bordure); border-left: 3px solid var(--marque);
  border-radius: 10px; padding: 10px 12px 12px; background: var(--fond-sous);
  display: flex; flex-direction: column; gap: 8px;
}
.ev-sport > h4 { margin: 0; font-size: 12px; letter-spacing: .03em; text-transform: uppercase;
                 color: var(--encre-2); }
.ev-sport .cases { background: var(--fond-carte); }
.ev-sport .cases-liste { max-height: none; overflow: visible; }
#ev-par-sport, #cote-par-sport { display: flex; flex-direction: column; gap: 8px; }
#ev-par-sport:empty, #cote-par-sport:empty { display: none; }

/* Six tranches, deux champs chacune : une grille « nom | bornes » tient en
   six lignes, là où des blocs empilés allongeaient le tiroir de 400 px. */
.ev-cote-grille {
  display: grid; grid-template-columns: max-content 1fr; gap: 6px 10px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--bordure); border-left: 3px solid var(--marque);
  border-radius: 10px; background: var(--fond-sous);
}
.ev-cote-nom { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--encre-2); white-space: nowrap; }
.ev-cote-grille .aide { grid-column: 1 / -1; }

.rapides { display: flex; flex-wrap: wrap; gap: 6px; }
.rapides button {
  font-size: 12px; padding: 4px 11px; border-radius: 20px; cursor: pointer;
  border: 1px solid var(--bordure-forte); background: var(--fond-carte); color: var(--encre-2);
}
.rapides button:hover { border-color: var(--marque-bord); color: var(--encre); }
.rapides button.actif {
  /* ⚠️ `--marque` sur du blanc tient 4,5:1 — le palier 3 de la même arme
     monte à 8:1 sans changer de teinte. */
  background: var(--pos-3); border-color: var(--pos-3); color: #fff;
}

/* ══ BADGES DE TAILLE D'ÉCHANTILLON ═══════════════════════════════════
   ⚠️ Ces badges disent un VOLUME. Jamais « significatif » — le mot
   n'apparaît nulle part dans l'interface, parce qu'un effectif ne le
   décide pas. */

.ech {
  display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .01em;
  padding: 2px 8px; border-radius: 20px; white-space: nowrap; border: 1px solid transparent;
}
.ech.tres_bon { background: var(--marque-doux); color: var(--marque-fort); }
.ech.bon      { background: transparent; color: var(--encre-2); border-color: var(--marque-bord); }
.ech.moyen    { background: transparent; color: var(--encre-muet); border-color: var(--bordure-forte); }
.ech.petit    { background: var(--alerte-doux); color: var(--alerte); }

/* ══ SEGMENTS ═════════════════════════════════════════════════════════ */

.crit {
  display: inline-block; font-size: 12px; padding: 2px 8px; margin: 1px 4px 1px 0;
  border-radius: 6px; background: var(--fond-sous); border: 1px solid var(--bordure);
  white-space: nowrap;
}
.crit b { font-weight: 600; color: var(--encre-2); }

/* Le bandeau de mise en garde du data mining : AU-DESSUS du tableau et
   dans le flux, jamais en note de bas de page. */
.mise-en-garde {
  border: 1px solid color-mix(in srgb, var(--alerte) 40%, transparent);
  border-left: 4px solid var(--alerte);
  border-radius: 10px; padding: 11px 14px; margin: 0 0 14px;
  font-size: 12.5px; line-height: 1.5; background: var(--alerte-doux);
}
.mise-en-garde b { color: var(--alerte); }
.mise-en-garde p { margin: 0 0 6px; }
.mise-en-garde p:last-child { margin-bottom: 0; }

/* ══ MES ANALYSES, EXPORT, PARAMÈTRES ═════════════════════════════════ */

.liste-analyses { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.analyse-carte { display: flex; flex-direction: column; gap: 8px; }
.analyse-carte h3 { margin: 0; font-size: 15px; font-weight: 620; }
.analyse-carte .quand { font-size: 12px; color: var(--encre-muet); }
.analyse-carte .desc { font-size: 12.5px; color: var(--encre-2); line-height: 1.5; flex: 1 1 auto; }
.analyse-carte .actions { display: flex; gap: 8px; margin-top: 6px; }

.carte-action { display: flex; flex-direction: column; gap: 10px; }
.carte-action h2 { margin: 0; font-size: 15px; font-weight: 620; }
.carte-action p { margin: 0; font-size: 13px; color: var(--encre-2); flex: 1 1 auto; line-height: 1.55; }
.carte-action .btn { align-self: flex-start; }

.reglage { display: flex; align-items: center; justify-content: space-between; gap: 14px;
           padding: 12px 0; border-bottom: 1px solid var(--bordure); flex-wrap: wrap; }
.reglage:last-child { border-bottom: 0; }
.reglage-lib { font-size: 13.5px; font-weight: 550; }

.liste-def { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; font-size: 13px; }
.liste-def dt { color: var(--encre-muet); }
.liste-def dd { margin: 0; font-weight: 550; }

/* ── Toast ─────────────────────────────────────────────────────────── */

.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 95;
  background: var(--encre); color: var(--fond-carte);
  padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 500;
  box-shadow: var(--ombre-pop); max-width: min(560px, 92vw);
  animation: pop .15s ease-out;
}

/* ══ STRATEGY FINDER ══════════════════════════════════════════════════
 * Une page outil : un formulaire, des cartes, un tableau, une modale de
 * détail. Uniquement des jetons : les deux thèmes suivent sans règle de
 * plus. Comme partout, la carte reste neutre — seuls les chiffres portent
 * le signe. */

.sf-formulaire .carte-tete { margin-bottom: 18px; }
.sf-formulaire .carte-tete h2 { font-size: 17px; }
#sf-methode-btn { color: var(--encre-2); }

.sf-champs { display: flex; flex-wrap: wrap; gap: 18px 22px; align-items: flex-start; }
.sf-champ { display: flex; flex-direction: column; gap: 6px; min-width: 0; flex: 1 1 190px; }
.sf-champ-periode { flex: 1.4 1 280px; }
.sf-champ-min { flex: 2 1 350px; }
.sf-champ-objectif { flex: 1 1 210px; }
.sf-lib { font-size: 12px; font-weight: 600; color: var(--encre-2); letter-spacing: .01em; }
.sf-periode { width: 100%; }
.sf-periode input[type="date"] { flex: 1 1 0; min-width: 0; }
.sf-min-ligne { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sf-min-ligne input[type="number"] { width: 100px; flex: 0 0 auto; }
.sf-champ .segmente { align-self: flex-start; }

.sf-bas {
  display: flex; align-items: center; justify-content: space-between; gap: 14px 18px;
  flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--bordure);
}
.sf-rapides-bloc { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#sf-lancer { height: 42px; padding: 0 20px; font-weight: 600; }
#sf-lancer .roue {
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .35); border-top-color: #fff;
  display: none; animation: tourne .7s linear infinite;
}
#sf-lancer.charge .roue { display: inline-block; }
#sf-lancer.charge .sf-ic-lancer { display: none; }

/* Chargement : une roue et une phrase. Pas de pourcentage d'avancement :
   le serveur n'en rend pas, et un chiffre inventé serait un mensonge. */
.sf-chargement {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 40px 22px; color: var(--encre-2); font-size: 14px; font-weight: 550;
}
.sf-roue {
  width: 20px; height: 20px; border-radius: 50%; flex: 0 0 auto;
  border: 2.5px solid var(--bordure-forte); border-top-color: var(--marque);
  animation: tourne .8s linear infinite;
}

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

.sf-resultats { display: flex; flex-direction: column; gap: 18px; }
.sf-resultats > .etat-vide { margin-bottom: 0; }
.sf-compteurs { display: grid; gap: 10px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.sf-compteur {
  display: flex; flex-direction: column; gap: 2px; min-width: 0;
  padding: 12px 14px; border-radius: var(--r-s);
  background: var(--fond-sous); border: 1px solid var(--bordure);
}
.sf-compteur b { font-size: 21px; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.sf-compteur span { font-size: 12px; color: var(--encre-muet); line-height: 1.35; }
.sf-split {
  margin: 12px 0 0; font-size: 12.5px; color: var(--encre-2);
  display: flex; flex-wrap: wrap; align-items: baseline; row-gap: 2px;
}
.sf-split b { font-weight: 600; color: var(--encre); }
.sf-split .sep { color: var(--encre-muet); margin: 0 7px; opacity: .6; }
/* Sans configuration, il n'y a rien à exporter : le bouton le montre. */
#sf-csv:disabled { opacity: .5; }
.sf-avert { display: flex; flex-direction: column; gap: 8px; }
.sf-avert:not(:empty) { margin-top: 12px; }
.avert:focus-visible { outline: 2px solid var(--marque); outline-offset: 2px; }

.sf-bloc-top { display: flex; flex-direction: column; gap: 12px; }
.sf-nombre { margin: 0; font-size: 13px; font-weight: 550; color: var(--encre-2); }
.sf-prudence { margin: 0; font-size: 12px; color: var(--encre-muet); line-height: 1.5; }

/* ── Cartes du top 5 ───────────────────────────────────────────────── */

.sf-cartes { display: grid; gap: 14px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.sf-carte {
  display: flex; flex-direction: column; gap: 10px; padding: 16px 16px 14px;
  cursor: pointer; transition: box-shadow .15s, border-color .15s, transform .06s;
}
.sf-carte:hover { box-shadow: var(--ombre-survol); border-color: var(--bordure-forte); }
.sf-carte:focus-visible { outline: 2px solid var(--marque); outline-offset: 2px; }
.sf-carte:active { transform: translateY(1px); }
.sf-carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.sf-rang {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 20px;
  font-size: 12px; font-weight: 650; color: var(--encre-2);
  background: var(--fond-sous); border: 1px solid var(--bordure);
}
.sf-carte-titre { margin: 0; font-size: 15px; font-weight: 640; letter-spacing: -.01em; line-height: 1.3; overflow-wrap: anywhere; }
.sf-crit { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 10px; margin: 0; font-size: 12.5px; }
.sf-crit dt { color: var(--encre-muet); }
.sf-crit dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.sf-carte-pied { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sf-mesures {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px;
  padding-top: 10px; border-top: 1px solid var(--bordure);
}
.sf-mesure { min-width: 0; }
.sf-mesure span { display: block; font-size: 11.5px; color: var(--encre-muet); }
.sf-mesure b { display: block; font-size: 17px; font-weight: 650; letter-spacing: -.02em; white-space: nowrap; }
.sf-carte-ligne {
  display: flex; align-items: baseline; justify-content: space-between; gap: 4px 8px; flex-wrap: wrap;
  font-size: 12px; padding-top: 8px; border-top: 1px solid var(--bordure);
}
.sf-carte-lib { color: var(--encre-muet); font-weight: 550; }
.sf-valid-val { color: var(--encre-2); white-space: nowrap; }
.sf-valid-val b { font-weight: 650; }
.sf-valid-insuf { color: var(--alerte); font-weight: 600; font-size: 12px; }

/* ⚠️ LA ROBUSTESSE SE LIT PAR LE MOT, LA COULEUR NE FAIT QUE L'APPUYER.
   Un point coloré seul serait illisible pour un daltonien ; « Forte »,
   « Moyenne », « Faible » sont toujours écrits à côté. */
.sf-robustesse {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--encre-2); white-space: nowrap;
}
.sf-point { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; background: var(--encre-muet); }
.sf-robustesse.strong .sf-point { background: var(--bon); }
.sf-robustesse.medium .sf-point { background: var(--alerte); }
.sf-robustesse.weak .sf-point { background: var(--grave); }

/* ── Tableau et comparaisons ───────────────────────────────────────── */

.sf-ligne { cursor: pointer; }
.sf-ligne-hors { cursor: default; }
.sf-rang-btn {
  font: inherit; font-size: 12.5px; font-weight: 650; white-space: nowrap; cursor: pointer;
  color: var(--marque-fort); background: var(--marque-doux);
  border: 1px solid transparent; border-radius: 20px; padding: 2px 9px;
}
.sf-rang-btn:hover { border-color: var(--marque-bord); }
.sf-absent { color: var(--encre-muet); }
.sf-crit-cell { white-space: nowrap; }
.sf-sans-filtre { margin: 6px 0 0; font-size: 11.5px; color: var(--encre-muet); }
.sf-dd-val.sf-libre { font-weight: 450; color: var(--encre-muet); }
/* Un critère imposé par le système (seuil d'EV de détection), pas choisi par
 * la configuration : affiché, mais en retrait. */
.sf-implicite, .sf-dd-val.sf-implicite { font-weight: 450; color: var(--encre-muet); }
.sf-valid-cell .sf-v { display: block; white-space: nowrap; color: var(--encre-2); }
.sf-valid-cell .sf-v2 { font-size: 11.5px; color: var(--encre-muet); }
.sf-valid-cell b { font-weight: 600; }
.sf-comp-config { min-width: 190px; }
.sf-comp-config .sf-rang-btn, .sf-comp-config .sf-hors { margin-right: 8px; }
.sf-hors {
  display: inline-block; font-size: 11px; color: var(--encre-muet); white-space: nowrap;
  border: 1px dashed var(--bordure-forte); border-radius: 20px; padding: 1px 7px;
}
.sf-comp-titre { font-weight: 550; }
.sf-comparaisons.sf-une { grid-template-columns: minmax(0, 1fr); }
/* Sept colonnes ne tiennent pas dans une demi-largeur : côte à côte
   seulement sur très grand écran, l'une sous l'autre ailleurs. */
@media (max-width: 1600px) {
  .sf-comparaisons { grid-template-columns: minmax(0, 1fr); }
}

/* ── Modales ───────────────────────────────────────────────────────── */

.sf-modale {
  position: fixed; inset: 0; z-index: 80; overflow-y: auto; overscroll-behavior: contain;
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 20px;
}
.sf-modale-boite {
  width: min(1080px, 100%); margin: auto 0;
  background: var(--fond-carte); color: var(--encre);
  border: 1px solid var(--bordure); border-radius: var(--r); box-shadow: var(--ombre-pop);
  display: flex; flex-direction: column; animation: pop .15s ease-out;
}
.sf-modale-etroite { width: min(560px, 100%); }
.sf-modale-tete {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 18px 22px 14px; border-bottom: 1px solid var(--bordure);
}
.sf-modale-tete h2 { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -.015em; overflow-wrap: anywhere; }
.sf-detail-entete { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
#sf-detail-sous { display: flex; flex-wrap: wrap; align-items: center; row-gap: 4px; }
#sf-detail-sous .sep { margin: 0 7px; opacity: .6; }
.sf-modale-corps { padding: 18px 22px 22px; display: flex; flex-direction: column; gap: 14px; }
.sf-methode-texte { margin: 0; font-size: 14px; line-height: 1.6; color: var(--encre-2); white-space: pre-line; }
.sf-modale-pied {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 14px 22px; border-top: 1px solid var(--bordure); background: var(--fond-sous);
  border-radius: 0 0 var(--r) var(--r);
}
.sf-modale-pied .aide { margin: 0; flex: 1 1 240px; }

.sf-detail-grille { display: grid; gap: 14px; }
.sf-grille-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.sf-grille-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sf-section {
  min-width: 0; padding: 14px 16px; border: 1px solid var(--bordure);
  border-radius: var(--r-s); background: var(--fond-carte);
}
.sf-section h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 650; color: var(--encre); }
.sf-section h4 {
  margin: 0; font-size: 11.5px; font-weight: 650; text-transform: uppercase;
  letter-spacing: .04em; color: var(--encre-2);
}
.sf-section .enrob { margin: 0 -16px; padding: 0 16px; }
.sf-section .graphe { min-height: 150px; }
.sf-section-graphe .carte-sous { margin: -6px 0 8px; }
.sf-dl {
  display: grid; grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  gap: 6px 14px; margin: 0; font-size: 13px;
}
.sf-dl dt { color: var(--encre-muet); }
.sf-dl dd { margin: 0; min-width: 0; }
.sf-dd-val { font-weight: 600; overflow-wrap: anywhere; }
.sf-dd-sous { display: block; font-size: 11.5px; color: var(--encre-muet); line-height: 1.4; }
.sf-dd-sous.fragile { color: var(--alerte); font-weight: 600; }
.sf-tv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.sf-tv-bloc {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 10px 12px;
  border-radius: var(--r-s); background: var(--fond-sous); border: 1px solid var(--bordure);
}
.sf-tv-per { margin: 0; font-size: 11.5px; color: var(--encre-muet); }
.sf-part { margin: 10px 0 0; font-size: 12.5px; color: var(--encre-2); }
.sf-liste {
  margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; color: var(--encre-2);
  display: flex; flex-direction: column; gap: 4px;
}
.sf-rob-tete { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 0 0 8px; }

@media (max-width: 1360px) {
  .sf-cartes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sf-cartes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sf-grille-3, .sf-grille-2 { grid-template-columns: minmax(0, 1fr); }
  .sf-compteurs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .sf-cartes { grid-template-columns: minmax(0, 1fr); }
  .sf-champ, .sf-champ-periode, .sf-champ-min, .sf-champ-objectif { flex-basis: 100%; }
  .sf-bas { flex-direction: column; align-items: stretch; }
  #sf-lancer { width: 100%; height: auto; min-height: 44px; padding: 8px 16px; white-space: normal; text-align: center; }
  #sf-methode-btn { height: auto; min-height: 32px; padding: 6px 12px; white-space: normal; text-align: left; }
  .sf-modale { padding: 0; }
  .sf-modale-boite { min-height: 100%; margin: 0; border: 0; border-radius: 0; }
  .sf-modale-tete, .sf-modale-corps, .sf-modale-pied { padding-left: 16px; padding-right: 16px; }
  .sf-modale-pied { border-radius: 0; }
  .sf-section { padding: 12px; }
  .sf-section .enrob { margin: 0 -12px; padding: 0 12px; }
  .sf-tv { grid-template-columns: minmax(0, 1fr); }
}

/* ══ RESPONSIVE ═══════════════════════════════════════════════════════ */

@media (max-width: 1360px) {
  .kpi .valeur { font-size: 30px; }
  .kpi-roi .valeur { font-size: 34px; }
}

@media (max-width: 1400px) {
  .kpis-secondaires[data-n="5"], .kpis-secondaires[data-n="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .kpis, .kpis-secondaires { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpis-secondaires[data-n="5"], .kpis-secondaires[data-n="6"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grille-2, .grille-3 { grid-template-columns: minmax(0, 1fr); }
  .barre-haut-cadre { flex-wrap: wrap; }
  .titre-page { flex: 1 1 300px; }
}

/* Tablette : la barre latérale se replie d'elle-même en icônes. */
@media (max-width: 1080px) {
  .app { --sb-l: 72px; }
  .sb-nom, .sb-lien span, .sb-pied > .sb-maj, .sb-statut span:last-child, .sb-replier { display: none; }
  .sb-marque { justify-content: center; padding: 18px 0; }
  .sb-lien { justify-content: center; padding: 10px 0; }
  .sb-pied { align-items: center; padding: 14px 0; }
  .grille-tables { grid-template-columns: minmax(0, 1fr); }
  .actions-haut { flex-wrap: wrap; justify-content: flex-end; }
}

/* Téléphone : navigation compacte, filtres dans le tiroir, KPI empilés. */
@media (max-width: 720px) {
  .app { grid-template-columns: minmax(0, 1fr); background: none; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 264px; height: auto;
    transform: translateX(-100%); transition: transform .22s ease; z-index: 85;
  }
  .app.nav-ouverte .sidebar { transform: none; box-shadow: var(--ombre-pop); }
  .app.nav-ouverte .sb-nom, .app.nav-ouverte .sb-lien span,
  .app.nav-ouverte .sb-pied > .sb-maj, .app.nav-ouverte .sb-statut span:last-child { display: initial; }
  .app.nav-ouverte .sb-nom { display: flex; }
  .app.nav-ouverte .sb-marque { justify-content: flex-start; padding: 18px; }
  .app.nav-ouverte .sb-lien { justify-content: flex-start; padding: 9px 10px; }
  .app.nav-ouverte .sb-pied { align-items: flex-start; padding: 14px 18px; }
  #voile-nav { z-index: 84; }
  .menu-mobile { display: inline-flex; }
  /* Sur téléphone, un en-tête collant de trois étages mangerait la moitié
     de l'écran : il défile avec la page. */
  .barre-haut { padding: 0 14px; position: static; }
  /* Un nom long passe à la ligne ENTRE ses mots — jamais « Foot / ball ». */
  .tableau td.nom { white-space: normal; max-width: 180px; min-width: 92px; overflow-wrap: break-word; }
  .barre-haut-cadre { flex-wrap: wrap; gap: 10px; min-height: 0; }
  .titre-page { flex: 1 1 calc(100% - 60px); }
  .titre-page h1 { font-size: 19px; }
  .h1-marque, .h1-sep { display: none; }
  .sous-titre { display: none; }
  .actions-haut { width: 100%; }
  .periode input[type="date"] { min-width: 0; flex: 1 1 0; font-size: 13px; }
  #analyser { min-width: 0; padding: 0 14px; }
  .barre-filtres { padding: 12px 14px 0; }
  .filtres-principaux .menu { display: none; }
  .btn-avances { width: 100%; }
  .btn-avances .lib-desktop { display: none; }
  .btn-avances .lib-mobile { display: inline; }
  .contexte { margin-top: 10px; }
  .contenu { padding: 14px 14px 40px; }
  .kpis, .kpis-secondaires, .kpis-secondaires[data-n="5"], .kpis-secondaires[data-n="6"] {
    grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .actions-haut { flex-wrap: wrap; }
  .periode { flex: 1 1 100%; justify-content: space-between; }
  #analyser { flex: 1 1 auto; }
  .presets .puces { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px;
                    margin: 0 -14px; padding-left: 14px; padding-right: 14px; scrollbar-width: none;
                    /* Le fondu à droite dit qu'il y a d'autres puces à faire défiler. */
                    -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent);
                    mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .presets .puce { flex: 0 0 auto; }
  .kpi .valeur { font-size: 30px; }
  .kpi-roi .valeur { font-size: 34px; }
  .carte { padding: 16px; }
  .enrob { margin: 0 -16px; padding: 0 16px; }
  .carte-tete { flex-direction: column; }
  input.recherche { width: 100%; }
  .grille-tables { gap: 14px; }
  .tiroir { width: 100vw; }
  .champ.pliable > .champ-tete { padding: 15px 2px; }
  .cases-liste { max-height: 260px; }
  .liste-def { grid-template-columns: 1fr; gap: 2px; }
  .liste-def dd { margin-bottom: 8px; }
}

@media (max-width: 480px) {
  .ev-cote-grille { grid-template-columns: 1fr; gap: 2px 0; }
  .ev-cote-nom { margin-top: 6px; }
  .segmente button { padding: 5px 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ══ IMPRESSION / EXPORT PDF ═════════════════════════════════════════
 *
 * ⚠️ AUCUNE BIBLIOTHÈQUE PDF. L'impression du navigateur rend déjà les
 * polices, les tableaux et les graphiques tels qu'ils s'affichent, hors
 * ligne. Un générateur embarqué coûterait des centaines de kilo-octets, une
 * SECONDE mise en page à maintenir — qui divergerait — et un téléchargement
 * de dépendance que cette machine s'interdit.
 *
 * Ce que la feuille doit garantir : que le papier porte les chiffres ET les
 * filtres qui les ont produits.
 */

.impression-seule { display: none; }

@media print {
  /* Le papier est blanc : imposer l'encre sombre, quel que soit le thème
     choisi à l'écran. Un export en mode sombre est illisible et ruineux. */
  :root, :root[data-theme="dark"] {
    --fond-page: #fff; --fond-carte: #fff; --fond-sous: #f6f6f6;
    --encre: #111; --encre-2: #333; --encre-muet: #555;
    --bordure: #bbb; --bordure-forte: #999; --grille: #e5e5e5; --axe: #999;
    --neutre: #f4f4f4; --bon: #0a6b3c; --grave: #b3261e;
  }
  body { background: #fff; color: #111; font-size: 10.5pt; }
  .app { display: block; background: none; }

  /* Ce qui ne sert qu'à PILOTER disparaît : navigation, filtres, boutons. */
  .sidebar, .voile, .tiroir, .toast, #bloc-filtres, .actions-haut, .menu-mobile,
  .presets, .carte-outils, .segmente, .barre-page, .pagination, .plus,
  .barre-outils, .lien-voir, .etat-vide-actions, #bulle { display: none !important; }
  .barre-haut { position: static; border: 0; padding: 0; backdrop-filter: none; }
  .contenu { padding: 0; }

  .impression-seule { display: block; }

  /* Une carte coupée en deux pages perd son titre ou sa légende. */
  .carte, .kpi {
    break-inside: avoid; page-break-inside: avoid;
    border: 1px solid var(--bordure); box-shadow: none; margin: 0 0 10pt;
  }
  .grille-2, .grille-tables, .kpis { gap: 10pt; }
  #entete-pdf { break-after: avoid; page-break-after: avoid; }

  /* L'en-tête d'export : deux colonnes serrées, critère puis valeur. */
  .export-filtres {
    display: grid; grid-template-columns: max-content 1fr;
    gap: 2pt 10pt; margin: 6pt 0 0;
  }
  .export-filtres dt { font-weight: 700; color: #333; }
  .export-filtres dd { margin: 0; }
  .export-limites { margin: 8pt 0 0; padding-left: 14pt; color: #333; font-size: 9pt; }

  /* Un tableau dont l'en-tête ne se répète pas devient illisible page 2. */
  thead { display: table-header-group; }
  tr, img, canvas, svg { break-inside: avoid; page-break-inside: avoid; }
  canvas, svg { max-width: 100% !important; height: auto !important; }
  .enrob { overflow: visible; margin: 0; padding: 0; }

  a[href]::after { content: ""; }   /* pas d'URL entre parenthèses */

  /* Un avertissement se lit EN ENTIER sur le papier ; ses boutons non. */
  .avert-texte { display: block !important; -webkit-line-clamp: unset !important; overflow: visible !important; }
  .avert-plus, .kpi-lien::after { display: none !important; }

  /* Rapport complet : chaque page d'analyse, titrée, sur sa propre feuille. */
  body.impression-rapport .barre-haut, body.impression-rapport .page-outil { display: none !important; }
  body.impression-rapport .page[data-titre]::before {
    content: attr(data-titre); display: block;
    font-size: 15pt; font-weight: 700; margin: 0 0 8pt; padding-bottom: 4pt;
    border-bottom: 1.5pt solid #111;
  }
  body.impression-rapport .page + .page:not([hidden]) { break-before: page; page-break-before: always; }
  .page { animation: none !important; }
}

@page { size: A4 portrait; margin: 12mm 10mm; }

/* Le fond ne défile pas sous le tiroir ouvert. */
body.fige { overflow: hidden; }

/* ══ STRATEGY FINDER SUR PAPIER ══════════════════════════════════════
 * Après le bloc d'impression général, pour primer sur les règles d'écran
 * de la page. Le papier porte l'en-tête des PARAMÈTRES DE LA RECHERCHE ;
 * celui des filtres de l'analyse, qui ne l'ont pas produite, s'efface. */
@media print {
  #sf-formulaire, #sf-etat, #sf-voile, .sf-modale { display: none !important; }
  body[data-page="strategies"]:not(.impression-rapport) #entete-pdf { display: none !important; }
  .sf-entete-pdf { break-after: avoid; page-break-after: avoid; }
  .sf-entete-pdf h2 { margin: 0 0 4pt; font-size: 14pt; }
  .sf-cartes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8pt; }
  .sf-carte { padding: 8pt; gap: 5pt; margin: 0; outline: none !important; }
  .sf-mesure b { font-size: 12pt; }
  .sf-compteurs { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6pt; }
  .sf-compteur { padding: 5pt 7pt; }
  .sf-compteur b { font-size: 13pt; }
  .sf-comparaisons { grid-template-columns: minmax(0, 1fr); }
  .sf-table, .sf-comp { font-size: 8pt; }
  .sf-table th, .sf-table td, .sf-comp th, .sf-comp td { padding: 3pt 4pt; }
  .sf-rang-btn { background: none; border: 0; padding: 0; color: #111; }
}
