/* CRM BlueIa · vue « Statistiques » (stats). Classes préfixées par .stats- */

/* Période et appelant */
.stats-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s-4) var(--s-5); margin-bottom: var(--s-4); }
.stats-controls__period { display: grid; gap: var(--s-1); }
.stats-controls__label { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
.stats-controls__who { min-width: 220px; margin-left: auto; }
.stats-custom { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--s-3); }
.stats-custom .field { min-width: 160px; }
.stats-custom .btn { margin-top: 22px; }

.stats-content { display: grid; gap: var(--s-4); min-width: 0; }
.stats-content > .dash-grid { align-items: start; }
.stats-kpis { margin: 0; }

/* Meilleur créneau, écrit en clair au-dessus de la carte de chaleur */
.stats-best { --tone-bg: var(--success-bg); --tone-fg: var(--success-fg); --tone-line: var(--success-line); display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s-2) var(--s-3); margin: 0 0 var(--s-4); padding: var(--s-3) var(--s-4); border: 1px solid var(--tone-line); border-radius: var(--r); background: var(--tone-bg); color: var(--tone-fg); }
.stats-best--none { --tone-bg: var(--neutral-bg); --tone-fg: var(--neutral-fg); --tone-line: var(--line); }
.stats-best__label { font-size: var(--fs-sm); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stats-best__slot { font-family: var(--font-title); font-size: var(--fs-lg); color: var(--ink); }
.stats-best__detail { font-size: var(--fs-sm); }
.stats-heat { min-width: 0; }

/* Tableau croisé : première colonne et en-tête collants, teinte selon le volume */
.stats-pivot-wrap { overflow: auto; max-height: 520px; }
.stats-pivot { width: 100%; border-collapse: separate; border-spacing: 0; }
.stats-pivot th, .stats-pivot td { white-space: nowrap; }
.stats-pivot thead th { position: sticky; top: 0; z-index: 2; background: var(--card); }
.stats-pivot__corner, .stats-pivot__row { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; font-weight: 500; color: var(--ink); max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.stats-pivot thead .stats-pivot__corner { z-index: 3; }
.stats-pivot__cell { font-family: var(--font-mono); min-width: 56px; }
.stats-pivot__cell--l0 { color: var(--muted); }
.stats-pivot__cell--l1 { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.stats-pivot__cell--l2 { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.stats-pivot__cell--l3 { background: color-mix(in srgb, var(--accent) 26%, transparent); }
.stats-pivot__cell--l4 { background: color-mix(in srgb, var(--accent) 38%, transparent); font-weight: 600; }
.stats-pivot__total { font-family: var(--font-mono); font-weight: 600; border-left: 1px solid var(--line); }
.stats-pivot tfoot th, .stats-pivot tfoot td { position: sticky; bottom: 0; background: var(--soft); font-weight: 600; border-top: 1px solid var(--line-strong); font-family: var(--font-mono); }
.stats-pivot tfoot .stats-pivot__row { font-family: var(--font); z-index: 2; background: var(--soft); }

@media (max-width: 900px) {
  .stats-controls__who { margin-left: 0; width: 100%; }
}
@media print {
  .stats-pivot-wrap { overflow: visible; max-height: none; }
  .stats-pivot thead th, .stats-pivot tfoot th, .stats-pivot tfoot td, .stats-pivot__corner, .stats-pivot__row { position: static; }
  .stats-pivot th, .stats-pivot td { white-space: normal; }
}
