/* Console BES Chorus — charte B E-Solutions.
 *
 * Aucune dépendance, aucune police distante : la console doit s'ouvrir sur un
 * poste hors ligne comme les documents qu'elle produit.
 *
 * Le parti pris tient en une phrase : c'est un instrument de lecture, pas une
 * page vitrine. La densité est une qualité — un audit se lit à 44 factures à
 * l'écran — donc pas de respiration décorative, pas de verre dépoli sur des
 * tableaux, pas de typographie monumentale. Le raffinement passe par les
 * filets, la hiérarchie, les chiffres alignés et le mouvement, jamais par
 * l'espace vide.
 */

:root {
  /* -- encre : une seule famille, du navy BES au gris de légende --------- */
  --encre-900: #0b1d30;
  --encre-800: #0f2a43;   /* navy BES — la référence de marque */
  --encre-700: #1b3f60;
  --encre-600: #33506e;
  --encre-500: #556681;
  --encre-400: #7a8699;
  --encre-300: #a4adbd;

  /* -- accent : l'or BES, rare et donc lisible --------------------------- */
  --or: #e8a33d;
  --or-fonce: #b97d1f;
  --or-voile: #fdf4e4;

  /* -- fonds et filets ---------------------------------------------------
     Les filets sont exprimés en alpha sur le navy, jamais en gris neutre :
     un trait gris sur un fond froid se voit comme une salissure. */
  --fond: #f5f7fa;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --surface-3: #f0f3f8;
  --trait: rgba(15, 42, 67, .09);
  --trait-fort: rgba(15, 42, 67, .16);
  --trait-clair: rgba(255, 255, 255, .12);

  /* -- sémantique --------------------------------------------------------- */
  --rouge: #b3261e;
  --rouge-voile: #fdecea;
  --vert: #1c5c2e;
  --vert-voile: #e6f4ea;
  --bleu: #14487d;
  --bleu-voile: #e8f0fa;
  --violet: #4a2b86;
  --violet-voile: #eee9f8;

  /* -- profondeur : ombres empilées et diffuses, jamais un bloc sombre --- */
  --ombre-1: 0 1px 2px rgba(11, 29, 48, .05);
  --ombre-2: 0 1px 2px rgba(11, 29, 48, .04), 0 6px 14px -6px rgba(11, 29, 48, .09);
  --ombre-3: 0 2px 4px rgba(11, 29, 48, .04), 0 14px 30px -12px rgba(11, 29, 48, .16);
  --ombre-4: 0 4px 8px rgba(11, 29, 48, .05), 0 24px 48px -16px rgba(11, 29, 48, .22);
  --lueur-focus: 0 0 0 3px rgba(232, 163, 61, .32);

  /* -- rayons : concentriques, pour que l'imbrication paraisse usinée ---- */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-xl: 24px;

  /* -- mouvement ---------------------------------------------------------
     Une seule courbe, sortie rapide puis freinage long : c'est ce qui donne
     l'impression de masse. Aucune transition linéaire dans cette feuille. */
  --sortie: cubic-bezier(.32, .72, 0, 1);
  --ressort: cubic-bezier(.34, 1.4, .64, 1);
  --t-court: .16s;
  --t-moyen: .28s;
  --t-long: .5s;

  --largeur: 1320px;
}

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

/* Une règle d'auteur bat toujours la feuille du navigateur, quelle que soit la
   spécificité : `button { display: inline-flex }` suffit à faire réapparaître
   un bouton portant l'attribut `hidden`. Le `!important` remet le masquage
   au-dessus de toute déclaration de `display`. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text',
               'Segoe UI Variable Text', 'Segoe UI', Ubuntu, Cantarell, sans-serif;
  background: var(--fond);
  color: var(--encre-800);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'kern' 1, 'liga' 1;
}

/* Les chiffres d'un audit se comparent en colonne : chasse fixe partout où
   ils s'empilent, sinon les montants dansent d'une ligne à l'autre. */
