/* Tableau de bord « Statistiques » de l'espace organisateur (pro-stats.js). Charte « Corde » (DESIGN.md) : blanc sur gris
   clair, carbone pour les données, rouge seulement pour l'action et l'onglet actif ; chiffres Manrope 800 tabulaires.
   Reprend les briques de pro-billetterie.css (bt-bloc, bt-table, bt-onglets, st-svg, st-bulle) ; préfixe sx-. */

/* ---------------------------------------------------------------- filtres : période en segments, dates, journée */
.sx-barre { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; margin: 0 0 10px; }
.sx-per { display: inline-flex; flex-wrap: wrap; margin: 0; padding: 3px; border: 1px solid var(--rule); border-radius: var(--radius-sm); background: var(--paper-2); min-width: 0; }
.sx-per label { position: relative; display: inline-flex; }
.sx-per input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.sx-per span { display: inline-flex; align-items: center; min-height: 40px; padding: 0 13px; border-radius: 7px; font: 600 14px var(--f-text); color: var(--ink-2); white-space: nowrap; transition: background .18s, color .18s; }
.sx-per label:hover span { color: var(--ink); }
.sx-per input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(22, 26, 29, .12); }
.sx-per input:focus-visible + span { outline: 2px solid var(--red-deep); outline-offset: 1px; }
.sx-dates { display: flex; gap: 10px; flex: 1 1 280px; }
.sx-dates[hidden] { display: none; }
.sx-dates .fld { flex: 1 1 130px; }
.sx-fld-j { flex: 1 1 260px; max-width: 420px; }
.sx-portee { margin: 0 0 16px; }
/* Place réservée avant l'arrivée des chiffres (CLS, audit lot 4) : phrase de période et barre d'onglets, hauteurs mesurées */
.sx-portee:empty { min-height: 1lh; }
.sx-onglets:empty { min-height: 42px; }
@media (max-width: 767px) { .sx-portee:empty { min-height: 2lh; } .sx-onglets:empty { min-height: 47px; } }

