/* Activité audio — feuille de style
   Parti pris : le papier quadrillé de l'audiogramme. Bleu de l'oreille gauche pour les ventes,
   rouge de l'oreille droite pour l'exercice en cours. Police Atkinson Hyperlegible
   (Braille Institute), dessinée pour la lisibilité. */

@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/atkinson-hyperlegible-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'Atkinson Hyperlegible';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/atkinson-hyperlegible-latin-700-normal.woff2') format('woff2');
}

:root {
  color-scheme: light;
  --papier: #f5f7f9;
  --surface: #ffffff;
  --encre: #16233a;
  --ardoise: #5a6678;
  --trait: #d5dce4;
  --grille: #e6ebf1;
  --grille-forte: #cbd5e0;
  --aides: #2453a6;
  --autres: #9db3d6;
  --accent: #c2362f;
  --ancien: #a7b1bf;
  --hausse: #1e7a4b;
  --baisse: #b3261e;
  --ombre: 0 6px 24px rgb(22 35 58 / 14%);
  --ombre-carte: 0 1px 2px rgb(22 35 58 / 6%), 0 6px 18px rgb(22 35 58 / 5%);
  --survol: #eef3fa;
  --teinte-actuelle: rgb(194 54 47 / 6%);
  --fond-hausse: rgb(30 122 75 / 10%);
  --fond-baisse: rgb(179 38 30 / 9%);
  --rayon: 6px;
  --rayon-carte: 12px;
  --police: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --papier: #0e1726;
    --surface: #13203a;
    --encre: #e6ecf4;
    --ardoise: #9ba8ba;
    --trait: #283754;
    --grille: #1a2740;
    --grille-forte: #2d3e5e;
    --aides: #7ea6ee;
    --autres: #3e5c8f;
    --accent: #f0736b;
    --ancien: #5c6b82;
    --hausse: #5cc28f;
    --baisse: #f08a84;
    --ombre: 0 6px 24px rgb(0 0 0 / 45%);
    --ombre-carte: 0 1px 2px rgb(0 0 0 / 35%);
    --survol: #1b2b49;
    --teinte-actuelle: rgb(240 115 107 / 9%);
    --fond-hausse: rgb(92 194 143 / 14%);
    --fond-baisse: rgb(240 138 132 / 14%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-family: var(--police);
  font-size: 100%;
  line-height: 1.5;
  color: var(--encre);
  background: var(--papier);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  max-width: 76rem;
  padding: 1.5rem clamp(1rem, 3vw, 2rem) 4rem;
  font-size: 0.9375rem;
}

h1,
h2,
p {
  margin: 0;
}

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

:focus-visible {
  outline: 2px solid var(--aides);
  outline-offset: 2px;
}

.evitement {
  position: absolute;
  left: -999px;
}

.evitement:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
}