.num, .kpi .valeur, td.num, .montant, input[type=date] {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

::selection { background: var(--or-voile); color: var(--encre-900); }

/* ══════════════════════════════════════════════════════════ barre haute */
.rail {
  position: sticky;
  top: 0;
  z-index: 40;
  background: linear-gradient(180deg, var(--encre-800), var(--encre-900));
  color: #fff;
  border-bottom: 1px solid rgba(0, 0, 0, .3);
  box-shadow: 0 1px 0 var(--trait-clair) inset, 0 6px 20px -12px rgba(11, 29, 48, .6);
}
.rail-interieur {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 0 24px;
  min-height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.marque { display: flex; align-items: center; gap: 13px; min-width: 0; }
.logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: linear-gradient(160deg, #f2b45a, var(--or) 55%, var(--or-fonce));
  color: var(--encre-900);
  font-weight: 800;
  font-size: 12px;
  letter-spacing: .3px;
  border-radius: var(--r-sm);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset,
              0 3px 8px -2px rgba(232, 163, 61, .45);
}
.marque-txt { min-width: 0; }
.marque-txt b {
  display: block;
  font-size: 14.5px;
  font-weight: 650;
  letter-spacing: -.15px;
  line-height: 1.25;
}
.marque-txt span {
  display: block;
  color: #9db0c8;
  font-size: 11.5px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rail-actions { display: flex; gap: 9px; align-items: center; }

/* Qui travaille. Discret : l'information compte au moment de la saisie, pas en
   permanence, et un badge d'utilisateur trop présent occupe une place que le
   sélecteur de missions utilise mieux. */
.qui {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 560;
  color: #c6d5e8;
  padding-left: 3px;
}
.qui::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #57c47a;
  box-shadow: 0 0 0 2px rgba(87, 196, 122, .22);
}

/* Le sélecteur de missions vit sur fond sombre : il lui faut ses propres
   couleurs, pas celles des champs de formulaire du corps de page. */
.rail select {
  background: rgba(255, 255, 255, .07);
  border: 1px solid var(--trait-clair);
  color: #fff;
  width: auto;
  min-width: 240px;
  max-width: 340px;
  padding: 7px 11px;
  font-size: 12.5px;
  border-radius: var(--r-sm);
  transition: background var(--t-court) var(--sortie),
              border-color var(--t-court) var(--sortie);
}
.rail select:hover { background: rgba(255, 255, 255, .12); }
.rail select:focus { outline: none; box-shadow: var(--lueur-focus); }
.rail select option { background: var(--encre-800); color: #fff; }

/* ══════════════════════════════════════════════════════════════ squelette */
main {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 26px 24px 88px;
}

.carte {
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-lg);
  box-shadow: var(--ombre-2);
  padding: 24px 26px;
  margin-bottom: 16px;
}

h1 {
  font-size: 24px;
  font-weight: 680;
  letter-spacing: -.5px;
  color: var(--encre-900);
  margin: 0 0 6px;
  line-height: 1.2;
}
h2 { font-size: 17px; font-weight: 650; letter-spacing: -.25px; color: var(--encre-900); margin: 0 0 5px; }
h3 { font-size: 14px; font-weight: 650; letter-spacing: -.1px; color: var(--encre-900); margin: 0 0 9px; }

.sous { color: var(--encre-400); font-size: 12.5px; }
.aide { color: var(--encre-500); font-size: 13px; margin: 6px 0 18px; max-width: 68ch; }
.aide b { color: var(--encre-800); font-weight: 600; }
i { font-style: normal; color: var(--encre-400); }

/* Étiquette microscopique au-dessus d'un titre : elle situe le bloc sans
   consommer une ligne de titre. */
.sourcil {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--or-fonce);
  background: var(--or-voile);
  border: 1px solid rgba(232, 163, 61, .28);
  border-radius: 100px;
  padding: 3px 10px;
  margin-bottom: 10px;
}

/* Le chevron d'un <details> : le marqueur natif est masqué pour éviter la
   puce système, il faut donc le redessiner. */
details > summary { display: flex; align-items: center; gap: 9px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before {
  content: '▶';
  font-size: 9px;
  color: var(--encre-300);
  transition: transform var(--t-moyen) var(--sortie), color var(--t-court) var(--sortie);
}
details[open] > summary::before { transform: rotate(90deg); color: var(--or-fonce); }
details > summary:hover::before { color: var(--encre-600); }

/* ═══════════════════════════════════════════════════════════════ boutons */
button, .bouton {
  font: inherit;
  font-weight: 560;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  padding: 9px 15px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: background var(--t-court) var(--sortie),
              border-color var(--t-court) var(--sortie),
              box-shadow var(--t-court) var(--sortie),
              transform var(--t-court) var(--sortie),
              color var(--t-court) var(--sortie);
}
button:active:not(:disabled) { transform: scale(.978); }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible { outline: none; box-shadow: var(--lueur-focus); }

.principal {
  background: linear-gradient(180deg, var(--encre-700), var(--encre-800));
  color: #fff;
  box-shadow: 0 1px 0 var(--trait-clair) inset, var(--ombre-2);
}
.principal:hover:not(:disabled) {
  background: linear-gradient(180deg, #24496b, var(--encre-700));
  box-shadow: 0 1px 0 var(--trait-clair) inset, var(--ombre-3);
}

.secondaire {
  background: var(--surface);
  color: var(--encre-700);
  border-color: var(--trait-fort);
  box-shadow: var(--ombre-1);
}
.secondaire:hover:not(:disabled) { background: var(--surface-2); border-color: rgba(15, 42, 67, .26); }

.rail .secondaire {
  background: rgba(255, 255, 255, .09);
  border-color: var(--trait-clair);
  color: #fff;
  box-shadow: none;
}
.rail .secondaire:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }

.discret {
  background: transparent;
  color: var(--encre-500);
  border-color: transparent;
  padding: 6px 11px;
}
.discret:hover:not(:disabled) { background: var(--surface-3); color: var(--encre-800); }

.danger {
  background: var(--surface);
  color: var(--rouge);
  border-color: rgba(179, 38, 30, .22);
  padding: 7px 13px;
  font-size: 13px;
}
.danger:hover:not(:disabled) { background: var(--rouge-voile); border-color: rgba(179, 38, 30, .38); }

/* Pastille circulaire nichée dans le bouton, flush contre le bord intérieur.
   Elle porte le mouvement au survol : le bouton reste immobile, la flèche
   avance. C'est la tension interne qui fait « fini », pas un survol coloré. */
.pastille-icone {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  margin: -4px -6px -4px 0;
  border-radius: 100px;
  background: rgba(255, 255, 255, .16);
  font-size: 12px;
  line-height: 1;
  transition: transform var(--t-moyen) var(--ressort),
              background var(--t-court) var(--sortie);
}
button:hover:not(:disabled) .pastille-icone {
  transform: translateX(2px);
  background: rgba(255, 255, 255, .26);
}
.secondaire .pastille-icone { background: var(--surface-3); }

/* ════════════════════════════════════════════════════════════════ champs */
input[type=text], input[type=date], input[type=search],
input[type=password], select, textarea {
  font: inherit;
  width: 100%;
  padding: 9px 12px;
  color: var(--encre-800);
  background: var(--surface);
  border: 1px solid var(--trait-fort);
  border-radius: var(--r-sm);
  box-shadow: 0 1px 2px rgba(11, 29, 48, .03) inset;
  transition: border-color var(--t-court) var(--sortie),
              box-shadow var(--t-court) var(--sortie),
              background var(--t-court) var(--sortie);
}
input::placeholder { color: var(--encre-300); }
input:hover:not(:focus), select:hover:not(:focus) { border-color: rgba(15, 42, 67, .26); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--or);
  box-shadow: var(--lueur-focus);
}

label { display: block; font-size: 12px; font-weight: 620; color: var(--encre-500); letter-spacing: .01em; }
label > input, label > select { margin-top: 5px; }

.grille-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 15px;
  margin: 20px 0;
}
.case {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-weight: 400;
  font-size: 12.5px;
  color: var(--encre-600);
  line-height: 1.45;
}
.case input { width: auto; margin-top: 2px; accent-color: var(--or-fonce); flex: none; }
.ligne-form { display: flex; gap: 10px; margin-top: 16px; align-items: center; flex-wrap: wrap; }
.ligne-form input { max-width: 290px; }

