/* ===========================================================================
   Pilotage STTL — feuille de style
   ---------------------------------------------------------------------------
   Reprise de la maquette présentée aux associés (maquette_dashboard_STTL.html)
   avec les mêmes couleurs, la même grille et les mêmes composants. Aucune
   bibliothèque : les barres et le donut sont en CSS et SVG natifs.
   =========================================================================== */

:root {
  --rouge:        #C8202E;
  --rouge-clair:  #E84855;
  --bleu:         #1E5FAA;
  --violet:       #7B4FA0;
  --vert:         #2C8C5C;
  --orange:       #C77800;
  --ardoise:      #2A3F5A;
  --encre:        #1A2330;
  --gris:         #6B7686;
  --gris-clair:   #A8AFB9;
  --bordure:      #E5E8EC;
  --bordure-2:    #D8DDE3;
  --fond:         #F5F6F8;
  --fond-2:       #F0F2F5;
  --fond-3:       #FAFBFC;
  --blanc:        #FFFFFF;
  /* Surfaces et teintes d'etat : en variables pour le theme sombre. */
  --surface:      #FFFFFF;
  --sur-accent:   #FFFFFF;
  --rouge-fonce:  #B01C29;
  --focus:        #C8202E33;
  --ombre:        rgba(26, 35, 48, 0.06);
  --fond-ok:      #EAFBF1;
  --bord-ok:      #BCEACF;
  --fond-alerte:  #FFF4E5;
  --bord-alerte:  #F4D8A8;
  --texte-alerte: #8B5A00;
  --fond-erreur:  #FDECEE;
  --bord-erreur:  #F5C2C7;
  --fond-affine:  #FFFCF7;
  /* Une couleur par agence (palette categorielle a 8 teintes, validee
     clair et sombre, 07/10/2026). */
  --serie-1: #2a78d6; --serie-2: #eb6834; --serie-3: #1baf7a; --serie-4: #eda100;
  --serie-5: #e87ba4; --serie-6: #008300; --serie-7: #4a3aa7; --serie-8: #e34948;
  color-scheme: light;
}