/* ---------------------------------------------------------------- indicateurs : une bande, filets entre les colonnes */
.sx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin: 0 0 18px; border: 1px solid var(--rule); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-1); overflow: hidden; }
.sx-kpi { display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px 18px 15px; box-shadow: -1px 0 0 var(--paper-2), 0 -1px 0 var(--paper-2); }
.sx-kpi-l { font: 600 13px/1.3 var(--f-text); color: var(--ink-3); }
.sx-kpi b { font-size: 28px; line-height: 1.05; color: var(--ink); overflow-wrap: anywhere; }
.sx-kpi.fort { background: var(--ink); box-shadow: none; }
.sx-kpi.fort .sx-kpi-l { color: rgba(255, 255, 255, .72); }
.sx-kpi.fort b { color: #fff; }
.sx-kpi.fort .sx-evo { background: rgba(255, 255, 255, .12); color: #fff; }
.sx-kpi.fort .sx-evo.nul { background: none; color: rgba(255, 255, 255, .6); }

.sx-evo { display: inline-flex; align-self: flex-start; align-items: center; gap: 4px; min-height: 24px; padding: 0 8px 0 6px; border-radius: 999px; font: 700 12.5px var(--f-text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.sx-evo .ico { width: 14px; height: 14px; stroke-width: 2.6; }
.sx-evo.haut { background: var(--green-2); color: var(--green); }
.sx-evo.baisse { background: var(--danger-bg); color: var(--red-hover); }
.sx-evo.plat { background: var(--paper-2); color: var(--ink-2); }
.sx-evo.nul { padding: 0; font-weight: 500; color: var(--ink-3); }
.sx-part { display: block; font: 500 12px/1.35 var(--f-text); color: var(--ink-3); }

/* ---------------------------------------------------------------- intérêt des pilotes */
.sx-int { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 4px 0 0; }
.sx-int > div { min-width: 0; padding: 4px 16px 4px 0; }
.sx-int > div + div { padding-left: 16px; border-left: 1px solid var(--paper-2); }
.sx-int dt { font: 600 13px var(--f-text); color: var(--ink-3); }
.sx-int dd { margin: 0; }
.sx-int .bt-num { font-size: 30px; line-height: 1.15; color: var(--ink); }
.sx-int-s { font-size: 12.5px; line-height: 1.35; color: var(--ink-3); }
.sx-regle { display: flex; gap: 9px; align-items: flex-start; margin: 16px 0 0; padding-top: 14px; border-top: 1px solid var(--paper-2); font-size: 13px; line-height: 1.45; color: var(--ink-2); max-width: 80ch; }
.sx-regle .ico { flex: none; width: 17px; height: 17px; margin-top: 1px; color: var(--ink-3); }

/* ---------------------------------------------------------------- graphiques */
.sx-fig { margin-top: 4px; }
.sx-legende { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0 0 8px; font: 500 12.5px var(--f-text); color: var(--ink-2); }
.sx-legende span { display: inline-flex; align-items: center; gap: 7px; }
.sx-legende span::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--ink); }
.sx-legende .sx-l-b::before { height: 3px; border-radius: 2px; background: var(--red); }
.sx-ligne { fill: none; stroke: var(--red); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.sx-note { margin: 0 0 14px; }

/* barres horizontales en SVG (aucun style en ligne) */
.sx-hb { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.sx-hb li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 5px 12px; align-items: baseline; }
.sx-hb-l b { display: block; font-weight: 600; font-size: 14.5px; color: var(--ink); overflow-wrap: anywhere; }
.sx-hb-l small { display: block; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.sx-hb-v { font-size: 15px; color: var(--ink); white-space: nowrap; }
.sx-hb-b { grid-column: 1 / -1; display: block; width: 100%; height: 8px; overflow: hidden; border-radius: 4px; }
.sx-hb-b .fond { fill: var(--paper-2); }
.sx-hb-b .val { fill: var(--ink); }
.sx-hb-b .hachure { fill: var(--rule-strong); }
.sx-hb li.masque .sx-hb-v { font-family: var(--f-text); font-weight: 600; font-size: 13.5px; color: var(--ink-3); letter-spacing: 0; }
.sx-ent li:last-child .sx-hb-b .val { fill: var(--green); }

/* ---------------------------------------------------------------- prochaines journées */
.sx-proch { display: grid; margin: 0; padding: 0; list-style: none; }
.sx-proch li { display: grid; grid-template-columns: minmax(120px, 190px) minmax(0, 1fr); gap: 6px 18px; align-items: center; padding: 11px 0; border-top: 1px solid var(--paper-2); }
.sx-proch li:first-child { border-top: 0; padding-top: 2px; }
.sx-proch-d b { display: block; font: 800 16px/1.2 var(--f-display); color: var(--ink); }
.sx-proch-d small { display: block; font-size: 12.5px; color: var(--ink-3); overflow-wrap: anywhere; }
.sx-proch-c { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13.5px; color: var(--ink-3); }
.sx-proch-c b { font-size: 16px; color: var(--ink); }

/* ---------------------------------------------------------------- comparaison des journées */
.sx-cmp-f { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 14px; margin: 0 0 18px; }
.sx-cmp-f .fld { flex: 1 1 240px; max-width: 360px; }
.sx-tab-j table { min-width: 860px; }
.sx-pan .bt-table tbody th b { display: block; white-space: nowrap; }
.sx-pan .bt-table tbody th small { display: block; margin-top: 2px; }
.sx-tab-j .btn.small { min-height: 36px; padding: 0 12px; font-size: 13px; }

/* ventes : rappel de l'évolution au-dessus du rendu de la billetterie */
.sx-evol { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin: 0 0 16px; font: 500 13.5px var(--f-text); color: var(--ink-2); }
.sx-evol > span { display: inline-flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- téléphone */
@media (max-width: 767px) {
  .sx-per { display: flex; width: 100%; }
  .sx-per label { flex: 1 1 auto; }
  .sx-per span { justify-content: center; width: 100%; padding: 0 8px; font-size: 13.5px; }
  .sx-fld-j { max-width: none; }
  .sx-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sx-kpi { padding: 13px 14px; }
  .sx-kpi b { font-size: 23px; }
  .sx-int { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 14px; }
  .sx-int > div:nth-child(3) { padding-left: 0; border-left: 0; }
  .sx-proch li { grid-template-columns: minmax(0, 1fr); }
  .sx-cmp-f .fld { max-width: none; }
}
@media (max-width: 359px) {
  .sx-per span { padding: 0 5px; font-size: 12.5px; }
  .sx-kpi b { font-size: 20px; }
  .sx-int .bt-num { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .sx-per span { transition: none; }
}