/* ═══════════════════════════════════════════════════════════ zone de dépôt
   Double enveloppe : un plateau creusé, et la zone active à l'intérieur. Le
   rayon interne est calculé pour que les courbes restent concentriques. */
.plateau {
  background: var(--surface-3);
  border: 1px solid var(--trait);
  border-radius: var(--r-xl);
  padding: 7px;
}
.zone-depot {
  position: relative;
  border: 1.5px dashed var(--trait-fort);
  border-radius: calc(var(--r-xl) - 7px);
  padding: 40px 22px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  box-shadow: 0 1px 0 #fff inset;
  transition: border-color var(--t-moyen) var(--sortie),
              background var(--t-moyen) var(--sortie),
              transform var(--t-moyen) var(--sortie);
}
.zone-depot:hover { border-color: rgba(232, 163, 61, .55); background: #fffdf9; }
.zone-depot.survol {
  border-color: var(--or);
  background: var(--or-voile);
  transform: scale(1.006);
}
.zone-icone {
  width: 38px;
  height: 38px;
  margin: 0 auto 12px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: var(--surface-3);
  color: var(--encre-500);
  transition: background var(--t-moyen) var(--sortie), color var(--t-moyen) var(--sortie);
}
.zone-depot:hover .zone-icone, .zone-depot.survol .zone-icone {
  background: var(--or-voile);
  color: var(--or-fonce);
}
.zone-txt b { display: block; color: var(--encre-900); font-size: 14.5px; font-weight: 620; }
.zone-txt span { color: var(--encre-400); font-size: 12.5px; }
.nom-fichier {
  margin-top: 13px;
  font-weight: 620;
  font-size: 13px;
  color: var(--encre-800);
  display: none;
}
.nom-fichier.visible { display: block; animation: monte var(--t-moyen) var(--sortie); }

/* ════════════════════════════════════════════════════════════ encarts */
.encart {
  border-radius: var(--r-md);
  padding: 13px 17px;
  font-size: 13px;
  border: 1px solid transparent;
  margin-bottom: 16px;
  animation: monte var(--t-moyen) var(--sortie);
}
.encart b { font-weight: 640; }
.encart ul { margin: 5px 0 0; padding-left: 17px; }
.encart li { margin: 3px 0; }

.erreur { background: var(--rouge-voile); border-color: rgba(179, 38, 30, .22); color: #8c1d18; }
.erreur[hidden] { display: none; }
.notes { background: var(--or-voile); border-color: rgba(232, 163, 61, .3); color: #6d4a12; }
.notes b { color: #4a3007; }

/* ══════════════════════════════════════════════════════ entête de mission */
.mission-tete {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.mission-meta {
  display: flex;
  gap: 7px 14px;
  flex-wrap: wrap;
  align-items: center;
  color: var(--encre-400);
  font-size: 12.5px;
  margin-top: 3px;
}
.mission-meta span { display: inline-flex; align-items: center; gap: 6px; }
.mission-meta span + span::before {
  content: '';
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--encre-300);
  margin-right: 8px;
}
.mono {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
  font-size: 11.5px;
  background: var(--surface-3);
  border: 1px solid var(--trait);
  border-radius: var(--r-xs);
  padding: 1px 6px;
  color: var(--encre-500);
}

/* ══════════════════════════════════════════════════════════════════ KPIs */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(228px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--trait);
  border-radius: var(--r-lg);
  padding: 18px 20px 17px;
  box-shadow: var(--ombre-2);
  overflow: hidden;
  transition: box-shadow var(--t-moyen) var(--sortie),
              transform var(--t-moyen) var(--sortie);
}
.kpi:hover { box-shadow: var(--ombre-3); transform: translateY(-1px); }
/* Filet supérieur teinté : signale la carte sans lui ajouter une bordure. */
.kpi::before {
  content: '';
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--trait-fort), transparent);
}
.kpi .valeur {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -.9px;
  color: var(--encre-900);
  line-height: 1.1;
}
.kpi .etiquette {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--encre-500);
  margin-top: 5px;
  letter-spacing: .005em;
}
.kpi .detail {
  font-size: 11.5px;
  color: var(--encre-400);
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--trait);
  line-height: 1.45;
}