/* --- Theme sombre ------------------------------------------------------------
   Demande de la direction (visio du 01/10/2026). Il suit le reglage de
   l'ordinateur, sauf choix contraire par le bouton du bandeau, memorise dans
   le navigateur (static/js/theme.js pose data-theme sur <html>). Les memes
   valeurs servent aux deux cas : reglage systeme et choix force. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --rouge: #E5484D; --rouge-clair: #F06A6F; --bleu: #4C8DDB; --violet: #A684CC;
    --vert: #3FB37A; --orange: #E39A2D; --ardoise: #B9C6D8;
    --encre: #E8ECF1; --gris: #9AA4B2; --gris-clair: #5E6875;
    --bordure: #2C3440; --bordure-2: #3A4350;
    --fond: #12161C; --fond-2: #1F2630; --fond-3: #1A2029; --blanc: #1A2029;
    --surface: #1A2029; --rouge-fonce: #C8202E; --focus: #E5484D55; --ombre: rgba(0, 0, 0, 0.35);
    --fond-ok: rgba(63, 179, 122, 0.14); --bord-ok: rgba(63, 179, 122, 0.4);
    --fond-alerte: rgba(227, 154, 45, 0.14); --bord-alerte: rgba(227, 154, 45, 0.4); --texte-alerte: #E8B565;
    --fond-erreur: rgba(229, 72, 77, 0.14); --bord-erreur: rgba(229, 72, 77, 0.4);
    --fond-affine: rgba(227, 154, 45, 0.08);
    --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #199e70; --serie-4: #c98500;
    --serie-5: #d55181; --serie-6: #008300; --serie-7: #9085e9; --serie-8: #e66767;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --rouge: #E5484D; --rouge-clair: #F06A6F; --bleu: #4C8DDB; --violet: #A684CC;
  --vert: #3FB37A; --orange: #E39A2D; --ardoise: #B9C6D8;
  --encre: #E8ECF1; --gris: #9AA4B2; --gris-clair: #5E6875;
  --bordure: #2C3440; --bordure-2: #3A4350;
  --fond: #12161C; --fond-2: #1F2630; --fond-3: #1A2029; --blanc: #1A2029;
  --surface: #1A2029; --rouge-fonce: #C8202E; --focus: #E5484D55; --ombre: rgba(0, 0, 0, 0.35);
  --fond-ok: rgba(63, 179, 122, 0.14); --bord-ok: rgba(63, 179, 122, 0.4);
  --fond-alerte: rgba(227, 154, 45, 0.14); --bord-alerte: rgba(227, 154, 45, 0.4); --texte-alerte: #E8B565;
  --fond-erreur: rgba(229, 72, 77, 0.14); --bord-erreur: rgba(229, 72, 77, 0.4);
  --fond-affine: rgba(227, 154, 45, 0.08);
  --serie-1: #3987e5; --serie-2: #d95926; --serie-3: #199e70; --serie-4: #c98500;
  --serie-5: #d55181; --serie-6: #008300; --serie-7: #9085e9; --serie-8: #e66767;
  color-scheme: dark;
}

/* Le logo : lettres sombres en theme clair, blanches en theme sombre. */
.logo-sombre { display: none !important; }
:root[data-theme="dark"] .logo-clair { display: none !important; }
:root[data-theme="dark"] .logo-sombre { display: block !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-clair { display: none !important; }
  :root:not([data-theme="light"]) .logo-sombre { display: block !important; }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
/* L'attribut hidden doit l'emporter sur tout display: posé par une classe. */
[hidden] { display: none !important; }

html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  background: var(--fond);
  color: var(--encre);
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
.num { font-variant-numeric: tabular-nums; }
a { color: inherit; }

/* --- Bandeau d'avertissement ------------------------------------------- */
.bandeau {
  background: var(--fond-alerte);
  border-bottom: 1px solid var(--bord-alerte);
  color: var(--texte-alerte);
  padding: 8px 24px;
  font-size: 12px;
  text-align: center;
  letter-spacing: 0.3px;
}
.bandeau strong { font-weight: 600; }
.bandeau details { display: inline; }
.bandeau summary { cursor: pointer; display: inline; text-decoration: underline dotted; }
.bandeau ul { display: inline; list-style: none; }
.bandeau li { display: inline; }
.bandeau li + li::before { content: " · "; }

/* --- En-tête ------------------------------------------------------------ */
header {
  background: var(--blanc);
  border-bottom: 1px solid var(--bordure);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.marque { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.navigation { display: flex; gap: 4px; }
.navigation a {
  text-decoration: none; font-size: 13px; font-weight: 500; color: var(--gris);
  padding: 6px 12px; border-radius: 6px;
}
.navigation a:hover  { background: var(--fond-2); color: var(--encre); }
.navigation a.active { background: var(--fond-2); color: var(--encre); font-weight: 600; }
.pastille-nb { display: inline-block; min-width: 16px; padding: 0 5px; border-radius: 8px; background: var(--fond-alerte); color: var(--orange); font-size: 10px; font-weight: 700; text-align: center; vertical-align: 1px; }
table.condense td { padding: 10px 8px; }
.regles { list-style: none; }
.regles li { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--fond-2); font-size: 13px; }
.regles li:last-child { border-bottom: none; }
.regles code { font-size: 12px; background: var(--fond-2); padding: 1px 5px; border-radius: 4px; }
.etiquette.validee { background: var(--fond-ok); color: var(--vert); }
.etiquette.provisoire { background: var(--fond-alerte); color: var(--orange); }
.etiquette.inactive { background: var(--fond-2); color: var(--gris); }
/* Le logo de STTL (static/img/logo-sttl.svg), repris de leur site. Un
   filet le separe du titre de l'application. */
.logo { display: block; height: 40px; width: auto; }
.marque > div { border-left: 1px solid var(--bordure); padding-left: 14px; }
.marque h1 { font-size: 16px; font-weight: 600; }
.marque p  { font-size: 12px; color: var(--gris); margin-top: 2px; }

.controles { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.groupe { display: flex; flex-direction: column; gap: 4px; }
.plage-champs { display: flex; gap: 6px; align-items: center; }
.plage-champs input[type="date"], .plage-champs input[type="month"] {
  border: 1px solid var(--bordure-2); border-radius: 6px; padding: 6px 8px;
  font-size: 13px; font-family: inherit; color: var(--encre); background: var(--surface);
}
.bouton.petit { width: auto; padding: 7px 12px; font-size: 13px; }
.groupe label {
  font-size: 11px; color: var(--gris);
  text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600;
}
select {
  background: var(--surface);
  border: 1px solid var(--bordure-2);
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  color: var(--encre);
  cursor: pointer;
  font-family: inherit;
  min-width: 180px;
}
select:hover { border-color: var(--gris-clair); }
select:focus { outline: 2px solid var(--focus); border-color: var(--rouge); }

.synchro {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 99px;
  color: var(--vert); background: var(--fond-ok); border: 1px solid var(--bord-ok);
}
.synchro.alerte { color: var(--orange); background: var(--fond-alerte); border-color: var(--bord-alerte); }
.synchro.echec  { color: var(--rouge);  background: var(--fond-erreur); border-color: var(--bord-erreur); }
.pastille { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.synchro:not(.alerte):not(.echec) .pastille { animation: pulsation 2s ease-in-out infinite; }
@keyframes pulsation {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.85); }
}

.utilisateur { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--gris); }
.utilisateur form { display: inline; }
.utilisateur a.lien-compte { display: inline-block; color: var(--encre); text-decoration: none; border: 1px solid var(--bordure-2); border-radius: 6px; padding: 5px 10px; }
.utilisateur a.lien-compte:hover { border-color: var(--gris-clair); }
.utilisateur button {
  background: none; border: 1px solid var(--bordure-2); border-radius: 6px;
  padding: 5px 10px; font-size: 12px; color: var(--encre); cursor: pointer; font-family: inherit;
}
.utilisateur button:hover { border-color: var(--gris-clair); }

/* --- Corps -------------------------------------------------------------- */
main { padding: 24px 32px 48px; max-width: 1480px; margin: 0 auto; }

.titre-periode { margin-bottom: 16px; color: var(--gris); font-size: 13px; }
.titre-periode strong { color: var(--encre); font-weight: 600; }

/* --- Cartes KPI --------------------------------------------------------- */
.kpi-ligne {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.kpi {
  display: block;
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}
/* Toute la carte est cliquable sans etre un <a> : un lien ne peut pas en
   contenir un autre (le navigateur casserait la carte au lien « avoirs »).
   Le lien du libelle s'etire sur la carte ; un sous-lien passe au-dessus. */
.kpi:has(.kpi-lien):hover { border-color: var(--bordure-2); box-shadow: 0 2px 8px var(--ombre); }
.kpi-lien { color: inherit; text-decoration: none; }
.kpi-lien::after { content: ''; position: absolute; inset: 0; }
.kpi-lien:focus-visible { outline: none; }
.kpi:has(.kpi-lien:focus-visible) { outline: 2px solid var(--bleu); outline-offset: 2px; }
.kpi-sous-lien { position: relative; z-index: 1; margin-left: 0; }
.kpi::before {
  content: '';
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent, var(--rouge));
}
.kpi-libelle { font-size: 12px; color: var(--gris); font-weight: 500; margin-bottom: 8px; }
.kpi-valeur  { font-size: 28px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; }
.kpi-valeur .unite { font-size: 16px; font-weight: 500; color: var(--gris); margin-left: 2px; }
.kpi-detail  { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 12px; color: var(--gris); flex-wrap: wrap; }
.kpi-detail.complet { border-top: 1px dashed var(--bordure); padding-top: 8px; }
.kpi-detail.complet strong { color: var(--encre); font-weight: 600; }

.tendance-hausse { color: var(--vert);   font-weight: 600; }
.tendance-baisse { color: var(--rouge);  font-weight: 600; }
.tendance-neutre { color: var(--gris);   font-weight: 600; }

/* --- Grilles et cartes -------------------------------------------------- */
.grille        { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-bottom: 16px; }
.grille-basse  { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; margin-bottom: 16px; }
.grille-pleine { margin-bottom: 16px; }

.carte {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: 10px;
  padding: 22px 24px;
}
.carte-entete { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.carte-titre  { font-size: 14px; font-weight: 600; }
.carte-sous   { font-size: 12px; color: var(--gris); margin-top: 2px; }
.carte-vide   { color: var(--gris); font-size: 13px; padding: 12px 0; }

/* --- Barres horizontales (CA par agence) -------------------------------- */
.barres { display: flex; flex-direction: column; gap: 10px; }
.barre {
  display: grid;
  grid-template-columns: 150px 1fr 120px;
  gap: 14px;
  align-items: center;
  font-size: 13px;
  text-decoration: none;
  color: inherit;
  border-radius: 4px;
}
.barre:hover .barre-remplissage { filter: brightness(1.08); }
.barre.active .barre-remplissage { background: var(--rouge); }
.barre-libelle { font-weight: 500; }
.barre-libelle small { color: var(--gris); font-weight: 400; font-size: 11px; margin-left: 4px; }
.barre-piste { height: 24px; background: var(--fond); border-radius: 4px; overflow: hidden; }
.barre-remplissage {
  height: 100%;
  background: var(--ardoise);
  border-radius: 4px;
  transition: width 0.5s ease, filter 0.2s ease;
  min-width: 2px;
}
.barre-valeur { font-weight: 600; text-align: right; }
.barre-valeur small { display: block; font-size: 11px; font-weight: 500; }

/* --- Donut -------------------------------------------------------------- */
.donut { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.donut svg { width: 180px; height: 180px; }
.legende { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.legende-item { display: grid; grid-template-columns: 12px 1fr auto; gap: 10px; align-items: center; font-size: 13px; }
.legende-point { width: 10px; height: 10px; border-radius: 2px; }
.legende-valeur { color: var(--gris); font-weight: 500; white-space: nowrap; }

/* --- Colonnes mensuelles (N vs N-1) ------------------------------------- */
.mensuel {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 10px;
  align-items: end;
  height: 180px;
  padding-top: 8px;
}
.mois { display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.mois-colonnes { display: flex; align-items: flex-end; gap: 3px; width: 100%; height: 100%; justify-content: center; position: relative; }
.objectif-marque { position: absolute; left: 10%; right: 10%; height: 0; border-top: 2px dashed var(--orange); z-index: 1; }
.mensuel-legende .obj::before { background: transparent; border-top: 2px dashed var(--orange); height: 0; vertical-align: 3px; }
.kpi-detail.objectif .jauge { width: 72px; }
.colonne { width: 45%; max-width: 22px; border-radius: 3px 3px 0 0; min-height: 2px; }
.colonne.n1 { background: var(--bordure-2); }
.colonne.n  { background: var(--rouge); }
.mois-libelle { font-size: 11px; color: var(--gris); }
.mensuel-legende { display: flex; gap: 18px; font-size: 12px; color: var(--gris); margin-top: 12px; }
.mensuel-legende span::before {
  content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px;
}
.mensuel-legende .n::before  { background: var(--rouge); }
.mensuel-legende .n1::before { background: var(--bordure-2); }

svg.cumul { width: 100%; height: auto; max-width: 100%; display: block; }
svg.cumul .grille-svg { stroke: var(--bordure); stroke-width: 1; }
svg.cumul .axe { fill: var(--gris); font-size: 11px; font-family: inherit; }
svg.cumul .courbe { fill: none; stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
svg.cumul .courbe.realise { stroke: var(--rouge); }
svg.cumul .courbe.objectif { stroke: var(--orange); stroke-width: 2; stroke-dasharray: 6 4; }
/* N-1 : le contexte, en gris (une serie mise en avant, le reste en gris). */
svg.cumul .courbe.n1 { stroke: var(--gris); stroke-width: 2; }
svg.cumul .survol { fill: transparent; }
svg.cumul .survol:hover { fill: var(--fond-2); fill-opacity: 0.5; }
.mensuel-legende .n1-courbe::before { background: var(--gris); height: 2px; vertical-align: 3px; }

/* --- Compteurs d'objectif (Tendances) -------------------------------------
   « Curseur rempli + valeur » (maquette de la direction) : une piste que le
   realise remplit, un trait a l'objectif attendu a date. La couleur porte
   l'etat (ok / proche / retard), toujours doublee d'un libelle ecrit. */
.compteurs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; }
.compteur { --c: var(--bleu); }
.compteur.statut-ok { --c: var(--vert); }
.compteur.statut-proche { --c: var(--orange); }
.compteur.statut-retard { --c: var(--rouge); }
.compteur.statut-neutre { --c: var(--gris); }
.compteur-titre { font-size: 12px; color: var(--gris); font-weight: 500; margin-bottom: 4px; }
.compteur-valeur { font-size: 13px; color: var(--gris); margin-bottom: 10px; }
.compteur-valeur strong { font-size: 24px; font-weight: 700; color: var(--encre); margin-right: 4px; }
.compteur-piste {
  position: relative; height: 12px; border-radius: 6px;
  background: color-mix(in srgb, var(--c) 18%, var(--surface));
}
.compteur-piste i { display: block; height: 100%; border-radius: 6px; background: var(--c); }
.compteur-piste b {
  position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px;
  background: var(--encre); border-radius: 1px;
}
.compteur-etat { font-size: 12px; color: var(--gris); margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.compteur-etat::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.compteur-etat strong { color: var(--encre); }
@media (max-width: 720px) { .compteurs { grid-template-columns: 1fr; } }
svg.cumul .point { fill: var(--rouge); }

/* --- Tableaux ----------------------------------------------------------- */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.4px;
  color: var(--gris); font-weight: 600; padding: 8px 8px 12px; border-bottom: 1px solid var(--bordure);
}
thead th.droite, tbody td.droite { text-align: right; }
thead th a.tri { color: inherit; text-decoration: none; }
thead th a.tri:hover { color: var(--encre); text-decoration: underline; }
thead th a.tri.actif { color: var(--encre); }
html[data-n1="masque"] .col-n1 { display: none; }
tbody td { padding: 12px 8px; border-bottom: 1px solid var(--fond-2); font-size: 13px; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--fond-3); }
.principal { font-weight: 500; }
.secondaire { font-size: 11px; color: var(--gris); margin-top: 2px; }

tr.lien { cursor: pointer; }
table.bulletin td { padding: 9px 8px; white-space: nowrap; }
table.bulletin tr.active td { background: var(--fond-2); }
table.bulletin tr.total td { border-top: 2px solid var(--bordure-2); font-weight: 600; }
table.bulletin td.fort { font-weight: 600; color: var(--encre); }
/* Le groupe de droite (commandes, devis) est mis a part : un filet et de l'air. */
table.bulletin th.decale, table.bulletin td.decale { border-left: 1px solid var(--bordure); padding-left: 28px; }
.mesure { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
.mesure small { color: var(--gris); font-size: 11px; min-width: 34px; text-align: right; }
.jauge { display: inline-block; width: 56px; height: 8px; background: var(--fond-2); border-radius: 4px; overflow: hidden; vertical-align: middle; }
.jauge i { display: block; height: 100%; max-width: 100%; background: var(--c, var(--gris)); border-radius: 4px; }
.puce { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; background: var(--fond-2); }
.puce.tendance-hausse { background: var(--fond-ok); }
.puce.tendance-baisse { background: var(--fond-erreur); }
abbr { text-decoration: underline dotted; cursor: help; }
tbody td a { text-decoration: none; }
tbody td a:hover { text-decoration: underline; }
.defilement { overflow-x: auto; }
.attention { color: var(--orange); }
table.bulletin th.centre { text-align: center; }
table.bulletin th.famille { border-bottom: 1px solid var(--bordure); }
table.anciennete thead th[rowspan], table.chaine thead th[rowspan] { vertical-align: bottom; }
.discret-montant { color: inherit; text-decoration: none; }
.discret-montant:hover, table.anciennete a.attention:hover { text-decoration: underline; }
table.anciennete a.attention { text-decoration: none; font-weight: 600; }

/* --- Drill-down : recherche de pièces ----------------------------------- */
.recherche { margin-bottom: 16px; }
.onglets { display: flex; gap: 4px; border-bottom: 1px solid var(--bordure); margin-bottom: 16px; }
.onglet {
  padding: 8px 14px; font-size: 13px; font-weight: 500; color: var(--gris); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.onglet input { position: absolute; opacity: 0; width: 0; height: 0; }
.onglet:hover  { color: var(--encre); }
.onglet.active { color: var(--rouge); border-bottom-color: var(--rouge); font-weight: 600; }
.criteres { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; }
.criteres .champ { margin-bottom: 0; min-width: 120px; }
.criteres .champ.large { flex: 1 1 200px; }
.criteres .champ select, .criteres .champ input {
  border: 1px solid var(--bordure-2); border-radius: 6px; padding: 7px 10px;
  font-size: 13px; font-family: inherit; color: var(--encre); background: var(--surface);
}
.criteres .champ.case { flex-direction: column; gap: 2px; }
.criteres .champ.case label { text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--encre); font-weight: 500; }
.criteres .champ.case small { font-size: 11px; color: var(--gris); }
.criteres .actions { flex-direction: row; align-items: center; gap: 12px; }
.criteres .actions .bouton { width: auto; padding: 8px 16px; }
.criteres .actions a { font-size: 12px; color: var(--gris); }
.recherche .erreur { margin: 12px 0 0; }
.pagination { display: flex; gap: 12px; font-size: 13px; white-space: nowrap; }
.pagination a { text-decoration: none; color: var(--bleu); font-weight: 500; }
.pagination-bas { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--bordure); }
table.pieces td, table.lignes td { padding: 9px 8px; }
tr.commentaire td { color: var(--gris); font-style: italic; padding-top: 5px; padding-bottom: 5px; }

/* --- Drill-down : fiche d'une pièce -------------------------------------- */
.fil { font-size: 13px; color: var(--gris); margin-bottom: 12px; }
.fil a { color: var(--bleu); text-decoration: none; }
.fil a.retour { display: inline-block; padding: 6px 12px; border: 1px solid var(--bordure); border-radius: 6px; color: var(--encre); font-weight: 500; }
.fil a.retour:hover { background: var(--fond-2); }
.fiche { margin-bottom: 16px; }
.fiche-total { text-align: right; }
.fiche-reste { margin-top: 8px; font-size: 14px; color: var(--encre); }
.etiquette {
  display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 10px;
  background: var(--fond-2); color: var(--gris); vertical-align: middle; margin-left: 6px;
}
.etiquette.en-cours { background: var(--fond-alerte); color: var(--orange); }
.proprietes { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; font-size: 13px; }
.proprietes dt { color: var(--gris); font-weight: 500; }
.discret { font-size: 12px; color: var(--bleu); margin-left: 10px; }

/* --- Objectifs ----------------------------------------------------------- */
.objectifs .carte-entete { align-items: center; }
table.objectifs td { padding: 4px 4px; white-space: nowrap; }
table.objectifs input {
  width: 96px; border: 1px solid var(--bordure-2); border-radius: 4px; padding: 6px 8px;
  font-size: 13px; font-family: inherit; text-align: right; color: var(--encre);
}
table.objectifs input:focus { outline: 2px solid var(--focus); border-color: var(--rouge); }
table.objectifs tr.total td { border-top: 2px solid var(--bordure-2); font-weight: 600; padding: 9px 8px; }
table.objectifs td.fort { font-weight: 600; }
table.suivi td, table.suivi th { padding: 8px 8px; white-space: nowrap; }
table.suivi th.trim, table.suivi td.objectif-cellule { background: var(--fond-3); }
table.suivi td.objectif-cellule { color: var(--violet); font-weight: 600; }
table.suivi td.a-venir { color: var(--gris-clair); font-weight: 400; }
table.suivi tr.total td { border-top: 2px solid var(--bordure-2); font-weight: 600; }
table.objectifs input.affine { border-color: var(--orange); background: var(--fond-affine); }
.onglets a.onglet { text-decoration: none; }
.actions-objectifs { display: flex; align-items: center; gap: 14px; margin-top: 14px; flex-wrap: wrap; }
.actions-objectifs input[type="file"] { font-size: 13px; }
.lien-bouton { display: inline-block; text-decoration: none; text-align: center; }
.message { background: var(--fond-ok); color: var(--vert); border: 1px solid var(--bord-ok); border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 14px; }
.erreur ul { margin: 6px 0 0 18px; }

/* --- Liste de fraîcheur ------------------------------------------------- */
.etats { display: flex; flex-direction: column; gap: 10px; }
.etat {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; background: var(--fond-3); border-radius: 8px;
  border-left: 3px solid var(--etat-couleur, var(--gris));
}
.etat-icone {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--etat-fond, var(--fond-2)); color: var(--etat-couleur, var(--gris));
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px;
}
.etat.ok      { --etat-couleur: var(--vert);   --etat-fond: var(--fond-ok); }
.etat.retard  { --etat-couleur: var(--orange); --etat-fond: var(--fond-alerte); }
.etat.echec   { --etat-couleur: var(--rouge);  --etat-fond: var(--fond-erreur); }
.etat-titre { font-weight: 600; font-size: 13px; }
.etat-desc  { font-size: 12px; color: var(--gris); margin-top: 2px; }
.etat-quand { font-size: 12px; color: var(--gris); white-space: nowrap; }

/* --- Connexion ---------------------------------------------------------- */
.connexion { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.connexion .carte { width: 100%; max-width: 380px; padding: 32px; }
.connexion .marque { margin-bottom: 24px; flex-direction: column; text-align: center; gap: 16px; }
.connexion .logo { height: 52px; }
.connexion .marque > div { border-left: none; padding-left: 0; }
.champ { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.champ label { font-size: 12px; color: var(--gris); font-weight: 600; text-transform: uppercase; letter-spacing: 0.4px; }
.champ input {
  border: 1px solid var(--bordure-2); border-radius: 6px; padding: 9px 12px;
  font-size: 14px; font-family: inherit; color: var(--encre);
}
.champ input:focus { outline: 2px solid var(--focus); border-color: var(--rouge); }
.bouton {
  width: 100%; background: var(--rouge); color: var(--sur-accent); border: none; border-radius: 6px;
  padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.bouton:hover { background: var(--rouge-fonce); }
.erreur { background: var(--fond-erreur); color: var(--rouge); border: 1px solid var(--bord-erreur); border-radius: 6px; padding: 10px 12px; font-size: 13px; margin-bottom: 16px; }

/* --- Adaptation --------------------------------------------------------- */
@media (max-width: 1100px) {
  .kpi-ligne { grid-template-columns: repeat(2, 1fr); }
  .grille, .grille-basse { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .kpi-ligne { grid-template-columns: 1fr; }
  main { padding: 16px; }
  header { padding: 14px 16px; }
  .barre { grid-template-columns: 110px 1fr 90px; }
  .mensuel { gap: 4px; }
  .mois-libelle { font-size: 9px; }
}

/* --- Bouton de theme ------------------------------------------------------ */
.bouton-theme {
  font: inherit; font-size: 12px; color: var(--gris); background: transparent;
  border: 1px solid var(--bordure); border-radius: 6px; padding: 5px 9px; cursor: pointer;
  white-space: nowrap;
}
.bouton-theme:hover { color: var(--encre); background: var(--fond-2); }

/* --- Suivi des objectifs, vue par mois (06/10/2026) ------------------------ */
.bascule { display: inline-flex; border: 1px solid var(--bordure); border-radius: 6px; overflow: hidden; align-self: flex-end; }
.bascule a, .bascule button { font-size: 12px; color: var(--gris); text-decoration: none; padding: 6px 12px; }
.bascule button { background: none; border: 0; font-family: inherit; cursor: pointer; }
.bascule a + a, .bascule button + button { border-left: 1px solid var(--bordure); }
.bascule a.active, .bascule button.active { background: var(--fond-2); color: var(--encre); font-weight: 600; }
.carte-actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 8px 16px; }
table.suivi th.centre { text-align: center; }
table.suivi-mois td.cellule-mois { font-size: 12px; line-height: 1.35; vertical-align: top; }
table.suivi-mois td.cellule-mois strong { font-size: 13px; color: var(--encre); }
table.suivi-mois .objectif-mois { color: var(--violet); font-size: 11px; }
table.suivi-mois td.a-venir .objectif-mois { color: var(--gris-clair); }
table.suivi-mois th .etiquette { font-size: 9px; padding: 0 4px; vertical-align: 1px; }

/* --- Choix de plusieurs agences (07/10/2026) ------------------------------- */
.etiquette-champ {
  font-size: 11px; color: var(--gris);
  text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600;
}
.choix-agences { position: relative; }
.choix-agences summary {
  list-style: none; cursor: pointer; min-width: 190px;
  background: var(--surface); border: 1px solid var(--bordure-2); border-radius: 6px;
  padding: 7px 30px 7px 12px; font-size: 13px; color: var(--encre); white-space: nowrap;
}
.choix-agences summary::-webkit-details-marker { display: none; }
.choix-agences summary::after {
  content: ""; position: absolute; right: 12px; top: 50%; margin-top: -4px;
  width: 6px; height: 6px; border-right: 1.5px solid var(--gris); border-bottom: 1.5px solid var(--gris);
  transform: rotate(45deg);
}
.choix-agences summary:hover { border-color: var(--gris-clair); }
.choix-agences[open] summary { outline: 2px solid var(--focus); border-color: var(--rouge); }
.choix-agences-menu {
  position: absolute; z-index: 20; top: calc(100% + 4px); left: 0; min-width: 240px;
  background: var(--surface); border: 1px solid var(--bordure-2); border-radius: 8px;
  box-shadow: 0 6px 20px var(--ombre); padding: 8px; display: flex; flex-direction: column; gap: 2px;
}
.groupe .choix-agences-menu label, .champ .choix-agences-menu label {
  display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 4px; cursor: pointer;
  font-size: 13px; color: var(--encre); text-transform: none; letter-spacing: 0; font-weight: 400;
}
.choix-agences-menu label:hover { background: var(--fond-2); }
.choix-agences-menu label.choix-toutes { border-bottom: 1px solid var(--bordure); margin-bottom: 4px; padding-bottom: 8px; font-weight: 600; }
.champ .choix-agences-menu input { width: auto; padding: 0; border: none; }
.choix-agences-menu .bouton { margin-top: 6px; align-self: flex-end; }

/* --- Courbes du CA par agence (07/10/2026) ----------------------------------- */
svg.courbes-agences .courbe-agence { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.courbes-agences .axe-zero { stroke: var(--gris-clair); stroke-width: 1; }
.legende-agences { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12px; margin-top: 12px; }
.legende-agences a { color: var(--encre); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.legende-agences a:hover { text-decoration: underline; }
.legende-agences i, .pastille-serie { display: inline-block; width: 12px; height: 3px; border-radius: 2px; }
.pastille-serie { margin-right: 8px; vertical-align: 3px; }
.tableau-chiffres { margin-top: 12px; }
.tableau-chiffres summary { cursor: pointer; font-size: 12px; color: var(--bleu); }
.tableau-chiffres table { margin-top: 8px; }