.visuellement-cache {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------------------------------------------------------------- en-tête */

.entete {
  padding-bottom: 1.25rem;
}

.entete-ligne {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

/* Points de vente et onglets : restent sous la main pendant le défilement (sur écran assez grand). */
.barre-navigation {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.6rem 0 0;
  background: var(--papier);
  border-bottom: 1px solid var(--trait);
}

@media (min-width: 48rem) {
  .barre-navigation {
    position: sticky;
    top: 0;
    z-index: 15;
  }
}

.entete h1 {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.01em;
}

.entete-etat,
.entete-mode {
  margin-top: 0.35rem;
  color: var(--ardoise);
  font-size: 0.875rem;
}

.entete-mode {
  color: var(--accent);
}

.entete-marque {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo {
  display: block;
  flex: none;
  width: auto;
  height: 3.75rem;
}

.logo--connexion {
  align-self: flex-start;
  height: 6rem;
}

/* Le logo est gris foncé et noir : inversé sur fond sombre, la teinte bleue est conservée. */
@media (prefers-color-scheme: dark) {
  .logo {
    filter: invert(1) hue-rotate(180deg);
  }
}

.entete-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.utilisateur:not([hidden]) {
  display: flex;
}

.utilisateur {
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  color: var(--ardoise);
  font-size: 0.8125rem;
}

.lien-discret {
  appearance: none;
  padding: 0;
  border: 0;
  background: none;
  color: var(--encre);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

/* ---------------------------------------------------------------- page de connexion */

.connexion {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 26rem;
  margin: 12vh auto 0;
  padding: 2rem;
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
}

.connexion h1 {
  font-size: 1.5rem;
  line-height: 1.2;
}

.connexion p {
  color: var(--ardoise);
}

.connexion .bouton {
  align-self: flex-start;
  text-decoration: none;
}

.connexion .erreur {
  color: var(--baisse);
}

.bouton {
  appearance: none;
  border: 1px solid var(--aides);
  background: var(--aides);
  color: var(--surface);
  border-radius: var(--rayon);
  padding: 0.55rem 1rem;
  font-weight: 700;
  cursor: pointer;
}

.bouton:hover {
  filter: brightness(1.08);
}

.bouton:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.bouton--discret {
  background: transparent;
  color: var(--encre);
  border-color: var(--trait);
}

.magasins {
  display: inline-flex;
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--surface);
  overflow: hidden;
}

.magasin {
  appearance: none;
  border: 0;
  border-right: 1px solid var(--trait);
  background: transparent;
  padding: 0.45rem 0.9rem;
  cursor: pointer;
  color: var(--ardoise);
  transition: background-color 0.15s, color 0.15s;
}

.magasin:hover:not([aria-pressed='true']) {
  background: var(--survol);
  color: var(--encre);
}

.magasin:last-child {
  border-right: 0;
}

.magasin[aria-pressed='true'] {
  background: var(--encre);
  color: var(--papier);
  font-weight: 700;
}

/* Point de vente sans données : italique plutôt qu'une opacité qui ferait passer le texte sous 4,5:1. */
.magasin--vide:not([aria-pressed='true']) {
  font-style: italic;
}

/* Le conteneur coupe ce qui dépasse (coins arrondis) : le contour de focus est dessiné à l'intérieur. */
.magasin:focus-visible {
  outline-offset: -4px;
}

.onglets {
  display: flex;
  gap: 1.5rem;
}

.onglet {
  appearance: none;
  border: 0;
  background: none;
  padding: 0.4rem 0 0.6rem;
  border-bottom: 3px solid transparent;
  color: var(--ardoise);
  cursor: pointer;
  font-weight: 700;
  transition: color 0.15s, border-color 0.2s;
}

.onglet:hover {
  color: var(--encre);
}

.onglet[aria-selected='true'] {
  color: var(--encre);
  border-bottom-color: var(--accent);
}

/* ---------------------------------------------------------------- contenu */

.contenu {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding-top: 1.5rem;
}

.contenu:focus {
  outline: none;
}

.synthese {
  max-width: 70ch;
  font-size: 1.0625rem;
  line-height: 1.6;
}

.synthese strong,
.indicateur-detail strong {
  font-weight: 700;
}

.hausse {
  color: var(--hausse);
}

.baisse {
  color: var(--baisse);
}

/* ---------------------------------------------------------------- cartes */

.carte {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon-carte);
  box-shadow: var(--ombre-carte);
}

/* ---------------------------------------------------------------- indicateurs */

.indicateurs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
  gap: 1rem;
  margin: 0;
}

.indicateur {
  display: flex;
  flex-direction: column;
  padding: 1rem 1.15rem 1.1rem;
}

/* La carte en vedette (cumul de l'exercice) : liseré rouge de l'exercice en cours, chiffre plus grand. */
.indicateur--vedette {
  box-shadow: inset 0 3px 0 var(--accent), var(--ombre-carte);
}

.indicateur dt {
  color: var(--ardoise);
  font-size: 0.8125rem;
}

/* Chiffres proportionnels : les chiffres à chasse fixe paraissent espacés à cette taille. */
.indicateur-valeur {
  margin: 0.25rem 0 0.35rem;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.15;
}

.indicateur--vedette .indicateur-valeur {
  font-size: 2.125rem;
}

.indicateur-detail {
  margin: 0;
  color: var(--ardoise);
  font-size: 0.8125rem;
}

/* Évolution en pastille, flèche comprise (la flèche est décorative : le signe porte déjà le sens). */
.indicateur-detail strong.hausse,
.indicateur-detail strong.baisse {
  display: inline-block;
  margin-right: 0.15rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  white-space: nowrap;
}

.indicateur-detail strong.hausse {
  background: var(--fond-hausse);
}

.indicateur-detail strong.baisse {
  background: var(--fond-baisse);
}

.indicateur-detail strong.hausse::before {
  content: '▲ ';
  content: '▲ ' / '';
  font-size: 0.7em;
}

.indicateur-detail strong.baisse::before {
  content: '▼ ';
  content: '▼ ' / '';
  font-size: 0.7em;
}

.indicateur-tendance {
  margin: auto 0 0;
  padding-top: 0.6rem;
}

.sparkline {
  display: block;
  width: 100%;
  height: 2.25rem;
  overflow: visible;
}

.sparkline-ligne {
  fill: none;
  stroke: var(--aides);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.sparkline-aire {
  fill: var(--aides);
  opacity: 0.1;
}

/* ---------------------------------------------------------------- blocs */

.bloc {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  min-width: 0;
  padding: 1.25rem 1.35rem 1.4rem;
}

.bloc-tete :is(h2, h3),
.intertitre {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 700;
}

.intertitre {
  margin-top: 0.5rem;
  margin-bottom: -1rem;
}

.bloc-note {
  margin-top: 0.2rem;
  color: var(--ardoise);
  font-size: 0.8125rem;
  max-width: 75ch;
}

.duo,
.trio {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 60rem) {
  .duo {
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  }

  .trio {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.legende {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--ardoise);
  font-size: 0.8125rem;
}

.pastille {
  display: inline-block;
  width: 0.7rem;
  height: 0.7rem;
  margin-right: 0.4rem;
  border-radius: 2px;
  vertical-align: -0.05rem;
}

.teinte-aides {
  background: var(--aides);
}

.teinte-autres {
  background: var(--autres);
}

/* Clé de légende pour une courbe : un trait de la couleur et du style de la série. */
.cle-ligne {
  display: inline-block;
  width: 1.2rem;
  margin-right: 0.4rem;
  vertical-align: 0.2rem;
  border-top: 3px solid var(--ancien);
  border-radius: 2px;
}

.cle-ligne.serie-actuelle {
  border-top-color: var(--accent);
}

.cle-ligne.serie-precedente {
  border-top-color: var(--aides);
}

.cle-ligne--pointilles {
  border-top-style: dotted;
}

.notes {
  max-width: 85ch;
  color: var(--ardoise);
  font-size: 0.8125rem;
  line-height: 1.55;
  padding-top: 1rem;
  border-top: 1px solid var(--trait);
}

.vide {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.75rem;
  max-width: 42rem;
  padding: 2.5rem 0;
}

.vide h2 {
  font-size: 1.375rem;
}

.vide p {
  color: var(--ardoise);
}

/* ---------------------------------------------------------------- CA mois par mois (papier quadrillé) */

.zone-histo {
  padding: 0.5rem 0 0;
}

.histo {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 0.6rem;
}

.histo-axe {
  position: relative;
  height: 16rem;
}

.histo-gabarit {
  display: block;
  height: 0;
  overflow: hidden;
  visibility: hidden;
  white-space: nowrap;
  font-size: 0.75rem;
}

.histo-tick {
  position: absolute;
  right: 0;
  transform: translateY(50%);
  color: var(--ardoise);
  font-size: 0.75rem;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

/* Grille horizontale seule, en traits fins : les barres sont la seule chose qui doit ressortir. */
.histo-zone {
  position: relative;
  height: 16rem;
  display: grid;
  grid-template-columns: repeat(var(--colonnes), minmax(0, 1fr));
  column-gap: 2px;
  border-bottom: 1px solid var(--grille-forte);
}

.histo-ligne {
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1px solid var(--grille);
  pointer-events: none;
}

.histo-col {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  cursor: default;
  transition: opacity 0.15s;
}

/* Les deux segments d'un mois, séparés par 2 px de fond ; arrondi de 4 px en haut de la pile. */
.histo-pile {
  display: flex;
  flex-direction: column-reverse;
  gap: 2px;
  max-width: 1.5rem;
  width: 100%;
  margin: 0 auto;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
  transform-origin: bottom;
}

.histo-seg {
  flex-basis: 0;
  min-height: 0;
  width: 100%;
}

.histo-seg--aides {
  background: var(--aides);
}

.histo-seg--autres {
  background: var(--autres);
}

.histo-col--partiel .histo-seg--aides {
  background: repeating-linear-gradient(135deg, var(--aides) 0 3px, transparent 3px 6px);
  box-shadow: inset 0 0 0 1px var(--aides);
}

.histo-col--partiel .histo-seg--autres {
  background: repeating-linear-gradient(135deg, var(--autres) 0 3px, transparent 3px 6px);
}

/* Séparation entre deux exercices : un trait fin pleine hauteur. */
.histo-col--exercice::before {
  content: '';
  position: absolute;
  left: -2px;
  top: -0.25rem;
  bottom: 0;
  border-left: 1px solid var(--grille-forte);
}

.histo-zone:hover .histo-col {
  opacity: 0.5;
}

.histo-zone .histo-col:hover {
  opacity: 1;
}

/* Sous l'axe : l'initiale de chaque mois, puis une accolade par exercice. */
.histo-x {
  display: grid;
  grid-template-columns: repeat(var(--colonnes), minmax(0, 1fr));
  column-gap: 2px;
  row-gap: 0.15rem;
  padding-top: 0.35rem;
}

.histo-x-mois {
  grid-row: 1;
  min-width: 0;
  text-align: center;
  color: var(--ardoise);
  font-size: 0.6875rem;
  line-height: 1.2;
}

.histo-x-exercice {
  grid-row: 2;
  min-width: 0;
  margin: 0 3px;
  padding-top: 0.25rem;
  border-top: 1px solid var(--grille-forte);
  text-align: center;
  color: var(--encre);
  font-size: 0.75rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------- courbes de cumul */

.zone-courbes {
  min-height: 300px;
}

/* Carte dont le graphique prend toute la hauteur disponible (courbe à côté d'un tableau). */
.bloc--remplir .bloc-contenu {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

.bloc--remplir .zone-courbes {
  flex: 1;
}

.zone-courbes svg {
  display: block;
  overflow: visible;
}

.courbe-label {
  fill: var(--ardoise);
  font-size: 12px;
  font-family: var(--police);
}

.courbe-fin {
  font-size: 12px;
  font-weight: 700;
  font-family: var(--police);
}

.courbe-grille {
  stroke: var(--grille);
}

.courbe-axe {
  stroke: var(--encre);
  stroke-width: 1.5;
}

.courbe-guide {
  stroke: var(--ardoise);
  stroke-dasharray: 3 3;
}

.courbe {
  fill: none;
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.courbe.serie-actuelle {
  stroke: var(--accent);
  stroke-width: 3;
}

.courbe.serie-precedente {
  stroke: var(--aides);
}

.courbe.courbe--prevision {
  stroke-width: 2.5;
  stroke-dasharray: 2 6;
}

/* Anneau de 2 px couleur du fond autour des points de fin, lisibles même là où une courbe les croise. */
.courbe-point {
  stroke: var(--surface);
  stroke-width: 2;
}

.courbe-point--prevision {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
}

.courbe-fin--prevision {
  font-weight: 400;
}

.courbe.serie-ancienne {
  stroke: var(--ancien);
}

.courbe-point.serie-actuelle,
.courbe-fin.serie-actuelle {
  fill: var(--accent);
}

.courbe-point.serie-precedente,
.courbe-fin.serie-precedente {
  fill: var(--aides);
}

.courbe-point.serie-ancienne,
.courbe-fin.serie-ancienne {
  fill: var(--ancien);
}

/* ---------------------------------------------------------------- CA par exercice */

.zone-colonnes {
  padding: 0.75rem 0 0;
}

.colonnes {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  height: 15rem;
  border-bottom: 1px solid var(--grille-forte);
  background-image: linear-gradient(to top, var(--grille) 1px, transparent 1px);
  background-size: 100% 20%;
  background-position: bottom;
}

.colonnes-col {
  position: relative;
}

.colonnes-barre {
  position: absolute;
  bottom: 0;
  left: 50%;
  width: min(40%, 2.25rem);
  transform: translateX(-50%);
  min-height: 2px;
  background: var(--aides);
  border-radius: 4px 4px 0 0;
  transform-origin: bottom;
}

.colonnes-barre--partiel {
  background: repeating-linear-gradient(135deg, var(--accent) 0 4px, transparent 4px 8px);
  box-shadow: inset 0 0 0 1.5px var(--accent);
}

.colonnes-repere {
  position: absolute;
  left: 50%;
  width: min(64%, 4rem);
  transform: translateX(-50%);
  border-top: 2px dashed var(--encre);
}

.colonnes-valeur {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  font-weight: 700;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.colonnes-x {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  padding-top: 0.5rem;
}

.colonnes-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  text-align: center;
  font-size: 0.8125rem;
}

.colonnes-evolution {
  color: var(--ardoise);
  font-size: 0.75rem;
}

.colonnes-evolution.hausse {
  color: var(--hausse);
}

.colonnes-evolution.baisse {
  color: var(--baisse);
}

/* ---------------------------------------------------------------- Classe I / Classe II */

.classes {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0.9rem 0 1.25rem;
}

.classes-ligne {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr) 11rem;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8125rem;
}

.classes-nom {
  white-space: nowrap;
}

.classes-barre {
  position: relative;
  display: flex;
  gap: 2px;
  height: 1.75rem;
  border-radius: var(--rayon);
  overflow: hidden;
}

.classes-seg {
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: 0 0.5rem;
  font-weight: 700;
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.classes-seg--1 {
  background: var(--aides);
  color: var(--surface);
}

.classes-seg--2 {
  justify-content: flex-end;
  background: var(--autres);
  color: var(--encre);
}

.classes-repere {
  position: absolute;
  top: 0;
  bottom: 0;
  margin-left: -1px;
  border-left: 2px dashed var(--accent);
}

.classes-ecart {
  color: var(--ardoise);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 40rem) {
  .classes-ligne {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 0.25rem;
  }

  .classes-barre {
    grid-column: 1 / -1;
    grid-row: 2;
  }
}

/* ---------------------------------------------------------------- barres horizontales, barre empilée */

.hbarre {
  display: grid;
  grid-template-columns: minmax(6rem, 38%) minmax(0, 1fr) auto;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0;
  font-size: 0.8125rem;
}

.hbarre-nom {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hbarre-piste {
  height: 0.6rem;
  background: var(--grille);
  border-radius: 999px;
}

.hbarre-barre {
  height: 100%;
  min-width: 2px;
  background: var(--aides);
  border-radius: 999px;
  transform-origin: left;
}

.hbarre-valeur {
  color: var(--ardoise);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.empile {
  display: flex;
  gap: 2px;
  height: 1.75rem;
  border-radius: var(--rayon);
  overflow: hidden;
}

.empile-seg {
  min-width: 2px;
}

.empile-seg--0 {
  background: var(--aides);
}

.empile-seg--1 {
  background: var(--autres);
}

.empile-seg--2 {
  background: var(--accent);
}

.empile-legende {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.8125rem;
}

.empile-legende li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto 3.75rem;
  align-items: center;
  gap: 0.5rem;
}

.empile-legende .pastille {
  margin-right: 0;
}

.nombre {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.discret {
  color: var(--ardoise);
}

/* ---------------------------------------------------------------- tableaux */

.tableau-cadre {
  overflow-x: auto;
}

.tableau-cadre--defilant {
  max-height: 30rem;
  overflow-y: auto;
}

.tableau {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.tableau th,
.tableau td {
  padding: 0.45rem 0.6rem;
  border-bottom: 1px solid var(--trait);
  text-align: left;
  vertical-align: top;
}

.tableau thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface);
  color: var(--ardoise);
  font-weight: 700;
  white-space: nowrap;
  vertical-align: bottom;
  border-bottom: 1.5px solid var(--encre);
}

.tableau tbody th {
  font-weight: 400;
  white-space: nowrap;
}

.tableau :is(th, td):first-child {
  padding-left: 0;
}

.tableau :is(th, td):last-child {
  padding-right: 0;
}

.tableau .droite {
  text-align: right;
  white-space: nowrap;
}

.tableau tr.total :is(th, td) {
  font-weight: 700;
  border-bottom: 0;
  border-top: 1.5px solid var(--encre);
}

/* Exercice en cours teinté (comme il est en rouge dans les graphiques) ; ligne survolée surlignée. */
.tableau .col-actuelle {
  background: var(--teinte-actuelle);
}

.tableau thead th.col-actuelle {
  background: linear-gradient(var(--teinte-actuelle), var(--teinte-actuelle)), var(--surface);
  color: var(--encre);
}

.tableau tbody tr {
  transition: background-color 0.12s;
}

.tableau tbody tr:hover > * {
  background: var(--survol);
}

.cellule-barre {
  display: block;
  height: 3px;
  min-width: 2px;
  margin: 0.25rem 0 0 auto;
  background: var(--autres);
  border-radius: 2px;
  transform-origin: right;
}

/* ---------------------------------------------------------------- dialogues, infobulle, annonce */

.dialogue {
  width: min(40rem, calc(100vw - 2rem));
  padding: 1.5rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--surface);
  color: var(--encre);
  box-shadow: var(--ombre);
}

.dialogue::backdrop {
  background: rgb(14 23 38 / 45%);
}

.dialogue form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.dialogue h2 {
  font-size: 1.25rem;
}

.dialogue-aide {
  color: var(--ardoise);
  font-size: 0.875rem;
}

.dialogue-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

.depot {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem;
  border: 1.5px dashed var(--grille-forte);
  border-radius: var(--rayon);
  cursor: pointer;
}

.depot-texte {
  font-weight: 700;
}

.fichiers {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.fichier {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.35rem 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--trait);
}

.fichier-nom {
  font-weight: 700;
  overflow-wrap: anywhere;
}

.fichier-statut {
  grid-column: 1 / -1;
  color: var(--ardoise);
  font-size: 0.8125rem;
}

.fichier .choix-magasin {
  grid-row: 1;
  grid-column: 2;
}

.choix-magasin,
.saisie {
  padding: 0.4rem 0.5rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  background: var(--papier);
}

.champ {
  font-weight: 700;
  margin-bottom: -0.6rem;
}

.erreur {
  color: var(--baisse);
  font-size: 0.875rem;
}

.fichier-statut.erreur {
  color: var(--baisse);
}

.infobulle {
  position: fixed;
  z-index: 20;
  display: none;
  min-width: 11rem;
  padding: 0.5rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  font-size: 0.8125rem;
  pointer-events: none;
}

.infobulle.visible {
  display: block;
}

.infobulle-titre {
  margin-bottom: 0.25rem;
  font-weight: 700;
}

.infobulle-ligne {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-variant-numeric: tabular-nums;
}

.annonce {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 30;
  max-width: min(36rem, calc(100vw - 2rem));
  padding: 0.65rem 1rem;
  transform: translate(-50%, 1rem);
  background: var(--encre);
  color: var(--papier);
  border-radius: var(--rayon);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.annonce.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------------------------------------------------------------- mouvement
   animation.js ajoute .revelable aux cartes d'une vue, puis .revele quand chacune entre à l'écran
   (--delai décale les cartes qui apparaissent ensemble). Les graphiques de la carte se dessinent alors,
   élément par élément (--i). Rien de tout cela sous prefers-reduced-motion : la vue s'affiche telle quelle. */

@keyframes apparaitre {
  from {
    opacity: 0;
    translate: 0 16px;
  }
}

@keyframes fondu {
  from {
    opacity: 0;
  }
}

@keyframes pousser-y {
  from {
    scale: 1 0;
  }
}

@keyframes pousser-x {
  from {
    scale: 0 1;
  }
}

@keyframes balayer {
  from {
    clip-path: inset(0 100% 0 0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .revelable:not(.revele) {
    opacity: 0;
  }

  .revele {
    --sortie: cubic-bezier(0.2, 0.75, 0.25, 1);
    animation: apparaitre 0.55s var(--sortie) var(--delai, 0ms) both;
  }

  .revele .histo-pile {
    animation: pousser-y 0.7s var(--sortie) both;
    animation-delay: calc(var(--delai, 0ms) + 150ms + var(--i, 0) * 16ms);
  }

  .revele .colonnes-barre {
    animation: pousser-y 0.8s var(--sortie) both;
    animation-delay: calc(var(--delai, 0ms) + 150ms + var(--i, 0) * 110ms);
  }

  .revele :is(.colonnes-valeur, .colonnes-repere) {
    animation: fondu 0.4s ease both;
    animation-delay: calc(var(--delai, 0ms) + 750ms + var(--i, 0) * 110ms);
  }

  .revele .hbarre-barre {
    animation: pousser-x 0.7s var(--sortie) both;
    animation-delay: calc(var(--delai, 0ms) + 150ms + var(--i, 0) * 60ms);
  }

  .revele .cellule-barre {
    animation: pousser-x 0.6s var(--sortie) both;
    animation-delay: calc(var(--delai, 0ms) + 200ms);
  }

  .revele .classes-barre {
    animation: balayer 0.8s var(--sortie) both;
    animation-delay: calc(var(--delai, 0ms) + 150ms + var(--i, 0) * 120ms);
  }

  .revele .empile {
    animation: balayer 0.9s var(--sortie) both;
    animation-delay: calc(var(--delai, 0ms) + 150ms);
  }

  .revele .courbe-traces {
    animation: balayer 1.3s cubic-bezier(0.45, 0, 0.25, 1) both;
    animation-delay: calc(var(--delai, 0ms) + 200ms);
  }

  .revele .courbe-annotations {
    animation: fondu 0.5s ease both;
    animation-delay: calc(var(--delai, 0ms) + 1300ms);
  }

  .revele .sparkline {
    animation: balayer 1s cubic-bezier(0.45, 0, 0.25, 1) both;
    animation-delay: calc(var(--delai, 0ms) + 250ms);
  }

  /* Redessin après un changement de largeur : pas de nouveau tracé. */
  .sans-animation :is(.courbe-traces, .courbe-annotations) {
    animation: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .annonce,
  .histo-col,
  .magasin,
  .onglet,
  .tableau tbody tr {
    transition: none;
  }
}

@media (max-width: 40rem) {
  .bloc {
    padding: 1rem 1rem 1.15rem;
  }

  .histo-x-mois:not(.histo-x-mois--repere) {
    visibility: hidden;
  }

  .histo-axe,
  .histo-zone {
    height: 12rem;
  }
}