.kpi.phare {
  background:
    radial-gradient(120% 130% at 88% -10%, rgba(232, 163, 61, .2), transparent 58%),
    linear-gradient(165deg, var(--encre-700), var(--encre-900));
  border-color: transparent;
  box-shadow: 0 1px 0 var(--trait-clair) inset, var(--ombre-4);
}
.kpi.phare::before { background: linear-gradient(90deg, var(--or), transparent); height: 2px; }
.kpi.phare .valeur { color: var(--or); letter-spacing: -1px; }
.kpi.phare .etiquette { color: #c6d5e8; }
.kpi.phare .detail { color: #93a8c1; border-top-color: rgba(255, 255, 255, .13); }
.kpi.phare:hover { box-shadow: 0 1px 0 var(--trait-clair) inset, var(--ombre-4); }

/* ═════════════════════════════════════════════════════════════ onglets */
.onglets {
  display: flex;
  gap: 3px;
  margin-bottom: 15px;
  background: var(--surface-3);
  border: 1px solid var(--trait);
  border-radius: var(--r-md);
  padding: 4px;
  width: max-content;
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
}
.onglets::-webkit-scrollbar { display: none; }
.onglets button {
  background: transparent;
  border: none;
  color: var(--encre-500);
  font-weight: 600;
  font-size: 13px;
  padding: 7px 15px;
  border-radius: var(--r-xs);
  white-space: nowrap;
}
.onglets button:hover:not(.actif) { color: var(--encre-800); background: rgba(255, 255, 255, .7); }
.onglets button.actif {
  background: var(--surface);
  color: var(--encre-900);
  box-shadow: var(--ombre-1), 0 0 0 1px var(--trait);
}
.onglets .compteur {
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 100px;
  background: var(--surface-3);
  color: var(--encre-400);
  margin-left: 2px;
}
.onglets button.actif .compteur { background: var(--or-voile); color: var(--or-fonce); }

/* ═════════════════════════════════════════════════════════════ filtres */
.filtres {
  display: flex;
  gap: 9px;
  align-items: center;
  flex-wrap: wrap;
  padding-bottom: 15px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--trait);
}
.filtres select { width: auto; min-width: 168px; font-size: 13px; padding: 7px 11px; }
.champ-recherche { position: relative; flex: 1; min-width: 190px; }
.champ-recherche input { padding-left: 32px; font-size: 13px; }
.champ-recherche::before {
  content: '⌕';
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-52%);
  color: var(--encre-300);
  font-size: 15px;
  pointer-events: none;
}
.compte { margin-left: auto; color: var(--encre-400); font-size: 12.5px; white-space: nowrap; }
.compte b { color: var(--encre-800); font-weight: 620; }

/* ═════════════════════════════════════════════════════════════ tableaux */
/* Piège déjà rencontré sur cette console, et à ne pas redécouvrir : un
   conteneur en `overflow` devient le référentiel des `position: sticky` qu'il
   contient. Un en-tête collé à `top: 60px` — la hauteur de la barre haute —
   s'épingle alors 60 px sous le haut du TABLEAU, c'est-à-dire par-dessus la
   première ligne, et non sous la barre.
   Le conteneur défile donc lui-même en hauteur, et l'en-tête se colle à son
   propre bord (`top: 0`). L'en-tête reste visible sur les 44 lignes d'un
   audit, et les filtres et indicateurs restent à l'écran avec lui. */
.table-defilante {
  overflow: auto;
  max-height: min(68dvh, 760px);
  margin: 0 -26px;
  padding: 0 26px;
  scrollbar-width: thin;
  overscroll-behavior: contain;
}
/* Sous cette largeur les colonnes s'écrasent et les libellés se coupent en
   trois lignes : le tableau défile plutôt que de se déformer. */
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
#table-factures table { min-width: 1000px; }
thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  color: var(--encre-400);
  text-align: left;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 11px 12px;
  box-shadow: inset 0 -1px 0 var(--trait-fort);
  white-space: nowrap;
}
thead th.triable { cursor: pointer; user-select: none; transition: color var(--t-court) var(--sortie); }
thead th.triable:hover { color: var(--encre-700); }
thead th .fleche { opacity: 0; margin-left: 4px; font-size: 9px; transition: opacity var(--t-court) var(--sortie); }
thead th.triable:hover .fleche { opacity: .4; }
thead th.trie { color: var(--encre-900); }
thead th.trie .fleche { opacity: 1; color: var(--or-fonce); }

tbody td {
  padding: 11px 12px;
  box-shadow: inset 0 -1px 0 var(--trait);
  vertical-align: top;
}
tbody tr { transition: background var(--t-court) var(--sortie); }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { box-shadow: none; }
td.num, th.num { text-align: right; white-space: nowrap; }
td .principal-cellule { font-weight: 620; color: var(--encre-900); }
td .sous { display: block; margin-top: 2px; line-height: 1.4; white-space: nowrap; }

/* Le liseré or marque les lignes qui attendent un arbitrage humain. */
tr.a-qualifier > td:first-child { box-shadow: inset 3px 0 0 var(--or); }

/* ══════════════════════════════════════════════════════════════ pastilles */
.pastille {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2.5px 9px 2.5px 7px;
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .01em;
  white-space: nowrap;
  border: 1px solid transparent;
}
.pastille::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.v-RECREER  { background: var(--rouge-voile);  color: #8c1d18;      border-color: rgba(179, 38, 30, .18); }
.v-RECYCLER { background: #fff4dd;             color: #7a5200;      border-color: rgba(122, 82, 0, .16); }
.v-COMPLETER{ background: var(--bleu-voile);   color: var(--bleu);  border-color: rgba(20, 72, 125, .16); }
.v-DORMANTE { background: var(--violet-voile); color: var(--violet);border-color: rgba(74, 43, 134, .16); }
.v-A_DEPOSER{ background: #e2f1f2;             color: #14606b;      border-color: rgba(20, 96, 107, .18); }
.v-EN_COURS { background: var(--surface-3);    color: var(--encre-500); border-color: var(--trait); }
.v-PAYEE    { background: var(--vert-voile);   color: var(--vert);  border-color: rgba(28, 92, 46, .16); }

.marqueur-retard {
  display: inline-block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--rouge);
  font-weight: 560;
}

/* ═══════════════════════════════════════════ détail dépliable d'une ligne
   Les indices de classification étouffaient la colonne « cause ». Ils sont
   toujours là, mais à la demande : un audit se lit d'abord en survol, et le
   détail ne se justifie que sur la facture qu'on est en train de traiter. */
.btn-detail {
  background: transparent;
  border: 1px solid var(--trait);
  color: var(--encre-400);
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  font-size: 10px;
  line-height: 1;
}
.btn-detail:hover { background: var(--surface-3); color: var(--encre-700); border-color: var(--trait-fort); }
.btn-detail .chevron { transition: transform var(--t-moyen) var(--sortie); display: block; }
.btn-detail[aria-expanded="true"] .chevron { transform: rotate(90deg); }
.btn-detail[aria-expanded="true"] { background: var(--encre-800); color: #fff; border-color: transparent; }

tr.detail > td {
  background: var(--surface-2);
  padding: 0 12px;
  box-shadow: inset 0 -1px 0 var(--trait);
}
tr.detail .boite-detail {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 18px;
  padding: 15px 4px 17px;
  animation: monte var(--t-moyen) var(--sortie);
}
.bloc-detail h4 {
  margin: 0 0 7px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--encre-400);
}
.indices { margin: 0; padding-left: 15px; color: var(--encre-600); font-size: 12.5px; }
.indices li { margin: 3px 0; }
.paire { display: flex; gap: 10px; font-size: 12.5px; margin: 3px 0; }
.paire dt { color: var(--encre-400); min-width: 118px; flex: none; }
.paire dd { margin: 0; color: var(--encre-800); }

/* ═════════════════════════════════════════════════════════════════ suivi */
/* Les libellés de cause sont longs par nature (« Numéro d'engagement juridique
   manquant ou invalide ») : un sélecteur trop étroit les tronque au milieu et
   rend l'arbitrage impossible à relire. */
.maj-cause { min-width: 210px; font-size: 12px; padding: 6px 9px; }

.suivi { display: flex; gap: 6px; align-items: center; }
.suivi select { width: auto; min-width: 124px; font-size: 12px; padding: 5px 8px; }
.suivi input { width: 108px; font-size: 12px; padding: 5px 8px; }
.suivi select[data-resultat="payee"] { border-color: rgba(28, 92, 46, .4); background: var(--vert-voile); color: var(--vert); font-weight: 600; }
.suivi select[data-resultat="redeposee"] { border-color: rgba(20, 72, 125, .35); background: var(--bleu-voile); color: var(--bleu); font-weight: 600; }
.suivi select[data-resultat="abandonnee"] { color: var(--encre-400); }

/* Confirmation d'enregistrement : un liseré vert qui s'efface. Rien de
   modal, rien à fermer — la saisie est déjà partie. */
@keyframes flash-ok {
  0%   { background: var(--vert-voile); }
  100% { background: transparent; }
}
tr.enregistre { animation: flash-ok 1.1s var(--sortie); }

/* ═══════════════════════════════════════════════════ agrégats et barres */
.barre-part {
  background: var(--surface-3);
  border-radius: 100px;
  height: 6px;
  overflow: hidden;
  width: 100%;
  min-width: 84px;
  box-shadow: 0 0 0 1px var(--trait) inset;
}
.barre-part > i {
  display: block;
  height: 100%;
  border-radius: 100px;
  background: linear-gradient(90deg, var(--or-fonce), var(--or));
  transform-origin: left;
  animation: pousse var(--t-long) var(--sortie);
}
@keyframes pousse { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ══════════════════════════════════════════════════════ timeline mission */
.frise { list-style: none; margin: 0; padding: 4px 0 0 0; }
.frise li {
  position: relative;
  padding: 0 0 20px 26px;
  border-left: 1px solid var(--trait-fort);
  margin-left: 5px;
}
.frise li:last-child { border-left-color: transparent; padding-bottom: 2px; }
.frise li::before {
  content: '';
  position: absolute;
  left: -5.5px;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--encre-300);
}
.frise li:first-child::before { border-color: var(--or); background: var(--or-voile); }
.frise .quand {
  display: block;
  font-size: 11px;
  font-weight: 640;
  letter-spacing: .01em;
  color: var(--encre-400);
  margin-bottom: 2px;
}
.frise .quoi { color: var(--encre-800); font-size: 13px; }

/* ════════════════════════════════════════════════════════════ documents */
.docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(268px, 1fr)); gap: 12px; }
.doc {
  position: relative;
  display: block;
  padding: 17px 19px;
  border: 1px solid var(--trait);
  border-radius: var(--r-md);
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  box-shadow: var(--ombre-1);
  transition: border-color var(--t-moyen) var(--sortie),
              box-shadow var(--t-moyen) var(--sortie),
              transform var(--t-moyen) var(--sortie);
}
.doc:hover {
  border-color: rgba(232, 163, 61, .5);
  box-shadow: var(--ombre-3);
  transform: translateY(-2px);
}
.doc b {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--encre-900);
  margin-bottom: 5px;
  font-weight: 640;
  font-size: 13.5px;
}
.doc .fleche-doc {
  color: var(--encre-300);
  font-size: 14px;
  transition: transform var(--t-moyen) var(--ressort), color var(--t-court) var(--sortie);
}
.doc:hover .fleche-doc { transform: translate(2px, -2px); color: var(--or-fonce); }
.doc span { font-size: 12.5px; color: var(--encre-500); line-height: 1.5; display: block; }
.doc.interne { background: linear-gradient(180deg, #fffdf9, var(--surface)); border-color: rgba(232, 163, 61, .3); }
.etiquette-interne {
  display: inline-block;
  margin-top: 9px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--or-fonce);
  background: var(--or-voile);
  border-radius: 100px;
  padding: 2px 8px;
}

/* ══════════════════════════════════════════════════════════ états vides */
.vide {
  color: var(--encre-400);
  padding: 44px 20px;
  text-align: center;
  font-size: 13px;
}
.vide b { display: block; color: var(--encre-700); font-size: 14px; font-weight: 620; margin-bottom: 4px; }

/* ═══════════════════════════════════════════════════════════ chargement
   Silhouette plutôt que roue : elle dit ce qui arrive et où, donc la page ne
   saute pas quand la donnée se pose. */
.squelette { animation: respire 1.5s ease-in-out infinite; }
.sq {
  background: linear-gradient(90deg, var(--surface-3), #e7ebf2, var(--surface-3));
  background-size: 200% 100%;
  border-radius: var(--r-xs);
  animation: glisse 1.4s var(--sortie) infinite;
}
@keyframes glisse { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes respire { 0%, 100% { opacity: 1; } 50% { opacity: .72; } }

.barre-progres {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--or), #f6c476);
  z-index: 60;
  transition: width var(--t-moyen) var(--sortie), opacity var(--t-moyen) var(--sortie);
  box-shadow: 0 0 8px rgba(232, 163, 61, .6);
}

@keyframes monte {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.entre { animation: monte var(--t-moyen) var(--sortie); }

/* ═══════════════════════════════════════════════════════════ connexion */
.ecran-connexion {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(80% 60% at 50% -8%, rgba(232, 163, 61, .1), transparent 62%),
    linear-gradient(170deg, var(--encre-800), var(--encre-900));
}
.boite-connexion {
  width: 100%;
  max-width: 372px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--trait-clair);
  border-radius: var(--r-xl);
  padding: 8px;
  box-shadow: var(--ombre-4);
}
.boite-connexion .interieur {
  background: var(--surface);
  border-radius: calc(var(--r-xl) - 8px);
  padding: 30px 28px 26px;
  box-shadow: 0 1px 0 #fff inset;
}
.boite-connexion .logo { margin: 0 auto 16px; width: 40px; height: 40px; font-size: 13px; }
.boite-connexion h1 { font-size: 19px; text-align: center; margin-bottom: 5px; }
.boite-connexion .aide { text-align: center; margin: 0 0 22px; font-size: 12.5px; }
.boite-connexion button { width: 100%; justify-content: center; margin-top: 15px; }
.mention-connexion {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--trait);
  font-size: 11.5px;
  color: var(--encre-400);
  text-align: center;
  line-height: 1.5;
}

/* ═════════════════════════════════════════════════════════════ responsive */
@media (max-width: 860px) {
  main { padding: 18px 14px 64px; }
  .rail-interieur { padding: 10px 14px; }
  .rail select { min-width: 0; flex: 1; }
  .rail-actions { width: 100%; }
  .carte { padding: 18px 16px; border-radius: var(--r-md); }
  .table-defilante { margin: 0 -16px; padding: 0 16px; }
  .table-defilante { max-height: none; }
  .kpi .valeur { font-size: 23px; }
  .compte { margin-left: 0; width: 100%; }

  /* Sur un écran étroit, l'en-tête de mission passe en colonne et la
     suppression se retrouve juste sous le titre, en pleine largeur. Une action
     irréversible ne mérite pas cette place : elle redescend en fin de bloc et
     cesse de crier. La confirmation reste, évidemment. */
  .mission-tete { flex-direction: column; }
  .mission-tete .danger {
    order: 2;
    align-self: flex-start;
    background: transparent;
    border-color: transparent;
    padding: 4px 0;
    font-size: 12.5px;
    text-decoration: underline;
    text-underline-offset: 3px;
  }
}

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

@media print {
  .rail, .onglets, .filtres, .docs, button { display: none !important; }
  body { background: #fff; }
  .carte { box-shadow: none; border-color: #ccc; }
}
